SIM_MatrixField Class Reference

This class holds a three dimensional tensor field. More...

#include <SIM_MatrixField.h>

Inheritance diagram for SIM_MatrixField:

SIM_Data SIM_OptionsUser

List of all members.

Public Member Functions

 GETSET_DATA_FUNCS_S (SIM_NAME_POSITIONPATH, PositionPath)
 GETSET_DATA_FUNCS_I (SIM_NAME_UNIFORMVOXELS, UniformVoxels)
 Control the number of divisions.
 GETSET_DATA_FUNCS_B (SIM_NAME_TWOD, TwoDField)
 GETSET_DATA_FUNCS_I (SIM_NAME_VOXELPLANE, VoxelPlane)
 GETSET_DATA_FUNCS_V3 (SIM_NAME_DIV, RawDivisions)
 GETSET_DATA_FUNCS_I ("uniformdiv", RawUniformDivisions)
 GETSET_DATA_FUNCS_F ("divsize", RawDivisionSize)
 GETSET_DATA_FUNCS_V3 (SIM_NAME_CENTER, RawCenter)
 GETSET_DATA_FUNCS_V3 (SIM_NAME_SIZE, RawSize)
 GETSET_DATA_FUNCS_V3 ("slicediv", SliceDivisions)
 GETSET_DATA_FUNCS_V3 ("sliceoverlapneg", SliceOverlapNeg)
 GETSET_DATA_FUNCS_V3 ("sliceoverlappos", SliceOverlapPos)
 GETSET_DATA_FUNCS_I ("totalvoxels", TotalVoxels)
 GETSET_DATA_FUNCS_V3 ("totalvoxelres", TotalVoxelRes)
 GETSET_DATA_FUNCS_F (SIM_NAME_TOLERANCE, Tolerance)
 GETSET_DATA_FUNCS_B ("usefp16", UseFP16)
 GETSET_DATA_FUNCS_I (SIM_NAME_VOXELSAMPLE, VoxelSampleRaw)
 GETSET_DATA_FUNCS_I ("border", RawBorder)
UT_VoxelBorderType getBorder () const
void setBorder (UT_VoxelBorderType border)
void getBBox (UT_BoundingBox &bbox) const
UT_Vector3 getOrig () const
UT_Vector3 getDivisions () const
UT_Vector3 getSize () const
UT_Vector3 getCenter () const
void setDivisions (const UT_Vector3 &div)
void setSize (const UT_Vector3 &div)
void setCenter (const UT_Vector3 &div)
void resizeKeepData (const UT_Vector3 &size, const UT_Vector3 &center)
void matchField (const SIM_ScalarField *field)
void matchField (const SIM_VectorField *field)
void matchField (const SIM_MatrixField *field, bool matchsamples=false)
void matchField (const SIM_IndexField *field)
bool isAligned (const SIM_ScalarField *field) const
bool isAligned (const SIM_VectorField *field) const
bool isAligned (const SIM_RawField *field) const
bool isAligned (const SIM_MatrixField *field) const
SIM_FieldSample getVoxelSample (int i, int j) const
const UT_Vector3getVoxelSize (int i, int j) const
fpreal getVoxelDiameter (int i, int j) const
UT_Matrix3 getValue (const UT_Vector3 &pos) const
UT_Matrix3 getCellValue (int x, int y, int z) const
void addToCell (int x, int y, int z, const UT_Matrix3 &dv)
void advect (const SIM_VectorField *vel, fpreal timestep, const SIM_RawField *collision=0, SIM_FieldAdvection advectmethod=SIM_ADVECT_TRACE)
 Advects this field by the other given field.
void advect (sim_PointVelocity getVelocity, fpreal timestep, fpreal voxelsize, const SIM_RawField *collision=0)
void enforceBoundary (const SIM_ScalarField *collision=0, const SIM_MatrixField *cvel=0)
 Enforces boundary conditions on the array.
bool indexToPos (int i, int j, int x, int y, int z, UT_Vector3 &pos) const
 Converts an integer index into a worldspace position.
bool posToIndex (int i, int j, const UT_Vector3 &pos, int &x, int &y, int &z) const
 Converts a worldspace position into an integer index.
SIM_RawFieldgetField (int i, int j) const
 Retrieve raw field.
void setField (int i, int j, SIM_RawField *field)
bool hasNan () const
 True if we contain any NANs.
SIM_RawFieldstealField (int i, int j)
void testForNan () const
void pubHandleModification ()
void updateTotalVoxels ()
GU_ConstDetailHandle createSmokeRepresentation (const SIM_RootData &root) const
 Creates a GDP with us as a Volume Primitive inside it.
void addSmokeRepresentation (const SIM_RootData &root, GU_Detail *gdp) const

Protected Member Functions

 SIM_MatrixField (const SIM_DataFactory *factory)
virtual ~SIM_MatrixField ()
virtual void initializeSubclass ()
 Overrides to properly implement this class as a SIM_Data.
virtual void makeEqualSubclass (const SIM_Data *source)
 myField aware copy constructor.
virtual void saveSubclass (ostream &os) const
 Saves our attributes, and our internal data if it has been set.
virtual bool loadSubclass (UT_IStream &is)
 Loads our attributes and internal data if it was set when we saved.
virtual int64 getMemorySizeSubclass () const
virtual void optionChangedSubclass (const char *name)
 Override the setDivisions to rebuild our voxel array on demand.


Detailed Description

This class holds a three dimensional tensor field.
Examples:

ROP/ROP_DopField.C, and SIM/SIM_GasAdd.C.

Definition at line 38 of file SIM_MatrixField.h.


Constructor & Destructor Documentation

SIM_MatrixField::SIM_MatrixField ( const SIM_DataFactory factory  )  [explicit, protected]

virtual SIM_MatrixField::~SIM_MatrixField (  )  [protected, virtual]


Member Function Documentation

void SIM_MatrixField::addSmokeRepresentation ( const SIM_RootData root,
GU_Detail gdp 
) const

Adds a volume primitive version of our field to the given gdp.

void SIM_MatrixField::addToCell ( int  x,
int  y,
int  z,
const UT_Matrix3 dv 
)

Adds a velocity to the given *voxel*. If this is face, it is divided in two and spread on each of 6 faces. If it is corner, it is divided by 8 and spread along each of 8 corners.

void SIM_MatrixField::advect ( sim_PointVelocity  getVelocity,
fpreal  timestep,
fpreal  voxelsize,
const SIM_RawField collision = 0 
)

void SIM_MatrixField::advect ( const SIM_VectorField vel,
fpreal  timestep,
const SIM_RawField collision = 0,
SIM_FieldAdvection  advectmethod = SIM_ADVECT_TRACE 
)

Advects this field by the other given field.

GU_ConstDetailHandle SIM_MatrixField::createSmokeRepresentation ( const SIM_RootData root  )  const

Creates a GDP with us as a Volume Primitive inside it.

void SIM_MatrixField::enforceBoundary ( const SIM_ScalarField collision = 0,
const SIM_MatrixField cvel = 0 
)

Enforces boundary conditions on the array.

void SIM_MatrixField::getBBox ( UT_BoundingBox bbox  )  const

Controls the dimensions of where the field is properly defined in the field space.

UT_VoxelBorderType SIM_MatrixField::getBorder (  )  const [inline]

Definition at line 68 of file SIM_MatrixField.h.

UT_Matrix3 SIM_MatrixField::getCellValue ( int  x,
int  y,
int  z 
) const

Gets the velocity at the given *voxel* location, interpolating if we have corner or face velocities.

UT_Vector3 SIM_MatrixField::getCenter (  )  const

UT_Vector3 SIM_MatrixField::getDivisions (  )  const

Calculate the size and divisions according to options such as 2d or equal sized voxels.

SIM_RawField* SIM_MatrixField::getField ( int  i,
int  j 
) const [inline]

Retrieve raw field.

Examples:
ROP/ROP_DopField.C, and SIM/SIM_GasAdd.C.

Definition at line 150 of file SIM_MatrixField.h.

virtual int64 SIM_MatrixField::getMemorySizeSubclass (  )  const [protected, virtual]

Override this function to return an accurate representation of the amount of memory used by this piece of data. The size of subdata should not be included in this calculation.

Reimplemented from SIM_Data.

UT_Vector3 SIM_MatrixField::getOrig (  )  const [inline]

Definition at line 75 of file SIM_MatrixField.h.

SIM_MatrixField::GETSET_DATA_FUNCS_B ( "usefp16"  ,
UseFP16   
)

SIM_MatrixField::GETSET_DATA_FUNCS_B ( SIM_NAME_TWOD  ,
TwoDField   
)

SIM_MatrixField::GETSET_DATA_FUNCS_F ( SIM_NAME_TOLERANCE  ,
Tolerance   
)

SIM_MatrixField::GETSET_DATA_FUNCS_F ( "divsize"  ,
RawDivisionSize   
)

SIM_MatrixField::GETSET_DATA_FUNCS_I ( "border"  ,
RawBorder   
)

SIM_MatrixField::GETSET_DATA_FUNCS_I ( SIM_NAME_VOXELSAMPLE  ,
VoxelSampleRaw   
)

SIM_MatrixField::GETSET_DATA_FUNCS_I ( "totalvoxels"  ,
TotalVoxels   
)

SIM_MatrixField::GETSET_DATA_FUNCS_I ( "uniformdiv"  ,
RawUniformDivisions   
)

SIM_MatrixField::GETSET_DATA_FUNCS_I ( SIM_NAME_VOXELPLANE  ,
VoxelPlane   
)

SIM_MatrixField::GETSET_DATA_FUNCS_I ( SIM_NAME_UNIFORMVOXELS  ,
UniformVoxels   
)

Control the number of divisions.

SIM_MatrixField::GETSET_DATA_FUNCS_S ( SIM_NAME_POSITIONPATH  ,
PositionPath   
)

Accesses the relative path to the position data associated with this geometry.

SIM_MatrixField::GETSET_DATA_FUNCS_V3 ( "totalvoxelres"  ,
TotalVoxelRes   
)

SIM_MatrixField::GETSET_DATA_FUNCS_V3 ( "sliceoverlappos"  ,
SliceOverlapPos   
)

SIM_MatrixField::GETSET_DATA_FUNCS_V3 ( "sliceoverlapneg"  ,
SliceOverlapNeg   
)

SIM_MatrixField::GETSET_DATA_FUNCS_V3 ( "slicediv"  ,
SliceDivisions   
)

SIM_MatrixField::GETSET_DATA_FUNCS_V3 ( SIM_NAME_SIZE  ,
RawSize   
)

SIM_MatrixField::GETSET_DATA_FUNCS_V3 ( SIM_NAME_CENTER  ,
RawCenter   
)

SIM_MatrixField::GETSET_DATA_FUNCS_V3 ( SIM_NAME_DIV  ,
RawDivisions   
)

UT_Vector3 SIM_MatrixField::getSize (  )  const

UT_Matrix3 SIM_MatrixField::getValue ( const UT_Vector3 pos  )  const

Access the field value given a world space location. This does trilinear interpolation.

fpreal SIM_MatrixField::getVoxelDiameter ( int  i,
int  j 
) const

SIM_FieldSample SIM_MatrixField::getVoxelSample ( int  i,
int  j 
) const

const UT_Vector3& SIM_MatrixField::getVoxelSize ( int  i,
int  j 
) const

bool SIM_MatrixField::hasNan (  )  const [inline]

True if we contain any NANs.

Definition at line 157 of file SIM_MatrixField.h.

bool SIM_MatrixField::indexToPos ( int  i,
int  j,
int  x,
int  y,
int  z,
UT_Vector3 pos 
) const

Converts an integer index into a worldspace position.

virtual void SIM_MatrixField::initializeSubclass (  )  [protected, virtual]

Overrides to properly implement this class as a SIM_Data.

Reimplemented from SIM_Data.

bool SIM_MatrixField::isAligned ( const SIM_MatrixField field  )  const

True if we are component wise aligned, the subfields may still not be aligned with respect to each other.

bool SIM_MatrixField::isAligned ( const SIM_RawField field  )  const

bool SIM_MatrixField::isAligned ( const SIM_VectorField field  )  const

bool SIM_MatrixField::isAligned ( const SIM_ScalarField field  )  const

virtual bool SIM_MatrixField::loadSubclass ( UT_IStream is  )  [protected, virtual]

Loads our attributes and internal data if it was set when we saved.

Reimplemented from SIM_Data.

virtual void SIM_MatrixField::makeEqualSubclass ( const SIM_Data source  )  [protected, virtual]

myField aware copy constructor.

Reimplemented from SIM_Data.

void SIM_MatrixField::matchField ( const SIM_IndexField field  ) 

void SIM_MatrixField::matchField ( const SIM_MatrixField field,
bool  matchsamples = false 
)

void SIM_MatrixField::matchField ( const SIM_VectorField field  ) 

void SIM_MatrixField::matchField ( const SIM_ScalarField field  ) 

Match this field to the given reference field. We will end up with the same size/divisions/twod/uniform, but not the same sampling pattern

virtual void SIM_MatrixField::optionChangedSubclass ( const char *  name  )  [protected, virtual]

Override the setDivisions to rebuild our voxel array on demand.

Reimplemented from SIM_OptionsUser.

bool SIM_MatrixField::posToIndex ( int  i,
int  j,
const UT_Vector3 pos,
int &  x,
int &  y,
int &  z 
) const

Converts a worldspace position into an integer index.

void SIM_MatrixField::pubHandleModification (  )  [inline]

Examples:
SIM/SIM_GasAdd.C.

Definition at line 174 of file SIM_MatrixField.h.

void SIM_MatrixField::resizeKeepData ( const UT_Vector3 size,
const UT_Vector3 center 
)

Resizes our field keeping our field data. The final size will be an integer number of voxels matching our current voxel size. The final center will be an integer number of voxel offset from our current center. This allows us to do a perfect copy of the data.

virtual void SIM_MatrixField::saveSubclass ( ostream &  os  )  const [protected, virtual]

Saves our attributes, and our internal data if it has been set.

Reimplemented from SIM_Data.

void SIM_MatrixField::setBorder ( UT_VoxelBorderType  border  )  [inline]

Definition at line 69 of file SIM_MatrixField.h.

void SIM_MatrixField::setCenter ( const UT_Vector3 div  ) 

void SIM_MatrixField::setDivisions ( const UT_Vector3 div  ) 

Adjusts the size/divisions of this field, overriding and twod or uniform voxel settings.

void SIM_MatrixField::setField ( int  i,
int  j,
SIM_RawField field 
)

Sets the field to the given field, gaining ownership of it. The new field must already match the field it will replace.

void SIM_MatrixField::setSize ( const UT_Vector3 div  ) 

SIM_RawField* SIM_MatrixField::stealField ( int  i,
int  j 
)

Steals the field, replacing this copy with an empty field and Steals the field, replacing this copy with an empty field and returning the old version.

void SIM_MatrixField::testForNan (  )  const

void SIM_MatrixField::updateTotalVoxels (  ) 

Recomputes total number of voxels to be stored on our options data for ease of reading


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

Generated on Mon Jan 28 00:48:53 2013 for HDK by  doxygen 1.5.9