40 #include "esysUtils/Esys_MPI.h"
45 #include <boost/shared_ptr.hpp>
46 #include <boost/python/object.hpp>
47 #include <boost/python/tuple.hpp>
119 bool expanded=
false);
136 bool expanded=
false);
160 Data(
const boost::python::object& value,
162 bool expanded=
false);
176 bool expanded=
false);
189 Data(
const boost::python::object& value,
198 const boost::python::tuple& shape=boost::python::make_tuple(),
200 bool expanded=
false);
280 const boost::python::object
311 const boost::python::object
463 return m_data->getFunctionSpace();
526 return m_data->getNumSamples();
538 return m_data->getNumDPPSample();
576 return m_data->getNoValues();
586 dump(
const std::string fileName)
const;
595 const boost::python::object
636 return m_data->getSampleDataByTag(tag);
671 return m_data->getPointOffset(sampleNo,dataPointNo);
683 return m_data->getShape();
691 const boost::python::tuple
733 const boost::python::object& value);
747 const boost::python::object& value);
803 double undef,
Data& B,
double Bmin,
double Bstep,
Data& C,
804 double Cmin,
double Cstep,
bool check_boundaries);
809 double undef,
Data& B,
double Bmin,
double Bstep,
bool check_boundaries);
814 double undef,
bool check_boundaries);
820 Data& B,
double Bmin,
double Bstep,
Data& C,
double Cmin,
double Cstep,
double undef,
bool check_boundaries);
826 Data& B,
double Bmin,
double Bstep,
double undef,
bool check_boundaries);
831 double undef,
bool check_boundaries);
835 nonuniforminterp(boost::python::object in, boost::python::object out,
bool check_boundaries);
839 nonuniformslope(boost::python::object in, boost::python::object out,
bool check_boundaries);
860 boost::python::object
869 boost::python::object
1032 const boost::python::tuple
1043 const boost::python::tuple
1083 trace(
int axis_offset)
const;
1114 const boost::python::tuple
1124 swapaxes(
const int axis0,
const int axis1)
const;
1318 powO(
const boost::python::object& right)
const;
1330 rpowO(
const boost::python::object& left)
const;
1405 boost::python::object
__add__(
const boost::python::object& right);
1413 boost::python::object
__sub__(
const boost::python::object& right);
1420 boost::python::object
__rsub__(
const boost::python::object& right);
1427 boost::python::object
__mul__(
const boost::python::object& right);
1434 boost::python::object
__div__(
const boost::python::object& right);
1441 boost::python::object
__rdiv__(
const boost::python::object& right);
1475 getItem(
const boost::python::object& key)
const;
1490 setItemD(
const boost::python::object& key,
1495 setItemO(
const boost::python::object& key,
1496 const boost::python::object& value);
1505 template <
class UnaryFunction>
1624 template <
class BinaryOp>
1641 boost::python::object
1678 template <
class BinaryFunction>
1682 double initial_value)
const;
1691 template <
class BinaryFunction>
1695 double initial_value)
const;
1705 template <
class BinaryFunction>
1709 BinaryFunction operation);
1820 if (omp_in_parallel())
1822 throw DataException(
"Please do not call forceResolve() in a parallel region.");
1836 if (omp_in_parallel())
1839 throw DataException(
"Programming error. Please do not run exclusiveWrite() in multi-threaded sections.");
1857 throw DataException(
"Programming error. ExclusiveWrite required - please call requireWrite()");
1871 #ifdef IKNOWWHATIMDOING
1880 #ifdef IKNOWWHATIMDOING
1899 long seed,
const boost::python::tuple& filter);
1919 EsysAssert((dr!=0),
"Error - casting to DataReady.");
1928 EsysAssert((dr!=0),
"Error - casting to DataReady.");
1940 EsysAssert((dr.get()!=0),
"Error - casting to DataReady.");
1950 EsysAssert((dr.get()!=0),
"Error - casting to DataReady.");
1960 throw DataException(
"Error, attempt to acquire RW access to lazy data. Please call requireWrite() first.");
1974 return &((*res)[offset]);
1982 inline double rpow(
double x,
double y)
2111 return *
this / right;
2145 template <
class BinaryFunction>
2149 BinaryFunction operation)
2154 throw DataException(
"Error - attempt to update rank zero object with object with rank bigger than zero.");
2159 throw DataException(
"Programmer error - attempt to call binaryOp with Lazy Data.");
2163 Data tempRight(right);
2170 std::string msg=
"Error - attempt to combine incompatible FunctionSpaces.";
2179 tempRight=
Data(right,fsl);
2184 Data tempLeft(*
this,fsr);
2200 EsysAssert((leftC!=0),
"Programming error - casting to DataExpanded.");
2207 EsysAssert((leftC!=0),
"Programming error - casting to DataTagged.");
2210 EsysAssert((rightC!=0),
"Programming error - casting to DataTagged.");
2214 EsysAssert((rightC!=0),
"Programming error - casting to DataConstant.");
2220 EsysAssert((leftC!=0 && rightC!=0),
"Programming error - casting to DataConstant.");
2232 template <
class BinaryFunction>
2239 EsysAssert((leftC!=0),
"Programming error - casting to DataExpanded.");
2243 EsysAssert((leftC!=0),
"Programming error - casting to DataTagged.");
2247 EsysAssert((leftC!=0),
"Programming error - casting to DataConstant.");
2250 throw DataException(
"Error - Operations not permitted on instances of DataEmpty.");
2252 throw DataException(
"Error - Operations not permitted on instances of DataLazy.");
2254 throw DataException(
"Error - Data encapsulates an unknown type.");
2266 template <
class BinaryFunction>
2272 throw DataException(
"Error - Operations not permitted on instances of DataEmpty.");
2278 EsysAssert((dataE!=0),
"Programming error - casting data to DataExpanded.");
2279 EsysAssert((resultE!=0),
"Programming error - casting result to DataExpanded.");
2285 EsysAssert((dataT!=0),
"Programming error - casting data to DataTagged.");
2290 return Data(resultT);
2296 EsysAssert((dataC!=0),
"Programming error - casting data to DataConstant.");
2297 EsysAssert((resultC!=0),
"Programming error - casting result to DataConstant.");
2301 throw DataException(
"Error - Operations not permitted on instances of DataLazy.");
2303 throw DataException(
"Error - Data encapsulates an unknown type.");
2314 template <
typename BinaryFunction>
2319 BinaryFunction operation)
2323 throw DataException(
"Error - Operations not permitted on instances of DataEmpty.");
2327 throw DataException(
"Error - Operations not permitted on lazy data.");
2330 Data arg_0_Z, arg_1_Z;
2337 std::string msg=
"Error - C_TensorBinaryOperation: arguments have incompatible function spaces.";
2346 arg_0_Z =
Data(arg_0);
2351 arg_1_Z =
Data(arg_1);
2354 arg_0_Z =
Data(arg_0);
2355 arg_1_Z =
Data(arg_1);
2367 if (shape0 == shape1) {
2401 DataTagged::DataMapType::const_iterator i;
2402 for (i=lookup_1.begin();i!=lookup_1.end();i++) {
2417 int sampleNo_1,dataPointNo_1;
2420 int offset_0 = tmp_0->getPointOffset(0,0);
2422 #pragma omp parallel for private(sampleNo_1,dataPointNo_1) schedule(static)
2423 for (sampleNo_1 = 0; sampleNo_1 < numSamples_1; sampleNo_1++) {
2424 for (dataPointNo_1 = 0; dataPointNo_1 < numDataPointsPerSample_1; dataPointNo_1++) {
2458 DataTagged::DataMapType::const_iterator i;
2459 for (i=lookup_0.begin();i!=lookup_0.end();i++) {
2487 DataTagged::DataMapType::const_iterator i;
2490 for (i=lookup_0.begin();i!=lookup_0.end();i++) {
2493 for (i=lookup_1.begin();i!=lookup_1.end();i++) {
2498 for (i=lookup_2.begin();i!=lookup_2.end();i++) {
2515 int sampleNo_0,dataPointNo_0;
2519 #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)
2520 for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
2521 int offset_0 = tmp_0->getPointOffset(sampleNo_0,0);
2523 for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {
2539 int sampleNo_0,dataPointNo_0;
2544 #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)
2545 for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
2546 for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {
2547 int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);
2567 int sampleNo_0,dataPointNo_0;
2571 #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)
2572 for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
2575 for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {
2576 int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);
2592 int sampleNo_0,dataPointNo_0;
2596 #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)
2597 for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
2600 int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);
2612 throw DataException(
"Error - C_TensorBinaryOperation: unknown combination of inputs");
2615 }
else if (0 == rank0) {
2647 DataTagged::DataMapType::const_iterator i;
2648 for (i=lookup_1.begin();i!=lookup_1.end();i++) {
2666 int offset_0 = tmp_0->getPointOffset(0,0);
2668 double ptr_0 = ptr_src[0];
2669 int size = size1*numDataPointsPerSample_1;
2671 #pragma omp parallel for private(sampleNo_1) schedule(static)
2672 for (sampleNo_1 = 0; sampleNo_1 < numSamples_1; sampleNo_1++) {
2711 DataTagged::DataMapType::const_iterator i;
2712 for (i=lookup_0.begin();i!=lookup_0.end();i++) {
2742 DataTagged::DataMapType::const_iterator i;
2745 for (i=lookup_0.begin();i!=lookup_0.end();i++) {
2748 for (i=lookup_1.begin();i!=lookup_1.end();i++) {
2753 for (i=lookup_2.begin();i!=lookup_2.end();i++) {
2770 int sampleNo_0,dataPointNo_0;
2774 #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)
2775 for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
2776 int offset_0 = tmp_0->getPointOffset(sampleNo_0,0);
2778 for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {
2794 int sampleNo_0,dataPointNo_0;
2799 #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)
2800 for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
2801 for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {
2802 int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);
2821 int sampleNo_0,dataPointNo_0;
2825 #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)
2826 for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
2829 for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {
2830 int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);
2847 int sampleNo_0,dataPointNo_0;
2851 #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)
2852 for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
2853 for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {
2854 int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);
2866 throw DataException(
"Error - C_TensorBinaryOperation: unknown combination of inputs");
2869 }
else if (0 == rank1) {
2902 DataTagged::DataMapType::const_iterator i;
2903 for (i=lookup_1.begin();i!=lookup_1.end();i++) {
2917 int sampleNo_1,dataPointNo_1;
2920 int offset_0 = tmp_0->getPointOffset(0,0);
2922 #pragma omp parallel for private(sampleNo_1,dataPointNo_1) schedule(static)
2923 for (sampleNo_1 = 0; sampleNo_1 < numSamples_1; sampleNo_1++) {
2924 for (dataPointNo_1 = 0; dataPointNo_1 < numDataPointsPerSample_1; dataPointNo_1++) {
2958 DataTagged::DataMapType::const_iterator i;
2959 for (i=lookup_0.begin();i!=lookup_0.end();i++) {
2988 DataTagged::DataMapType::const_iterator i;
2991 for (i=lookup_0.begin();i!=lookup_0.end();i++) {
2994 for (i=lookup_1.begin();i!=lookup_1.end();i++) {
2999 for (i=lookup_2.begin();i!=lookup_2.end();i++) {
3015 int sampleNo_0,dataPointNo_0;
3019 #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)
3020 for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
3021 int offset_0 = tmp_0->getPointOffset(sampleNo_0,0);
3023 for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {
3044 double ptr_1 = ptr_src[0];
3045 int size = size0 * numDataPointsPerSample_0;
3047 #pragma omp parallel for private(sampleNo_0) schedule(static)
3048 for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
3050 int offset_0 = tmp_0->getPointOffset(sampleNo_0,0);
3069 int sampleNo_0,dataPointNo_0;
3073 #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)
3074 for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
3077 for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {
3078 int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);
3095 int sampleNo_0,dataPointNo_0;
3099 #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)
3100 for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
3101 for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {
3102 int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);
3114 throw DataException(
"Error - C_TensorBinaryOperation: unknown combination of inputs");
3118 throw DataException(
"Error - C_TensorBinaryOperation: arguments have incompatible shapes");
3124 template <
typename UnaryFunction>
3127 UnaryFunction operation)
3131 throw DataException(
"Error - Operations not permitted on instances of DataEmpty.");
3135 throw DataException(
"Error - Operations not permitted on lazy data.");
3170 DataTagged::DataMapType::const_iterator i;
3171 for (i=lookup_0.begin();i!=lookup_0.end();i++) {
3185 int sampleNo_0,dataPointNo_0;
3188 #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static)
3189 for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
3192 int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);
3201 throw DataException(
"Error - C_TensorUnaryOperation: unknown combination of inputs");
double sup_const() const
Definition: Data.cpp:1616
Give a short description of what FunctionSpace does.
Definition: FunctionSpace.h:46
DataVector implements an arbitrarily long vector of data values. DataVector is the underlying data co...
Definition: DataVector.h:44
std::ostream & operator<<(std::ostream &o, const Data &data)
Output operator.
Definition: Data.cpp:2746
DataAbstract_ptr m_data
Definition: Data.h:1758
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:1087
int getNumDataPointsPerSample() const
Return the number of data points per sample.
Definition: Data.h:536
DataTypes::ValueType::reference getDataAtOffsetRW(DataTypes::ValueType::size_type i)
Definition: Data.cpp:3164
Data asin() const
Return the asin of each data point of this Data object.
Definition: Data.cpp:1437
const DataTypes::ShapeType & getDataPointShape() const
Return a reference to the data point shape.
Definition: Data.h:681
double LsupWorker() const
Definition: Data.cpp:1740
Data wherePositive() const
Return a Data with a 1 for +ive values and a 0 for 0 or -ive values.
Definition: Data.cpp:983
void addTag(int tagKey)
addTag - does not modify the default value for this object. ** Not unit tested ** ...
Definition: DataTagged.cpp:429
void setItemO(const boost::python::object &key, const boost::python::object &value)
Definition: Data.cpp:2601
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:3988
Data whereNonNegative() const
Return a Data with a 1 for +ive or 0 values and a 0 for -ive values.
Definition: Data.cpp:997
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:3976
unsigned int getDataPointRank() const
Return the rank of the point data.
Definition: Data.h:501
int getNumSamples() const
Return the number of samples.
Definition: Data.h:524
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:339
boost::python::object __add__(const boost::python::object &right)
wrapper for python add operation
Definition: Data.cpp:4411
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
void checkExclusiveWrite()
checks if caller can have exclusive write to the object
Definition: Data.h:1853
boost::python::object __rsub__(const boost::python::object &right)
wrapper for python reverse subtract operation
Definition: Data.cpp:4459
DataReady_ptr borrowReadyPtr(void) const
Definition: Data.cpp:3127
void setToZero()
set all values to zero
Definition: Data.cpp:595
Data getItem(const boost::python::object &key) const
Returns a slice from this Data object.
Definition: Data.cpp:2579
Data dp_algorithm(BinaryFunction operation, double 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:2269
bool isExpanded() const
Return true if this Data is expanded.
Definition: Data.cpp:847
double Lsup()
Return the maximum absolute value of this Data object.
Definition: Data.cpp:1595
Data tanh() const
Return the tanh of each data point of this Data object.
Definition: Data.cpp:1473
Data delay()
produce a delayed evaluation version of this Data.
Definition: Data.cpp:566
Data & operator*=(const Data &right)
Overloaded operator *=.
Definition: Data.cpp:2363
void tag()
If possible convert this Data to DataTagged. This will only allow Constant data to be converted to ta...
Definition: Data.cpp:934
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:431
boost::python::object integrateToTuple()
Calculate the integral over the function space domain as a python tuple.
Definition: Data.cpp:1368
int getDataPointSize() const
Return the size of the data point. It is the product of the data point shape dimensions.
Definition: Data.cpp:1069
boost::shared_ptr< AbstractDomain > Domain_ptr
Definition: AbstractDomain.h:57
double lazyAlgWorker(double init)
Definition: Data.cpp:1682
Definition: DataReady.h:35
double inf_const() const
Definition: Data.cpp:1647
bool m_shared
Definition: Data.h:1752
std::vector< std::pair< int, int > > RegionType
Definition: DataTypes.h:39
bool probeInterpolation(const FunctionSpace &functionspace) const
Returns true if this can be interpolated to functionspace.
Definition: Data.cpp:1035
escriptDataC getDataC()
Return the C wrapper for the Data object.
Definition: Data.cpp:509
boost::shared_ptr< const DataReady > const_DataReady_ptr
Definition: DataAbstract.h:59
DataTypes::ValueType::const_reference getDataAtOffsetRO(DataTypes::ValueType::size_type i)
Return a pointer to the beginning of the datapoint at the specified offset. TODO Eventually these sho...
Definition: Data.cpp:3172
double infWorker() const
Definition: Data.cpp:1814
void setItemD(const boost::python::object &key, const Data &value)
Copies slice from value into this Data object.
Definition: Data.cpp:2609
void tensor_unary_operation(const int size, const double *arg1, double *argRes, UnaryFunction operation)
Definition: LocalOps.h:517
virtual ValueType::size_type getPointOffset(int sampleNo, int dataPointNo) const
getPointOffset
Definition: DataTagged.cpp:505
Data atan() const
Return the atan of each data point of this Data object.
Definition: Data.cpp:1452
Data operator-(const Data &left, const Data &right)
Operator- Takes two Data objects.
Definition: Data.cpp:2471
void transpose(const DataTypes::ValueType &in, const DataTypes::ShapeType &inShape, DataTypes::ValueType::size_type inOffset, DataTypes::ValueType &ev, const DataTypes::ShapeType &evShape, DataTypes::ValueType::size_type evOffset, int axis_offset)
Transpose each data point of this Data object around the given axis.
Definition: DataMaths.h:394
Data rpowO(const boost::python::object &left) const
Return the given power of each data point of this boost python object.
Definition: Data.cpp:2439
void print(void)
print the data values to stdout. Used for debugging
Definition: Data.cpp:3928
void typeMatchRight(const Data &right)
Convert the data type of this to match the RHS.
Definition: Data.cpp:2656
void setSlice(const Data &value, const DataTypes::RegionType ®ion)
Copy the specified slice from the given value into this Data object.
Definition: Data.cpp:2625
Data neg() const
Return the negation of each data point of this Data object.
Definition: Data.cpp:1553
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:42
std::string toString() const
Write the data as a string. For large amounts of data, a summary is printed.
Definition: Data.cpp:3135
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:1195
Data log10() const
Return the log to base 10 of each data point of this Data object.
Definition: Data.cpp:1525
Data interpolateFromTable2DP(boost::python::object table, double Amin, double Astep, Data &B, double Bmin, double Bstep, double undef, bool check_boundaries)
Definition: Data.cpp:3225
Data getSlice(const DataTypes::RegionType ®ion) const
Return a Data object containing the specified slice of this Data object.
Definition: Data.cpp:2593
bool isLazy() const
Return true if this Data is lazy.
Definition: Data.cpp:882
Data swapaxes(const int axis0, const int axis1) const
swaps the components axis0 and axis1
Definition: Data.cpp:1888
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:2680
Give a short description of what DataExpanded does.
Definition: DataExpanded.h:44
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:548
double Lsup_const() const
Definition: Data.cpp:1585
const DataMapType & getTagLookup() const
getTagLookup
Definition: DataTagged.h:660
DataReady_ptr getReadyPtr()
Definition: Data.h:1937
double * getSampleDataRW(ValueType::size_type sampleNo)
Return the sample data for the given sample number.
Definition: DataReady.h:113
DataTypes::ValueType::const_reference getDataByTagRO(int tag, DataTypes::ValueType::size_type i) const
Definition: DataTagged.cpp:542
virtual DataTypes::ValueType::size_type getPointOffset(int sampleNo, int dataPointNo) const
Return the offset for the given sample. This is a somewhat artificial notion but returns the offset i...
Definition: DataConstant.cpp:117
Data trace(int axis_offset) const
Return the trace of a matrix.
Definition: Data.cpp:2003
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.
Data maxval_nonlazy() const
Definition: Data.cpp:1862
Data symmetric() const
Return the symmetric part of a matrix which is half the matrix plus its transpose.
Definition: Data.cpp:1945
(Testing use only) Provides a domain to wrap a collection of values.
Definition: TestDomain.h:45
Data nonuniformslope(boost::python::object in, boost::python::object out, bool check_boundaries)
Definition: Data.cpp:3849
Domain_ptr getDomainPython() const
Return the function space domain. Internal use only! This gets around some python difficulties by cas...
Definition: FunctionSpace.cpp:109
std::vector< int > ShapeType
The shape of a single datapoint.
Definition: DataTypes.h:38
boost::python::object __sub__(const boost::python::object &right)
wrapper for python subtract operation
Definition: Data.cpp:4435
DataAbstract_ptr borrowDataPtr(void) const
Definition: Data.cpp:3120
Simulates a full dataset accessible via sampleNo and dataPointNo.
Definition: DataTagged.h:43
boost::shared_ptr< DataAbstract > DataAbstract_ptr
Definition: DataAbstract.h:51
void operandCheck(const Data &right) const
Check *this and the right operand are compatible. Throws an exception if they aren't.
Definition: Data.h:1668
Data interpolateFromTable1D(const WrappedArray &table, double Amin, double Astep, double undef, bool check_boundaries)
Definition: Data.cpp:3243
Data sqrt() const
Return the square root of each data point of this Data object.
Definition: Data.cpp:1578
DataAbstract::ValueType::value_type * getSampleDataByTag(int tag)
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:634
bool isConstant() const
Return true if this Data is constant.
Definition: Data.cpp:875
DataTypes::ValueType & getExpandedVectorReference()
Ensures that the Data is expanded and returns its underlying vector Does not check for exclusive writ...
Definition: Data.cpp:4345
void binaryOp(const Data &right, BinaryFunction operation)
Perform the given binary operation on all of the data's elements. The underlying type of the right ha...
Definition: Data.h:2148
Data cos() const
Return the cos of each data point of this Data object.
Definition: Data.cpp:1423
Data minval() const
Return the minimum value of each data point of this Data object.
Definition: Data.cpp:1880
Data matrixInverse() const
return inverse of matricies.
Definition: Data.cpp:2413
int MPI_Comm
Definition: Esys_MPI.h:29
Data cosh() const
Return the cosh of each data point of this Data object.
Definition: Data.cpp:1466
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:2753
bool m_protected
Definition: Data.h:1751
bool isTagged() const
Return true if this Data is tagged.
Definition: Data.cpp:861
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:1041
Data transpose(int axis_offset) const
Transpose each data point of this Data object around the given axis.
Definition: Data.cpp:2058
Data & operator/=(const Data &right)
Overloaded operator /=.
Definition: Data.cpp:2386
Data pos() const
Return the identity of each data point of this Data object. Simply returns this object unmodified...
Definition: Data.cpp:1560
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:960
Data powD(const Data &right) const
Return the given power of each data point of this Data object.
Definition: Data.cpp:2453
bool isReady() const
Return true if this data is ready.
Definition: Data.cpp:889
DataTypes::ValueType::reference getDataByTagRW(int tag, DataTypes::ValueType::size_type i)
getDataByTag
Definition: DataTagged.cpp:553
Data sin() const
Return the sin of each data point of this Data object.
Definition: Data.cpp:1416
void calc_minGlobalDataPoint(int &ProcNo, int &DataPointNo) const
Definition: Data.cpp:2143
Data minval_nonlazy() const
Definition: Data.cpp:1852
const boost::python::tuple getShapeTuple() const
Return the data point shape as a tuple of integers.
Definition: Data.cpp:525
Data C_TensorUnaryOperation(Data const &arg_0, UnaryFunction operation)
Definition: Data.h:3126
bool isShared() const
Definition: Data.h:1803
Data acos() const
Return the acos of each data point of this Data object.
Definition: Data.cpp:1444
bool isProtected() const
Returns true, if the data object is protected against update.
Definition: Data.cpp:902
double(* UnaryDFunPtr)(double)
Definition: Data.h:77
Data rtruedivO(const boost::python::object &left)
Newer style division operator for python.
Definition: Data.h:2134
Data interpolateFromTable1DP(boost::python::object table, double Amin, double Astep, double undef, bool check_boundaries)
Definition: Data.cpp:3234
std::map< int, int > DataMapType
Definition: DataTagged.h:56
std::string toString() const
Return a text description of the function space.
Definition: FunctionSpace.cpp:118
Data log() const
Return the natural log of each data point of this Data object.
Definition: Data.cpp:1532
Data nonsymmetric() const
Return the nonsymmetric part of a matrix which is half the matrix minus its transpose.
Definition: Data.cpp:1968
Data interpolateFromTable3DP(boost::python::object table, double Amin, double Astep, Data &B, double Bmin, double Bstep, Data &C, double Cmin, double Cstep, double undef, bool check_boundaries)
Definition: Data.cpp:3215
Provide a wrapper around a Data object so Data may be accessed from C.
Definition: DataC.h:30
void delaySelf()
convert the current data into lazy data.
Definition: Data.cpp:577
bool hasNoSamples() const
Return true if this object contains no samples. This is not the same as isEmpty() ...
Definition: Data.h:717
double rpow(double x, double y)
Definition: Data.h:1982
DataTypes::ValueType::size_type getDataOffset(int sampleNo, int dataPointNo)
Return the offset for the given sample and point within the sample.
Definition: Data.h:668
void setTaggedValueFromCPP(int tagKey, const DataTypes::ShapeType &pointshape, const DataTypes::ValueType &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:2717
void expand()
Whatever the current Data type make this into a DataExpanded.
Definition: Data.cpp:910
const FunctionSpace & getFunctionSpace() const
Return the function space.
Definition: Data.h:461
Data operator+(const Data &left, const Data &right)
Operator+ Takes two Data objects.
Definition: Data.cpp:2462
boost::python::object integrateToTuple_const() const
Calculate the integral over the function space domain as a python tuple.
Definition: Data.cpp:1358
DataTypes::ValueType::size_type getLength() const
Return the number of doubles stored for this Data.
Definition: Data.cpp:1076
Data represents a collection of datapoints.
Definition: Data.h:71
void updateShareStatus(bool nowshared) const
Update the Data's shared flag This indicates that the DataAbstract used by this object is now shared ...
Definition: Data.h:1784
double algorithm(BinaryFunction operation, double initial_value) const
Perform the specified reduction algorithm on every element of every data point in this Data object ac...
Definition: Data.h:2235
const DataAbstract::ValueType::value_type * getSampleDataRO(DataAbstract::ValueType::size_type sampleNo) const
Return the sample data for the given sample no. Please do not use this unless you NEED to access samp...
Definition: Data.h:1967
Data sinh() const
Return the sinh of each data point of this Data object.
Definition: Data.cpp:1459
double supWorker() const
Definition: Data.cpp:1778
Data maxval() const
Return the maximum value of each data point of this Data object.
Definition: Data.cpp:1872
Data interpolateFromTable3D(const WrappedArray &table, double Amin, double Astep, double undef, Data &B, double Bmin, double Bstep, Data &C, double Cmin, double Cstep, bool check_boundaries)
Definition: Data.cpp:3530
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:1247
#define EsysAssert(AssertTest, AssertMessage)
EsysAssert is a MACRO that will throw an exception if the boolean condition specified is false...
Definition: EsysAssert.h:96
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:3964
const ElementType & const_reference
Definition: DataVector.h:62
double(* BinaryDFunPtr)(double, double)
Definition: Data.h:78
const double * getSampleDataRO(ValueType::size_type sampleNo) const
Definition: DataReady.h:119
DataAbstract::ValueType::value_type * getSampleDataRW(DataAbstract::ValueType::size_type sampleNo)
Return the sample data for the given sample no. Please do not use this unless you NEED to access samp...
Definition: Data.h:1956
boost::python::object integrateWorker() const
Definition: Data.cpp:1379
Data & operator=(const Data &other)
Definition: Data.cpp:2332
void forceResolve()
Definition: Data.h:1815
Data C_TensorBinaryOperation(Data const &arg_0, Data const &arg_1, BinaryFunction operation)
Compute a tensor operation with two Data objects.
Definition: Data.h:2317
int getTypeCode() const
Return the function space type code.
Definition: FunctionSpace.cpp:95
int getNumDataPoints() const
Return the number of data points.
Definition: Data.h:513
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:969
Data whereNonPositive() const
Return a Data with a 1 for -ive or 0 values and a 0 for +ive values.
Definition: Data.cpp:1004
Data atanh() const
Return the atanh of each data point of this Data object.
Definition: Data.cpp:1514
Data copySelf()
Return a pointer to a deep copy of this object.
Definition: Data.cpp:550
DataTypes::ValueType::const_reference getDataPointRO(int sampleNo, int dataPointNo)
Return a reference into the DataVector which points to the specified data point.
Definition: Data.cpp:3191
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
DataTypes::ValueType::reference getDefaultValueRW(DataTypes::ValueType::size_type i)
getDefaultValue
Definition: DataTagged.h:646
bool m_lazy
Definition: Data.h:1753
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:868
void setTupleForGlobalDataPoint(int id, int proc, boost::python::object)
Set the value of a global data point.
Definition: Data.cpp:1203
DataTypes::ValueType::const_reference getDefaultValueRO(DataTypes::ValueType::size_type i) const
Definition: DataTagged.h:653
boost::python::object __div__(const boost::python::object &right)
wrapper for python divide operation
Definition: Data.cpp:4508
DataAbstract * borrowData(void) const
return the object produced by the factory, which is a DataConstant or DataExpanded TODO Ownership of ...
Definition: Data.cpp:3113
Data grad() const
Definition: Data.cpp:1059
void setValueOfDataPoint(int dataPointNo, const double)
sets the values of a data-point on this process
Definition: Data.cpp:1284
friend Data condEval(escript::Data &mask, escript::Data &trueval, escript::Data &falseval)
void calc_maxGlobalDataPoint(int &ProcNo, int &DataPointNo) const
Definition: Data.cpp:2229
void copy(const Data &other)
Make this object a deep copy of "other".
Definition: Data.cpp:557
Wraps an expression tree of other DataObjects. The data will be evaluated when required.
Definition: DataLazy.h:102
int getTagNumber(int dpno)
Return the tag number associated with the given data-point.
Definition: Data.cpp:2736
double inf()
Return the minimum value of this Data object.
Definition: Data.cpp:1657
DataException exception class.
Definition: DataException.h:35
#define ESCRIPT_DLL_API
Definition: escriptcore/src/system_dep.h:64
Data nonuniforminterp(boost::python::object in, boost::python::object out, bool check_boundaries)
Definition: Data.cpp:3773
Data erf() const
Return the error function erf of each data point of this Data object.
Definition: Data.cpp:1481
Data acosh() const
Return the acosh of each data point of this Data object.
Definition: Data.cpp:1503
Data condEval(escript::Data &mask, escript::Data &trueval, escript::Data &falseval)
Definition: Data.cpp:4173
ElementType & reference
Definition: DataVector.h:61
Describes binary operations performed on instances of DataAbstract.
ElementType value_type
Definition: DataVector.h:59
Data operator*(const AbstractSystemMatrix &left, const Data &right)
Definition: AbstractSystemMatrix.cpp:56
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.
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:1539
void exclusiveWrite()
if another object is sharing out member data make a copy to work with instead. This code should only ...
Definition: Data.h:1833
Data oneOver() const
Returns 1./ Data object.
Definition: Data.cpp:976
Data abs() const
Return the absolute value of each data point of this Data object.
Definition: Data.cpp:1546
Definition: DataAbstract.h:61
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:2130
const ValueType * resolveSample(int sampleNo, size_t &roffset) const
Compute the value of the expression for the given sample.
Definition: DataLazy.cpp:1642
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:854
void setProtection()
switches on update protection
Definition: Data.cpp:896
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:4532
Data powO(const boost::python::object &right) const
Return the given power of each data point of this boost python object.
Definition: Data.cpp:2446
Data interpolateFromTable2D(const WrappedArray &table, double Amin, double Astep, double undef, Data &B, double Bmin, double Bstep, bool check_boundaries)
Definition: Data.cpp:3371
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:2220
Data eigenvalues() const
Return the eigenvalues of the symmetric part at each data point of this Data object in increasing val...
Definition: Data.cpp:2082
Data tan() const
Return the tan of each data point of this Data object.
Definition: Data.cpp:1430
Data operator/(const Data &left, const Data &right)
Operator/ Takes two Data objects.
Definition: Data.cpp:2489
Data()
Default constructor. Creates a DataEmpty object.
Definition: Data.cpp:239
void initialise(const DataTypes::ValueType &value, const DataTypes::ShapeType &shape, const FunctionSpace &what, bool expanded)
Construct a Data object of the appropriate type.
Definition: Data.cpp:466
void copyWithMask(const Data &other, const Data &mask)
Copy other Data object into this Data object where mask is positive.
Definition: Data.cpp:617
boost::python::object __mul__(const boost::python::object &right)
wrapper for python multiply operation
Definition: Data.cpp:4484
void typeMatchLeft(Data &right) const
Convert the data type of the RHS to match this.
Definition: Data.cpp:2640
long size_type
Definition: DataVector.h:60
int getNoValues() const
Return the number of values in the shape for this object.
Definition: Data.h:574
Data whereZero(double tol=0.0) const
Return a Data with a 1 for 0 values and a 0 for +ive or -ive values.
Definition: Data.cpp:1011
Data asinh() const
Return the asinh of each data point of this Data object.
Definition: Data.cpp:1492
DataTypes::ValueType::reference getDataPointRW(int sampleNo, int dataPointNo)
Return a reference into the DataVector which points to the specified data point.
Definition: Data.cpp:3207
Data interpolate(const FunctionSpace &functionspace) const
Interpolates this onto the given functionspace and returns the result as a Data object.
Definition: Data.cpp:1029
Data truedivO(const boost::python::object &right)
Newer style division operator for python.
Definition: Data.h:2121
Definition: WrappedArray.h:29
double sup()
Return the maximum value of this Data object.
Definition: Data.cpp:1626
Data exp() const
Return the exponential function of each data point of this Data object.
Definition: Data.cpp:1571
~Data()
Destructor.
Definition: Data.cpp:423
void unaryOp2(UnaryFunction operation)
Perform the given unary operation on every element of every data point in this Data object...
void tensor_binary_operation(const int size, const double *arg1, const double *arg2, double *argRes, BinaryFunction operation)
Definition: LocalOps.h:529
const boost::python::object getValueOfDataPointAsTuple(int dataPointNo)
Return the value of a data point as a python tuple.
Definition: Data.cpp:1164
const_Domain_ptr getDomain() const
Return the function space domain.
Definition: FunctionSpace.cpp:103
Data truedivD(const Data &right)
Newer style division operator for python.
Definition: Data.h:2109
boost::shared_ptr< const AbstractDomain > const_Domain_ptr
Definition: AbstractDomain.h:60
Domain_ptr getDomainPython() const
Return the domain. TODO: For internal use only. This should be removed.
Definition: Data.h:489
Data & operator-=(const Data &right)
Overloaded operator -=.
Definition: Data.cpp:2340
Data whereNonZero(double tol=0.0) const
Return a Data with a 0 for 0 values and a 1 for +ive or -ive values.
Definition: Data.cpp:1020
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:2696
const boost::python::object getValueOfGlobalDataPointAsTuple(int procNo, int dataPointNo)
Return a data point across all processors as a python tuple.
Definition: Data.cpp:1306
void dump(const std::string fileName) const
dumps the object into a netCDF file
Definition: Data.cpp:3942
const DataReady * getReady() const
Definition: Data.h:1916
const boost::python::tuple eigenvalues_and_eigenvectors(const double tol=1.e-12) const
Return the eigenvalues and corresponding eigenvcetors of the symmetric part at each data point of thi...
Definition: Data.cpp:2105
Data whereNegative() const
Return a Data with a 1 for -ive values and a 0 for +ive or 0 values.
Definition: Data.cpp:990
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:560
const_Domain_ptr getDomain() const
Return the domain.
Definition: Data.h:474
Data & operator+=(const Data &right)
Overloaded operator +=.
Definition: Data.cpp:2308
void binaryOp(DataTagged &left, const DataConstant &right, BinaryFunction operation)
Perform the given binary operation.
Definition: BinaryOp.h:45