/[escript]/trunk/escript/src/DataAlgorithm.h
ViewVC logotype

Diff of /trunk/escript/src/DataAlgorithm.h

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

revision 106 by jgs, Thu Dec 23 07:20:12 2004 UTC revision 108 by jgs, Thu Jan 27 06:21:59 2005 UTC
# Line 168  algorithm(DataExpanded& data, Line 168  algorithm(DataExpanded& data,
168  #pragma omp for private(i,j) schedule(static)  #pragma omp for private(i,j) schedule(static)
169      for (i=0;i<numSamples;i++) {      for (i=0;i<numSamples;i++) {
170        for (j=0;j<numDPPSample;j++) {        for (j=0;j<numDPPSample;j++) {
171      resultLocal=data.getPointDataView().algorithm(data.getPointOffset(i,j), operation);      resultLocal=data.getPointDataView().reductionOp(data.getPointOffset(i,j), operation);
172  #pragma omp critical (algorithm)  #pragma omp critical (algorithm)
173      operation(resultLocal);      operation(resultLocal);
174        }        }
# Line 190  algorithm(DataTagged& data, Line 190  algorithm(DataTagged& data,
190    DataTagged::DataMapType::const_iterator lookupEnd=lookup.end();    DataTagged::DataMapType::const_iterator lookupEnd=lookup.end();
191    DataArrayView& dataView=data.getPointDataView();    DataArrayView& dataView=data.getPointDataView();
192    for (i=lookup.begin();i!=lookupEnd;i++) {    for (i=lookup.begin();i!=lookupEnd;i++) {
193      operation(dataView.algorithm(i->second,operation));      operation(dataView.reductionOp(i->second,operation));
194    }    }
195    //    //
196    // finally perform the operation on the default value    // finally perform the operation on the default value
197    operation(data.getDefaultValue().algorithm(operation));    operation(data.getDefaultValue().reductionOp(operation));
198    return operation.getResult();    return operation.getResult();
199  }  }
200    
# Line 204  double Line 204  double
204  algorithm(DataConstant& data,  algorithm(DataConstant& data,
205            UnaryFunction operation)            UnaryFunction operation)
206  {  {
207    return data.getPointDataView().algorithm(operation);    return data.getPointDataView().reductionOp(operation);
208  }  }
209    
210  /**  /**
# Line 237  dp_algorithm(DataExpanded& data, Line 237  dp_algorithm(DataExpanded& data,
237        for (j=0;j<numDPPSample;j++) {        for (j=0;j<numDPPSample;j++) {
238  #pragma omp critical (dp_algorithm)  #pragma omp critical (dp_algorithm)
239          result.getPointDataView().getData(data.getPointOffset(i,j)) =          result.getPointDataView().getData(data.getPointOffset(i,j)) =
240            data.getPointDataView().dp_algorithm(data.getPointOffset(i,j),operation);            data.getPointDataView().dp_reductionOp(data.getPointOffset(i,j),operation);
241        }        }
242      }      }
243    }    }
# Line 258  dp_algorithm(DataTagged& data, Line 258  dp_algorithm(DataTagged& data,
258    DataTagged::DataMapType::const_iterator lookupEnd=lookup.end();    DataTagged::DataMapType::const_iterator lookupEnd=lookup.end();
259    for (i=lookup.begin();i!=lookupEnd;i++) {    for (i=lookup.begin();i!=lookupEnd;i++) {
260      result.getPointDataView().getData(i->second) =      result.getPointDataView().getData(i->second) =
261        data.getPointDataView().dp_algorithm(i->second,operation);        data.getPointDataView().dp_reductionOp(i->second,operation);
262    }    }
263    //    //
264    // finally perform the operation on the default data value    // finally perform the operation on the default data value
265    // and assign this to the default element in result    // and assign this to the default element in result
266    result.getPointDataView().getData(0) =    result.getPointDataView().getData(0) =
267      data.getDefaultValue().dp_algorithm(operation);      data.getDefaultValue().dp_reductionOp(operation);
268  }  }
269    
270  template <class UnaryFunction>  template <class UnaryFunction>
# Line 278  dp_algorithm(DataConstant& data, Line 278  dp_algorithm(DataConstant& data,
278    // perform the operation on the default data value    // perform the operation on the default data value
279    // and assign this to the default element in result    // and assign this to the default element in result
280    result.getPointDataView().getData(0) =    result.getPointDataView().getData(0) =
281      data.getPointDataView().dp_algorithm(operation);      data.getPointDataView().dp_reductionOp(operation);
282  }  }
283    
284  } // end of namespace  } // end of namespace

Legend:
Removed from v.106  
changed lines
  Added in v.108

  ViewVC Help
Powered by ViewVC 1.1.26