|
AGX Dynamics 2.41.1.2
|
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 Member Functions | |
| MaterialManager () | |
| Default constructor. | |
| bool | add (agx::ContactMaterial *contactMaterial) |
| Add explicit contact material to this manager. | |
| bool | add (agx::Material *material) |
| Add material to this manager. | |
| const agx::ContactMaterial * | getContactMaterial (agx::Physics::MaterialPtr material1, agx::Physics::MaterialPtr material2) const |
| Returns an implicit or explicit contact material if it exists. | |
| const agx::ContactMaterial * | getContactMaterial (const agx::Material *material1, const agx::Material *material2) const |
| Returns an implicit or explicit contact material if it exists. | |
| const MaterialSPairContactMaterialRefTable & | getContactMaterials () const |
| agxData::EntityStorage * | getContactMaterialStorage () |
| agx::ContactMaterialPtrVector | getContactMaterialVector () const |
| This method will create and return new vector with all ContactMaterials. | |
| const agx::Material * | getDefaultMaterial () 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. | |
| agx::ContactMaterial * | getOrCreateContactMaterial (const agx::Material *material1, const agx::Material *material2) |
| Returns or creates an explicit contact material. | |
| agx::ContactMaterial * | getOrCreateContactMaterial (const agxCollide::GeometryContact *geometryContact) |
| Not part of the public API. | |
| bool | hasMaterialsWithContactReduction () const |
| bool | remove (agx::ContactMaterial *contactMaterial) |
| Remove explicit contact material from this manager. | |
| bool | remove (agx::Material *material) |
| Remove material from this manager. | |
| void | restore (const MaterialManagerSerializer &mgr) |
| Restores necessary internal structures. | |
| bool | setContactMaterial (agxCollide::LocalGeometryContact *localGeometryContact) |
| Assigns contact material to a local geometry contact. | |
| void | store (agxStream::OutputArchive &out) const |
| Saves necessary internal structures. | |
Public Member Functions inherited from agx::Component | |
| Component (const agx::Name &name=agx::Name(), agx::Model *model=agx::Component::ClassModel(), agx::Device *device=nullptr) | |
| virtual void | addObject (agx::Object *object, bool assignContext=true) |
| Add an object to the component. | |
| virtual String | autoComplete (const String &partialName, StringVector &matchingNames) const |
| virtual void | buildNavigationTree (agxJson::Value &eNode) const override |
| void | configure (Model *model) |
| virtual void | configure (TiXmlElement *eComponent) override |
| agx::Device * | getDevice () |
| template<typename T > | |
| T * | getDevice () |
| const agx::Device * | getDevice () const |
| template<typename T > | |
| const T * | getDevice () const |
| size_t | getNumObjects (const agx::Name &name) 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 |
| agx::Object * | getObject (const agx::Name &name, size_t index=0) |
| template<typename T > | |
| T * | getObject (const agx::Name &name, size_t index=0) |
| const agx::Object * | getObject (const agx::Name &name, size_t index=0) const |
| 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 |
| virtual Object * | getResourceImpl (const Path &path, agx::Model *model) override |
| virtual void | printSubtree () const override |
| void | printSubtree (std::ostream &stream, int depth=0) const |
| virtual void | rebind () override |
| void | removeAllObjects () |
| Remove all components. | |
| virtual void | removeObject (agx::Object *object) |
| Remove an object from the component. | |
| void | removeObject (const agx::Name &name, size_t index=0) |
| Remove an object with a specified name (and optional index) from the component. | |
| virtual void | snapshot (TiXmlNode *eParent, const String &directory) const override |
| void | traverse (ComponentVisitor *) |
| void | traverse (const TraverseCallback &callback) |
Public Member Functions inherited from agx::Object | |
| Object (const Name &name=Name(), Model *model=Object::ClassModel()) | |
| void | addListener (EventListener *listener) |
| virtual void | buildNavigationTree (agxJson::Value &eNode) const |
| virtual void | configure (TiXmlElement *) |
| agx::String | fullName () const |
| agx::String | fullPath () const |
| agx::String | fullPath (const agx::Object *root) const |
| template<typename T > | |
| T * | getAutoScopedResource (const agx::Path &path) |
| template<typename T > | |
| const T * | getAutoScopedResource (const agx::Path &path) 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 |
| agx::Object * | getContext () |
| template<typename T > | |
| T * | getContext () |
| const agx::Object * | getContext () const |
| template<typename T > | |
| const T * | getContext () const |
| agx::UInt32 | getId () const |
| const agx::Name & | getImplementationName () const |
| agx::Model * | getModel () |
| const agx::Model * | getModel () const |
| const agx::Name & | getName () const |
| agx::Object * | getNextSibling () |
| const agx::Object * | getNextSibling () const |
| agx::Path | getPath () const |
| agx::Path | getPath (const agx::Object *root) const |
| template<typename T > | |
| T * | getResource (const agx::Path &path) |
| template<typename T > | |
| const T * | getResource (const agx::Path &path) 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 |
| virtual agx::Object * | getResourceImpl (const agx::Path &path, agx::Model *model) |
| agx::Object * | getRootContext () |
| const agx::Object * | getRootContext () const |
| bool | hasListener (EventListener *listener) |
| bool | hasParent (const agx::Object *node) const |
| bool | isUnique () const |
| virtual void | printSubtree () const |
| virtual void | rebind () |
| void | removeListener (EventListener *listener) |
| virtual void | save (TiXmlElement *) const |
| virtual void | setContext (agx::Object *context) |
| void | setId (UInt32 id) |
| void | setModel (agx::Model *model) |
| Set the object model (handled automatically). | |
| void | setName (const agx::Name &name) |
| Set the name of the object. | |
| virtual void | snapshot (TiXmlNode *, const String &) const |
Public Member Functions inherited from agx::Referenced | |
| Referenced () | |
| Default constructor. | |
| Referenced (const Referenced &) | |
| template<typename T > | |
| T * | as () |
| Subclass casting. | |
| template<typename T > | |
| const T * | as () const |
| template<typename T > | |
| T * | asSafe () |
| Safe subclass casting, return nullptr if template type does not match. | |
| template<typename T > | |
| const T * | asSafe () const |
| int | getReferenceCount () const |
| template<typename T > | |
| bool | is () const |
| Subclass test. | |
| Referenced & | operator= (const Referenced &) |
| Assignment operator. Will increment the number of references to the referenced object. | |
| void | reference (void *ptr=nullptr) const |
| Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it. | |
| void | unreference (void *ptr=nullptr) const |
| Decrement the reference count by one, indicating that a pointer to this object is referencing it. | |
| void | unreference_nodelete () const |
| Decrement the reference count by one, indicating that a pointer to this object is referencing it. | |
Static Public Member Functions | |
| static void | calculateContactMaterial (agx::ContactMaterial *contactMaterial) |
| Static method to calculate the parameters in a contact material given the two materials assigned to it. | |
| static agx::Model * | ClassModel () |
Static Public Member Functions inherited from agx::Component | |
| static Component * | _load (TiXmlElement *eComponent, Device *device) |
| static agx::Model * | ClassModel () |
| static Component * | load (const Path &path, const Name &implementation, Device *device, const Path &_namespace=Path()) |
| 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 (TiXmlElement *eComponent, Device *device) |
Static Public Member Functions inherited from agx::Object | |
| 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. | |
| static Object * | load (const String &path, Device *device, const String &type, const String &attribute, const String &value) |
| template<typename T > | |
| static T * | load (const String &path, Device *device, const String &type, const String &attribute, const String &value) |
| static Object * | load (const String &path, Device *device, const String &type="", size_t instance=0) |
| template<typename T > | |
| static T * | load (const String &path, Device *device, const String &type="", size_t instance=0) |
| static void | load (const String &path, Device *device, ObjectPtrVector &loadedObjects) |
| static Object * | load (TiXmlElement *eObject, Device *device) |
| template<typename T > | |
| static T * | load (TiXmlElement *eObject, Device *device) |
| static TiXmlDocument | openDocument (const String &path) |
| static void | setEnableRebind (bool flag) |
| Sets if rebinding of objects should be allowed (Right now a global setting). | |
Static Public Member Functions inherited from agx::Referenced | |
| template<typename T > | |
| static bool | ValidateCast (const Referenced *object) |
Protected Member Functions | |
| virtual | ~MaterialManager () |
| Destructor. | |
| void | clear () |
| Clears all internal structures. | |
| 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. | |
| bool | loadLibraryContactMaterial (const agx::Material *material1, const agx::Material *material2, agx::ContactMaterial *contactMaterial) |
| Try to load the Library ContactMaterial for the pair (material1, material2) and fill in the settings in the provided contactMaterial. | |
| void | resetDirtyMaterials () const |
| Updates implicit contact materials containing at least one dirty material. | |
| void | updateContactMaterials (const agxCollide::GeometryContactPtrVector &geometryContacts) |
| Updates implicit, dirty, materials that are currently used. | |
Protected Member Functions inherited from agx::Component | |
| virtual | ~Component () |
| String | expandAutoCompletionMatch (const String &query, const StringVector &matchingNames) const |
| void | setDevice (Device *device) |
Protected Member Functions inherited from agx::Object | |
| virtual | ~Object () |
Protected Member Functions inherited from agx::Referenced | |
| virtual | ~Referenced () |
| Destructor. | |
| void | allocateObserverVector () const |
| void | deleteUsingDeleteHandler () const |
Additional Inherited Members | |
Public Types inherited from agx::Component | |
| typedef Event2< Component *, Object * > | ObjectEvent |
| Event when adding removing child objects. | |
| typedef Callback1< Object * > | TraverseCallback |
Public Types inherited from agx::Object | |
| typedef agx::observer_ptr< const Event > | EventConstObserver |
| typedef agx::ref_ptr< const Event > | EventConstRef |
| typedef agx::observer_ptr< Event > | EventObserver |
| typedef agx::Vector< EventObserver > | EventObserverVector |
| typedef agx::VectorPOD< Event * > | EventPtrVector |
| typedef agx::ref_ptr< Event > | EventRef |
| typedef agx::Vector< EventRef > | EventRefVector |
Public Attributes inherited from agx::Component | |
| ObjectEvent | addObjectEvent |
| ObjectEvent | removeObjectEvent |
Static Protected Member Functions inherited from agx::Referenced | |
| static DeleteHandler * | getDeleteHandler () |
| static void | setDeleteHandler (DeleteHandler *handler) |
| Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to. | |
Protected Attributes inherited from agx::Referenced | |
| Mutex | m_mutex |
| 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 49 of file MaterialManager.h.
| agxSDK::MaterialManager::MaterialManager | ( | ) |
Default constructor.
|
protectedvirtual |
Destructor.
Reference counted so protected.
| 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 |
| 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 |
|
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.
|
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 317 of file MaterialManager.h.
References getContactMaterial(), getDefaultMaterial(), and agx::Physics::MaterialPtr::model().
| 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().
| const MaterialSPairContactMaterialRefTable & agxSDK::MaterialManager::getContactMaterials | ( | ) | const |
|
inline |
Definition at line 312 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
|
inline |
Definition at line 307 of file MaterialManager.h.
References agx::Material::getDefaultMaterial().
Referenced by getContactMaterial(), and getSymmetricPair().
| 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
| 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.
|
protected |
Definition at line 322 of file MaterialManager.h.
References agxAssert, getDefaultMaterial(), agx::ContactMaterial::getMaterial1(), and agx::ContactMaterial::getMaterial2().
|
protected |
Definition at line 330 of file MaterialManager.h.
References getDefaultMaterial().
| bool agxSDK::MaterialManager::hasMaterialsWithContactReduction | ( | ) | const |
|
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.
|
protected |
Try to load the Library ContactMaterial for the pair (material1, material2) and fill in the settings in the provided contactMaterial.
Return true if successful.
| bool agxSDK::MaterialManager::remove | ( | agx::ContactMaterial * | contactMaterial | ) |
Remove explicit contact material from this manager.
| contactMaterial | - contact material to remove |
| bool agxSDK::MaterialManager::remove | ( | agx::Material * | material | ) |
Remove material from this manager.
| material | - material to remove |
|
protected |
Updates implicit contact materials containing at least one dirty material.
| void agxSDK::MaterialManager::restore | ( | const MaterialManagerSerializer & | mgr | ) |
Restores necessary internal structures.
| 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 |
| void agxSDK::MaterialManager::store | ( | agxStream::OutputArchive & | out | ) | const |
Saves necessary internal structures.
|
protected |
Updates implicit, dirty, materials that are currently used.