/[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 147 by jgs, Fri Aug 12 01:45:47 2005 UTC revision 148 by jgs, Tue Aug 23 01:24:31 2005 UTC
# Line 1007  Data Line 1007  Data
1007  Data::pos() const  Data::pos() const
1008  {  {
1009    profData->unary++;    profData->unary++;
1010    return (*this);    Data result;
1011      // perform a deep copy
1012      result.copy(*this);
1013      return result;
1014  }  }
1015    
1016  Data  Data
# Line 1112  Data::transpose(int axis) const Line 1115  Data::transpose(int axis) const
1115  const boost::python::tuple  const boost::python::tuple
1116  Data::mindp() const  Data::mindp() const
1117  {  {
1118      // NB: calc_mindp had to be split off from mindp as boost::make_tuple causes an
1119      // abort (for unknown reasons) if there are openmp directives with it in the
1120      // surrounding function
1121    
1122      int SampleNo;
1123      int DataPointNo;
1124    
1125      calc_mindp(SampleNo,DataPointNo);
1126    
1127      return make_tuple(SampleNo,DataPointNo);
1128    }
1129    
1130    void
1131    Data::calc_mindp(int& SampleNo,
1132                     int& DataPointNo) const
1133    {
1134      int i,j;
1135      int lowi=0,lowj=0;
1136      double min=numeric_limits<double>::max();
1137    
1138    Data temp=minval();    Data temp=minval();
1139    
1140    int numSamples=temp.getNumSamples();    int numSamples=temp.getNumSamples();
1141    int numDPPSample=temp.getNumDataPointsPerSample();    int numDPPSample=temp.getNumDataPointsPerSample();
1142    
1143    int i,j,lowi=0,lowj=0;    double next,local_min;
1144    double min=numeric_limits<double>::max();    int local_lowi,local_lowj;
1145    
1146    for (i=0; i<numSamples; i++) {    #pragma omp parallel private(next,local_min,local_lowi,local_lowj)
1147      for (j=0; j<numDPPSample; j++) {    {
1148        double next=temp.getDataPoint(i,j)();      local_min=min;
1149        if (next<min) {      #pragma omp for private(i,j) schedule(static)
1150          min=next;      for (i=0; i<numSamples; i++) {
1151          lowi=i;        for (j=0; j<numDPPSample; j++) {
1152          lowj=j;          next=temp.getDataPoint(i,j)();
1153            if (next<local_min) {
1154              local_min=next;
1155              local_lowi=i;
1156              local_lowj=j;
1157            }
1158        }        }
1159      }      }
1160        #pragma omp critical
1161        if (local_min<min) {
1162          min=local_min;
1163          lowi=local_lowi;
1164          lowj=local_lowj;
1165        }
1166    }    }
1167    
1168    return make_tuple(lowi,lowj);    SampleNo = lowi;
1169      DataPointNo = lowj;
1170  }  }
1171    
1172  void  void

Legend:
Removed from v.147  
changed lines
  Added in v.148

  ViewVC Help
Powered by ViewVC 1.1.26