CompuCell3D::Field3D< T > Class Template Reference

#include <Field3D.h>

Inheritance diagram for CompuCell3D::Field3D< T >:

Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual void set (const Point3D &pt, const T value)=0
virtual T get (const Point3D &pt) const =0
virtual T getByIndex (long _offset) const
virtual void setByIndex (long _offset, const T value)
virtual T operator[] (const Point3D &pt) const
virtual Dim3D getDim () const =0
virtual bool isValid (const Point3D &pt) const =0
virtual void setDim (const Dim3D theDim)
virtual Point3D getNeighbor (const Point3D &pt, unsigned int &token, double &distance, bool checkBounds=true) const
bool isLittleEndian ()
template<typename U>
void swapBytes (U &t)

Static Public Member Functions

static Field3D< T > * createInstance (const Dim3D dim, const T &initialValue)

Static Public Attributes

static const char typeStr [3]
 Used by Field3DIO functions to match data types.

Friends

std::ofstream & operator<< (std::ofstream &, const Field3D< T > &)
std::ifstream & operator>> (std::ifstream &, Field3D< T > &)


Detailed Description

template<class T>
class CompuCell3D::Field3D< T >

A 3 dimensional descrete field.

You should only use dynamically allocated instances of this interface. This will make sure the underlying implementation is not lost in copying.

Definition at line 65 of file Field3D.h.


Member Function Documentation

template<class T>
static Field3D<T>* CompuCell3D::Field3D< T >::createInstance ( const Dim3D  dim,
const T &  initialValue 
) [inline, static]

Create an instance of the default Field3D implementation. In this case Field3DImpl.

Parameters:
dim The dimensions of the field.
initialValue The initial value of all data elements in the field.
Returns:
A pointer to the newly allocated Field.

Definition at line 79 of file Field3D.h.

template<class T>
virtual void CompuCell3D::Field3D< T >::set ( const Point3D pt,
const T  value 
) [pure virtual]

template<class T>
virtual T CompuCell3D::Field3D< T >::get ( const Point3D pt  )  const [pure virtual]

template<class T>
virtual T CompuCell3D::Field3D< T >::getByIndex ( long  _offset  )  const [inline, virtual]

If _offset is out of range either a BasicException will be thrown or a function will return default value for the field element

Parameters:
_offset offset of the field element in the internal field array.
Returns:
The value of the element at _offset.

Reimplemented in CompuCell3D::Array3DField3DAdapter< T >, CompuCell3D::Array3DBordersField3DAdapter< T >, CompuCell3D::Array2DBordersField3DAdapter< T >, CompuCell3D::Field3DImpl< T >, CompuCell3D::Field3DImpl< float >, CompuCell3D::Field3DImpl< CompuCell3D::CellG * >, and CompuCell3D::Field3DImpl< precision >.

Definition at line 111 of file Field3D.h.

template<class T>
virtual void CompuCell3D::Field3D< T >::setByIndex ( long  _offset,
const T  value 
) [inline, virtual]

If _offset is out of range either nothing is done

Parameters:
_offset offset of the field element in the internal field array.
Returns:
The value of the element at _offset.

Reimplemented in CompuCell3D::Array3DField3DAdapter< T >, CompuCell3D::Array3DBordersField3DAdapter< T >, CompuCell3D::Array2DBordersField3DAdapter< T >, CompuCell3D::Field3DImpl< T >, CompuCell3D::Field3DImpl< float >, CompuCell3D::Field3DImpl< CompuCell3D::CellG * >, and CompuCell3D::Field3DImpl< precision >.

Definition at line 122 of file Field3D.h.

template<class T>
virtual T CompuCell3D::Field3D< T >::operator[] ( const Point3D pt  )  const [inline, virtual]

If pt is out of range a BasicException will be thrown.

Parameters:
pt The coordinates of the field element.
Returns:
The value of the element at pt. If pt is out of range a BasicException will be thrown.
Parameters:
pt The coordinates of the field element.
Returns:
The value of the element at pt.

Definition at line 141 of file Field3D.h.

template<class T>
virtual Dim3D CompuCell3D::Field3D< T >::getDim (  )  const [pure virtual]

template<class T>
virtual bool CompuCell3D::Field3D< T >::isValid ( const Point3D pt  )  const [pure virtual]

template<class T>
virtual void CompuCell3D::Field3D< T >::setDim ( const Dim3D  theDim  )  [inline, virtual]

template<class T>
virtual Point3D CompuCell3D::Field3D< T >::getNeighbor ( const Point3D pt,
unsigned int &  token,
double &  distance,
bool  checkBounds = true 
) const [inline, virtual]

Get the next Neighbor points in the sequence. To start a new sequence of Neighbor points set token to zero. Neighbor points which are outside of the field are automatically filtered out. If you call this function too many times it will cause an infinite loop when the neighbor depth is beyond all points in the field.

Parameters:
pt The current source point.
token Keeps track of which Neighbor is next.
distance Is set on return to the distance of the neighbor.
Returns:
The next neighbor point.

Definition at line 179 of file Field3D.h.

Referenced by CompuCell3D::ViscosityEnergy::changeEnergy().

template<class T>
bool CompuCell3D::Field3D< T >::isLittleEndian (  )  [inline]

Definition at line 187 of file Field3D.h.

template<class T>
template<typename U>
void CompuCell3D::Field3D< T >::swapBytes ( U &  t  )  [inline]

Definition at line 193 of file Field3D.h.


Friends And Related Function Documentation

template<class T>
std::ofstream& operator<< ( std::ofstream &  stream,
const Field3D< T > &  field 
) [friend]

Generic operator for writing Field3D data in a platform independent way.

The format is as follows:
Bytes Type Description
2 char Data type string.
1 char Number of dimensions. Always 3.
4 uint32_t X dimension.
4 uint32_t Y dimension.
4 uint32_t Z dimension.
X*Y*Z*sizeof(data type) data type according to the type string The field data

The predefined data type strings are as follows:
" i" 4 byte signed integer
"ui" 4 byte unsigned integer
" d" 8 byte double
" f" 4 byte float
" c" 1 byte signed character
"uc" 1 byte unsigned character
" l" 4 byte signed integer
"ul" 4 byte unsigned integer

If you what to write a field of a data type not listed in this table you must define const char Field3D<T>::typeStr[3] for that type somewhere in your code or you will get link errors.

All data is written in network byte order. (ie. Most significant byte first)

Long data types and pointers are different on 64 bit machines. Such data fields will be incompatable between 64 bit and 32 bit machines.

Parameters:
stream The output stream.
field The field to write.
Returns:
A reference to the passed stream.

template<class T>
std::ifstream& operator>> ( std::ifstream &  stream,
Field3D< T > &  field 
) [friend]

Generic operator for reading Field3D data in a platform independent way.

See std::ofstream &operator<<(std::ofstream &, Field3D<T> &)


Member Data Documentation

template<class T>
const char CompuCell3D::Field3D< T >::typeStr[3] [static]

Used by Field3DIO functions to match data types.

Definition at line 68 of file Field3D.h.

Referenced by CompuCell3D::operator>>().


The documentation for this class was generated from the following file:

Generated on Thu Dec 4 11:41:56 2008 for CompuCell3D by  doxygen 1.5.6