AGXDynamics  2.31.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
agxModel::GranularFieldPostProcessor Class Reference

Class for calculating different granular fields. More...

#include <GranularFieldPostProcessor.h>

+ Inheritance diagram for agxModel::GranularFieldPostProcessor:

Public Member Functions

 GranularFieldPostProcessor (agx::Physics::GranularBodySystem *gbs, const agx::Vec3u &voxelCount, const agx::Vec3 &halfExtents)
 GranularFieldPostProcessor that computes voxel discretized granular fields for a given granular body system inside a rectangular volume. More...
 
bool addField (agxModel::GranularField *gf)
 Adds a new field. More...
 
template<typename T >
T * as ()
 Subclass casting. More...
 
template<typename T >
const T * as () const
 
template<typename T >
T * asSafe ()
 Safe subclass casting, return nullptr if template type does not match. More...
 
template<typename T >
const T * asSafe () const
 
bool calculateFields ()
 Sorts particles into voxels and calculate the fields that are added to this class. More...
 
void createDebugVisualization (agxSDK::Simulation *simulation)
 Set position of the field volume in world coordinates. More...
 
agxModel::GranularField * getField (const agx::String &name)
 Get a field added to the GranularFieldPostProcessor. More...
 
const
agxModel::GranularFieldRefVector & 
getFields ()
 
agx::Frame * getFrame ()
 
agx::Physics::GranularBodySystem * getGranularBodySystem ()
 
agx::Vec3 getHalfExtents ()
 
int getReferenceCount () const
 
agx::Vec3u getVoxelCount ()
 
agx::Vec3 getVoxelSize ()
 
agx::Real getVoxelVolume ()
 
template<typename T >
bool is () const
 Subclass test. More...
 
void reference (void *ptr=nullptr) const
 Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
bool removeField (const agx::String &name)
 Remove field with this name. More...
 
void setPosition (const agx::Vec3 &pos)
 Set position of the field volume in world coordinates. More...
 
void setRotation (const agx::Quat &quat)
 Set rotation of the field volume in world coordinates. More...
 
void unreference (void *ptr=nullptr) const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unreference_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 

Static Public Member Functions

template<typename T >
static bool ValidateCast (const Referenced *object)
 

Public Attributes

agxData::BufferRef m_particleInfo
 
agxData::BufferRef m_particleVoxelIndices
 
agxData::BufferRef m_particleVoxelWeights
 

Protected Member Functions

virtual ~GranularFieldPostProcessor ()
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 

Static Protected Member Functions

static DeleteHandler * getDeleteHandler ()
 
static void setDeleteHandler (DeleteHandler *handler)
 Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to. More...
 

Protected Attributes

Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Detailed Description

Class for calculating different granular fields.

The fields are discretized into voxels and every particle in the system is sorted into voxels together with a weight. The field value in every voxel is then the weighted sum of the particles in that voxel.

Definition at line 42 of file GranularFieldPostProcessor.h.

Constructor & Destructor Documentation

agxModel::GranularFieldPostProcessor::GranularFieldPostProcessor ( agx::Physics::GranularBodySystem *  gbs,
const agx::Vec3u &  voxelCount,
const agx::Vec3 &  halfExtents 
)

GranularFieldPostProcessor that computes voxel discretized granular fields for a given granular body system inside a rectangular volume.

Parameters
gbs- Granular body system for the field
voxelCount- How many voxel in each dimension to fit inside the volume
halfExtents- Half size of volumes sides
virtual agxModel::GranularFieldPostProcessor::~GranularFieldPostProcessor ( )
protectedvirtual

Member Function Documentation

bool agxModel::GranularFieldPostProcessor::addField ( agxModel::GranularField *  gf)

Adds a new field.

This allocates memory in the field class given the shape of the field defined in this class

Parameters
gf- GranularField that should be calculated by the GranularFieldPostProcessor
void agx::Referenced::allocateObserverVector ( ) const
protectedinherited
template<typename T >
T* agx::Referenced::as ( )
inherited

Subclass casting.

Template type must match actual type, dynamic_cast assertion will fail otherwise.

Referenced by agx::InternalData::get(), agxVehicle::Track::getNode(), and agx::InternalData::getOrCreate().

template<typename T >
const T* agx::Referenced::as ( ) const
inherited
template<typename T >
T* agx::Referenced::asSafe ( )
inherited

Safe subclass casting, return nullptr if template type does not match.

Referenced by agxUtil::CollectBodiesAndWiresVisitor::visit().

template<typename T >
const T* agx::Referenced::asSafe ( ) const
inherited
bool agxModel::GranularFieldPostProcessor::calculateFields ( )

Sorts particles into voxels and calculate the fields that are added to this class.

Returns
- true if successful
void agxModel::GranularFieldPostProcessor::createDebugVisualization ( agxSDK::Simulation *  simulation)

Set position of the field volume in world coordinates.

Parameters
simulation- simulation
void agx::Referenced::deleteUsingDeleteHandler ( ) const
protectedinherited
static DeleteHandler* agx::Referenced::getDeleteHandler ( )
staticprotectedinherited
Returns
a DeleteHandler.
agxModel::GranularField* agxModel::GranularFieldPostProcessor::getField ( const agx::String &  name)

Get a field added to the GranularFieldPostProcessor.

Parameters
name- Name of the field to get
Returns
field or nullptr if the field was not added
const agxModel::GranularFieldRefVector& agxModel::GranularFieldPostProcessor::getFields ( )
Returns
a vector of all the fields
agx::Frame* agxModel::GranularFieldPostProcessor::getFrame ( )
Returns
frame for the field
agx::Physics::GranularBodySystem* agxModel::GranularFieldPostProcessor::getGranularBodySystem ( )
Returns
the granular body system.
agx::Vec3 agxModel::GranularFieldPostProcessor::getHalfExtents ( )
Returns
half extents of the volume
int agx::Referenced::getReferenceCount ( ) const
inherited
Returns
the number pointers currently referencing this object.
agx::Vec3u agxModel::GranularFieldPostProcessor::getVoxelCount ( )
Returns
voxel count
agx::Vec3 agxModel::GranularFieldPostProcessor::getVoxelSize ( )
Returns
the size of one voxel
agx::Real agxModel::GranularFieldPostProcessor::getVoxelVolume ( )
Returns
Voxel volume
template<typename T >
bool agx::Referenced::is ( ) const
inherited
void agx::Referenced::reference ( void *  ptr = nullptr) const
inherited

Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it.

This method should be used with care, always balanced with the same number of calls to unreference.

Referenced by agxData::Val< UInt >::Val().

bool agxModel::GranularFieldPostProcessor::removeField ( const agx::String &  name)

Remove field with this name.

Parameters
name- Remove granularField with this name
static void agx::Referenced::setDeleteHandler ( DeleteHandler *  handler)
staticprotectedinherited

Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.

void agxModel::GranularFieldPostProcessor::setPosition ( const agx::Vec3 &  pos)

Set position of the field volume in world coordinates.

Parameters
pos- position in world coordinates
void agxModel::GranularFieldPostProcessor::setRotation ( const agx::Quat &  quat)

Set rotation of the field volume in world coordinates.

Parameters
quat- rotation in world coordinates
void agx::Referenced::unreference ( void *  ptr = nullptr) const
inherited

Decrement the reference count by one, indicating that a pointer to this object is referencing it.

If the reference count goes to zero, it is assumed that this object is no longer referenced and is automatically deleted.

This method should be used with care, always balanced with the same number of calls to reference.

void agx::Referenced::unreference_nodelete ( ) const
inherited

Decrement the reference count by one, indicating that a pointer to this object is referencing it.

However, do not delete it, even if ref count goes to 0. Warning, unref_nodelete() should only be called if the user knows exactly who will be responsible for, one should prefer unref() over unref_nodelete() as the later can lead to memory leaks.

template<typename T >
static bool agx::Referenced::ValidateCast ( const Referenced *  object)
staticinherited

Member Data Documentation

Mutex agx::Referenced::m_mutex
mutableprotectedinherited

Definition at line 240 of file Referenced.h.

ObserverContainer agx::Referenced::m_observers
mutableprotectedinherited

Definition at line 239 of file Referenced.h.

agxData::BufferRef agxModel::GranularFieldPostProcessor::m_particleInfo

Definition at line 145 of file GranularFieldPostProcessor.h.

agxData::BufferRef agxModel::GranularFieldPostProcessor::m_particleVoxelIndices

Definition at line 146 of file GranularFieldPostProcessor.h.

agxData::BufferRef agxModel::GranularFieldPostProcessor::m_particleVoxelWeights

Definition at line 147 of file GranularFieldPostProcessor.h.

AtomicValue agx::Referenced::m_refCount
mutableprotectedinherited

Definition at line 241 of file Referenced.h.


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