HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SIM_Data Class Reference

#include <SIM_Data.h>

+ Inheritance diagram for SIM_Data:

Public Member Functions

const UT_StringHoldergetDataType () const
 
void initialize (const SIM_SubdataBehavior &subdatabehavior)
 
void makeEqual (const SIM_Data *source, const SIM_SubdataBehavior &subdatabehavior)
 
void setParameters (const SIM_Options &parms)
 
void interpolate (const SIM_Data *source1, const SIM_Data *source2, fpreal interp)
 
int64 getMemorySize () const
 
bool getIsAlternateRepresentation () const
 
bool saveToFile (const char *filename, UT_CompressionType compressionType) const
 
bool saveToStream (std::ostream &os, UT_CompressionType compressionType) const
 
void appendFullDataPath (const SIM_Data *subdata, bool useobjectid, UT_String &datapath) const
 
bool loadFromFile (const char *filename)
 
bool loadFromStream (UT_IStream &is, bool skiptype=false)
 
bool getIsOfType (const UT_StringRef &datatype) const
 
const voidgetConstPointerToType (const UT_StringRef &datatype) const
 
voidgetPointerToType (const UT_StringRef &datatype)
 
int getNumSubData () const
 Get the number of sub-data items attached to this data. More...
 
const UT_StringHoldergetSubDataName (int index) const
 Get the name of the sub-data at a particular index location. More...
 
int getSubDataIndex (const SIM_Data *subdata) const
 
bool buildSubDataPath (const SIM_Data *subdata, UT_String &pathto) const
 
const SIM_QuerygetQueryObject () const
 
SIM_OptionsgetUserOptions ()
 
const SIM_OptionsgetConstUserOptions () const
 
long getGuideParmVersion () const
 
void addGuideDep (DEP_MicroNode &src) const
 
virtual bool getGuideGeometryList (const SIM_RootData &root, const char *datapath, const SIM_Time &t, UT_Array< GU_ConstDetailHandle > &detailArray, UT_Array< UT_DMatrix4 > &xformArray) const
 
GU_ConstDetailHandle getGuideGeometry (const SIM_RootData &root, const char *datapath, UT_DMatrix4 &xform, const SIM_Time &t) const
 
void buildGuideOptions (SIM_Options &options, const SIM_Time &time) const
 
SIM_DatagetSubData (int index)
 
const SIM_DatagetConstSubData (int index) const
 
SIM_DatagetNamedSubData (const char *dataname)
 
const SIM_DatagetConstNamedSubData (const char *dataname) const
 
void filterSubData (SIM_DataArray &ncdp, UT_StringArray *names, const SIM_DataFilter &ncfilter, const char *startfrom, const SIM_DataFilter &recursefilter)
 
void filterConstSubData (SIM_ConstDataArray &dp, UT_StringArray *names, const SIM_DataFilter &filter, const char *startfrom, const SIM_DataFilter &recurseFilter) const
 
SIM_DatagetNthSubData (UT_String *name, const SIM_DataFilter &filter, int n, const char *startfrom, const SIM_DataFilter &recurseFilter)
 
const SIM_DatagetNthConstSubData (UT_String *name, const SIM_DataFilter &filter, int n, const char *startfrom, const SIM_DataFilter &recurseFilter) const
 
void forEachSubData (SIM_EachDataCallback &cb, const SIM_DataFilter &filter, const char *startfrom, const SIM_DataFilter &recurseFilter)
 
void forEachConstSubData (SIM_EachDataCallback &cb, const SIM_DataFilter &filter, const char *startfrom, const SIM_DataFilter &recurseFilter) const
 
SIM_DatacreateNamedSubData (const char *dataname, const char *datatype, int creationflags, UT_String *newdatanameptr=NULL)
 
SIM_DatagetOrCreateAlternateRepresentation (const char *dataname, const char *datatype) const
 
void interpolateSubData (const SIM_Data &source1, const SIM_Data &source2, fpreal interp, const SIM_DataFilter &interpdata, const SIM_DataFilter &recurse)
 
void setNamedSubData (const char *dataname, const SIM_Data *data, int setflags)
 
void createUniqueSubDataName (const SIM_Data *subdata, UT_String &dataname) const
 
void removeNamedSubData (const char *dataname)
 Remove some existing sub-data by name. More...
 
void removeSubData (int index)
 Remove some existing sub-data by index. More...
 
void moveNamedSubData (const char *oldname, const char *newname)
 
const UT_GuidgetUniqueId () const
 
long getReferenceCount () const
 
int getCreatorId () const
 Get the ID of the node that created this data. More...
 
OP_NodegetCreatorNode () const
 Use the creator ID to look up the OP_Node that created this data. More...
 
OP_NodegetOwnerNetwork () const
 Look up the owner node of our engine to get the DOP Network pointer. More...
 
const SIM_EnginegetEngine () const
 Get the engine that created us (from our data factory). More...
 
int getCreatorIndex () const
 Get the output index of the creator node that generated this data. More...
 
const SIM_TimegetCreationTime () const
 Get the creation time for this data. More...
 
bool getIsSelected () const
 Get the selected flag for this data. More...
 
void setIsSelected (bool selected) const
 
bool getSelectionRepresentsObject () const
 
void copyCreationInfoFrom (const SIM_Data *source)
 
OP_NodegetNodePathsRelativeTo () const
 
OP_NodegetOPNode (const char *path, bool addinterest) const
 Given a path relative to our creator node, return an OBJ_Node. More...
 
OBJ_NodegetOBJNode (const char *path, bool addinterest) const
 Given a path relative to our creator node, return an OBJ_Node. More...
 
SOP_NodegetSOPNode (const char *path, bool addinterest) const
 Given a path relative to our creator node, return a SOP_Node. More...
 
DOP_NodegetDOPNode (const char *path, bool addinterest) const
 Given a path relative to our creator node, return a DOP_Node. More...
 
COP2_NodegetCOP2Node (const char *path, bool addinterest) const
 Given a path relative to our creator node, return a COP2_Node. More...
 
CHOP_NodegetCHOPNode (const char *path, bool addinterest) const
 Given a path relative to our creator node, return a CHOP_Node. More...
 
void addOPInterest (OP_Node *node) const
 Adds an interest in the specified node to our engine's owner node. More...
 
void addError (const SIM_RootData *root, int errorcode, const char *errorparm, UT_ErrorSeverity severity) const
 Adds an error to our SIM_Engine. More...
 
void makeMemberDataUnique ()
 
virtual void makeMemberDataUniqueSubclass ()
 

Static Public Member Functions

static bool getDataTypeFromFile (const char *filename, UT_String &datatype)
 
static bool getDataTypeFromStream (UT_IStream &is, UT_String &datatype)
 
static const voidcastConstPointerToType (const SIM_Data *data, const UT_StringRef &datatype)
 
static voidcastPointerToType (SIM_Data *data, const UT_StringRef &datatype)
 

Protected Member Functions

 SIM_Data (const SIM_DataFactory *factory)
 
virtual ~SIM_Data ()
 
void handleModification (int code=-1)
 
void setNeedsToRecalculateMemorySize () const
 
void deleteQueryObjectIfNotBuilding () const
 Deletes the query object for this data, if there is one. More...
 
void deleteGuideObjectIfNotBuilding () const
 Delete the guide geometry for this data, if it exists. More...
 
void initAlternateRepresentation () const
 
void setNeedsInitialization (bool needsinit) const
 Flags an alternate representation subdata as requiring initialization. More...
 
bool getNeedsInitialization () const
 Tests whether an alternate representation requires initialization. More...
 
bool saveOptionPacket (std::ostream &os, const char *name, const SIM_Options *opts) const
 
bool loadOptionPacket (UT_IStream &is, const char *name, SIM_Options *opts) const
 
bool getIsDoingSimplifiedSaveLoad () const
 
void initializeFromParmDefaults ()
 
void setSelectionRepresentsObject (bool representsobject)
 
virtual void setNeedsInitializationSubclass (bool needsinit) const
 
virtual void initializeSubclass ()
 
virtual void makeEqualSubclass (const SIM_Data *source)
 
virtual void saveSubclass (std::ostream &os) const
 
virtual void saveIOSubclass (std::ostream &os, SIM_DataThreadedIO *io) const
 
virtual bool loadSubclass (UT_IStream &is)
 
virtual bool loadIOSubclass (UT_IStream &is, SIM_DataThreadedIO *io)
 
virtual SIM_QuerycreateQueryObjectSubclass () const
 
virtual long getGuideParmVersionSubclass () const
 
virtual SIM_GuidecreateGuideObjectSubclass () const
 
virtual void buildGuideGeometrySubclass (const SIM_RootData &root, const SIM_Options &options, const GU_DetailHandle &gdh, UT_DMatrix4 *xform, const SIM_Time &t) const
 
virtual void setParametersSubclass (const SIM_Options &parms)
 
virtual void setNamedSubDataSubclass (const char *dataname, const SIM_Data *data)
 
virtual void removeNamedSubDataSubclass (const char *dataname)
 
virtual void interpolateSubclass (const SIM_Data *source1, const SIM_Data *source2, fpreal interp)
 
virtual int64 getMemorySizeSubclass () const
 
virtual void handleModificationSubclass (int code)
 
virtual bool getIsAlternateRepresentationSubclass () const
 
virtual void initAlternateRepresentationSubclass (const SIM_Data &)
 
virtual voidgetCastToType (const UT_StringRef &datatype) const
 
virtual const UT_StringHoldergetDataTypeSubclass () const
 
const SIM_DatagetAlternateRepresentationOf () const
 

Static Protected Member Functions

static const PRM_TemplategetEmptyTemplateList ()
 
static const SIM_DopDescriptiongetEmptyDopDescription ()
 A DOP description that says not to create an automatic DOP. More...
 
static void getDataTypeSuperclasses (UT_StringArray &)
 

Friends

class SIM_DataFactory
 
class SIM_SimulationState
 
class SIM_OptionsUser
 
class SIM_Guide
 

Detailed Description

This is the base class for all data types that are part of a simulation. To work within a simulation, any data that you want to attach to a simulation object must be a subclass of this type. A number of useful subclasses of this type are provided, such as SIM_Geometry and SIM_Position. Every SIM_Data subclass that is attached to a parent data must be assigned a unique name, so the more data that can be put into a single SIM_Data subclass the more efficient it will be. At the same time, providing small discrete classes makes those classes more likely to be usable in different circumstances.

Examples:
SIM/SIM_ElectricalProperties.h, SIM/SIM_SolverHair.C, SIM/SNOW_Solver.C, and SIM/SNOW_Solver.h.

Definition at line 137 of file SIM_Data.h.

Constructor & Destructor Documentation

SIM_Data::SIM_Data ( const SIM_DataFactory factory)
explicitprotected

The SIM_Data constructor when being created by a SIM_DataFactory. All SIM_Data subclasses should have protected constructors to ensure that only the SIM_DataFactory can create objects of this type.

virtual SIM_Data::~SIM_Data ( )
protectedvirtual

The SIM_Data destructor. It is very important that SIM_Data created by a SIM_DataFactory only be deleted by that SIM_DataFactory.

Member Function Documentation

void SIM_Data::addError ( const SIM_RootData root,
int  errorcode,
const char *  errorparm,
UT_ErrorSeverity  severity 
) const
void SIM_Data::addGuideDep ( DEP_MicroNode src) const

Adds a dependency to our guide from the given micronode, meant to be invoked inside of buildGuideGeometrySubclass

void SIM_Data::addOPInterest ( OP_Node node) const

Adds an interest in the specified node to our engine's owner node.

void SIM_Data::appendFullDataPath ( const SIM_Data subdata,
bool  useobjectid,
UT_String datapath 
) const

Returns the full path starting at this data to the specified subdata. If this is a simulation object, the path will start with the name or the object ID (depending on useobjectid flag). If this is a relationship, the path will start with "Relationships/". Otherwise, the path will start with a slash.

virtual void SIM_Data::buildGuideGeometrySubclass ( const SIM_RootData root,
const SIM_Options options,
const GU_DetailHandle gdh,
UT_DMatrix4 xform,
const SIM_Time t 
) const
protectedvirtual

Override this function to create custom guide geometry for this class. This method should add geometry to the gdp (if supplied), not alter anything that is already there. The xform will always default to an identity matrix. The gdp pointer or the xform pointer may be null, in which case the other should still be calculated.

Reimplemented in HDK_Sample::SNOW_Visualize, SIM_BVTree, SIM_ForceField, SIM_ForceVortex, SIM_SDF, SIM_ScalarFieldVisualization, SIM_VectorFieldVisualization, HDK_Sample::SIM_ForceOrbit, SIM_ForceFan, SIM_ParticleFieldVisualization, SIM_Visualization, SIM_MatrixFieldVisualization, SIM_IndexFieldVisualization, SIM_ForceMagnet, SIM_SlicePlane, SIM_SopGuide, SIM_Constraint, and SIM_ConstraintNetworkVisualization.

void SIM_Data::buildGuideOptions ( SIM_Options options,
const SIM_Time time 
) const

Collect the information in our guide templates and store to a SIM_Options structure.

bool SIM_Data::buildSubDataPath ( const SIM_Data subdata,
UT_String pathto 
) const

Finds the given data as subdata. Returns true if found and populates the path required to get there. There is no preceding '/' on the returned path. If subdata == this, "" is the path.

static const void* SIM_Data::castConstPointerToType ( const SIM_Data data,
const UT_StringRef datatype 
)
static

This static function checks the passed in value for a null pointer then calls getConstPointerToType().

static void* SIM_Data::castPointerToType ( SIM_Data data,
const UT_StringRef datatype 
)
static

This static function checks the passed in value for a null pointer then calls getPointerToType().

void SIM_Data::copyCreationInfoFrom ( const SIM_Data source)

Copy the creation info from the specified data into this data. This optional call after makeEqual() copies the creation info from the source data which is appropriate if this data is meant to replace or precisely represent the source data.

virtual SIM_Guide* SIM_Data::createGuideObjectSubclass ( ) const
protectedvirtual
SIM_Data* SIM_Data::createNamedSubData ( const char *  dataname,
const char *  datatype,
int  creationflags,
UT_String newdatanameptr = NULL 
)

Adds a new sub-data item to this data. The returned value is a pointer to the newly created sub-data. The creationflags parameter can be any combination of the SIM_DATA flags defined in this file. The SIM_DATA_CREATE macro provides an easy way to call this function and cast the return value in a single step.

virtual SIM_Query* SIM_Data::createQueryObjectSubclass ( ) const
protectedvirtual

Override this method to create a custom SIM_Query for this class. By creating a custom SIM_Query, it is possible to customize the expression function interface to the data.

Reimplemented in SIM_Object, SIM_Impacts, SIM_ConRel, SIM_Relationship, SIM_Geometry, SIM_SolverEnable, SIM_GasOpenCLEnforceBoundary, GAS_GeometryVex, SIM_GasOpenCLMergeVDB, and GAS_OpenCL.

void SIM_Data::createUniqueSubDataName ( const SIM_Data subdata,
UT_String dataname 
) const

Generates a unique sub-data name. Using the passed in dataname parameter as a starting point. this function generates a subdata name that is not currently in use. This function usually does not need to be called explicitly since it is called by setNamedSubData() and createNamedSubData() if the SIM_DATA_CREATE_UNIQUE_NAME flag is passed in.

void SIM_Data::deleteGuideObjectIfNotBuilding ( ) const
protected

Delete the guide geometry for this data, if it exists.

void SIM_Data::deleteQueryObjectIfNotBuilding ( ) const
protected

Deletes the query object for this data, if there is one.

void SIM_Data::filterConstSubData ( SIM_ConstDataArray dp,
UT_StringArray names,
const SIM_DataFilter filter,
const char *  startfrom,
const SIM_DataFilter recurseFilter 
) const

Fills an array with all subdata pointers accepted by a filter. The startfrom parameter, if not null, is the name of a subdata item which acts as the root of the search. No data items will be copied by this function, even if they are shared. The names parameter, if not null, will be filled with the paths to the returned data items relative to the startfrom data. The recurseFilter determines which data items have their subdata items searched (and which of those subdata items have their subdata items searched, and so on).

Examples:
SIM/GAS_NetVDBSliceExchange.C.
void SIM_Data::filterSubData ( SIM_DataArray ncdp,
UT_StringArray names,
const SIM_DataFilter ncfilter,
const char *  startfrom,
const SIM_DataFilter recursefilter 
)

Fills an array with all subdata pointers accepted by a filter. The startfrom parameter, if not null, is the name of a subdata item which acts as the root of the search. Data items accepted by the filter will be copied if they point to shared data. When searching recursively, this means that the parents of any returned data must also be copied. The names parameter, if not null, will be filled with the paths to the returned data items relative to the startfrom data. The recurseFilter determines which data items have their subdata items searched (and which of those subdata items have their subdata items searched, and so on).

void SIM_Data::forEachConstSubData ( SIM_EachDataCallback cb,
const SIM_DataFilter filter,
const char *  startfrom,
const SIM_DataFilter recurseFilter 
) const

Executes a callback function for each sub-data item that matches the filter criteria. The callback is called with each data item as a parameter. If the recurse parameter is true, this function searches each sub-data recursively, looking for sub-data items of its own. No data items will be copied by this function, even if they are shared.

void SIM_Data::forEachSubData ( SIM_EachDataCallback cb,
const SIM_DataFilter filter,
const char *  startfrom,
const SIM_DataFilter recurseFilter 
)

Executes a callback function for each sub-data item that matches the filter criteria. The callback is called with each data item as a parameter. If the recurse parameter is true, this function searches each sub-data recursively, looking for sub-data items of its own. Data items accepted by the filter will be copied if they point to shared data. When searching recursively, this means that the parents of any returned data must also be copied.

const SIM_Data* SIM_Data::getAlternateRepresentationOf ( ) const
inlineprotected

Definition at line 699 of file SIM_Data.h.

virtual void* SIM_Data::getCastToType ( const UT_StringRef datatype) const
protectedvirtual

Return this pointer cast us to another data type. All subclasses should implement this function, but generally the DECLARE_STANDARD_GETCASTTOYPE() macro will work. Only if your class uses multiple inheritance will it be necessary to write a custom version of this function. If you write your own custom implementation of this method, remember to call the base class implementation.

CHOP_Node* SIM_Data::getCHOPNode ( const char *  path,
bool  addinterest 
) const

Given a path relative to our creator node, return a CHOP_Node.

const SIM_Data* SIM_Data::getConstNamedSubData ( const char *  dataname) const

Get the sub-data attached to this data with a particular name. If no sub-data with the specified name exists, null is returned. The returned data is not copied even if it is shared.

const void* SIM_Data::getConstPointerToType ( const UT_StringRef datatype) const

Return a const pointer that can be cast directly to the specified type. This function calls getDistanceToType(). It will return null if we can't be converted to the specified type. This function should normally not be called directly. Instead, the SIM_DATA_CASTCONST macro provides a safer method of using this function.

const SIM_Data* SIM_Data::getConstSubData ( int  index) const

This is the same as getSubData(), but it returns a const pointer. Also, the returned data is not copied even if it is shared.

const SIM_Options* SIM_Data::getConstUserOptions ( ) const
inline

Definition at line 265 of file SIM_Data.h.

COP2_Node* SIM_Data::getCOP2Node ( const char *  path,
bool  addinterest 
) const

Given a path relative to our creator node, return a COP2_Node.

const SIM_Time& SIM_Data::getCreationTime ( ) const

Get the creation time for this data.

int SIM_Data::getCreatorId ( ) const

Get the ID of the node that created this data.

int SIM_Data::getCreatorIndex ( ) const

Get the output index of the creator node that generated this data.

OP_Node* SIM_Data::getCreatorNode ( ) const

Use the creator ID to look up the OP_Node that created this data.

const UT_StringHolder& SIM_Data::getDataType ( ) const

Return the unique descriptive name for the class. The returned value will always be the most-derived class for the data object. The name is fetched from the SIM_DataFactory that created this data.

static bool SIM_Data::getDataTypeFromFile ( const char *  filename,
UT_String datatype 
)
static

Opens the specified file and returns the type of data stored in that file. Having a static function here to look up this information from the file saves any callers from requiring any knowledge of the single data format.

static bool SIM_Data::getDataTypeFromStream ( UT_IStream is,
UT_String datatype 
)
static
virtual const UT_StringHolder& SIM_Data::getDataTypeSubclass ( ) const
protectedvirtual

Returns the class name for this data type. This function is automaticaly implemented by the DECLARE_CLASSNAME() and DECLARE_DATAFACTORY() macros.

static void SIM_Data::getDataTypeSuperclasses ( UT_StringArray )
inlinestaticprotected

Definition at line 709 of file SIM_Data.h.

DOP_Node* SIM_Data::getDOPNode ( const char *  path,
bool  addinterest 
) const

Given a path relative to our creator node, return a DOP_Node.

static const SIM_DopDescription* SIM_Data::getEmptyDopDescription ( )
staticprotected

A DOP description that says not to create an automatic DOP.

static const PRM_Template* SIM_Data::getEmptyTemplateList ( )
staticprotected

An empty parm template. This provides a simple default value to use for those SIM_Data subclasses that don't want to define a parm template.

const SIM_Engine& SIM_Data::getEngine ( ) const
inline

Get the engine that created us (from our data factory).

Definition at line 455 of file SIM_Data.h.

GU_ConstDetailHandle SIM_Data::getGuideGeometry ( const SIM_RootData root,
const char *  datapath,
UT_DMatrix4 xform,
const SIM_Time t 
) const

Get the guide geometry associated with this data. The returned value may be null if there is no guide geometry.

virtual bool SIM_Data::getGuideGeometryList ( const SIM_RootData root,
const char *  datapath,
const SIM_Time t,
UT_Array< GU_ConstDetailHandle > &  detailArray,
UT_Array< UT_DMatrix4 > &  xformArray 
) const
virtual

Get the guide geometry list associated with this data. The returned value is true if at least one guide geometry has been generated, false otherwise. Note, the detail and xform arrays will be cleared prior to use.

long SIM_Data::getGuideParmVersion ( ) const

Returns a number that indicates the current state of the guide parms on our source node (or nodes). This value is used to automatically refresh our guide geometry if one of our guide parms changes. This function just calls getGuideParmVersionSubclass().

virtual long SIM_Data::getGuideParmVersionSubclass ( ) const
protectedvirtual

Override this if the guide geometry for this data depends on parameters on nodes other than our creator node. Otherwise the guide geometry won't refresh when changing those parameters.

Reimplemented in SIM_Constraint.

bool SIM_Data::getIsAlternateRepresentation ( ) const

This function returns true if this data is built on demand from some other data. This function calls getIsAlternateRepresentationSubclass(). This value is usually a characteristic of the data type as a whole, and will be the same for all data of a particular type.

virtual bool SIM_Data::getIsAlternateRepresentationSubclass ( ) const
protectedvirtual

Override this method to return true if your data type is built on demand. This is true for data that is just an alternative representation of some other data. This has several consequences. First, it implies that the data can be rebuilt from other data on the object, therefore it is not saved to disk. Also, it is assumed to be represent its parent data, so any modifications to the parent data cause this data to be deleted. If you override this method, do not call the base class implementation.

Reimplemented in HDK_Sample::SNOW_Visualize, SIM_BVTree, RBD_SpherePointTree, SIM_SDF, RBD_SphereEdgeTree, SIM_ScalarFieldVisualization, SIM_VectorFieldVisualization, SIM_ParticleFieldVisualization, SIM_TriangulatedGeometry, SIM_MatrixFieldVisualization, SIM_IndexFieldVisualization, SIM_PointNeighbourList, SIM_PointTree, SIM_RayIntersect, SIM_PointMapping, SIM_ConstraintNetworkVisualization, and SIM_ContainerAlt.

bool SIM_Data::getIsDoingSimplifiedSaveLoad ( ) const
protected

Returns true if we are performing a simplified load or save. A simplified load or save is one performed from the saveToFile or loadFromFile functions.

bool SIM_Data::getIsOfType ( const UT_StringRef datatype) const

Return whether we are of the specified type, or a subclass of it. This function calls the getPointerToType() function to make this determination.

bool SIM_Data::getIsSelected ( ) const

Get the selected flag for this data.

int64 SIM_Data::getMemorySize ( ) const

This function returns the amount of memory consumed by this data. The returned value will not include the size of any subdata.

virtual int64 SIM_Data::getMemorySizeSubclass ( ) const
protectedvirtual

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 in SIM_VectorField, SIM_Object, SIM_Impacts, SIM_MatrixField, SIM_ScalarField, SIM_IndexField, HDK_Sample::SNOW_VoxelArray, SIM_Relationship, SIM_Geometry, RBD_SpherePointTree, SIM_SDF, RBD_SphereEdgeTree, SIM_TriangulatedGeometry, SIM_BVTreeBase, SIM_PointNeighbourList, SIM_PointTree, SIM_RayIntersect, and SIM_PointMapping.

SIM_Data* SIM_Data::getNamedSubData ( const char *  dataname)

Get the sub-data attached to this data with a particular name. If no sub-data with the specified name exists, null is returned. If the found data is shared, then the data is copied before it is returned.

bool SIM_Data::getNeedsInitialization ( ) const
protected

Tests whether an alternate representation requires initialization.

OP_Node& SIM_Data::getNodePathsRelativeTo ( ) const

Returns the node that relative node paths are relative to. This function returns the creator node if there is one, otherwise it returns the OP_Director.

const SIM_Data* SIM_Data::getNthConstSubData ( UT_String name,
const SIM_DataFilter filter,
int  n,
const char *  startfrom,
const SIM_DataFilter recurseFilter 
) const

Returns the nth data item which matches the filter criteria. The startfrom parameter, if not null, is the name of a subdata item which acts as the root of the search. If the recurse parameter is true, then subdata are checked recursively. No data items will be copied by this function, even if they are shared. The name parameter, if not null, will be filled with the path to the returned data item relative to the startfrom data. Note that n starts at zero, in typical C++ fashion.

SIM_Data* SIM_Data::getNthSubData ( UT_String name,
const SIM_DataFilter filter,
int  n,
const char *  startfrom,
const SIM_DataFilter recurseFilter 
)

Returns the nth data item which matches the filter criteria. The startfrom parameter, if not null, is the name of a subdata item which acts as the root of the search. If the recurse parameter is true, then subdata are checked recursively. The data item returned by this function will be copied if it points to shared data. When searching recursively, this means that the parents of the returned data must also be copied. The name parameter, if not null, will be filled with the path to the returned data item relative to the startfrom data. Note that n starts at zero, in typical C++ fashion.

int SIM_Data::getNumSubData ( ) const

Get the number of sub-data items attached to this data.

OBJ_Node* SIM_Data::getOBJNode ( const char *  path,
bool  addinterest 
) const

Given a path relative to our creator node, return an OBJ_Node.

OP_Node* SIM_Data::getOPNode ( const char *  path,
bool  addinterest 
) const

Given a path relative to our creator node, return an OBJ_Node.

SIM_Data* SIM_Data::getOrCreateAlternateRepresentation ( const char *  dataname,
const char *  datatype 
) const

This function is a special version of the function above. It can only be used to create subdata that represents an alternate representation of this data. Because the new subdata is just another representation of this data, it can be added to a const SIM_Data. There is no creationflags parameter because this parameter is always implicitly SIM_DATA_RETURN_EXISTING.

OP_Node* SIM_Data::getOwnerNetwork ( ) const

Look up the owner node of our engine to get the DOP Network pointer.

void* SIM_Data::getPointerToType ( const UT_StringRef datatype)

Return a pointer that can be cast directly to the specified type. This function calls getDistanceToType(). It will return null if we can't be converted to the specified type. This function should normally not be called directly. Instead, the SIM_DATA_CAST macro provides a safer method of using this function.

const SIM_Query& SIM_Data::getQueryObject ( ) const

Get a SIM_Query object associated with this data. The returned reference will generally be destroyed when the data is next modified.

long SIM_Data::getReferenceCount ( ) const

Returns the reference count for this data. This is the number of other data items that hold a pointer to this data.

bool SIM_Data::getSelectionRepresentsObject ( ) const

This function returns true if selecting this data is equivalent to selecting the DOP object to which it is attached. This is currently a property of the data type.

SOP_Node* SIM_Data::getSOPNode ( const char *  path,
bool  addinterest 
) const

Given a path relative to our creator node, return a SOP_Node.

SIM_Data* SIM_Data::getSubData ( int  index)

Get the sub-data at a particular index location. If the found data is shared, then the data is copied before it is returned.

int SIM_Data::getSubDataIndex ( const SIM_Data subdata) const

Returns the index for a piece of sub-data. The return value is -1 if the sub-data can't be found.

const UT_StringHolder& SIM_Data::getSubDataName ( int  index) const

Get the name of the sub-data at a particular index location.

const UT_Guid& SIM_Data::getUniqueId ( ) const

Returns the unique identifier for this data. The unique identifier will be unique for all data over all time in this simulations.

SIM_Options* SIM_Data::getUserOptions ( )
inline

Provide direct access to the SIM_UserOptions that may have been mixed into this data. Will be null if none has been mixed in.

Definition at line 264 of file SIM_Data.h.

void SIM_Data::handleModification ( int  code = -1)
protected

Call this function whenever the internal data of this object changes. The code parameter can be used to signal what sort of modification has occurred. The meaning of this code can be different from one data type to the next. This function calls handleModificationSubclass.

Examples:
SIM/SNOW_Solver.h.
virtual void SIM_Data::handleModificationSubclass ( int  code)
protectedvirtual

Override this method to customize the behavior when our internal data changes. The code parameter is a data type specific value which can be used to indicate the type of change that has occurred. The default implementation deletes all subdata that was created with the deleteifmodified flag turned on. Remember to call the base class implementation.

Reimplemented in HDK_Sample::SNOW_VoxelArray, SIM_SopGeometry, SIM_SopScalarField, and SIM_SopVectorField.

void SIM_Data::initAlternateRepresentation ( ) const
protected

This function is called from getOrCreateAlternateRepresentation(). It should be used to initialize the alternate representation from the parent data. It calls initAlternateRepresentationSubclass() to do the actual work.

Examples:
SIM/SNOW_Solver.C.
virtual void SIM_Data::initAlternateRepresentationSubclass ( const SIM_Data )
protectedvirtual
void SIM_Data::initialize ( const SIM_SubdataBehavior subdatabehavior)

Set this data to its default empty state. This function calls initializeSubclass() to initialize the state of the data. After calling this function, the data should be indistinguishable from a new instance of this data type. This function is always called when a new piece of data is created.

void SIM_Data::initializeFromParmDefaults ( )
protected

This function looks through the parameter templates defined in our SIM_DopDescription, loads the default values into a SIM_Options structure, and calls setParameters(). This function is useful for initializing data types that use the SIM_DopDescription to create an automatic DOP node type.

void SIM_Data::interpolate ( const SIM_Data source1,
const SIM_Data source2,
fpreal  interp 
)

Set this data to be some linear interpolation between two input data. This method is used by the simulation engine to generate approximate data between timesteps. It can also be used by solvers that sub-sample the global timestep, and for display purposes if the global time step is greater than one step time. This function calls interpolateSubclass.

Warning: if the source1 or source2 pointers are equal to the this pointer, this function will only do an assignment (via makeEqual) to one of the sources.

virtual void SIM_Data::interpolateSubclass ( const SIM_Data source1,
const SIM_Data source2,
fpreal  interp 
)
protectedvirtual

Override this method to customize the interpolation behavior. The interp parameter will always be greater than 0 and less than one in this call. Values outside this range are handled by the interpolate() function by calling makeEqual() on one source or the other. The default implementation calls makeEqualSubclass() on source1 or source2 depending on whether interp is less or greater than 0.5. Both source1 and source2 are guaranteed to be non-null in this call. Subclasses should not call the base class implementation, except in the case of an error condition which prevents the custom interpolation from functioning properly. You should also not call makeEqual() from this function, though makeEqualSubclass() is acceptable.

Reimplemented in SIM_Object, SIM_Geometry, SIM_PositionSimple, SIM_SopGeometry, SIM_SopScalarField, and SIM_SopVectorField.

void SIM_Data::interpolateSubData ( const SIM_Data source1,
const SIM_Data source2,
fpreal  interp,
const SIM_DataFilter interpdata,
const SIM_DataFilter recurse 
)

Creates a new sub-data item for this data by interpolating between two reference sub-data items. This function provides an easy way to interpolate certain sub-data items after making a copy of some existing data.

bool SIM_Data::loadFromFile ( const char *  filename)

Loads this piece of data from a file. This file must be in a format like that saved from saveToFile(). No subdata or creation info is loaded (because it isn't saved in the file).

bool SIM_Data::loadFromStream ( UT_IStream is,
bool  skiptype = false 
)

skiptype is set if the stream is already past the type data, for example due to an earlier call to getDataTypeFromStream

virtual bool SIM_Data::loadIOSubclass ( UT_IStream is,
SIM_DataThreadedIO io 
)
protectedvirtual

Loading variant that allows you to request loading data at the end of the .sim file that was saved with saveIOSubclass If not overloaded, passes through to loadSubclass. If io is NULL, shoudl not attempt threaded loading.

Reimplemented in HDK_Sample::SNOW_VoxelArray, and SIM_Geometry.

bool SIM_Data::loadOptionPacket ( UT_IStream is,
const char *  name,
SIM_Options opts 
) const
protected

This function loads a SIM_Options from a stream. Using a SIM_Options provides an easy way to allow for forward and backward compatibility when new data is added or removed.

virtual bool SIM_Data::loadSubclass ( UT_IStream is)
protectedvirtual
void SIM_Data::makeEqual ( const SIM_Data source,
const SIM_SubdataBehavior subdatabehavior 
)

Sets our data to be the same as the source data. This function calls makeEqualSubclass() to do the actual assignment. Note that it is legal to call makeEqual() with any pair of SIM_Data subclasses, not just related types. It is up to the makeEqualSubclass implementation to determine if the passed in data type is acceptable.

virtual void SIM_Data::makeEqualSubclass ( const SIM_Data source)
protectedvirtual

Override this method to set subclass data equal to the source data. The source parameter at this level is guaranteed to be non-null. Remember to call the base class implementation.

Reimplemented in SIM_VectorField, SIM_Object, SIM_Impacts, SIM_MatrixField, SIM_ScalarField, SIM_IndexField, HDK_Sample::SNOW_VoxelArray, SIM_ConRel, SIM_Relationship, SIM_Geometry, SIM_SolverSop, SIM_GeometryCopy, SIM_SolverEnable, SIM_GasOpenCLEnforceBoundary, SIM_GasOpenCLMergeVDB, GAS_GeometryVex, GAS_OpenCL, GAS_FieldVex, SIM_BVTreeBase, and SIM_RandomTwister.

void SIM_Data::makeMemberDataUnique ( )
inline

Simulation data may have member data which it thinks it can write to; but someone may have shared a copy between simulations. This callback can be used to verify it is unique and unique it if needed.

Definition at line 507 of file SIM_Data.h.

virtual void SIM_Data::makeMemberDataUniqueSubclass ( )
inlinevirtual

Reimplemented in SIM_GeometryCopy.

Definition at line 508 of file SIM_Data.h.

void SIM_Data::moveNamedSubData ( const char *  oldname,
const char *  newname 
)

Change the name of some existing sub-data found by name. The newname may specify a completely different location than the old name.

void SIM_Data::removeNamedSubData ( const char *  dataname)

Remove some existing sub-data by name.

virtual void SIM_Data::removeNamedSubDataSubclass ( const char *  dataname)
protectedvirtual

Override this function to do special processing when removing subdata. One example would be to eliminate a cached value set up in the setNamedSubDataSubclass() function.

Reimplemented in SIM_Object.

void SIM_Data::removeSubData ( int  index)

Remove some existing sub-data by index.

virtual void SIM_Data::saveIOSubclass ( std::ostream &  os,
SIM_DataThreadedIO io 
) const
protectedvirtual

Save variant that allows you to delay part of your saving to a background thread. If not overloaded, passes through to saveSubclass. If io is NULL, shoudl not attempt threaded loading.

Reimplemented in HDK_Sample::SNOW_VoxelArray, and SIM_Geometry.

bool SIM_Data::saveOptionPacket ( std::ostream &  os,
const char *  name,
const SIM_Options opts 
) const
protected

This function saves a SIM_Options to a stream. Using a SIM_Options provides an easy way to allow for forward and backward compatibility when new data is added or removed.

virtual void SIM_Data::saveSubclass ( std::ostream &  os) const
protectedvirtual
bool SIM_Data::saveToFile ( const char *  filename,
UT_CompressionType  compressionType 
) const

Saves this piece of data to a file. This is the only public method for saving SIM_Data. It does not save subdata or creation info. It simply saves the contents of this single piece of data to a file.

bool SIM_Data::saveToStream ( std::ostream &  os,
UT_CompressionType  compressionType 
) const
void SIM_Data::setIsSelected ( bool  selected) const

Set the selected flag for this data. Notice this method is const. Selection isn't really part of the data, it is a UI concept.

void SIM_Data::setNamedSubData ( const char *  dataname,
const SIM_Data data,
int  setflags 
)

Add a new piece of sub-data to this data. If data with the given name already exists it will be deleted and replaced with the new data. The data pointer will most likely come from a call to createNamedData() or getSubData() on another parent data. The setflags parameter can be any combination of the SIM_DATA flags defined in this file.

virtual void SIM_Data::setNamedSubDataSubclass ( const char *  dataname,
const SIM_Data data 
)
protectedvirtual

Override this virtual to do special processing when adding subdata. One example would be to cache certain pieces of subdata for quicker access through member functions. Remember to also handle the removeNamedSubDataSubclass function to handle the removal of subdata.

Reimplemented in SIM_Object.

void SIM_Data::setNeedsInitialization ( bool  needsinit) const
protected

Flags an alternate representation subdata as requiring initialization.

virtual void SIM_Data::setNeedsInitializationSubclass ( bool  needsinit) const
protectedvirtual

Override this method to invalidate cached data based on object geometry.

void SIM_Data::setNeedsToRecalculateMemorySize ( ) const
protected

This function flags the data as needing to recalculate its memory size. The default handleModificationSubclass() implementation calls this function, but it can also be called directly when the memory size of a SIM_Data is changing without any changes that would require a handleModification() call.

void SIM_Data::setParameters ( const SIM_Options parms)

Given a SIM_Options, set up this data. This function calls setParametersSubclass() to do its work. It is used by automatically generated DOP nodes to convert parameter values into SIM_Options entries, then set up the data. This function can also be used by loadSubclass() if some of the data for this type is stored in a SIM_Options.

virtual void SIM_Data::setParametersSubclass ( const SIM_Options parms)
protectedvirtual

Override this method to process our DOP node parameter values. Automatically created DOP nodes turn their parameter values into SIM_Options entries, which are passed to this function. This function can also be used to help load data from a stream if it is stored in a SIM_Options. Remember to call the base class implementation.

Reimplemented in SIM_GeometryCopy, and SIM_PointPosition.

void SIM_Data::setSelectionRepresentsObject ( bool  representsobject)
protected

Sets the flag indicating that selecting this object represents a selection of the object to which it is attached.

Friends And Related Function Documentation

friend class SIM_DataFactory
friend

Definition at line 811 of file SIM_Data.h.

friend class SIM_Guide
friend

Definition at line 814 of file SIM_Data.h.

friend class SIM_OptionsUser
friend

Definition at line 813 of file SIM_Data.h.

friend class SIM_SimulationState
friend

Definition at line 812 of file SIM_Data.h.


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