|
AGXDynamics
2.31.1.0
|
Simulation unique manager that handles logics around and parameters in contact materials given two agx::Materials. More...
#include <MaterialManager.h>
Inheritance diagram for agxSDK::MaterialManager:Classes | |
| class | MaterialManagerSerializer |
| Internal class for store/restore of MaterialManager. More... | |
Public Types | |
| typedef agx::observer_ptr < const Event > | EventConstObserver |
| typedef agx::ref_ptr< const Event > | EventConstRef |
| typedef agx::observer_ptr< Event > | EventObserver |
| typedef agx::ref_ptr< Event > | EventRef |
| typedef Event2< Component *, Object * > | ObjectEvent |
| Event when adding removing child objects. More... | |
| typedef Callback1< Object * > | TraverseCallback |
Public Member Functions | |
| MaterialManager () | |
| Default constructor. More... | |
| bool | add (agx::Material *material) |
| Add material to this manager. More... | |
| bool | add (agx::ContactMaterial *contactMaterial) |
| Add explicit contact material to this manager. More... | |
| void | addListener (EventListener *listener) |
| virtual void | addObject (agx::Object *object, bool assignContext=true) |
| Add an object to the component. More... | |
| AGX_DECLARE_VECTOR_TYPES (Event) | |
| 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 String | autoComplete (const String &partialName, StringVector &matchingNames) const |
| virtual void | buildNavigationTree (agxJson::Value &eNode) const override |
| virtual void | configure (TiXmlElement *eComponent) override |
| void | configure (Model *model) |
| agx::String | fullName () const |
| agx::String | fullPath () const |
| agx::String | fullPath (const agx::Object *root) const |
| agx::Object * | getAutoScopedResource (const agx::Path &path, agx::Model *model=nullptr) |
| const agx::Object * | getAutoScopedResource (const agx::Path &path, agx::Model *model=nullptr) const |
| template<typename T > | |
| T * | getAutoScopedResource (const agx::Path &path) |
| template<typename T > | |
| const T * | getAutoScopedResource (const agx::Path &path) const |
| const agx::ContactMaterial * | getContactMaterial (const agx::Material *material1, const agx::Material *material2) const |
| Returns an implicit or explicit contact material if it exists. More... | |
| const agx::ContactMaterial * | getContactMaterial (agx::Physics::MaterialPtr material1, agx::Physics::MaterialPtr material2) const |
| Returns an implicit or explicit contact material if it exists. More... | |
| const MaterialSPairContactMaterialRefTable & | getContactMaterials () const |
| agxData::EntityStorage * | getContactMaterialStorage () |
| agx::ContactMaterialPtrVector | getContactMaterialVector () const |
| This method will create and return new vector with all ContactMaterials. More... | |
| agx::Object * | getContext () |
| const agx::Object * | getContext () const |
| template<typename T > | |
| T * | getContext () |
| template<typename T > | |
| const T * | getContext () const |
| const agx::Material * | getDefaultMaterial () const |
| agx::Device * | getDevice () |
| const agx::Device * | getDevice () const |
| template<typename T > | |
| T * | getDevice () |
| template<typename T > | |
| const T * | getDevice () const |
| agx::UInt32 | getId () const |
| const agx::Name & | getImplementationName () const |
| agx::Material * | getMaterial (const agx::String &name) |
| const agx::Material * | getMaterial (const agx::String &name) const |
| agx::Material * | getMaterial (const agx::Uuid &uuid) |
| const StringMaterialRefTable & | getMaterials () const |
| agx::MaterialPtrVector | getMaterialVector () const |
| This method will create and return new vector with all materials. More... | |
| agx::Model * | getModel () |
| const agx::Model * | getModel () const |
| const agx::Name & | getName () const |
| agx::Object * | getNextSibling () |
| const agx::Object * | getNextSibling () const |
| size_t | getNumObjects (const agx::Name &name) const |
| agx::Object * | getObject (const agx::Name &name, size_t index=0) |
| const agx::Object * | getObject (const agx::Name &name, size_t index=0) const |
| agx::Object * | getObject (const agx::Name &name, agx::Model *model, size_t index=0) |
| const agx::Object * | getObject (const agx::Name &name, agx::Model *model, size_t index=0) const |
| template<typename T > | |
| T * | getObject (const agx::Name &name, size_t index=0) |
| template<typename T > | |
| const T * | getObject (const agx::Name &name, size_t index=0) const |
| const agx::ObjectRefVector & | getObjects () const |
| template<typename T > | |
| void | getObjects (agx::ObjectPtrVector &result, bool recursive=false) const |
| void | getObjects (agx::ObjectPtrVector &result, const agx::Model *model, bool recursive=false) const |
| template<typename T > | |
| void | getObjects (ObjectPtrVector &result, bool recursive) const |
| agx::ContactMaterial * | getOrCreateContactMaterial (const agx::Material *material1, const agx::Material *material2) |
| Returns or creates an explicit contact material. More... | |
| agx::ContactMaterial * | getOrCreateContactMaterial (const agxCollide::GeometryContact *geometryContact) |
| Not part of the public API. More... | |
| agx::Path | getPath () const |
| agx::Path | getPath (const agx::Object *root) const |
| int | getReferenceCount () const |
| agx::Object * | getResource (const agx::Path &path, agx::Model *model=nullptr) |
| const agx::Object * | getResource (const agx::Path &path, agx::Model *model=nullptr) const |
| template<typename T > | |
| T * | getResource (const agx::Path &path) |
| template<typename T > | |
| const T * | getResource (const agx::Path &path) const |
| virtual Object * | getResourceImpl (const Path &path, agx::Model *model) override |
| agx::Object * | getRootContext () |
| const agx::Object * | getRootContext () const |
| bool | hasListener (EventListener *listener) |
| bool | hasMaterialsWithContactReduction () const |
| bool | hasParent (const agx::Object *node) const |
| template<typename T > | |
| bool | is () const |
| Subclass test. More... | |
| bool | isUnique () const |
| virtual void | printSubtree () const override |
| void | printSubtree (std::ostream &stream, int depth=0) const |
| virtual void | rebind () override |
| 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 | remove (agx::Material *material) |
| Remove material from this manager. More... | |
| bool | remove (agx::ContactMaterial *contactMaterial) |
| Remove explicit contact material from this manager. More... | |
| void | removeAllObjects () |
| Remove all components. More... | |
| void | removeListener (EventListener *listener) |
| virtual void | removeObject (agx::Object *object) |
| Remove an object from the component. More... | |
| void | removeObject (const agx::Name &name, size_t index=0) |
| Remove an object with a specified name (and optional index) from the component. More... | |
| void | restore (const MaterialManagerSerializer &mgr) |
| Restores necessary internal structures. More... | |
| virtual void | save (TiXmlElement *) const |
| bool | setContactMaterial (agxCollide::LocalGeometryContact *localGeometryContact) |
| Assigns contact material to a local geometry contact. More... | |
| virtual void | setContext (agx::Object *context) |
| void | setId (UInt32 id) |
| void | setModel (agx::Model *model) |
| Set the object model (handled automatically). More... | |
| void | setName (const agx::Name &name) |
| Set the name of the object. More... | |
| virtual void | snapshot (TiXmlNode *eParent, const String &directory) const override |
| void | store (agxStream::OutputArchive &out) const |
| Saves necessary internal structures. More... | |
| void | traverse (const TraverseCallback &callback) |
| void | traverse (ComponentVisitor *) |
| 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 Component * | _load (TiXmlElement *eComponent, Device *device) |
| static void | calculateContactMaterial (agx::ContactMaterial *contactMaterial) |
| Static method to calculate the parameters in a contact material given the two materials assigned to it. More... | |
| static agx::Model * | ClassModel () |
| static agx::String | generateName (const agx::String &bindPath) |
| static const HashSet< Object * > & | getActiveObjects () |
| static bool | getEnableRebind () |
| Should rebinding be allowed? Right now a global setting. More... | |
| static Component * | load (const String &path, const Path &_namespace=Path()) |
| static Component * | load (const String &path, Device *device, const Path &_namespace=Path()) |
| static Component * | load (const Path &path, const Name &implementation, Device *device, const Path &_namespace=Path()) |
| static Component * | load (TiXmlElement *eComponent, Device *device) |
| static Object * | load (const String &path, Device *device, const String &type="", size_t instance=0) |
| static Object * | load (const String &path, Device *device, const String &type, const String &attribute, const String &value) |
| static void | load (const String &path, Device *device, ObjectPtrVector &loadedObjects) |
| static TiXmlDocument | openDocument (const String &path) |
| static void | setEnableRebind (bool flag) |
| Sets if rebinding of objects should be allowed (Right now a global setting). More... | |
| template<typename T > | |
| static bool | ValidateCast (const Referenced *object) |
Public Attributes | |
| ObjectEvent | addObjectEvent |
| ObjectEvent | removeObjectEvent |
Protected Member Functions | |
| virtual | ~MaterialManager () |
| Destructor. More... | |
| void | allocateObserverVector () const |
| void | clear () |
| Clears all internal structures. More... | |
| void | deleteUsingDeleteHandler () const |
| String | expandAutoCompletionMatch (const String &query, const StringVector &matchingNames) const |
| SymmetricMaterialPair | getSymmetricPair (const agx::ContactMaterial *contactMaterial) const |
| SymmetricMaterialPair | getSymmetricPair (const agx::Material *material1, const agx::Material *material2) const |
| void | initializeNewGeometryContacts (const agxCollide::GeometryContactPtrVector &geometryContacts) |
| For any geometry contact where the contact material is zero, this method performs getOrCreateContactMaterial and assigns it. More... | |
| void | resetDirtyMaterials () const |
| Updates implicit contact materials containing at least one dirty material. More... | |
| void | setDevice (Device *device) |
| void | updateContactMaterials (const agxCollide::GeometryContactPtrVector &geometryContacts) |
| Updates implicit, dirty, materials that are currently used. More... | |
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 | |
| ObserverContainer | m_observers |
| AtomicValue | m_refCount |
Simulation unique manager that handles logics around and parameters in contact materials given two agx::Materials.
Definition at line 50 of file MaterialManager.h.
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
Event when adding removing child objects.
NOTE: Events are triggered recursively up the parent structure Example: B is added to root node A, one event is triggered (A.addObjectEvent(A, B)). Then when C is added to B two events are triggered (B.addObjectEvent(B, C), and A.addObjectEvent(B,C))
Definition at line 61 of file Component.h.
|
inherited |
Definition at line 141 of file Component.h.
| agxSDK::MaterialManager::MaterialManager | ( | ) |
Default constructor.
|
protectedvirtual |
Destructor.
Reference counted so protected.
|
staticinherited |
| bool agxSDK::MaterialManager::add | ( | agx::Material * | material | ) |
Add material to this manager.
If a material with the same name already exists, it will return false.
| material | - the material to add |
| bool agxSDK::MaterialManager::add | ( | agx::ContactMaterial * | contactMaterial | ) |
Add explicit contact material to this manager.
This method adds all geometry materials in the contact material that aren't present in this manager.
If an explicit contact material with the same two materials already exists, the old explicit contact material will be overwritten.
The two materials defining this contact material can never trigger a recalculation of the values stored in this contact material. The ones specified will always be used.
| contactMaterial | - the contact material to add |
|
inherited |
|
virtualinherited |
Add an object to the component.
| object | The object to be added |
| assignContext | True if the child get the component as the context, set to false to allow 'weak' coupled children |
|
inherited |
|
protectedinherited |
|
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().
|
inherited |
|
inherited |
Safe subclass casting, return nullptr if template type does not match.
Referenced by agxUtil::CollectBodiesAndWiresVisitor::visit().
|
inherited |
|
virtualinherited |
Reimplemented in agx::Namespace.
|
overridevirtualinherited |
Reimplemented from agx::Object.
Reimplemented in agxData::Buffer, and agx::Model.
|
static |
Static method to calculate the parameters in a contact material given the two materials assigned to it.
| contactMaterial | - contact material to fill with values (getMaterial1() and getMaterial2() will be used) |
|
static |
|
protected |
Clears all internal structures.
|
overridevirtualinherited |
Reimplemented from agx::Object.
Reimplemented in agx::Clock, agx::Task, agx::Kernel, agx::UnresolvedTask, and agx::Clock.
|
protectedinherited |
|
protectedinherited |
|
inherited |
Referenced by agx::ScalarParameter::get(), agx::ArrayParameter::get(), agxData::Buffer::getArray(), and agxData::Buffer::getElement().
|
inherited |
|
inherited |
|
staticinherited |
|
staticinherited |
|
inherited |
Referenced by agx::Object::getAutoScopedResource().
|
inherited |
|
inherited |
Definition at line 428 of file Object.h.
References agx::Object::getAutoScopedResource(), and agx::Referenced::is().
|
inherited |
| const agx::ContactMaterial* agxSDK::MaterialManager::getContactMaterial | ( | const agx::Material * | material1, |
| const agx::Material * | material2 | ||
| ) | const |
Returns an implicit or explicit contact material if it exists.
When the contact material can be implicit, it's not defined to change any parameters in the contact material. I.e., this is the current version of the contact material.
| material1 | - first material, if nullptr the default material will be used |
| material2 | - second material, if nullptr the default material will be used |
Referenced by getContactMaterial().
|
inline |
Returns an implicit or explicit contact material if it exists.
When the contact material can be implicit, it's not defined to change any parameters in the contact material. I.e., this is the current version of the contact material.
| material1 | - first material, if nullptr the default material will be used |
| material2 | - second material, if nullptr the default material will be used |
Definition at line 311 of file MaterialManager.h.
References getContactMaterial(), getDefaultMaterial(), and agx::Physics::MaterialPtr::model().
| const MaterialSPairContactMaterialRefTable& agxSDK::MaterialManager::getContactMaterials | ( | ) | const |
|
inline |
Definition at line 306 of file MaterialManager.h.
| agx::ContactMaterialPtrVector agxSDK::MaterialManager::getContactMaterialVector | ( | ) | const |
This method will create and return new vector with all ContactMaterials.
This is raw pointers to ContactMaterial objects, so if they are unreferenced (for example if someone removes it from the simulation), the pointer might be invalidated
|
inherited |
Definition at line 373 of file Object.h.
Referenced by agxData::Value::get(), and agx::Model::getNamespace().
|
inherited |
|
inherited |
|
inline |
Definition at line 301 of file MaterialManager.h.
References agx::Material::getDefaultMaterial().
Referenced by getContactMaterial(), and getSymmetricPair().
|
staticprotectedinherited |
|
inherited |
Definition at line 222 of file Component.h.
Referenced by agx::Component::getDevice().
|
inherited |
Definition at line 223 of file Component.h.
References agx::Component::getDevice().
|
inherited |
|
inherited |
|
staticinherited |
Should rebinding be allowed? Right now a global setting.
|
inherited |
Definition at line 370 of file Object.h.
Referenced by agxData::EntityStorage::indexToId().
|
inherited |
| agx::Material* agxSDK::MaterialManager::getMaterial | ( | const agx::String & | name | ) |
| const agx::Material* agxSDK::MaterialManager::getMaterial | ( | const agx::String & | name | ) | const |
| agx::Material* agxSDK::MaterialManager::getMaterial | ( | const agx::Uuid & | uuid | ) |
| const StringMaterialRefTable& agxSDK::MaterialManager::getMaterials | ( | ) | const |
| agx::MaterialPtrVector agxSDK::MaterialManager::getMaterialVector | ( | ) | const |
This method will create and return new vector with all materials.
This is raw pointers to materials, so if they are unreferenced (for example if someone removes it from the simulation), the pointer might be invalidated
|
inherited |
|
inherited |
Definition at line 369 of file Object.h.
Referenced by agxData::Value::get(), agxData::EntityStorage::get(), agxData::FormatBinding< T >::getFormat(), and agxData::EntityPtr::operator()().
|
inherited |
|
inherited |
|
inherited |
|
inherited |
Definition at line 194 of file Component.h.
Referenced by agxData::EntityPtr::operator()().
|
inherited |
Definition at line 195 of file Component.h.
|
inherited |
Definition at line 197 of file Component.h.
|
inherited |
Definition at line 198 of file Component.h.
|
inherited |
|
inherited |
|
inherited |
Definition at line 192 of file Component.h.
Referenced by agx::Component::getObjects().
|
inherited |
|
inherited |
|
inherited |
Definition at line 241 of file Component.h.
References agx::Component::getObjects().
| agx::ContactMaterial* agxSDK::MaterialManager::getOrCreateContactMaterial | ( | const agx::Material * | material1, |
| const agx::Material * | material2 | ||
| ) |
Returns or creates an explicit contact material.
If material1 or material2 are changed after this contact material has been created, no recalculations of the contact material will be made.
| material1 | - first material, if nullptr the default material will be used |
| material2 | - second material, if nullptr the default material will be used |
| agx::ContactMaterial* agxSDK::MaterialManager::getOrCreateContactMaterial | ( | const agxCollide::GeometryContact * | geometryContact | ) |
Not part of the public API.
This method can create implicit contact materials if no explicit is present.
|
inherited |
Referenced by agxData::EntityStorage::dereferenceMultipliedAttribute(), agx::ScalarParameter::get(), agx::ArrayParameter::get(), agx::PointerParameter::get(), agxData::EntityInstance::verifyIndex(), and agxData::EntityPtr::verifyIndex().
|
inherited |
| root | A node along the parent path from this object. |
|
inherited |
|
inherited |
Referenced by agx::Object::getResource().
|
inherited |
|
inherited |
Definition at line 414 of file Object.h.
References agx::Object::getResource(), and agx::Referenced::is().
|
inherited |
|
overridevirtualinherited |
Reimplemented from agx::Object.
Reimplemented in agx::Task, and agxData::EntityStorage.
|
inherited |
|
inherited |
|
protected |
Definition at line 316 of file MaterialManager.h.
References agxAssert, getDefaultMaterial(), agx::ContactMaterial::getMaterial1(), and agx::ContactMaterial::getMaterial2().
|
protected |
Definition at line 324 of file MaterialManager.h.
References getDefaultMaterial().
|
inherited |
| bool agxSDK::MaterialManager::hasMaterialsWithContactReduction | ( | ) | const |
|
inherited |
|
protected |
For any geometry contact where the contact material is zero, this method performs getOrCreateContactMaterial and assigns it.
Note that this method doesn't updates dirty implicit materials, it only makes sure GeometryContact::m_material != nullptr. This method should be called after narrow phase update.
|
inherited |
Subclass test.
Referenced by agx::Object::getAutoScopedResource(), agxData::Buffer::getElement(), and agx::Object::getResource().
|
staticinherited |
|
staticinherited |
|
staticinherited |
|
staticinherited |
|
staticinherited |
Definition at line 379 of file Object.h.
References agx::Object::load().
|
staticinherited |
Definition at line 386 of file Object.h.
References agx::Object::load().
|
staticinherited |
|
staticinherited |
|
overridevirtualinherited |
Reimplemented from agx::Object.
|
inherited |
|
overridevirtualinherited |
Reimplemented from agx::Object.
Reimplemented in agx::Task, and agx::Clock.
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 agxSDK::MaterialManager::remove | ( | agx::Material * | material | ) |
Remove material from this manager.
| material | - material to remove |
| bool agxSDK::MaterialManager::remove | ( | agx::ContactMaterial * | contactMaterial | ) |
Remove explicit contact material from this manager.
| contactMaterial | - contact material to remove |
|
inherited |
Remove all components.
|
inherited |
|
virtualinherited |
Remove an object from the component.
Remove an object with a specified name (and optional index) from the component.
|
protected |
Updates implicit contact materials containing at least one dirty material.
| void agxSDK::MaterialManager::restore | ( | const MaterialManagerSerializer & | mgr | ) |
Restores necessary internal structures.
|
inlinevirtualinherited |
Reimplemented in agx::Clock.
| bool agxSDK::MaterialManager::setContactMaterial | ( | agxCollide::LocalGeometryContact * | localGeometryContact | ) |
Assigns contact material to a local geometry contact.
This contact material can be either implicit or explicit.
| localGeometryContact | - local geometry contact to assign contact material to |
|
virtualinherited |
Reimplemented in agx::Task, and agxData::FunctionValue.
|
staticprotectedinherited |
Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.
|
staticinherited |
Sets if rebinding of objects should be allowed (Right now a global setting).
Allowing it when adding larger parts to the system tree might hit performance, so it might be smarter to disable it first, then add, and then enable again.
|
inherited |
Set the object model (handled automatically).
|
overridevirtualinherited |
Reimplemented from agx::Object.
| void agxSDK::MaterialManager::store | ( | agxStream::OutputArchive & | out | ) | const |
Saves necessary internal structures.
|
inherited |
|
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.
|
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.
|
protected |
Updates implicit, dirty, materials that are currently used.
|
staticinherited |
|
inherited |
Definition at line 63 of file Component.h.
|
mutableprotectedinherited |
Definition at line 239 of file Referenced.h.
|
mutableprotectedinherited |
Definition at line 241 of file Referenced.h.
|
inherited |
Definition at line 64 of file Component.h.