HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SIM_Utils.h File Reference
#include "SIM_API.h"
#include "SIM_Data.h"
#include "SIM_DataFilter.h"
#include "SIM_Time.h"
#include "SIM_Names.h"
#include "SIM_CacheCompression.h"
#include <GEO/GEO_Primitive.h>
#include <UT/UT_SysSpecific.h>
#include <UT/UT_Array.h>
+ Include dependency graph for SIM_Utils.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  sim_EdgeDataEntry
 Information about a single edge. More...
 

Macros

#define SIM_DATA_CAST(Data, DataClass)
 
#define SIM_DATA_CASTCONST(Data, DataClass)
 
#define SIM_DATA_GET(Parent, DataName, DataClass)   SIM_DATA_CAST((Parent).getNamedSubData(DataName), DataClass)
 
#define SIM_DATA_GETCONST(Parent, DataName, DataClass)   SIM_DATA_CASTCONST((Parent).getConstNamedSubData(DataName), DataClass)
 
#define SIM_DATA_GETNTH(Parent, DataClass, N, StartFrom, RecurseFilter)
 
#define SIM_DATA_GETNTHCONST(Parent, DataClass, N, StartFrom, RecurseFilter)
 
#define SIM_DATA_CREATE(Parent, DataName, DataClass, Flags)
 
#define SIM_DATA_GETORCREATE_ALT(Parent, DataName, DataClass)
 

Typedefs

typedef UT_Array
< sim_EdgeDataEntry
SIM_EdgeData
 

Functions

template<class DataClass >
void SIMconvertConstArray (const SIM_ConstDataArray &src, UT_ValArray< const DataClass * > &dest, const char *DataClassName, bool includenulls=false)
 
template<class DataClass >
void SIMconvertArray (const SIM_DataArray &src, UT_ValArray< DataClass * > &dest, const char *DataClassName, bool includenulls=false)
 
SIM_API void SIMgetPositionTransform (UT_DMatrix4 &result, const SIM_Object &)
 
SIM_API void SIMgetGeometryTransform (UT_DMatrix4 &result, const SIM_Object &)
 
SIM_API void SIMgetObjectProperties (const SIM_Object &obj, const UT_Vector3 &pos, const GA_Index ptnum, fpreal &friction, fpreal &bounce, fpreal &dynamicfriction, fpreal &bounceforward)
 Returns object properties at the given point (if non-negative) or position. More...
 
void SIMgetObjectProperties (const SIM_Object &obj, const UT_Vector3 &pos, const GA_Index ptnum, fpreal &friction, fpreal &bounce, fpreal &dynamicfriction)
 
SIM_API bool SIMisTri (const GEO_Primitive &prim)
 
SIM_API void SIMcalcEdgeData (SIM_EdgeData &edgeData, const GU_Detail &gdp)
 
SYS_VISIBILITY_EXPORT void initializeSIM (void *data)
 
SIM_API void initializeSIM ()
 
SIM_API void SIMbuildAnchorGuideObjectLink (GU_Detail *gdp, GA_Offset ptoff, const SIM_Object &object, const SIM_Options &options, const SIM_Relationship &rel)
 Constructs guide geometry to illustrate connection between an anchored. More...
 
SIM_API void SIMbuildAnchorGuideObjectLink (GU_Detail *gdp, GA_Offset ptoff, const UT_Vector3 &obj_pos, fpreal scale, const GA_RWHandleV3 &color_attrib, const UT_Vector3 &color, const UT_Vector3 &affcolor)
 
SIM_API bool SIMtryCachePointList (UT_IntArray &points, const char *pattern)
 

Macro Definition Documentation

#define SIM_DATA_CAST (   Data,
  DataClass 
)
Value:
((DataClass *)(SIM_Data::castPointerToType( \
static_cast<SIM_Data *>(Data), #DataClass)))
static void * castPointerToType(SIM_Data *data, const UT_StringRef &datatype)

This macros simplifies calling and casting the return value from the SIM_Data::getPointerToType() function. The returned value is a DataClass pointer.

Examples:
SIM/SIM_GasAdd.C.

Definition at line 28 of file SIM_Utils.h.

#define SIM_DATA_CASTCONST (   Data,
  DataClass 
)
Value:
((const DataClass *)(SIM_Data::castConstPointerToType( \
static_cast<const SIM_Data *>(Data), #DataClass)))
static const void * castConstPointerToType(const SIM_Data *data, const UT_StringRef &datatype)

This macros simplifies calling and casting the return value from the SIM_Data::getPointerToType() function. The returned value is a const DataClass pointer.

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

Definition at line 34 of file SIM_Utils.h.

#define SIM_DATA_CREATE (   Parent,
  DataName,
  DataClass,
  Flags 
)
Value:
((DataClass *)(static_cast<SIM_Data &>(Parent)). \
createNamedSubData(DataName, #DataClass, Flags))

This macro simplifies calling and casting the return value of a call to the SIM_Data::createNamedSubData function.

Examples:
DOP/DOP_GroupAndApply.C, SIM/SIM_SolverHair.C, and SIM/SNOW_Solver.C.

Definition at line 63 of file SIM_Utils.h.

#define SIM_DATA_GET (   Parent,
  DataName,
  DataClass 
)    SIM_DATA_CAST((Parent).getNamedSubData(DataName), DataClass)

This macro simplifies the calling and casting the return value from SIM_Data::getNamedSubData(). The returned value is a DataClass pointer.

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

Definition at line 40 of file SIM_Utils.h.

#define SIM_DATA_GETCONST (   Parent,
  DataName,
  DataClass 
)    SIM_DATA_CASTCONST((Parent).getConstNamedSubData(DataName), DataClass)

This macro simplifies the calling and casting the return value from SIM_Data::getConstNamedSubData(). The returned value is a const DataClass pointer.

Definition at line 45 of file SIM_Utils.h.

#define SIM_DATA_GETNTH (   Parent,
  DataClass,
  N,
  StartFrom,
  RecurseFilter 
)
Value:
SIM_DATA_CAST((Parent).getNthSubData( \
NULL, SIM_DataFilterByType(#DataClass), N, \
StartFrom, RecurseFilter), DataClass)
GA_API const UT_StringHolder N
#define SIM_DATA_CAST(Data, DataClass)
Definition: SIM_Utils.h:28

This macro simplifies the calling and casting the return value from SIM_Data::getNthSubData(), using SIM_DataFilterByType. The returned value is a DataClass pointer.

Definition at line 50 of file SIM_Utils.h.

#define SIM_DATA_GETNTHCONST (   Parent,
  DataClass,
  N,
  StartFrom,
  RecurseFilter 
)
Value:
SIM_DATA_CASTCONST((Parent).getNthConstSubData( \
NULL, SIM_DataFilterByType(#DataClass), N, \
StartFrom, RecurseFilter), DataClass)
#define SIM_DATA_CASTCONST(Data, DataClass)
Definition: SIM_Utils.h:34
GA_API const UT_StringHolder N

This macro simplifies the calling and casting the return value from SIM_Data::getNthConstSubData(), using SIM_DataFilterByType. The returned value is a const DataClass pointer.

Definition at line 57 of file SIM_Utils.h.

#define SIM_DATA_GETORCREATE_ALT (   Parent,
  DataName,
  DataClass 
)
Value:
SIM_DATA_CAST((Parent).getOrCreateAlternateRepresentation( \
DataName, #DataClass), DataClass)
#define SIM_DATA_CAST(Data, DataClass)
Definition: SIM_Utils.h:28

This macro simplifies the calling and casting the return value from SIM_Data::getorCreateAlternateRepresentation(). The returned value is a DataClass pointer.

Definition at line 69 of file SIM_Utils.h.

Typedef Documentation

Definition at line 180 of file SIM_Utils.h.

Function Documentation

SYS_VISIBILITY_EXPORT void initializeSIM ( void )

Declaration of the function that must be implemented by custom SIM library extensions.

This is the hook that Houdini grabs from the dll to link in this. As such, it merely has to implement the data factory for this node.

Examples:
SIM/GAS_NetVDBSliceExchange.C, SIM/SIM_ElectricalProperties.C, SIM/SIM_ForceOrbit.C, SIM/SIM_GasAdd.C, SIM/SIM_RadialEmit.C, SIM/SIM_SolverHair.C, and SIM/SNOW_Solver.C.

Definition at line 52 of file GAS_NetVDBSliceExchange.C.

SIM_API void initializeSIM ( )

Call this initialization function to register all data types, solvers, and colliders in this library.

SIM_API void SIMbuildAnchorGuideObjectLink ( GU_Detail gdp,
GA_Offset  ptoff,
const SIM_Object object,
const SIM_Options options,
const SIM_Relationship rel 
)

Constructs guide geometry to illustrate connection between an anchored.

SIM_API void SIMbuildAnchorGuideObjectLink ( GU_Detail gdp,
GA_Offset  ptoff,
const UT_Vector3 obj_pos,
fpreal  scale,
const GA_RWHandleV3 color_attrib,
const UT_Vector3 color,
const UT_Vector3 affcolor 
)
SIM_API void SIMcalcEdgeData ( SIM_EdgeData edgeData,
const GU_Detail gdp 
)

Calculate information about triangle edges in the given gdp. This is intended as a lightweight alternative to GQ_Detail, with only very basic edge information.

template<class DataClass >
void SIMconvertArray ( const SIM_DataArray src,
UT_ValArray< DataClass * > &  dest,
const char *  DataClassName,
bool  includenulls = false 
)

This function converts SIM_Data pointers in an array to pointers of any SIM_Data subclass. If one of the SIM_Data pointers cannot be cast to the requested new type, it is not added to the new array.

Definition at line 102 of file SIM_Utils.h.

template<class DataClass >
void SIMconvertConstArray ( const SIM_ConstDataArray src,
UT_ValArray< const DataClass * > &  dest,
const char *  DataClassName,
bool  includenulls = false 
)

This function converts const SIM_Data pointers in an array to pointers of any const SIM_Data subclass. If one of the SIM_Data pointers cannot be cast to the requested new type, it is not added to the new array.

Definition at line 78 of file SIM_Utils.h.

SIM_API void SIMgetGeometryTransform ( UT_DMatrix4 result,
const SIM_Object  
)

A utility method for computing the transform from the local-space of an object's geometry to world-space co-ordinates.

Examples:
SIM/SIM_SolverHair.C.
SIM_API void SIMgetObjectProperties ( const SIM_Object obj,
const UT_Vector3 pos,
const GA_Index  ptnum,
fpreal friction,
fpreal bounce,
fpreal dynamicfriction,
fpreal bounceforward 
)

Returns object properties at the given point (if non-negative) or position.

void SIMgetObjectProperties ( const SIM_Object obj,
const UT_Vector3 pos,
const GA_Index  ptnum,
fpreal friction,
fpreal bounce,
fpreal dynamicfriction 
)
inline

Definition at line 138 of file SIM_Utils.h.

SIM_API void SIMgetPositionTransform ( UT_DMatrix4 result,
const SIM_Object  
)

A utility method for computing the transform from the local-space of an object to world-space co-ordinates.

SIM_API bool SIMisTri ( const GEO_Primitive prim)

Returns true if the given primitive is a polygon with three vertices.

SIM_API bool SIMtryCachePointList ( UT_IntArray points,
const char *  pattern 
)

Used in SIM_ConAnchorObjPointGroupPos and SIM_ConAnchorObjPointGroupRot to generate a point list WITH duplicates from a pattern string.