ESYS13  Revision_
Namespaces | Typedefs | Functions | Variables
DataTypes.h File Reference
#include "system_dep.h"
#include "DataVector.h"
#include <vector>
#include <string>
#include <boost/python/object.hpp>
#include <boost/python/extract.hpp>

Go to the source code of this file.

Namespaces

namespace  escript
namespace  escript::DataTypes
 

Contains the types to represent Shapes, Regions, RegionLoop ranges and vectors of data as well as the functions to manipulate them.


Typedefs

typedef DataVector escript::DataTypes::ValueType
 Vector to store underlying data.
typedef std::vector< int > escript::DataTypes::ShapeType
 The shape of a single datapoint.
typedef std::vector< std::pair
< int, int > > 
escript::DataTypes::RegionType
typedef std::vector< std::pair
< int, int > > 
escript::DataTypes::RegionLoopRangeType

Functions

int escript::DataTypes::noValues (const DataTypes::ShapeType &shape)
 Calculate the number of values in a datapoint with the given shape.
std::string escript::DataTypes::shapeToString (const DataTypes::ShapeType &shape)
 Return the given shape as a string.
DataTypes::ShapeType escript::DataTypes::getResultSliceShape (const DataTypes::RegionType &region)
 Determine the shape of the specified slice region.
DataTypes::RegionType escript::DataTypes::getSliceRegion (const DataTypes::ShapeType &shape, const boost::python::object &key)
 Determine the region specified by the given python slice object.
DataTypes::RegionLoopRangeType escript::DataTypes::getSliceRegionLoopRange (const DataTypes::RegionType &region)
 Modify region to copy from in order to deal with the case where one range in the region contains identical indexes, eg: <<1,1><0,3><0,3>> This situation implies we want to copy from an object with rank greater than that of this object. eg: we want to copy the values from a two dimensional slice out of a three dimensional object into a two dimensional object. We do this by taking a slice from the other object where one dimension of the slice region is of size 1. So in the above example, we modify the above region like so: <<1,2><0,3><0,3>> and take this slice.
int escript::DataTypes::getRank (const DataTypes::ShapeType &shape)
 Return the rank (number of dimensions) of the given shape.
DataTypes::ValueType::size_type escript::DataTypes::getRelIndex (const DataTypes::ShapeType &shape, DataTypes::ValueType::size_type i)
 Compute the offset (in 1D vector) of a given subscript with a shape.
DataTypes::ValueType::size_type escript::DataTypes::getRelIndex (const DataTypes::ShapeType &shape, DataTypes::ValueType::size_type i, DataTypes::ValueType::size_type j)
 Compute the offset (in 1D vector) of a given subscript with a shape.
DataTypes::ValueType::size_type escript::DataTypes::getRelIndex (const DataTypes::ShapeType &shape, DataTypes::ValueType::size_type i, DataTypes::ValueType::size_type j, DataTypes::ValueType::size_type k)
 Compute the offset (in 1D vector) of a given subscript with a shape.
DataTypes::ValueType::size_type escript::DataTypes::getRelIndex (const DataTypes::ShapeType &shape, DataTypes::ValueType::size_type i, DataTypes::ValueType::size_type j, DataTypes::ValueType::size_type k, DataTypes::ValueType::size_type m)
 Compute the offset (in 1D vector) of a given subscript with a shape.
bool escript::DataTypes::checkShape (const ShapeType &s1, const ShapeType &s2)
 Test if two shapes are equal.
std::string escript::DataTypes::createShapeErrorMessage (const std::string &messagePrefix, const DataTypes::ShapeType &other, const DataTypes::ShapeType &thisShape)
 Produce a string containing two shapes.
void escript::DataTypes::copySlice (ValueType &left, const ShapeType &leftShape, ValueType::size_type leftOffset, const ValueType &other, const ShapeType &otherShape, ValueType::size_type otherOffset, const RegionLoopRangeType &region)
 Copy a data slice specified by the given region and offset from the "other" view into the "left" view at the given offset.
void escript::DataTypes::copySliceFrom (ValueType &left, const ShapeType &leftShape, ValueType::size_type leftOffset, const ValueType &other, const ShapeType &otherShape, ValueType::size_type otherOffset, const RegionLoopRangeType &region)
 Copy data into a slice specified by the given region and offset in the left vector from the other vector at the given offset.
void escript::DataTypes::pointToStream (std::ostream &os, const ValueType::ElementType *data, const ShapeType &shape, int offset, bool needsep=true, const std::string &sep=",")
 Display a single value (with the specified shape) from the data.
std::string escript::DataTypes::pointToString (const ValueType &data, const ShapeType &shape, int offset, const std::string &prefix)
 Display a single value (with the specified shape) from the data.
void escript::DataTypes::copyPoint (ValueType &dest, ValueType::size_type doffset, ValueType::size_type nvals, const ValueType &src, ValueType::size_type soffset)
 Copy a point from one vector to another. Note: This version does not check to see if shapes are the same.

Variables

static const int escript::DataTypes::maxRank = 4
 The maximum number of dimensions a datapoint can have.
static const ShapeType escript::DataTypes::scalarShape
 Use this instead of creating empty shape objects for scalars.