19 #ifndef __ESCRIPT_DATA_H__ 20 #define __ESCRIPT_DATA_H__ 33 #include <boost/python/object.hpp> 34 #include <boost/python/tuple.hpp> 35 #include <boost/math/special_functions/bessel.hpp> 37 #ifndef ESCRIPT_MAX_DATA_RANK 38 #define ESCRIPT_MAX_DATA_RANK 4 169 Data(
const boost::python::object& value,
192 Data(boost::python::object value,
193 boost::python::object par1=boost::python::object(),
194 boost::python::object par2=boost::python::object(),
195 boost::python::object par3=boost::python::object());
269 const boost::python::object
300 const boost::python::object
464 return m_data->getFunctionSpace();
522 return m_data->getNumSamples();
533 return m_data->getNumDPPSample();
569 return m_data->getNoValues();
578 dump(
const std::string fileName)
const;
586 const boost::python::object
643 return m_data->getSampleDataByTag(tag, dummy);
650 return m_data->getSampleDataByTag(tag, dummy);
683 return m_data->getPointOffset(sampleNo,dataPointNo);
694 return m_data->getShape();
701 const boost::python::tuple
726 return m_data->getNumSamples()==0;
739 const boost::python::object& value);
752 const boost::python::object& value);
834 nonuniforminterp(boost::python::object in, boost::python::object out,
bool check_boundaries);
837 nonuniformslope(boost::python::object in, boost::python::object out,
bool check_boundaries);
855 boost::python::object
863 boost::python::object
1018 const boost::python::tuple
1028 const boost::python::tuple
1081 trace(
int axis_offset)
const;
1109 const boost::python::tuple
1118 swapaxes(
const int axis0,
const int axis1)
const;
1332 powO(
const boost::python::object& right)
const;
1343 rpowO(
const boost::python::object& left)
const;
1405 boost::python::object
__add__(
const boost::python::object& right);
1412 boost::python::object
__sub__(
const boost::python::object& right);
1418 boost::python::object
__rsub__(
const boost::python::object& right);
1424 boost::python::object
__mul__(
const boost::python::object& right);
1430 boost::python::object
__div__(
const boost::python::object& right);
1436 boost::python::object
__rdiv__(
const boost::python::object& right);
1467 getItem(
const boost::python::object& key)
const;
1481 setItemD(
const boost::python::object& key,
1485 setItemO(
const boost::python::object& key,
1486 const boost::python::object& value);
1495 template <
class UnaryFunction>
1625 template <
typename S>
1629 template <
class BinaryOp>
1646 template<
typename Scalar>
1647 boost::python::object
1684 template <
class BinaryFunction>
1697 template <
class BinaryFunction>
1768 ESYS_ASSERT(dr!=0,
"error casting to DataReady.");
1776 ESYS_ASSERT(dr!=0,
"error casting to DataReady.");
1788 ESYS_ASSERT(dr.get()!=0,
"error casting to DataReady.");
1796 ESYS_ASSERT(dr.get()!=0,
"error casting to DataReady.");
1816 #ifdef SLOWSHARECHECK 1817 return m_data->isShared();
1819 return !m_data.unique();
1828 if (omp_in_parallel())
1830 throw DataException(
"Please do not call forceResolve() in a parallel region.");
1844 if (omp_in_parallel())
1846 throw DataException(
"Programming error. Please do not run exclusiveWrite() in multi-threaded sections.");
1856 m_data->exclusivewritecalled=
true;
1867 std::ostringstream oss;
1868 oss <<
"Programming error. ExclusiveWrite required - please call requireWrite() isLazy=" <<
isLazy() <<
" isShared()=" <<
isShared();
1886 #ifdef IKNOWWHATIMDOING 1889 template <
typename S>
1891 friend Data randomData(
const boost::python::tuple& shape,
const FunctionSpace& what,
long seed,
const boost::python::tuple& filter);
1896 #ifdef IKNOWWHATIMDOING 1911 long seed,
const boost::python::tuple& filter);
1937 throw DataException(
"Error, attempt to acquire RW access to lazy data. Please call requireWrite() first.");
1940 if (!
getReady()->exclusivewritecalled)
1942 throw DataException(
"Error, call to Data::getSampleDataRW without a preceeding call to requireWrite/exclusiveWrite.");
1954 throw DataException(
"Error, attempt to acquire RW access to lazy data. Please call requireWrite() first.");
1957 if (!
getReady()->exclusivewritecalled)
1959 throw DataException(
"Error, call to Data::getSampleDataRW without a preceeding call to requireWrite/exclusiveWrite.");
1975 return &((*res)[offset]);
1987 throw DataException(
"Programming error: complex lazy objects are not supported.");
1999 throw DataException(
"Programmer error - getDataRO must not be called on Lazy Data.");
2017 throw DataException(
"Programmer error - getDataRO must not be called on Lazy Data.");
2161 return *
this / right;
2199 template <
class BinaryFunction>
2206 ESYS_ASSERT(leftC!=0,
"Programming error - casting to DataExpanded.");
2214 const auto& vec=data.
getTypedVectorRO(
typename BinaryFunction::first_argument_type(0));
2218 #pragma omp parallel private(local_current_value) 2220 local_current_value=initial_value;
2221 #pragma omp for private(i,j) schedule(static) 2222 for (i=0;i<numSamples;i++) {
2223 for (j=0;j<numDPPSample;j++) {
2228 #pragma omp critical 2229 global_current_value=operation(global_current_value,local_current_value);
2231 return global_current_value;
2234 ESYS_ASSERT(leftC!=0,
"Programming error - casting to DataTagged.");
2239 const auto& vec=data.
getTypedVectorRO(
typename BinaryFunction::first_argument_type(0));
2243 for (std::list<int>::const_iterator i=used.begin();i!=used.end();++i)
2246 DataTagged::DataMapType::const_iterator it=lookup.find(tag);
2247 if ((tag==0) || (it==lookup.end()))
2256 return current_value;
2259 ESYS_ASSERT(leftC!=0,
"Programming error - casting to DataConstant.");
2262 throw DataException(
"Error - Operations (algorithm) not permitted on instances of DataEmpty.");
2264 throw DataException(
"Error - Operations not permitted on instances of DataLazy.");
2266 throw DataException(
"Error - Data encapsulates an unknown type.");
2278 template <
class BinaryFunction>
2284 throw DataException(
"Error - Operations (dp_algorithm) not permitted on instances of DataEmpty.");
2290 ESYS_ASSERT(dataE!=0,
"Programming error - casting data to DataExpanded.");
2291 ESYS_ASSERT(resultE!=0,
"Programming error - casting result to DataExpanded.");
2305 #pragma omp parallel for private(i,j) schedule(static) 2306 for (i=0;i<numSamples;i++) {
2307 for (j=0;j<numDPPSample;j++) {
2318 ESYS_ASSERT(dataT!=0,
"Programming error - casting data to DataTagged.");
2327 for (DataTagged::DataMapType::const_iterator i=lookup.begin(); i!=lookup.end(); i++) {
2337 return Data(resultT);
2343 ESYS_ASSERT(dataC!=0,
"Programming error - casting data to DataConstant.");
2344 ESYS_ASSERT(resultC!=0,
"Programming error - casting result to DataConstant.");
2353 throw DataException(
"Error - Operations not permitted on instances of DataLazy.");
2355 throw DataException(
"Error - Data encapsulates an unknown type.");
2380 #endif // __ESCRIPT_DATA_H__ Definition: FunctionSpace.h:34
std::ostream & operator<<(std::ostream &o, const Data &data)
Output operator.
Definition: Data.cpp:3647
void typeMatchLeft(Data &right) const
Convert the data type of the RHS to match this.
Definition: Data.cpp:3493
DataAbstract_ptr m_data
Definition: Data.h:1760
DataTypes::RealVectorType::size_type getLength() const
Return the number of doubles stored for this Data.
Definition: Data.cpp:1349
const boost::python::object toListOfTuples(bool scalarastuple=true)
returns the values of the object as a list of tuples (one for each datapoint).
Definition: Data.cpp:1360
DataTypes::real_t * getSampleDataByTag(int tag, DataTypes::real_t dummy=0)
Return the sample data for the given tag. If an attempt is made to access data that isn't tagged an e...
Definition: Data.h:641
Data sqrt() const
Return the square root of each data point of this Data object.
Definition: Data.cpp:2162
void setItemO(const boost::python::object &key, const boost::python::object &value)
Definition: Data.cpp:3454
Data antihermitian() const
Return the anti-hermitian part of a matrix which is half the matrix minus its hermitian.
Definition: Data.cpp:2772
Data interpolateFromTable1D(const WrappedArray &table, DataTypes::real_t Amin, DataTypes::real_t Astep, DataTypes::real_t undef, bool check_boundaries)
Definition: Data.cpp:4729
boost::python::object __add__(const boost::python::object &right)
wrapper for python add operation
Definition: Data.cpp:5876
const_DataReady_ptr getReadyPtr() const
Definition: Data.h:1793
void checkExclusiveWrite()
checks if caller can have exclusive write to the object
Definition: Data.h:1863
boost::python::object __rsub__(const boost::python::object &right)
wrapper for python reverse subtract operation
Definition: Data.cpp:5924
std::string toString() const
Write the data as a string. For large amounts of data, a summary is printed.
Definition: Data.cpp:4607
void setToZero()
set all values to zero
Definition: Data.cpp:797
DataTypes::real_t rpow(DataTypes::real_t x, DataTypes::real_t y)
Definition: Data.h:2033
ElementType & reference
Definition: DataVectorAlt.h:50
DataTypes::real_t inf()
Return the minimum value of this Data object.
Definition: Data.cpp:2267
void replaceNaN(DataTypes::real_t value)
replaces all NaN values with value
Definition: Data.cpp:2364
unsigned int getDataPointRank() const
Return the rank of the point data.
Definition: Data.h:499
int MPI_Op
Definition: EsysMPI.h:43
bool hasInf()
Definition: Data.cpp:2398
Data delay()
produce a delayed evaluation version of this Data.
Definition: Data.cpp:768
Data & operator*=(const Data &right)
Overloaded operator *=.
Definition: Data.cpp:3201
void tag()
If possible convert this Data to DataTagged. This will only allow Constant data to be converted to ta...
Definition: Data.cpp:1186
bool isDataPointShapeEqual(int rank, const int *dimensions) const
Returns true if the shape matches the vector (dimensions[0],..., dimensions[rank-1]). DataEmpty always returns true.
Definition: Data.h:554
void set_m_data(DataAbstract_ptr p)
Modify the data abstract hosted by this Data object For internal use only. Passing a pointer to null ...
Definition: Data.cpp:612
virtual DataTypes::RealVectorType & getTypedVectorRW(DataTypes::real_t dummy)
These versions use the type system rather than method name to determine return type.
Definition: DataExpanded.cpp:1525
boost::python::object integrateToTuple()
Calculate the integral over the function space domain as a python tuple.
Definition: Data.cpp:1748
Data getSlice(const DataTypes::RegionType ®ion) const
Return a Data object containing the specified slice of this Data object.
Definition: Data.cpp:3446
DataTypes::real_t supWorker() const
Definition: Data.cpp:2501
boost::shared_ptr< AbstractDomain > Domain_ptr
Definition: AbstractDomain.h:36
Data sign() const
Return the sign of each data point of this Data object. -1 for negative values, zero for zero values...
Definition: Data.cpp:2121
Definition: DataReady.h:35
DataTypes::vec_size_type size_type
Definition: DataVectorAlt.h:49
std::vector< std::pair< int, int > > RegionType
Definition: DataTypes.h:43
int getDataPointSize() const
Return the size of the data point. It is the product of the data point shape dimensions.
Definition: Data.cpp:1342
Definition: AbstractContinuousDomain.cpp:22
Data imag() const
Definition: Data.cpp:1967
Data atan() const
Return the atan of each data point of this Data object.
Definition: Data.cpp:2046
Data log10() const
Return the log to base 10 of each data point of this Data object.
Definition: Data.cpp:2107
Data pos() const
Return the identity of each data point of this Data object. Simply returns this object unmodified...
Definition: Data.cpp:2143
boost::shared_ptr< const DataReady > const_DataReady_ptr
Definition: DataAbstract.h:59
void setItemD(const boost::python::object &key, const Data &value)
Copies slice from value into this Data object.
Definition: Data.cpp:3462
Data operator-(const Data &left, const Data &right)
Operator- Takes two Data objects.
Definition: Data.cpp:3323
void replaceInfPython(boost::python::object obj)
Definition: Data.cpp:2429
MPI_Comm get_MPIComm(void) const
return the MPI rank number of the local data MPI_COMM_WORLD is assumed and returned.
Definition: Data.cpp:5427
DataTypes::real_t sup_const() const
Definition: Data.cpp:2214
Data besselSecondKind(int order)
Return the Bessel function of the second kind for each data point of this Data object.
Definition: Data.cpp:1828
void print(void)
print the data values to stdout. Used for debugging
Definition: Data.cpp:5351
Data interpolateFromTable3DP(boost::python::object table, DataTypes::real_t Amin, DataTypes::real_t Astep, Data &B, DataTypes::real_t Bmin, DataTypes::real_t Bstep, Data &C, DataTypes::real_t Cmin, DataTypes::real_t Cstep, DataTypes::real_t undef, bool check_boundaries)
Definition: Data.cpp:4701
void typeMatchRight(const Data &right)
Convert the data type of this to match the RHS.
Definition: Data.cpp:3513
void setSlice(const Data &value, const DataTypes::RegionType ®ion)
Copy the specified slice from the given value into this Data object.
Definition: Data.cpp:3478
DataConstant stores a single data point which represents the entire function space.
Definition: DataConstant.h:37
static const ShapeType scalarShape
Use this instead of creating empty shape objects for scalars.
Definition: DataTypes.h:46
void setValueOfDataPointToPyObject(int dataPointNo, const boost::python::object &py_object)
sets the values of a data-point from a python object on this process
Definition: Data.cpp:1541
DataTypes::RealVectorType::const_reference getDataPointRO(int sampleNo, int dataPointNo)
Return a reference into the DataVector which points to the specified data point.
Definition: Data.cpp:4677
bool isLazy() const
Return true if this Data is lazy.
Definition: Data.cpp:1128
Data C_TensorUnaryOperation(Data const &arg_0, escript::ES_optype operation, DataTypes::real_t tol=0)
Definition: Data.cpp:6043
DataAbstract_ptr borrowDataPtr(void) const
Definition: Data.cpp:4592
Data real() const
Definition: Data.cpp:1948
virtual const DataTypes::RealVectorType & getTypedVectorRO(DataTypes::real_t dummy) const
Definition: DataConstant.cpp:871
void setTaggedValueByName(std::string name, const boost::python::object &value)
Assign the given value to the tag assocciated with name. Implicitly converts this object to type Data...
Definition: Data.cpp:3541
Give a short description of what DataExpanded does.
Definition: DataExpanded.h:43
virtual const DataTypes::RealVectorType & getTypedVectorRO(DataTypes::real_t dummy) const
Definition: DataTagged.cpp:1675
Data sinh() const
Return the sinh of each data point of this Data object.
Definition: Data.cpp:2053
Data atanh() const
Return the atanh of each data point of this Data object.
Definition: Data.cpp:2100
DataReady_ptr getReadyPtr()
Definition: Data.h:1785
void TensorSelfUpdateBinaryOperation(const Data &right, escript::ES_optype operation)
Definition: Data.cpp:6495
DataTypes::RealVectorType::reference getDataByTagRW(int tag, DataTypes::RealVectorType::size_type i, DataTypes::real_t dummy=0)
getDataByTag
Definition: DataTagged.cpp:1016
const_Domain_ptr getDomain() const
Returns the function space domain.
Definition: FunctionSpace.cpp:102
Data rpowO(const boost::python::object &left) const
Return the given power of each data point of this boost python object.
Definition: Data.cpp:3287
friend Data randomData(const boost::python::tuple &shape, const FunctionSpace &what, long seed, const boost::python::tuple &filter)
Create a new Expanded Data object filled with pseudo-random data.
DataTypes::real_t lazyAlgWorker(DataTypes::real_t init)
Data interpolateFromTable1DP(boost::python::object table, DataTypes::real_t Amin, DataTypes::real_t Astep, DataTypes::real_t undef, bool check_boundaries)
Definition: Data.cpp:4720
std::list< int > getListOfTagsSTL() const
Returns an stl list of the tags used in this function space.
Definition: FunctionSpace.cpp:286
(Testing use only) Provides a domain to wrap a collection of values.
Definition: TestDomain.h:41
void setTaggedValueFromCPP(int tagKey, const DataTypes::ShapeType &pointshape, const DataTypes::RealVectorType &value, int dataOffset=0)
Assign the given value to the tag. Implicitly converts this object to type DataTagged if it is consta...
Definition: Data.cpp:3598
Data nonuniformslope(boost::python::object in, boost::python::object out, bool check_boundaries)
Definition: Data.cpp:5272
std::vector< int > ShapeType
The shape of a single datapoint.
Definition: DataTypes.h:42
boost::python::object __sub__(const boost::python::object &right)
wrapper for python subtract operation
Definition: Data.cpp:5900
Data interpolateFromTable2DP(boost::python::object table, DataTypes::real_t Amin, DataTypes::real_t Astep, Data &B, DataTypes::real_t Bmin, DataTypes::real_t Bstep, DataTypes::real_t undef, bool check_boundaries)
Definition: Data.cpp:4711
Data acos() const
Return the acos of each data point of this Data object.
Definition: Data.cpp:2038
Simulates a full dataset accessible via sampleNo and dataPointNo.
Definition: DataTagged.h:44
bool probeInterpolation(const FunctionSpace &functionspace) const
Returns true if this can be interpolated to functionspace.
Definition: Data.cpp:1299
boost::shared_ptr< DataAbstract > DataAbstract_ptr
Definition: DataAbstract.h:51
Data phase() const
Return the phase/arg/angular-part of complex values.
Definition: Data.cpp:1987
DataTypes::real_t * getSampleDataRW(DataTypes::RealVectorType::size_type sampleNo, DataTypes::real_t dummy=0)
Return the sample data for the given sample number.
Definition: DataReady.h:203
Data getItem(const boost::python::object &key) const
Returns a slice from this Data object.
Definition: Data.cpp:3432
void initialise(const DataTypes::RealVectorType &value, const DataTypes::ShapeType &shape, const FunctionSpace &what, bool expanded)
Construct a Data object of the appropriate type.
Definition: Data.cpp:641
Data maxval() const
Return the maximum value of each data point of this Data object.
Definition: Data.cpp:2611
void setValueOfDataPointC(int dataPointNo, const DataTypes::cplx_t)
Definition: Data.cpp:1658
Data cos() const
Return the cos of each data point of this Data object.
Definition: Data.cpp:2017
const DataTypes::real_t * getDataRO(DataTypes::real_t dummy=0) const
Return a pointer to the beginning of the underlying data.
Definition: Data.h:1995
Data C_GeneralTensorProduct(Data &arg_0, Data &arg_1, int axis_offset=0, int transpose=0)
Compute a tensor product of two Data objects.
Definition: Data.cpp:3654
DataTypes::RealVectorType::const_reference getDataAtOffsetRO(DataTypes::RealVectorType::size_type i, DataTypes::real_t dummy)
Return a pointer to the beginning of the datapoint at the specified offset. TODO Eventually these sho...
Definition: Data.cpp:4654
bool m_protected
Definition: Data.h:1754
Data cosh() const
Return the cosh of each data point of this Data object.
Definition: Data.cpp:2060
void setValueOfDataPoint(int dataPointNo, const DataTypes::real_t)
sets the values of a data-point on this process
Definition: Data.cpp:1637
Data interpolate(const FunctionSpace &functionspace) const
Interpolates this onto the given functionspace and returns the result as a Data object.
Definition: Data.cpp:1293
Data matrixInverse() const
return inverse of matricies.
Definition: Data.cpp:3259
Data & operator/=(const Data &right)
Overloaded operator /=.
Definition: Data.cpp:3228
DataReady * getReady()
Definition: Data.h:1773
Data copySelf() const
Return a pointer to a deep copy of this object.
Definition: Data.cpp:752
void resolve()
If this data is lazy, then convert it to ready data. What type of ready data depends on the expressio...
Definition: Data.cpp:1212
bool isEmpty() const
Return true if this Data holds an instance of DataEmpty. This is _not_ the same as asking if the obj...
Definition: Data.cpp:1114
Data tanh() const
Return the tanh of each data point of this Data object.
Definition: Data.cpp:2067
void calc_minGlobalDataPoint(int &ProcNo, int &DataPointNo) const
Definition: Data.cpp:2961
void operandCheck(const Data &right) const
Check *this and the right operand are compatible. Throws an exception if they aren't.
Definition: Data.h:1674
DataAbstract * borrowData(void) const
return the object produced by the factory, which is a DataConstant or DataExpanded TODO Ownership of ...
Definition: Data.cpp:4585
Data erf() const
Return the error function erf of each data point of this Data object.
Definition: Data.cpp:2075
const DataTypes::ShapeType & getShape() const
Return the shape information for the point data.
Definition: DataAbstract.h:641
int getNumSamples() const
Return the number of samples.
Definition: DataAbstract.h:622
int getNumDPPSample() const
Return the number of data points per sample.
Definition: DataAbstract.h:611
DataTypes::real_t infWorker() const
Definition: Data.cpp:2544
int getNoValues() const
Return the number of values in the shape for this object.
Definition: Data.h:567
Describes binary operations performed on DataVector.
virtual DataTypes::RealVectorType::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:621
boost::python::object integrateWorker() const
Data rtruedivO(const boost::python::object &left)
Newer style division operator for python.
Definition: Data.h:2184
const boost::python::tuple maxGlobalDataPoint() const
Return the (sample number, data-point number) of the data point with the minimum component value in t...
Definition: Data.cpp:3047
const DataTypes::real_t * getSampleDataRO(DataTypes::RealVectorType::size_type sampleNo, DataTypes::real_t dummy=0) const
Return the sample data for the given sample no. Please do not use this unless you NEED to access samp...
Definition: Data.h:1968
std::map< int, int > DataMapType
Definition: DataTagged.h:57
Data powD(const Data &right) const
Return the given power of each data point of this Data object.
Definition: Data.cpp:3301
void replaceNaNPython(boost::python::object obj)
replaces all NaN values with value
Definition: Data.cpp:2384
Data trace(int axis_offset) const
Return the trace of a matrix.
Definition: Data.cpp:2812
DataTypes::RealVectorType::size_type getOffsetForTag(int tag) const
getOffsetForTag
Definition: DataTagged.cpp:994
const boost::python::tuple minGlobalDataPoint() const
Return the (sample number, data-point number) of the data point with the minimum component value in t...
Definition: Data.cpp:2944
Data minval_nonlazy() const
Definition: Data.cpp:2589
int get_MPISize(void) const
return the MPI rank number of the local data MPI_COMM_WORLD is assumed and the result of MPI_Comm_ran...
Definition: Data.cpp:5403
const DataTypes::ShapeType & getDataPointShape() const
Return a reference to the data point shape.
Definition: Data.h:692
const FunctionSpace & getFunctionSpace() const
Return the function space.
Definition: Data.h:462
void delaySelf()
convert the current data into lazy data.
Definition: Data.cpp:779
Data transpose(int axis_offset) const
Transpose each data point of this Data object around the given axis.
Definition: Data.cpp:2867
int get_MPIRank(void) const
return the MPI rank number of the local data MPI_COMM_WORLD is assumed and the result of MPI_Comm_siz...
Definition: Data.cpp:5415
void expand()
Whatever the current Data type make this into a DataExpanded.
Definition: Data.cpp:1162
DataTypes::real_t reduction(BinaryFunction operation, DataTypes::real_t initial_value) const
Perform the specified reduction algorithm on every element of every data point in this Data object ac...
Definition: Data.h:2202
Data operator+(const Data &left, const Data &right)
Operator+ Takes two Data objects.
Definition: Data.cpp:3313
Data represents a collection of datapoints.
Definition: Data.h:63
Data whereZero(DataTypes::real_t tol=0.0) const
Return a Data with a 1 for 0 values and a 0 for +ive or -ive values.
Definition: Data.cpp:1279
DataTypes::RealVectorType::reference getDataPointRW(int sampleNo, int dataPointNo)
Return a reference into the DataVector which points to the specified data point.
Definition: Data.cpp:4693
Data asinh() const
Return the asinh of each data point of this Data object.
Definition: Data.cpp:2086
void maskWorker(Data &other2, Data &mask2, S sentinel)
Definition: Data.cpp:936
virtual DataTypes::RealVectorType & getTypedVectorRW(DataTypes::real_t dummy)
These versions use the type system rather than method name to determine return type.
Definition: DataConstant.cpp:864
DataTypes::RealVectorType::reference getDataAtOffsetRW(DataTypes::RealVectorType::size_type i, DataTypes::real_t dummy)
Definition: Data.cpp:4646
ES_optype
Definition: ES_optype.h:26
Data asin() const
Return the asin of each data point of this Data object.
Definition: Data.cpp:2031
void replaceInf(DataTypes::real_t value)
Definition: Data.cpp:2409
bool isConstant() const
Return true if this Data is constant.
Definition: Data.cpp:1121
void setValueOfDataPointToArray(int dataPointNo, const boost::python::object &)
sets the values of a data-point from a array-like object on this process
Definition: Data.cpp:1594
bool isComplex() const
True if components of this data are stored as complex.
Definition: Data.cpp:1142
bool isShared() const
Definition: Data.h:1814
bool numSamplesEqual(int numDataPointsPerSample, int numSamples) const
Returns true if the number of data points per sample and the number of samples match the respective a...
Definition: Data.h:542
const DataTypes::RealVectorType * resolveSample(int sampleNo, size_t &roffset) const
Compute the value of the expression for the given sample.
Definition: DataLazy.cpp:2335
DataReady_ptr borrowReadyPtr(void) const
Definition: Data.cpp:4599
Data acosh() const
Return the acosh of each data point of this Data object.
Definition: Data.cpp:2093
Data wherePositive() const
Return a Data with a 1 for +ive values and a 0 for 0 or -ive values.
Definition: Data.cpp:1235
bool actsExpanded() const
Return true if this Data is expanded or resolves to expanded. That is, if it has a separate value for...
Definition: Data.cpp:1100
Data & operator=(const Data &other)
Definition: Data.cpp:3166
void forceResolve()
Definition: Data.h:1823
DataTypes::cplx_t * getSampleDataByTag(int tag, DataTypes::cplx_t dummy)
Definition: Data.h:648
virtual DataAbstract * deepCopy() const =0
Return a deep copy of the current object.
void requireWrite()
Ensures data is ready for write access. This means that the data will be resolved if lazy and will be...
Definition: Data.cpp:1221
DataTypes::real_t Lsup_const() const
Definition: Data.cpp:2169
int getNumDataPointsPerSample() const
Return the number of data points per sample.
Definition: Data.h:531
const DataReady * getReady() const
Definition: Data.h:1765
DataTypes::RealVectorType::size_type getDefaultOffset() const
Returns the offset in the structure which stores the default value.
Definition: DataTagged.h:723
DataTypes::real_t * getSampleDataRW(DataTypes::RealVectorType::size_type sampleNo, DataTypes::real_t dummy=0)
Return the sample data for the given sample no. Please do not use this unless you NEED to access samp...
Definition: Data.h:1933
int MPI_Comm
Definition: EsysMPI.h:41
Data hermitian() const
Return the hermitian part of a matrix which is half the matrix plus its adjoint.
Definition: Data.cpp:2745
friend Data condEvalWorker(escript::Data &mask, escript::Data &trueval, escript::Data &falseval, S sentinel)
Data oneOver() const
Returns 1./ Data object.
Definition: Data.cpp:1228
virtual DataTypes::RealVectorType & getTypedVectorRW(DataTypes::real_t dummy)
These versions use the type system rather than method name to determine return type.
Definition: DataTagged.cpp:1668
DataTypes::real_t LsupWorker() const
Definition: Data.cpp:2444
Data minval() const
Return the minimum value of each data point of this Data object.
Definition: Data.cpp:2620
Data C_TensorBinaryOperation(Data const &arg_0, Data const &arg_1, ES_optype operation)
Compute a tensor operation with two Data objects.
Definition: Data.cpp:6319
bool m_lazy
Definition: Data.h:1755
DataTypes::real_t sup()
Return the maximum value of this Data object.
Definition: Data.cpp:2228
void setTupleForGlobalDataPoint(int id, int proc, boost::python::object)
Set the value of a global data point.
Definition: Data.cpp:1549
const DataTypes::real_t * getSampleDataRO(DataTypes::RealVectorType::size_type sampleNo, DataTypes::real_t dummy=0) const
Definition: DataReady.h:217
int getNumSamples() const
Return the number of samples.
Definition: Data.h:520
boost::python::object __div__(const boost::python::object &right)
wrapper for python divide operation
Definition: Data.cpp:5973
virtual const DataTypes::RealVectorType & getTypedVectorRO(DataTypes::real_t dummy) const =0
Data abs() const
Return the absolute value of each data point of this Data object.
Definition: Data.cpp:2129
Data grad() const
Definition: Data.cpp:1332
Data dp_algorithm(BinaryFunction operation, DataTypes::real_t initial_value) const
Reduce each data-point in this Data object using the given operation. Return a Data object with the s...
Definition: Data.h:2281
void copy(const Data &other)
Make this object a deep copy of "other".
Definition: Data.cpp:759
Wraps an expression tree of other DataObjects. The data will be evaluated when required.
Definition: DataLazy.h:47
std::complex< real_t > cplx_t
complex data type
Definition: DataTypes.h:53
DataTypes::real_t inf_const() const
Definition: Data.cpp:2253
const boost::python::tuple eigenvalues_and_eigenvectors(const DataTypes::real_t tol=1.e-12) const
Return the eigenvalues and corresponding eigenvcetors of the symmetric part at each data point of thi...
Definition: Data.cpp:2918
void init_from_data_and_fs(const Data &inData, const FunctionSpace &functionspace)
Definition: Data.cpp:433
int getTagNumber(int dpno)
Return the tag number associated with the given data-point.
Definition: Data.cpp:3637
Domain_ptr getDomainPython() const
Return the function space domain. Internal use only! This gets around some python difficulties by cas...
Definition: FunctionSpace.cpp:108
Definition: DataException.h:26
void complicate()
Definition: Data.cpp:6021
Data nonuniforminterp(boost::python::object in, boost::python::object out, bool check_boundaries)
Definition: Data.cpp:5196
virtual const DataTypes::RealVectorType & getTypedVectorRO(DataTypes::real_t dummy) const
Definition: DataExpanded.cpp:1531
Data maxval_nonlazy() const
Definition: Data.cpp:2600
DataTypes::real_t reductionOpVector(const DataTypes::RealVectorType &left, const DataTypes::ShapeType &leftShape, DataTypes::RealVectorType::size_type offset, BinaryFunction operation, DataTypes::real_t initial_value)
Perform the given data point reduction operation on the data point specified by the given offset into...
Definition: DataVectorOps.h:1393
Data condEval(escript::Data &mask, escript::Data &trueval, escript::Data &falseval)
Definition: Data.cpp:5612
Data powO(const boost::python::object &right) const
Return the given power of each data point of this boost python object.
Definition: Data.cpp:3294
Data whereNonNegative() const
Return a Data with a 1 for +ive or 0 values and a 0 for -ive values.
Definition: Data.cpp:1257
Data exp() const
Return the exponential function of each data point of this Data object.
Definition: Data.cpp:2155
Data operator*(const AbstractSystemMatrix &left, const Data &right)
Definition: AbstractSystemMatrix.cpp:59
void exclusiveWrite()
if another object is sharing out member data make a copy to work with instead. This code should only ...
Definition: Data.h:1841
Data whereNegative() const
Return a Data with a 1 for -ive values and a 0 for +ive or 0 values.
Definition: Data.cpp:1246
bool isTagged() const
Return true if this Data is tagged.
Definition: Data.cpp:1107
Definition: DataAbstract.h:61
bool hasNoSamples() const
Return true if this object contains no samples. This is not the same as isEmpty() ...
Definition: Data.h:724
Data conjugate() const
For complex values return the conjugate values. For non-complex data return a copy.
Definition: Data.cpp:1928
const_Domain_ptr getDomain() const
Return the domain.
Definition: Data.h:474
Data interpolateFromTable2D(const WrappedArray &table, DataTypes::real_t Amin, DataTypes::real_t Astep, DataTypes::real_t undef, Data &B, DataTypes::real_t Bmin, DataTypes::real_t Bstep, bool check_boundaries)
Definition: Data.cpp:4857
const ElementType & const_reference
Definition: DataVectorAlt.h:51
void dump(const std::string fileName) const
dumps the object into a netCDF file
Definition: Data.cpp:5381
void setProtection()
switches on update protection
Definition: Data.cpp:1148
const FunctionSpace & getFunctionSpace() const
Return the function space associated with this Data object.
Definition: DataAbstract.h:634
Data besselFirstKind(int order)
Return the Bessel function of the first kind for each data point of this Data object.
Definition: Data.cpp:1821
boost::shared_ptr< DataReady > DataReady_ptr
Definition: DataAbstract.h:56
boost::python::object __rdiv__(const boost::python::object &right)
wrapper for python reverse divide operation
Definition: Data.cpp:5997
bool hasNaN()
returns return true if data contains NaN.
Definition: Data.cpp:2353
DataTypes::RealVectorType::size_type getDataOffset(int sampleNo, int dataPointNo)
Return the offset for the given sample and point within the sample.
Definition: Data.h:680
Data operator/(const Data &left, const Data &right)
Operator/ Takes two Data objects.
Definition: Data.cpp:3342
bool isExpanded() const
Return true if this Data is expanded.
Definition: Data.cpp:1093
Data whereNonPositive() const
Return a Data with a 1 for -ive or 0 values and a 0 for +ive values.
Definition: Data.cpp:1268
Data()
Default constructor. Creates a DataEmpty object.
Definition: Data.cpp:249
void copyWithMask(const Data &other, const Data &mask)
Copy other Data object into this Data object where mask is positive.
Definition: Data.cpp:833
boost::python::object __mul__(const boost::python::object &right)
wrapper for python multiply operation
Definition: Data.cpp:5949
size_t getNumberOfTaggedValues() const
For tagged Data returns the number of tags with values. For non-tagged data will return 0 (even Data ...
Definition: Data.cpp:5823
Data neg() const
Return the negation of each data point of this Data object.
Definition: Data.cpp:2136
const boost::python::tuple getShapeTuple() const
Return the data point shape as a tuple of integers.
Definition: Data.cpp:727
const DataMapType & getTagLookup() const
getTagLookup
Definition: DataTagged.h:761
Data truedivO(const boost::python::object &right)
Newer style division operator for python.
Definition: Data.h:2171
bool isReady() const
Return true if this data is ready.
Definition: Data.cpp:1135
Data symmetric() const
Return the symmetric part of a matrix which is half the matrix plus its transpose.
Definition: Data.cpp:2686
#define ESYS_ASSERT(a, b)
EsysAssert is a MACRO that will throw an exception if the boolean condition specified is false...
Definition: Assert.h:78
Definition: WrappedArray.h:31
DataTypes::RealVectorType & getExpandedVectorReference(DataTypes::real_t dummy=0)
Ensures that the Data is expanded and returns its underlying vector Does not check for exclusive writ...
Definition: Data.cpp:5805
int getNumDataPoints() const
Return the number of data points.
Definition: Data.h:510
Data antisymmetric() const
Return the antisymmetric part of a matrix which is half the matrix minus its transpose.
Definition: Data.cpp:2709
Data sin() const
Return the sin of each data point of this Data object.
Definition: Data.cpp:2010
~Data()
Destructor.
Definition: Data.cpp:604
void unaryOp2(UnaryFunction operation)
Perform the given unary operation on every element of every data point in this Data object...
Data gradOn(const FunctionSpace &functionspace) const
Calculates the gradient of the data at the data points of functionspace. If functionspace is not pres...
Definition: Data.cpp:1305
const boost::python::object getValueOfDataPointAsTuple(int dataPointNo)
Return the value of a data point as a python tuple.
Definition: Data.cpp:1502
#define S(_J_, _I_)
Definition: ShapeFunctions.cpp:121
Data interpolateFromTable3D(const WrappedArray &table, DataTypes::real_t Amin, DataTypes::real_t Astep, DataTypes::real_t undef, Data &B, DataTypes::real_t Bmin, DataTypes::real_t Bstep, Data &C, DataTypes::real_t Cmin, DataTypes::real_t Cstep, bool check_boundaries)
Definition: Data.cpp:5013
bool isProtected() const
Returns true, if the data object is protected against update.
Definition: Data.cpp:1154
Data log() const
Return the natural log of each data point of this Data object.
Definition: Data.cpp:2114
Data truedivD(const Data &right)
Newer style division operator for python.
Definition: Data.h:2159
boost::shared_ptr< const AbstractDomain > const_Domain_ptr
Definition: AbstractDomain.h:39
Data whereNonZero(DataTypes::real_t tol=0.0) const
Return a Data with a 0 for 0 values and a 1 for +ive or -ive values.
Definition: Data.cpp:1286
DataTypes::real_t Lsup()
Return the maximum absolute value of this Data object.
Definition: Data.cpp:2179
Data & operator-=(const Data &right)
Overloaded operator -=.
Definition: Data.cpp:3174
boost::python::object integrateToTuple_const() const
Calculate the integral over the function space domain as a python tuple.
Definition: Data.cpp:1734
double real_t
type of all real-valued scalars in escript
Definition: DataTypes.h:50
void calc_maxGlobalDataPoint(int &ProcNo, int &DataPointNo) const
Definition: Data.cpp:3057
Data eigenvalues() const
Return the eigenvalues of the symmetric part at each data point of this Data object in increasing val...
Definition: Data.cpp:2891
Data bessel(int order, DataTypes::real_t(*besselfunc)(int, DataTypes::real_t))
Bessel worker function.
Definition: Data.cpp:1835
void setTaggedValue(int tagKey, const boost::python::object &value)
Assign the given value to the tag. Implicitly converts this object to type DataTagged if it is consta...
Definition: Data.cpp:3558
const boost::python::object getValueOfGlobalDataPointAsTuple(int procNo, int dataPointNo)
Return a data point across all processors as a python tuple.
Definition: Data.cpp:1681
Data swapaxes(const int axis0, const int axis1) const
swaps the components axis0 and axis1
Definition: Data.cpp:2629
Domain_ptr getDomainPython() const
Return the domain. TODO: For internal use only. This should be removed.
Definition: Data.h:488
Data tan() const
Return the tan of each data point of this Data object.
Definition: Data.cpp:2024
Data & operator+=(const Data &right)
Overloaded operator +=.
Definition: Data.cpp:3138