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

Storage that holds data needed for added mass calculations. More...

#include <AddedMassDb.h>

+ Inheritance diagram for agxModel::AddedMassStorage:

Classes

struct  Report
 Report from creation, store and restore. More...
 

Public Types

typedef agx::UInt32 Identifier
 
typedef agx::VectorPOD< agx::Vec6 > NormalTangentContainer
 
typedef agxModel::dense::Vector Phi
 
typedef agx::Vector< Phi > PhiContainer
 

Public Member Functions

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
 
agxModel::AddedMassStorage::Report create (const agxCollide::Mesh *mesh, const agx::Vec3 &localCenterOfMassPosition)
 Create/calculate data given mesh and center of mass position given in mesh coordinate frame. More...
 
agx::Bool equals (const agxModel::AddedMassStorage *other, agx::Real threshold=agx::Real(0)) const
 Mostly for debug purposes. More...
 
const
agxModel::AddedMassStorage::PhiContainer & 
getFlowData () const
 
agxModel::AddedMassStorage::Identifier getIdentifier () const
 
const
agxModel::AddedMassStorage::NormalTangentContainer & 
getNormalTangentData () const
 
int getReferenceCount () const
 
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...
 
agxModel::AddedMassStorage::Report restore (agxStream::StorageStream &str)
 Restore data from stream. More...
 
agxModel::AddedMassStorage::Report store (agxStream::StorageStream &str) const
 Store data to stream. 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

static
agxModel::AddedMassStorage::Identifier 
createIdentifier (const agx::String &name)
 Creates an identifier given name (normally path + filename) used to identify added mass storages. More...
 
static agx::Bool isValid (agxModel::AddedMassStorage::Identifier id)
 
template<typename T >
static bool ValidateCast (const Referenced *object)
 

Protected Member Functions

 AddedMassStorage (agxModel::AddedMassStorage::Identifier identifier)
 Construct given identifier. More...
 
virtual ~AddedMassStorage ()
 Reference counted object, protected destructor. More...
 
void allocate (agx::UInt numElements)
 Allocate internal structure given the number of elements (triangles). More...
 
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

Storage that holds data needed for added mass calculations.

Definition at line 38 of file AddedMassDb.h.

Member Typedef Documentation

Constructor & Destructor Documentation

agxModel::AddedMassStorage::AddedMassStorage ( agxModel::AddedMassStorage::Identifier  identifier)
protected

Construct given identifier.

virtual agxModel::AddedMassStorage::~AddedMassStorage ( )
protectedvirtual

Reference counted object, protected destructor.

Member Function Documentation

void agxModel::AddedMassStorage::allocate ( agx::UInt  numElements)
protected

Allocate internal structure given the number of elements (triangles).

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
agxModel::AddedMassStorage::Report agxModel::AddedMassStorage::create ( const agxCollide::Mesh *  mesh,
const agx::Vec3 &  localCenterOfMassPosition 
)

Create/calculate data given mesh and center of mass position given in mesh coordinate frame.

static agxModel::AddedMassStorage::Identifier agxModel::AddedMassStorage::createIdentifier ( const agx::String &  name)
static

Creates an identifier given name (normally path + filename) used to identify added mass storages.

void agx::Referenced::deleteUsingDeleteHandler ( ) const
protectedinherited
agx::Bool agxModel::AddedMassStorage::equals ( const agxModel::AddedMassStorage *  other,
agx::Real  threshold = agx::Real(0) 
) const

Mostly for debug purposes.

Check if two storages are identical.

static DeleteHandler* agx::Referenced::getDeleteHandler ( )
staticprotectedinherited
Returns
a DeleteHandler.
const agxModel::AddedMassStorage::PhiContainer& agxModel::AddedMassStorage::getFlowData ( ) const
Returns
the flow data, empty if not loaded
agxModel::AddedMassStorage::Identifier agxModel::AddedMassStorage::getIdentifier ( ) const
Returns
the identifier of this storage
const agxModel::AddedMassStorage::NormalTangentContainer& agxModel::AddedMassStorage::getNormalTangentData ( ) const
Returns
normal-tangent data, empty if not loaded
int agx::Referenced::getReferenceCount ( ) const
inherited
Returns
the number pointers currently referencing this object.
template<typename T >
bool agx::Referenced::is ( ) const
inherited
static agx::Bool agxModel::AddedMassStorage::isValid ( agxModel::AddedMassStorage::Identifier  id)
static
Returns
true if the identifier is valid
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().

agxModel::AddedMassStorage::Report agxModel::AddedMassStorage::restore ( agxStream::StorageStream &  str)

Restore data from stream.

static void agx::Referenced::setDeleteHandler ( DeleteHandler *  handler)
staticprotectedinherited

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

agxModel::AddedMassStorage::Report agxModel::AddedMassStorage::store ( agxStream::StorageStream &  str) const

Store data to stream.

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.

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: