36 #include "esysUtils/Esys_MPI.h" 41 #include <boost/shared_ptr.hpp> 42 #include <boost/python/object.hpp> 43 #include <boost/python/tuple.hpp> 44 #include <boost/math/special_functions/bessel.hpp> 116 bool expanded=
false);
133 bool expanded=
false);
157 Data(
const boost::python::object& value,
159 bool expanded=
false);
173 bool expanded=
false);
186 Data(
const boost::python::object& value,
195 const boost::python::tuple& shape=boost::python::make_tuple(),
197 bool expanded=
false);
277 const boost::python::object
308 const boost::python::object
457 return m_data->getFunctionSpace();
520 return m_data->getNumSamples();
532 return m_data->getNumDPPSample();
570 return m_data->getNoValues();
580 dump(
const std::string fileName)
const;
589 const boost::python::object
641 return m_data->getSampleDataByTag(tag);
676 return m_data->getPointOffset(sampleNo,dataPointNo);
688 return m_data->getShape();
696 const boost::python::tuple
738 const boost::python::object& value);
752 const boost::python::object& value);
808 double undef,
Data& B,
double Bmin,
double Bstep,
Data& C,
809 double Cmin,
double Cstep,
bool check_boundaries);
814 double undef,
Data& B,
double Bmin,
double Bstep,
bool check_boundaries);
819 double undef,
bool check_boundaries);
825 Data& B,
double Bmin,
double Bstep,
Data& C,
double Cmin,
double Cstep,
double undef,
bool check_boundaries);
831 Data& B,
double Bmin,
double Bstep,
double undef,
bool check_boundaries);
836 double undef,
bool check_boundaries);
840 nonuniforminterp(boost::python::object in, boost::python::object out,
bool check_boundaries);
844 nonuniformslope(boost::python::object in, boost::python::object out,
bool check_boundaries);
865 boost::python::object
874 boost::python::object
1037 const boost::python::tuple
1048 const boost::python::tuple
1088 trace(
int axis_offset)
const;
1119 const boost::python::tuple
1129 swapaxes(
const int axis0,
const int axis1)
const;
1165 bessel(
int order,
double (*besselfunc) (
int,
double) );
1352 powO(
const boost::python::object& right)
const;
1364 rpowO(
const boost::python::object& left)
const;
1439 boost::python::object
__add__(
const boost::python::object& right);
1447 boost::python::object
__sub__(
const boost::python::object& right);
1454 boost::python::object
__rsub__(
const boost::python::object& right);
1461 boost::python::object
__mul__(
const boost::python::object& right);
1468 boost::python::object
__div__(
const boost::python::object& right);
1475 boost::python::object
__rdiv__(
const boost::python::object& right);
1509 getItem(
const boost::python::object& key)
const;
1524 setItemD(
const boost::python::object& key,
1529 setItemO(
const boost::python::object& key,
1530 const boost::python::object& value);
1539 template <
class UnaryFunction>
1667 template <
class BinaryOp>
1684 boost::python::object
1721 template <
class BinaryFunction>
1725 double initial_value)
const;
1734 template <
class BinaryFunction>
1738 double initial_value)
const;
1748 template <
class BinaryFunction>
1752 BinaryFunction operation);
1863 if (omp_in_parallel())
1865 throw DataException(
"Please do not call forceResolve() in a parallel region.");
1879 if (omp_in_parallel())
1882 throw DataException(
"Programming error. Please do not run exclusiveWrite() in multi-threaded sections.");
1892 m_data->exclusivewritecalled=
true;
1903 throw DataException(
"Programming error. ExclusiveWrite required - please call requireWrite()");
1917 #ifdef IKNOWWHATIMDOING 1926 #ifdef IKNOWWHATIMDOING 1945 long seed,
const boost::python::tuple& filter);
1965 EsysAssert((dr!=0),
"Error - casting to DataReady.");
1974 EsysAssert((dr!=0),
"Error - casting to DataReady.");
1986 EsysAssert((dr.get()!=0),
"Error - casting to DataReady.");
1996 EsysAssert((dr.get()!=0),
"Error - casting to DataReady.");
2006 throw DataException(
"Error, attempt to acquire RW access to lazy data. Please call requireWrite() first.");
2009 if (!
getReady()->exclusivewritecalled)
2011 throw DataException(
"Error, call to Data::getSampleDataRW without a preceeding call to requireWrite/exclusiveWrite.");
2026 return &((*res)[offset]);
2037 throw DataException(
"Programmer error - getDataRO must not be called on Lazy Data.");
2053 inline double rpow(
double x,
double y)
2182 return *
this / right;
2216 template <
class BinaryFunction>
2220 BinaryFunction operation)
2225 throw DataException(
"Error - attempt to update rank zero object with object with rank bigger than zero.");
2230 throw DataException(
"Programmer error - attempt to call binaryOp with Lazy Data.");
2234 Data tempRight(right);
2241 std::string msg=
"Error - attempt to combine incompatible FunctionSpaces.";
2250 tempRight=
Data(right,fsl);
2255 Data tempLeft(*
this,fsr);
2271 EsysAssert((leftC!=0),
"Programming error - casting to DataExpanded.");
2278 EsysAssert((leftC!=0),
"Programming error - casting to DataTagged.");
2281 EsysAssert((rightC!=0),
"Programming error - casting to DataTagged.");
2285 EsysAssert((rightC!=0),
"Programming error - casting to DataConstant.");
2291 EsysAssert((leftC!=0 && rightC!=0),
"Programming error - casting to DataConstant.");
2303 template <
class BinaryFunction>
2310 EsysAssert((leftC!=0),
"Programming error - casting to DataExpanded.");
2314 EsysAssert((leftC!=0),
"Programming error - casting to DataTagged.");
2318 EsysAssert((leftC!=0),
"Programming error - casting to DataConstant.");
2321 throw DataException(
"Error - Operations (algorithm) not permitted on instances of DataEmpty.");
2323 throw DataException(
"Error - Operations not permitted on instances of DataLazy.");
2325 throw DataException(
"Error - Data encapsulates an unknown type.");
2337 template <
class BinaryFunction>
2343 throw DataException(
"Error - Operations (dp_algorithm) not permitted on instances of DataEmpty.");
2349 EsysAssert((dataE!=0),
"Programming error - casting data to DataExpanded.");
2350 EsysAssert((resultE!=0),
"Programming error - casting result to DataExpanded.");
2356 EsysAssert((dataT!=0),
"Programming error - casting data to DataTagged.");
2361 return Data(resultT);
2367 EsysAssert((dataC!=0),
"Programming error - casting data to DataConstant.");
2368 EsysAssert((resultC!=0),
"Programming error - casting result to DataConstant.");
2372 throw DataException(
"Error - Operations not permitted on instances of DataLazy.");
2374 throw DataException(
"Error - Data encapsulates an unknown type.");
2385 template <
typename BinaryFunction>
2390 BinaryFunction operation)
2394 throw DataException(
"Error - Operations (C_TensorBinaryOperation) not permitted on instances of DataEmpty.");
2398 throw DataException(
"Error - Operations not permitted on lazy data.");
2401 Data arg_0_Z, arg_1_Z;
2408 std::string msg=
"Error - C_TensorBinaryOperation: arguments have incompatible function spaces.";
2417 arg_0_Z =
Data(arg_0);
2422 arg_1_Z =
Data(arg_1);
2425 arg_0_Z =
Data(arg_0);
2426 arg_1_Z =
Data(arg_1);
2438 if (shape0 == shape1) {
2472 DataTagged::DataMapType::const_iterator i;
2473 for (i=lookup_1.begin();i!=lookup_1.end();i++) {
2488 int sampleNo_1,dataPointNo_1;
2491 int offset_0 = tmp_0->getPointOffset(0,0);
2493 #pragma omp parallel for private(sampleNo_1,dataPointNo_1) schedule(static) 2494 for (sampleNo_1 = 0; sampleNo_1 < numSamples_1; sampleNo_1++) {
2495 for (dataPointNo_1 = 0; dataPointNo_1 < numDataPointsPerSample_1; dataPointNo_1++) {
2529 DataTagged::DataMapType::const_iterator i;
2530 for (i=lookup_0.begin();i!=lookup_0.end();i++) {
2558 DataTagged::DataMapType::const_iterator i;
2561 for (i=lookup_0.begin();i!=lookup_0.end();i++) {
2564 for (i=lookup_1.begin();i!=lookup_1.end();i++) {
2569 for (i=lookup_2.begin();i!=lookup_2.end();i++) {
2586 int sampleNo_0,dataPointNo_0;
2590 #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static) 2591 for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
2592 int offset_0 = tmp_0->getPointOffset(sampleNo_0,0);
2594 for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {
2610 int sampleNo_0,dataPointNo_0;
2615 #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static) 2616 for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
2617 for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {
2618 int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);
2638 int sampleNo_0,dataPointNo_0;
2642 #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static) 2643 for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
2646 for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {
2647 int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);
2663 int sampleNo_0,dataPointNo_0;
2667 #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static) 2668 for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
2671 int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);
2683 throw DataException(
"Error - C_TensorBinaryOperation: unknown combination of inputs");
2686 }
else if (0 == rank0) {
2718 DataTagged::DataMapType::const_iterator i;
2719 for (i=lookup_1.begin();i!=lookup_1.end();i++) {
2737 int offset_0 = tmp_0->getPointOffset(0,0);
2739 double ptr_0 = ptr_src[0];
2740 int size = size1*numDataPointsPerSample_1;
2742 #pragma omp parallel for private(sampleNo_1) schedule(static) 2743 for (sampleNo_1 = 0; sampleNo_1 < numSamples_1; sampleNo_1++) {
2782 DataTagged::DataMapType::const_iterator i;
2783 for (i=lookup_0.begin();i!=lookup_0.end();i++) {
2813 DataTagged::DataMapType::const_iterator i;
2816 for (i=lookup_0.begin();i!=lookup_0.end();i++) {
2819 for (i=lookup_1.begin();i!=lookup_1.end();i++) {
2824 for (i=lookup_2.begin();i!=lookup_2.end();i++) {
2841 int sampleNo_0,dataPointNo_0;
2845 #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static) 2846 for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
2847 int offset_0 = tmp_0->getPointOffset(sampleNo_0,0);
2849 for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {
2865 int sampleNo_0,dataPointNo_0;
2870 #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static) 2871 for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
2872 for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {
2873 int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);
2892 int sampleNo_0,dataPointNo_0;
2896 #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static) 2897 for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
2900 for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {
2901 int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);
2918 int sampleNo_0,dataPointNo_0;
2922 #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static) 2923 for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
2924 for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {
2925 int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);
2937 throw DataException(
"Error - C_TensorBinaryOperation: unknown combination of inputs");
2940 }
else if (0 == rank1) {
2973 DataTagged::DataMapType::const_iterator i;
2974 for (i=lookup_1.begin();i!=lookup_1.end();i++) {
2988 int sampleNo_1,dataPointNo_1;
2991 int offset_0 = tmp_0->getPointOffset(0,0);
2993 #pragma omp parallel for private(sampleNo_1,dataPointNo_1) schedule(static) 2994 for (sampleNo_1 = 0; sampleNo_1 < numSamples_1; sampleNo_1++) {
2995 for (dataPointNo_1 = 0; dataPointNo_1 < numDataPointsPerSample_1; dataPointNo_1++) {
3029 DataTagged::DataMapType::const_iterator i;
3030 for (i=lookup_0.begin();i!=lookup_0.end();i++) {
3059 DataTagged::DataMapType::const_iterator i;
3062 for (i=lookup_0.begin();i!=lookup_0.end();i++) {
3065 for (i=lookup_1.begin();i!=lookup_1.end();i++) {
3070 for (i=lookup_2.begin();i!=lookup_2.end();i++) {
3086 int sampleNo_0,dataPointNo_0;
3090 #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static) 3091 for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
3092 int offset_0 = tmp_0->getPointOffset(sampleNo_0,0);
3094 for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {
3115 double ptr_1 = ptr_src[0];
3116 int size = size0 * numDataPointsPerSample_0;
3118 #pragma omp parallel for private(sampleNo_0) schedule(static) 3119 for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
3121 int offset_0 = tmp_0->getPointOffset(sampleNo_0,0);
3140 int sampleNo_0,dataPointNo_0;
3144 #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static) 3145 for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
3148 for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {
3149 int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);
3166 int sampleNo_0,dataPointNo_0;
3170 #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static) 3171 for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
3172 for (dataPointNo_0 = 0; dataPointNo_0 < numDataPointsPerSample_0; dataPointNo_0++) {
3173 int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);
3185 throw DataException(
"Error - C_TensorBinaryOperation: unknown combination of inputs");
3189 throw DataException(
"Error - C_TensorBinaryOperation: arguments have incompatible shapes");
3195 template <
typename UnaryFunction>
3198 UnaryFunction operation)
3202 throw DataException(
"Error - Operations (C_TensorUnaryOperation) not permitted on instances of DataEmpty.");
3206 throw DataException(
"Error - Operations not permitted on lazy data.");
3241 DataTagged::DataMapType::const_iterator i;
3242 for (i=lookup_0.begin();i!=lookup_0.end();i++) {
3256 int sampleNo_0,dataPointNo_0;
3259 #pragma omp parallel for private(sampleNo_0,dataPointNo_0) schedule(static) 3260 for (sampleNo_0 = 0; sampleNo_0 < numSamples_0; sampleNo_0++) {
3263 int offset_0 = tmp_0->getPointOffset(sampleNo_0,dataPointNo_0);
3272 throw DataException(
"Error - C_TensorUnaryOperation: unknown combination of inputs");
double sup_const() const
Definition: Data.cpp:1703
Definition: FunctionSpace.h:34
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:2859
DataAbstract_ptr m_data
Definition: Data.h:1801
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:1072
int getNumDataPointsPerSample() const
Return the number of data points per sample.
Definition: Data.h:530
DataTypes::ValueType::reference getDataAtOffsetRW(DataTypes::ValueType::size_type i)
Definition: Data.cpp:3277
Data asin() const
Return the asin of each data point of this Data object.
Definition: Data.cpp:1524
const DataTypes::ShapeType & getDataPointShape() const
Return a reference to the data point shape.
Definition: Data.h:686
double LsupWorker() const
Definition: Data.cpp:1851
Data wherePositive() const
Return a Data with a 1 for +ive values and a 0 for 0 or -ive values.
Definition: Data.cpp:968
void addTag(int tagKey)
addTag - does not modify the default value for this object. ** Not unit tested ** ...
Definition: DataTagged.cpp:432
void setItemO(const boost::python::object &key, const boost::python::object &value)
Definition: Data.cpp:2713
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:4101
Data whereNonNegative() const
Return a Data with a 1 for +ive or 0 values and a 0 for -ive values.
Definition: Data.cpp:982
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:4089
unsigned int getDataPointRank() const
Return the rank of the point data.
Definition: Data.h:495
int getNumSamples() const
Return the number of samples.
Definition: Data.h:518
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
boost::python::object __add__(const boost::python::object &right)
wrapper for python add operation
Definition: Data.cpp:4536
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:1899
boost::python::object __rsub__(const boost::python::object &right)
wrapper for python reverse subtract operation
Definition: Data.cpp:4584
DataReady_ptr borrowReadyPtr(void) const
Definition: Data.cpp:3240
void setToZero()
set all values to zero
Definition: Data.cpp:580
Data getItem(const boost::python::object &key) const
Returns a slice from this Data object.
Definition: Data.cpp:2691
double(* UnaryDFunPtr)(double)
Definition: Data.h:74
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:2340
bool isExpanded() const
Return true if this Data is expanded.
Definition: Data.cpp:832
double Lsup()
Return the maximum absolute value of this Data object.
Definition: Data.cpp:1682
Data tanh() const
Return the tanh of each data point of this Data object.
Definition: Data.cpp:1560
Data delay()
produce a delayed evaluation version of this Data.
Definition: Data.cpp:551
Data & operator*=(const Data &right)
Overloaded operator *=.
Definition: Data.cpp:2474
void tag()
If possible convert this Data to DataTagged. This will only allow Constant data to be converted to ta...
Definition: Data.cpp:919
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:433
boost::python::object integrateToTuple()
Calculate the integral over the function space domain as a python tuple.
Definition: Data.cpp:1353
virtual DataAbstract * deepCopy()=0
Return a deep copy of the current object.
int getDataPointSize() const
Return the size of the data point. It is the product of the data point shape dimensions.
Definition: Data.cpp:1054
boost::shared_ptr< AbstractDomain > Domain_ptr
Definition: AbstractDomain.h:36
double lazyAlgWorker(double init)
Definition: Data.cpp:1769
Definition: DataReady.h:35
double inf_const() const
Definition: Data.cpp:1734
bool m_shared
Definition: Data.h:1795
std::vector< std::pair< int, int > > RegionType
Definition: DataTypes.h:39
Definition: AbstractContinuousDomain.cpp:24
bool probeInterpolation(const FunctionSpace &functionspace) const
Returns true if this can be interpolated to functionspace.
Definition: Data.cpp:1020
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:3285
double infWorker() const
Definition: Data.cpp:1925
void replaceNaN(double value)
replaces all NaN values with value
Definition: Data.cpp:1837
void setItemD(const boost::python::object &key, const Data &value)
Copies slice from value into this Data object.
Definition: Data.cpp:2721
void tensor_unary_operation(const int size, const double *arg1, double *argRes, UnaryFunction operation)
Definition: LocalOps.h:512
virtual ValueType::size_type getPointOffset(int sampleNo, int dataPointNo) const
getPointOffset
Definition: DataTagged.cpp:526
Data atan() const
Return the atan of each data point of this Data object.
Definition: Data.cpp:1539
Data operator-(const Data &left, const Data &right)
Operator- Takes two Data objects.
Definition: Data.cpp:2583
Data rpowO(const boost::python::object &left) const
Return the given power of each data point of this boost python object.
Definition: Data.cpp:2550
Data besselSecondKind(int order)
Return the Bessel function of the second kind for each data point of this Data object.
Definition: Data.cpp:1407
void print(void)
print the data values to stdout. Used for debugging
Definition: Data.cpp:4041
void typeMatchRight(const Data &right)
Convert the data type of this to match the RHS.
Definition: Data.cpp:2768
void setSlice(const Data &value, const DataTypes::RegionType ®ion)
Copy the specified slice from the given value into this Data object.
Definition: Data.cpp:2737
Data neg() const
Return the negation of each data point of this Data object.
Definition: Data.cpp:1640
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:3248
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:1180
Data log10() const
Return the log to base 10 of each data point of this Data object.
Definition: Data.cpp:1612
Data interpolateFromTable2DP(boost::python::object table, double Amin, double Astep, Data &B, double Bmin, double Bstep, double undef, bool check_boundaries)
Definition: Data.cpp:3338
Data getSlice(const DataTypes::RegionType ®ion) const
Return a Data object containing the specified slice of this Data object.
Definition: Data.cpp:2705
bool isLazy() const
Return true if this Data is lazy.
Definition: Data.cpp:867
Data swapaxes(const int axis0, const int axis1) const
swaps the components axis0 and axis1
Definition: Data.cpp:1999
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:2792
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:542
double Lsup_const() const
Definition: Data.cpp:1672
const DataMapType & getTagLookup() const
getTagLookup
Definition: DataTagged.h:629
DataReady_ptr getReadyPtr()
Definition: Data.h:1983
double * getSampleDataRW(ValueType::size_type sampleNo)
Return the sample data for the given sample number.
Definition: DataReady.h:120
DataTypes::ValueType::const_reference getDataByTagRO(int tag, DataTypes::ValueType::size_type i) const
Definition: DataTagged.cpp:563
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:137
Data trace(int axis_offset) const
Return the trace of a matrix.
Definition: Data.cpp:2114
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:1973
Data symmetric() const
Return the symmetric part of a matrix which is half the matrix plus its transpose.
Definition: Data.cpp:2056
(Testing use only) Provides a domain to wrap a collection of values.
Definition: TestDomain.h:41
Data nonuniformslope(boost::python::object in, boost::python::object out, bool check_boundaries)
Definition: Data.cpp:3962
Domain_ptr getDomainPython() const
Return the function space domain. Internal use only! This gets around some python difficulties by cas...
Definition: FunctionSpace.cpp:113
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:4560
DataAbstract_ptr borrowDataPtr(void) const
Definition: Data.cpp:3233
Simulates a full dataset accessible via sampleNo and dataPointNo.
Definition: DataTagged.h:44
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:1711
Data interpolateFromTable1D(const WrappedArray &table, double Amin, double Astep, double undef, bool check_boundaries)
Definition: Data.cpp:3356
Data sqrt() const
Return the square root of each data point of this Data object.
Definition: Data.cpp:1665
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:639
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:4467
bool isConstant() const
Return true if this Data is constant.
Definition: Data.cpp:860
DataTypes::ValueType & getExpandedVectorReference()
Ensures that the Data is expanded and returns its underlying vector Does not check for exclusive writ...
Definition: Data.cpp:4458
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:2219
Data cos() const
Return the cos of each data point of this Data object.
Definition: Data.cpp:1510
Data minval() const
Return the minimum value of each data point of this Data object.
Definition: Data.cpp:1991
Data matrixInverse() const
return inverse of matricies.
Definition: Data.cpp:2524
int MPI_Comm
Definition: Esys_MPI.h:38
Data cosh() const
Return the cosh of each data point of this Data object.
Definition: Data.cpp:1553
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:2866
bool m_protected
Definition: Data.h:1794
bool isTagged() const
Return true if this Data is tagged.
Definition: Data.cpp:846
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:1026
Data transpose(int axis_offset) const
Transpose each data point of this Data object around the given axis.
Definition: Data.cpp:2169
Data & operator/=(const Data &right)
Overloaded operator /=.
Definition: Data.cpp:2497
Data pos() const
Return the identity of each data point of this Data object. Simply returns this object unmodified...
Definition: Data.cpp:1647
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:945
Data powD(const Data &right) const
Return the given power of each data point of this Data object.
Definition: Data.cpp:2564
bool isReady() const
Return true if this data is ready.
Definition: Data.cpp:874
DataTypes::ValueType::reference getDataByTagRW(int tag, DataTypes::ValueType::size_type i)
getDataByTag
Definition: DataTagged.cpp:574
Data sin() const
Return the sin of each data point of this Data object.
Definition: Data.cpp:1503
void calc_minGlobalDataPoint(int &ProcNo, int &DataPointNo) const
Definition: Data.cpp:2254
double(* BinaryDFunPtr)(double, double)
Definition: Data.h:75
Data minval_nonlazy() const
Definition: Data.cpp:1963
const boost::python::tuple getShapeTuple() const
Return the data point shape as a tuple of integers.
Definition: Data.cpp:510
Data C_TensorUnaryOperation(Data const &arg_0, UnaryFunction operation)
Definition: Data.h:3197
bool isShared() const
Definition: Data.h:1846
Data acos() const
Return the acos of each data point of this Data object.
Definition: Data.cpp:1531
bool isProtected() const
Returns true, if the data object is protected against update.
Definition: Data.cpp:887
Data rtruedivO(const boost::python::object &left)
Newer style division operator for python.
Definition: Data.h:2205
Data interpolateFromTable1DP(boost::python::object table, double Amin, double Astep, double undef, bool check_boundaries)
Definition: Data.cpp:3347
std::map< int, int > DataMapType
Definition: DataTagged.h:57
std::string toString() const
Returns a text description of the function space.
Definition: FunctionSpace.cpp:122
Data log() const
Return the natural log of each data point of this Data object.
Definition: Data.cpp:1619
Data nonsymmetric() const
Return the nonsymmetric part of a matrix which is half the matrix minus its transpose.
Definition: Data.cpp:2079
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:3328
void delaySelf()
convert the current data into lazy data.
Definition: Data.cpp:562
bool hasNoSamples() const
Return true if this object contains no samples. This is not the same as isEmpty() ...
Definition: Data.h:722
double rpow(double x, double y)
Definition: Data.h:2053
DataTypes::ValueType::size_type getDataOffset(int sampleNo, int dataPointNo)
Return the offset for the given sample and point within the sample.
Definition: Data.h:673
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:2830
void expand()
Whatever the current Data type make this into a DataExpanded.
Definition: Data.cpp:895
const FunctionSpace & getFunctionSpace() const
Return the function space.
Definition: Data.h:455
Data operator+(const Data &left, const Data &right)
Operator+ Takes two Data objects.
Definition: Data.cpp:2574
boost::python::object integrateToTuple_const() const
Calculate the integral over the function space domain as a python tuple.
Definition: Data.cpp:1343
DataTypes::ValueType::size_type getLength() const
Return the number of doubles stored for this Data.
Definition: Data.cpp:1061
Data represents a collection of datapoints.
Definition: Data.h:68
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:1827
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:2306
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:2019
Data sinh() const
Return the sinh of each data point of this Data object.
Definition: Data.cpp:1546
double supWorker() const
Definition: Data.cpp:1889
Data maxval() const
Return the maximum value of each data point of this Data object.
Definition: Data.cpp:1983
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:3643
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:1232
#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:4077
const ElementType & const_reference
Definition: DataVector.h:62
const double * getSampleDataRO(ValueType::size_type sampleNo) const
Definition: DataReady.h:126
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:2002
boost::python::object integrateWorker() const
Definition: Data.cpp:1364
Data & operator=(const Data &other)
Definition: Data.cpp:2443
void forceResolve()
Definition: Data.h:1858
Data C_TensorBinaryOperation(Data const &arg_0, Data const &arg_1, BinaryFunction operation)
Compute a tensor operation with two Data objects.
Definition: Data.h:2388
int getTypeCode() const
Returns the function space type code.
Definition: FunctionSpace.cpp:99
int getNumDataPoints() const
Return the number of data points.
Definition: Data.h:507
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:954
virtual const DataTypes::ValueType & getVectorRO() const =0
Data whereNonPositive() const
Return a Data with a 1 for -ive or 0 values and a 0 for +ive values.
Definition: Data.cpp:989
Data atanh() const
Return the atanh of each data point of this Data object.
Definition: Data.cpp:1601
Data copySelf()
Return a pointer to a deep copy of this object.
Definition: Data.cpp:535
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:3304
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:615
bool m_lazy
Definition: Data.h:1796
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:853
void setTupleForGlobalDataPoint(int id, int proc, boost::python::object)
Set the value of a global data point.
Definition: Data.cpp:1188
DataTypes::ValueType::const_reference getDefaultValueRO(DataTypes::ValueType::size_type i) const
Definition: DataTagged.h:622
boost::python::object __div__(const boost::python::object &right)
wrapper for python divide operation
Definition: Data.cpp:4633
DataAbstract * borrowData(void) const
return the object produced by the factory, which is a DataConstant or DataExpanded TODO Ownership of ...
Definition: Data.cpp:3226
Data grad() const
Definition: Data.cpp:1044
const DataAbstract::ValueType::value_type * getDataRO() const
Return a pointer to the beginning of the underlying data.
Definition: Data.h:2033
void setValueOfDataPoint(int dataPointNo, const double)
sets the values of a data-point on this process
Definition: Data.cpp:1269
friend Data condEval(escript::Data &mask, escript::Data &trueval, escript::Data &falseval)
void calc_maxGlobalDataPoint(int &ProcNo, int &DataPointNo) const
Definition: Data.cpp:2340
void copy(const Data &other)
Make this object a deep copy of "other".
Definition: Data.cpp:542
Wraps an expression tree of other DataObjects. The data will be evaluated when required.
Definition: DataLazy.h:102
int MPI_Op
Definition: Esys_MPI.h:40
Data bessel(int order, double(*besselfunc)(int, double))
Bessel worker function.
Definition: Data.cpp:1413
int getTagNumber(int dpno)
Return the tag number associated with the given data-point.
Definition: Data.cpp:2849
double inf()
Return the minimum value of this Data object.
Definition: Data.cpp:1744
DataException exception class.
Definition: DataException.h:35
#define ESCRIPT_DLL_API
Definition: escriptcore/src/system_dep.h:54
Data nonuniforminterp(boost::python::object in, boost::python::object out, bool check_boundaries)
Definition: Data.cpp:3886
Data erf() const
Return the error function erf of each data point of this Data object.
Definition: Data.cpp:1568
Data acosh() const
Return the acosh of each data point of this Data object.
Definition: Data.cpp:1590
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:43
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:1626
void exclusiveWrite()
if another object is sharing out member data make a copy to work with instead. This code should only ...
Definition: Data.h:1876
Data oneOver() const
Returns 1./ Data object.
Definition: Data.cpp:961
Data abs() const
Return the absolute value of each data point of this Data object.
Definition: Data.cpp:1633
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:2241
const ValueType * resolveSample(int sampleNo, size_t &roffset) const
Compute the value of the expression for the given sample.
Definition: DataLazy.cpp:1644
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:839
void setProtection()
switches on update protection
Definition: Data.cpp:881
Data besselFirstKind(int order)
Return the Bessel function of the first kind for each data point of this Data object.
Definition: Data.cpp:1401
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:4657
bool hasNaN()
returns return true if data contains NaN.
Definition: Data.cpp:1826
Data powO(const boost::python::object &right) const
Return the given power of each data point of this boost python object.
Definition: Data.cpp:2557
Data interpolateFromTable2D(const WrappedArray &table, double Amin, double Astep, double undef, Data &B, double Bmin, double Bstep, bool check_boundaries)
Definition: Data.cpp:3484
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:2331
Data eigenvalues() const
Return the eigenvalues of the symmetric part at each data point of this Data object in increasing val...
Definition: Data.cpp:2193
Data tan() const
Return the tan of each data point of this Data object.
Definition: Data.cpp:1517
Data operator/(const Data &left, const Data &right)
Operator/ Takes two Data objects.
Definition: Data.cpp:2601
Data()
Default constructor. Creates a DataEmpty object.
Definition: Data.cpp:241
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:468
void copyWithMask(const Data &other, const Data &mask)
Copy other Data object into this Data object where mask is positive.
Definition: Data.cpp:602
boost::python::object __mul__(const boost::python::object &right)
wrapper for python multiply operation
Definition: Data.cpp:4609
void typeMatchLeft(Data &right) const
Convert the data type of the RHS to match this.
Definition: Data.cpp:2752
long size_type
Definition: DataVector.h:60
int getNoValues() const
Return the number of values in the shape for this object.
Definition: Data.h:568
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:996
Data asinh() const
Return the asinh of each data point of this Data object.
Definition: Data.cpp:1579
DataTypes::ValueType::reference getDataPointRW(int sampleNo, int dataPointNo)
Return a reference into the DataVector which points to the specified data point.
Definition: Data.cpp:3320
Data interpolate(const FunctionSpace &functionspace) const
Interpolates this onto the given functionspace and returns the result as a Data object.
Definition: Data.cpp:1014
Data truedivO(const boost::python::object &right)
Newer style division operator for python.
Definition: Data.h:2192
Definition: WrappedArray.h:29
double sup()
Return the maximum value of this Data object.
Definition: Data.cpp:1713
Data exp() const
Return the exponential function of each data point of this Data object.
Definition: Data.cpp:1658
~Data()
Destructor.
Definition: Data.cpp:425
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:524
const boost::python::object getValueOfDataPointAsTuple(int dataPointNo)
Return the value of a data point as a python tuple.
Definition: Data.cpp:1149
const_Domain_ptr getDomain() const
Returns the function space domain.
Definition: FunctionSpace.cpp:107
Data truedivD(const Data &right)
Newer style division operator for python.
Definition: Data.h:2180
boost::shared_ptr< const AbstractDomain > const_Domain_ptr
Definition: AbstractDomain.h:39
Domain_ptr getDomainPython() const
Return the domain. TODO: For internal use only. This should be removed.
Definition: Data.h:483
Data & operator-=(const Data &right)
Overloaded operator -=.
Definition: Data.cpp:2451
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:1005
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:2809
const boost::python::object getValueOfGlobalDataPointAsTuple(int procNo, int dataPointNo)
Return a data point across all processors as a python tuple.
Definition: Data.cpp:1291
void dump(const std::string fileName) const
dumps the object into a netCDF file
Definition: Data.cpp:4055
const DataReady * getReady() const
Definition: Data.h:1962
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:2216
Data whereNegative() const
Return a Data with a 1 for -ive values and a 0 for +ive or 0 values.
Definition: Data.cpp:975
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
const_Domain_ptr getDomain() const
Return the domain.
Definition: Data.h:468
Data & operator+=(const Data &right)
Overloaded operator +=.
Definition: Data.cpp:2419
void binaryOp(DataTagged &left, const DataConstant &right, BinaryFunction operation)
Perform the given binary operation.
Definition: BinaryOp.h:45