Go to the documentation of this file.
18 #ifndef __ESCRIPT_DATATYPES_H__
19 #define __ESCRIPT_DATATYPES_H__
21 #include <boost/python/object_fwd.hpp>
44 typedef std::vector<std::pair<int, int> >
RegionType;
54 typedef std::complex<real_t>
cplx_t;
57 #ifdef ESYS_INDEXTYPE_LONG
73 return std::numeric_limits<index_t>::min();
82 return std::numeric_limits<index_t>::max();
91 return std::numeric_limits<real_t>::max();
100 return std::numeric_limits<real_t>::epsilon();
236 ESYS_ASSERT(
getRank(shape)==1,
"Incorrect number of indices for the rank of this object.");
255 ESYS_ASSERT(
getRank(shape)==2,
"Incorrect number of indices for the rank of this object.");
274 ESYS_ASSERT(
getRank(shape)==3,
"Incorrect number of indices for the rank of this object.");
294 ESYS_ASSERT(
getRank(shape)==4,
"Incorrect number of indices for the rank of this object.");
295 vec_size_type temp=i+j*shape[0]+k*shape[1]*shape[0]+m*shape[2]*shape[1]*shape[0];
326 return (size >= (offset+noval));
333 #endif // __ESCRIPT_DATATYPES_H__
static const int maxRank
The maximum number of dimensions a datapoint can have.
Definition: DataTypes.h:71
std::string shapeToString(const DataTypes::ShapeType &shape)
Return the given shape as a string.
Definition: DataTypes.cpp:116
double real_t
type of all real-valued scalars in escript
Definition: DataTypes.h:76
index_t index_t_min()
Returns the minimum finite value for the index_t type.
Definition: DataTypes.h:96
int getRank(const DataTypes::ShapeType &shape)
Return the rank (number of dimensions) of the given shape.
Definition: DataTypes.h:244
bool checkOffset(vec_size_type offset, int size, int noval)
Definition: DataTypes.h:349
bool checkShape(const ShapeType &s1, const ShapeType &s2)
Test if two shapes are equal.
Definition: DataTypes.h:330
real_t real_t_max()
Returns the maximum finite value for the real_t type.
Definition: DataTypes.h:114
DataTypes::RegionLoopRangeType getSliceRegionLoopRange(const DataTypes::RegionType ®ion)
Modify region to copy from in order to deal with the case where one range in the region contains iden...
Definition: DataTypes.cpp:187
index_t index_t_max()
Returns the maximum finite value for the index_t type.
Definition: DataTypes.h:105
long vec_size_type
Definition: DataTypes.h:73
Definition: DataException.h:39
index_t dim_t
Definition: DataTypes.h:90
std::vector< int > ShapeType
The shape of a single datapoint.
Definition: DataTypes.h:68
Contains the types to represent Shapes, Regions, RegionLoop ranges and vectors of data as well as the...
Definition: DataTypes.cpp:86
std::vector< std::pair< int, int > > RegionType
Definition: DataTypes.h:69
int noValues(const ShapeType &shape)
Calculate the number of values in a datapoint with the given shape.
Definition: DataTypes.cpp:90
DataTypes::ShapeType getResultSliceShape(const RegionType ®ion)
Determine the shape of the specified slice region.
Definition: DataTypes.cpp:172
int noValues(const RegionLoopRangeType ®ion)
Calculate the number of values for the given region.
Definition: DataTypes.cpp:103
std::vector< std::pair< int, int > > RegionLoopRangeType
Definition: DataTypes.h:70
int index_t
type for array/matrix indices used both globally and on each rank
Definition: DataTypes.h:85
Definition: AbstractContinuousDomain.cpp:23
vec_size_type getRelIndex(const DataTypes::ShapeType &shape, vec_size_type i)
Compute the offset (in 1D vector) of a given subscript with a shape.
Definition: DataTypes.h:259
std::string createShapeErrorMessage(const std::string &messagePrefix, const DataTypes::ShapeType &other, const DataTypes::ShapeType &thisShape)
Produce a string containing two shapes.
Definition: DataTypes.cpp:205
real_t real_t_eps()
Returns the machine epsilon for the real_t type.
Definition: DataTypes.h:123
std::complex< real_t > cplx_t
complex data type
Definition: DataTypes.h:79
#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
DataTypes::RegionType getSliceRegion(const DataTypes::ShapeType &shape, const bp::object &key)
Definition: DataTypes.cpp:136
static const ShapeType scalarShape
Use this instead of creating empty shape objects for scalars.
Definition: DataTypes.h:72
std::vector< index_t > IndexVector
Definition: DataTypes.h:88