18 #if !defined escript_DataAlgorithm_20040714_H 19 #define escript_DataAlgorithm_20040714_H 44 template <
class BinaryFunction>
87 struct FMax :
public std::binary_function<double,double,double>
99 struct FMin :
public std::binary_function<double,double,double>
103 return std::min(x,y);
111 struct AbsMax :
public std::binary_function<double,double,double>
115 return std::max(fabs(x),fabs(y));
123 struct AbsMin :
public std::binary_function<double,double,double>
127 return std::min(fabs(x),fabs(y));
135 struct Length :
public std::binary_function<double,double,double>
139 return std::sqrt(std::pow(x,2)+std::pow(y,2));
147 struct Trace :
public std::binary_function<double,double,double>
158 struct AbsGT :
public std::binary_function<double,double,double>
169 struct AbsLTE :
public std::binary_function<double,double,double>
183 template <
class BinaryFunction>
188 double initial_value)
193 double global_current_value=initial_value;
194 double local_current_value;
200 #pragma omp parallel private(local_current_value) 202 local_current_value=initial_value;
203 #pragma omp for private(i,j) schedule(static) 204 for (i=0;i<numSamples;i++) {
205 for (j=0;j<numDPPSample;j++) {
212 global_current_value=
operation(global_current_value,local_current_value);
214 return global_current_value;
218 template <
class BinaryFunction>
223 double initial_value)
225 double current_value=initial_value;
231 for (std::list<int>::const_iterator i=used.begin();i!=used.end();++i)
240 DataTagged::DataMapType::const_iterator it=lookup.find(tag);
241 if (it!=lookup.end())
247 return current_value;
250 template <
class BinaryFunction>
255 double initial_value)
271 template <
class BinaryFunction>
277 double initial_value)
289 #pragma omp parallel for private(i,j) schedule(static) 290 for (i=0;i<numSamples;i++) {
291 for (j=0;j<numDPPSample;j++) {
301 template <
class BinaryFunction>
307 double initial_value)
314 for (DataTagged::DataMapType::const_iterator i=lookup.begin(); i!=lookup.end(); i++) {
323 template <
class BinaryFunction>
329 double initial_value)
DataVector implements an arbitrarily long vector of data values. DataVector is the underlying data co...
Definition: DataVector.h:44
double operator()(double x, double y) const
Definition: DataAlgorithm.h:171
DataAlgorithmAdapter(double initialValue)
Definition: DataAlgorithm.h:47
virtual DataTypes::ValueType::size_type getPointOffset(int sampleNo, int dataPointNo) const
Return the offset for the given given data point. This returns the offset in bytes for the given poin...
Definition: DataExpanded.cpp:305
void dp_algorithm(const DataExpanded &data, DataExpanded &result, BinaryFunction operation, double initial_value)
Perform the given data-point reduction operation on all data-points in data, storing results in corre...
Definition: DataAlgorithm.h:274
const DataTypes::ValueType & getVectorRO() const
Definition: DataExpanded.cpp:755
double m_initialValue
Definition: DataAlgorithm.h:74
DataTypes::ValueType::size_type getDefaultOffset() const
Returns the offset in the structure which stores the default value.
Definition: DataTagged.h:608
double operator()(double x, double y) const
Definition: DataAlgorithm.h:101
double operator()(double x, double y) const
Definition: DataAlgorithm.h:149
Return the absolute minimum value of the two given values.
Definition: DataAlgorithm.h:123
double m_currentValue
Definition: DataAlgorithm.h:77
BinaryFunction operation
Definition: DataAlgorithm.h:80
Definition: AbstractContinuousDomain.cpp:24
DataConstant stores a single data point which represents the entire function space.
Definition: DataConstant.h:37
void operator()(double value)
Definition: DataAlgorithm.h:58
Give a short description of what DataExpanded does.
Definition: DataExpanded.h:44
const DataMapType & getTagLookup() const
getTagLookup
Definition: DataTagged.h:629
void resetResult()
Definition: DataAlgorithm.h:63
Return the length between the two given values.
Definition: DataAlgorithm.h:135
std::vector< int > ShapeType
The shape of a single datapoint.
Definition: DataTypes.h:38
DataAlgorithmAdapter(const DataAlgorithmAdapter &other)
Definition: DataAlgorithm.h:52
Simulates a full dataset accessible via sampleNo and dataPointNo.
Definition: DataTagged.h:44
double reductionOp(const DataTypes::ValueType &left, const DataTypes::ShapeType &shape, DataTypes::ValueType::size_type offset, BinaryFunction operation, double initial_value)
Perform the given data point reduction operation on the data point specified by the given offset into...
Definition: DataMaths.h:880
DataTypes::ValueType::reference getDataByTagRW(int tag, DataTypes::ValueType::size_type i)
getDataByTag
Definition: DataTagged.cpp:574
DataTypes::ValueType & getVectorRW()
Return a reference to the underlying DataVector.
Definition: DataTagged.cpp:890
int getNumDPPSample() const
Return the number of data points per sample.
Definition: DataAbstract.h:562
Return the absolute maximum value of the two given values.
Definition: DataAlgorithm.h:111
double operator()(double x, double y) const
Definition: DataAlgorithm.h:137
std::map< int, int > DataMapType
Definition: DataTagged.h:57
const DataTypes::ValueType & getVectorRO() const
Definition: DataConstant.cpp:395
double operator()(double x, double y) const
Definition: DataAlgorithm.h:89
DataTypes::ValueType & getVectorRW()
Return a reference to the underlying DataVector.
Definition: DataConstant.cpp:388
Return the trace of the two given values.
Definition: DataAlgorithm.h:147
Return the minimum value of the two given values.
Definition: DataAlgorithm.h:99
double operator()(double x, double y) const
Definition: DataAlgorithm.h:160
Return the maximum value of the two given values.
Definition: DataAlgorithm.h:87
double algorithm(const DataExpanded &data, BinaryFunction operation, double initial_value)
Perform the given operation upon all values in all data-points in the given Data object and return th...
Definition: DataAlgorithm.h:186
int getNumSamples() const
Return the number of samples.
Definition: DataAbstract.h:573
const DataTypes::ShapeType & getShape() const
Return the shape information for the point data.
Definition: DataAbstract.h:592
DataTypes::ValueType & getVectorRW()
Return a a reference to the underlying DataVector.
Definition: DataExpanded.cpp:749
std::list< int > getListOfTagsSTL() const
Returns an stl list of the tags used in this function space.
Definition: FunctionSpace.cpp:291
const FunctionSpace & getFunctionSpace() const
Return the function space associated with this Data object.
Definition: DataAbstract.h:585
const DataTypes::ValueType & getVectorRO() const
Definition: DataTagged.cpp:897
Return 1 if abs(x)>y, otherwise return 0.
Definition: DataAlgorithm.h:158
Return 1 if abs(x)<=y, otherwise return 0.
Definition: DataAlgorithm.h:169
double operator()(double x, double y) const
Definition: DataAlgorithm.h:125
double operator()(double x, double y) const
Definition: DataAlgorithm.h:113
Adapt binary algorithms so they may be used in DataArrayView reduction operations.
Definition: DataAlgorithm.h:45
double getResult() const
Definition: DataAlgorithm.h:67
Describes binary operations performed on DataVector.
DataTypes::ValueType::size_type getOffsetForTag(int tag) const
getOffsetForTag
Definition: DataTagged.cpp:552