/[escript]/trunk/escript/src/Data.cpp
ViewVC logotype

Diff of /trunk/escript/src/Data.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1409 by gross, Wed Feb 6 22:44:28 2008 UTC revision 1455 by phornby, Thu Feb 28 17:19:44 2008 UTC
# Line 1052  Data::sqrt() const Line 1052  Data::sqrt() const
1052  double  double
1053  Data::Lsup() const  Data::Lsup() const
1054  {  {
1055    double localValue, globalValue;    double localValue;
1056    //    //
1057    // set the initial absolute maximum value to zero    // set the initial absolute maximum value to zero
1058    
1059    AbsMax abs_max_func;    AbsMax abs_max_func;
1060    localValue = algorithm(abs_max_func,0);    localValue = algorithm(abs_max_func,0);
1061  #ifdef PASO_MPI  #ifdef PASO_MPI
1062      double globalValue;
1063    MPI_Allreduce( &localValue, &globalValue, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD );    MPI_Allreduce( &localValue, &globalValue, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD );
1064    return globalValue;    return globalValue;
1065  #else  #else
# Line 1069  Data::Lsup() const Line 1070  Data::Lsup() const
1070  double  double
1071  Data::sup() const  Data::sup() const
1072  {  {
1073    double localValue, globalValue;    double localValue;
1074    //    //
1075    // set the initial maximum value to min possible double    // set the initial maximum value to min possible double
1076    FMax fmax_func;    FMax fmax_func;
1077    localValue = algorithm(fmax_func,numeric_limits<double>::max()*-1);    localValue = algorithm(fmax_func,numeric_limits<double>::max()*-1);
1078  #ifdef PASO_MPI  #ifdef PASO_MPI
1079      double globalValue;
1080    MPI_Allreduce( &localValue, &globalValue, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD );    MPI_Allreduce( &localValue, &globalValue, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD );
1081    return globalValue;    return globalValue;
1082  #else  #else
# Line 1085  Data::sup() const Line 1087  Data::sup() const
1087  double  double
1088  Data::inf() const  Data::inf() const
1089  {  {
1090    double localValue, globalValue;    double localValue;
1091    //    //
1092    // set the initial minimum value to max possible double    // set the initial minimum value to max possible double
1093    FMin fmin_func;    FMin fmin_func;
1094    localValue = algorithm(fmin_func,numeric_limits<double>::max());    localValue = algorithm(fmin_func,numeric_limits<double>::max());
1095  #ifdef PASO_MPI  #ifdef PASO_MPI
1096      double globalValue;
1097    MPI_Allreduce( &localValue, &globalValue, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD );    MPI_Allreduce( &localValue, &globalValue, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD );
1098    return globalValue;    return globalValue;
1099  #else  #else
# Line 2551  Data::dump(const std::string fileName) c Line 2554  Data::dump(const std::string fileName) c
2554  int  int
2555  Data::get_MPISize() const  Data::get_MPISize() const
2556  {  {
2557      int error, size;      int size;
2558  #ifdef PASO_MPI  #ifdef PASO_MPI
2559        int error;
2560      error = MPI_Comm_size( get_MPIComm(), &size );      error = MPI_Comm_size( get_MPIComm(), &size );
2561  #else  #else
2562      size = 1;      size = 1;
# Line 2563  Data::get_MPISize() const Line 2567  Data::get_MPISize() const
2567  int  int
2568  Data::get_MPIRank() const  Data::get_MPIRank() const
2569  {  {
2570      int error, rank;      int rank;
2571  #ifdef PASO_MPI  #ifdef PASO_MPI
2572        int error;
2573      error = MPI_Comm_rank( get_MPIComm(), &rank );      error = MPI_Comm_rank( get_MPIComm(), &rank );
2574  #else  #else
2575      rank = 0;      rank = 0;

Legend:
Removed from v.1409  
changed lines
  Added in v.1455

  ViewVC Help
Powered by ViewVC 1.1.26