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

#include <GranularFields.h>

+ Inheritance diagram for agxModel::GranularCustomBufferField:

Public Member Functions

 GranularCustomBufferField (agx::String bufferName)
 Custom buffer field. More...
 
virtual bool addToField (agx::UInt index, ParticleWeightPair *pair)
 Implement this method in derived classes to define how the particle weight pair should be added to the field element with index index. More...
 
bool allocateField ()
 Allocate memory for the 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
 
virtual bool calculateFieldElement (agx::UInt index)
 Implement this method in derived class to do a final computation on the field when all the particles have been added. More...
 
void clearField ()
 Clear the field. More...
 
agx::Real * getFieldData ()
 Get ptr to field data. More...
 
agx::Vec4u getFieldShape ()
 Get the shape of the field. More...
 
agx::UInt getFieldSize ()
 Get the field size. More...
 
agxModel::GranularFieldPostProcessor * getGranularFieldPostProcessor ()
 Get the granular field post processor. More...
 
agx::String getName ()
 Get field name. More...
 
int getReferenceCount () const
 
const agx::Vector< agx::String > getRequiredFields ()
 Get the names of the fields that this field depends on. More...
 
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...
 
void setGranularFieldPostProcesser (agxModel::GranularFieldPostProcessor *pp)
 Set GranularFieldPostProcessor. 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)
 

Protected Member Functions

 ~GranularCustomBufferField ()
 
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

agx::Vector< agx::Real > m_field
 
agx::Vec4u m_fieldShape
 
Mutex m_mutex
 
agx::String m_name
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 
agx::Vector< agx::String > m_requiredFields
 

Detailed Description

Definition at line 186 of file GranularFields.h.

Constructor & Destructor Documentation

agxModel::GranularCustomBufferField::GranularCustomBufferField ( agx::String  bufferName)

Custom buffer field.

Requires that the granularfield name is the same as a custom buffer in the particle system

Parameters
bufferName- The field name and the name of the custom buffer in the particle system
agxModel::GranularCustomBufferField::~GranularCustomBufferField ( )
protected

Member Function Documentation

virtual bool agxModel::GranularCustomBufferField::addToField ( agx::UInt  index,
ParticleWeightPair *  pair 
)
virtual

Implement this method in derived classes to define how the particle weight pair should be added to the field element with index index.

Parameters
index- What voxel to add the particle field data to
pair- The particle and the its weight
Returns
- true if successful

Reimplemented from agxModel::GranularField.

bool agxModel::GranularField::allocateField ( )
inherited

Allocate memory for the field.

Returns
- true if successful
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
virtual bool agxModel::GranularCustomBufferField::calculateFieldElement ( agx::UInt  )
virtual

Implement this method in derived class to do a final computation on the field when all the particles have been added.

Possible to use if the field depends on other fields to be computed first.

Returns
- true if successful

Reimplemented from agxModel::GranularField.

void agxModel::GranularField::clearField ( )
inherited

Clear the field.

void agx::Referenced::deleteUsingDeleteHandler ( ) const
protectedinherited
static DeleteHandler* agx::Referenced::getDeleteHandler ( )
staticprotectedinherited
Returns
a DeleteHandler.
agx::Real* agxModel::GranularField::getFieldData ( )
inherited

Get ptr to field data.

Returns
ptr to field data
agx::Vec4u agxModel::GranularField::getFieldShape ( )
inherited

Get the shape of the field.

x, y, z is the number of voxels the fields granular postprocessor have. w is number of dimensions for the field.

Returns
- field shape
agx::UInt agxModel::GranularField::getFieldSize ( )
inherited

Get the field size.

That is, the number of voxels in the field times the number of field elements.

Returns
- field size
agxModel::GranularFieldPostProcessor* agxModel::GranularField::getGranularFieldPostProcessor ( )
inherited

Get the granular field post processor.

Returns
- GranularFieldPostProcessor
agx::String agxModel::GranularField::getName ( )
inherited

Get field name.

Returns
- field name
int agx::Referenced::getReferenceCount ( ) const
inherited
Returns
the number pointers currently referencing this object.
const agx::Vector<agx::String> agxModel::GranularField::getRequiredFields ( )
inherited

Get the names of the fields that this field depends on.

Returns
- Vector of required fields
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().

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::GranularField::setGranularFieldPostProcesser ( agxModel::GranularFieldPostProcessor *  pp)
inherited

Set GranularFieldPostProcessor.

Parameters
pp- Set the granularFieldPostProcessor for this granularField
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

agx::Vector<agx::Real> agxModel::GranularField::m_field
protectedinherited

Definition at line 132 of file GranularFields.h.

agx::Vec4u agxModel::GranularField::m_fieldShape
protectedinherited

Definition at line 131 of file GranularFields.h.

Mutex agx::Referenced::m_mutex
mutableprotectedinherited

Definition at line 240 of file Referenced.h.

agx::String agxModel::GranularField::m_name
protectedinherited

Definition at line 134 of file GranularFields.h.

ObserverContainer agx::Referenced::m_observers
mutableprotectedinherited

Definition at line 239 of file Referenced.h.

AtomicValue agx::Referenced::m_refCount
mutableprotectedinherited

Definition at line 241 of file Referenced.h.

agx::Vector<agx::String> agxModel::GranularField::m_requiredFields
protectedinherited

Definition at line 133 of file GranularFields.h.


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