/[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 2652 by jfenwick, Fri Sep 4 00:13:00 2009 UTC revision 2653 by jfenwick, Tue Sep 8 04:26:30 2009 UTC
# Line 87  using namespace escript; Line 87  using namespace escript;
87      return Data(c);\      return Data(c);\
88    }    }
89    
 // Do not use the following unless you want to make copies on assignment rather than  
 // share data.  CopyOnWrite should make this unnescessary.  
 // #define ASSIGNMENT_MEANS_DEEPCOPY  
   
90  namespace  namespace
91  {  {
92    
# Line 1989  Data::calc_minGlobalDataPoint(int& ProcN Line 1985  Data::calc_minGlobalDataPoint(int& ProcN
1985          }          }
1986    }    }
1987    MPI_Bcast( &lowProc, 1, MPI_INT, 0, get_MPIComm() );    MPI_Bcast( &lowProc, 1, MPI_INT, 0, get_MPIComm() );
1988      DataPointNo = lowj + lowi * numDPPSample;
1989      MPI_Bcast(&DataPointNo, 1, MPI_INT, lowProc, get_MPIComm() );
1990    delete [] globalMins;    delete [] globalMins;
1991    ProcNo = lowProc;    ProcNo = lowProc;
1992  #else  #else
1993    ProcNo = 0;    ProcNo = 0;
 #endif  
1994    DataPointNo = lowj + lowi * numDPPSample;    DataPointNo = lowj + lowi * numDPPSample;
1995    #endif
1996  }  }
1997    
1998    
# Line 2021  Data::calc_maxGlobalDataPoint(int& ProcN Line 2018  Data::calc_maxGlobalDataPoint(int& ProcN
2018    int i,j;    int i,j;
2019    int highi=0,highj=0;    int highi=0,highj=0;
2020  //-------------  //-------------
2021    double max=numeric_limits<double>::min();    double max= -numeric_limits<double>::max();
2022    
2023    Data temp=maxval();    Data temp=maxval();
2024    
# Line 2052  Data::calc_maxGlobalDataPoint(int& ProcN Line 2049  Data::calc_maxGlobalDataPoint(int& ProcN
2049        highj=local_highj;        highj=local_highj;
2050      }      }
2051    }    }
   
2052  #ifdef PASO_MPI  #ifdef PASO_MPI
2053    // determine the processor on which the maximum occurs    // determine the processor on which the maximum occurs
2054    next = temp.getDataPointRO(highi,highj);    next = temp.getDataPointRO(highi,highj);
# Line 2060  Data::calc_maxGlobalDataPoint(int& ProcN Line 2056  Data::calc_maxGlobalDataPoint(int& ProcN
2056    double *globalMaxs = new double[get_MPISize()+1];    double *globalMaxs = new double[get_MPISize()+1];
2057    int error;    int error;
2058    error = MPI_Gather ( &next, 1, MPI_DOUBLE, globalMaxs, 1, MPI_DOUBLE, 0, get_MPIComm() );    error = MPI_Gather ( &next, 1, MPI_DOUBLE, globalMaxs, 1, MPI_DOUBLE, 0, get_MPIComm() );
   
2059    if( get_MPIRank()==0 ){    if( get_MPIRank()==0 ){
2060    next = globalMaxs[highProc];      next = globalMaxs[highProc];
2061    for( i=1; i<get_MPISize(); i++ )      for( i=1; i<get_MPISize(); i++ )
2062      if( next>globalMaxs[i] ){      {
2063        if( next<globalMaxs[i] )
2064        {
2065          highProc = i;          highProc = i;
2066          next = globalMaxs[i];          next = globalMaxs[i];
2067      }      }
2068        }
2069    }    }
2070    MPI_Bcast( &highProc, 1, MPI_INT, 0, get_MPIComm() );    MPI_Bcast( &highProc, 1, MPI_INT, 0, get_MPIComm() );
2071      DataPointNo = highj + highi * numDPPSample;  
2072      MPI_Bcast(&DataPointNo, 1, MPI_INT, highProc, get_MPIComm() );
2073    
2074    delete [] globalMaxs;    delete [] globalMaxs;
2075    ProcNo = highProc;    ProcNo = highProc;
2076  #else  #else
2077    ProcNo = 0;    ProcNo = 0;
 #endif  
2078    DataPointNo = highj + highi * numDPPSample;    DataPointNo = highj + highi * numDPPSample;
2079    #endif
2080  }  }
2081    
2082  void  void
# Line 2147  Data::operator+=(const boost::python::ob Line 2148  Data::operator+=(const boost::python::ob
2148  Data&  Data&
2149  Data::operator=(const Data& other)  Data::operator=(const Data& other)
2150  {  {
 #if defined ASSIGNMENT_MEANS_DEEPCOPY    
 // This should not be used.  
 // Just leaving this here until I have completed transition  
   copy(other);  
 #else  
2151    m_protected=false;        // since any changes should be caught by exclusiveWrite();    m_protected=false;        // since any changes should be caught by exclusiveWrite();
2152  //   m_data=other.m_data;  //   m_data=other.m_data;
2153    set_m_data(other.m_data);    set_m_data(other.m_data);
 #endif  
2154    return (*this);    return (*this);
2155  }  }
2156    

Legend:
Removed from v.2652  
changed lines
  Added in v.2653

  ViewVC Help
Powered by ViewVC 1.1.26