|
AGX Dynamics
2.37.3.2
|
This class implements an interface for how the terrain accesses the data it needs to access data items for each grid point of the terrain. More...
#include <TerrainDataInterface.h>
Inheritance diagram for agxModel::TerrainDataInterface:Public Member Functions | |
| TerrainDataInterface (const agxCollide::HeightField *heightField, const agx::Material *defaultTerrainMaterial=nullptr) | |
| void | add (const agx::Material *material, const size_t materialIndex, const agx::Real particleAdhesion=agx::Real(0), const agx::Real deformability=agx::Real(0), agx::Real angleOfRepose=agx::Real(0)) |
| Adds a material to the terrain. More... | |
| void | addExternalMaterial (agx::Material *material, agx::Real surfaceViscosity=agx::Real(1E-3)) |
| Add an external material to the terrain. More... | |
| virtual agx::Real | calculateYoungsModulus (size_t x, size_t y, agx::Real defaultYoungsModulus, agx::Real deformability, agx::Real localDepth=agx::Real(0)) const |
| Calculate the YoungsModulus value for a given grid point. More... | |
| const char * | getClassName () const override |
| virtual agx::Real | getCompression (size_t x, size_t y) const |
| void | getCoordinates (size_t i, size_t &x, size_t &y) const |
| Get the x,y coordinate of the i:th point in the grid (starting from 0,0) More... | |
| void | getCoordinates (size_t i, int &x, int &y) const |
| Get the x,y coordinate of the i:th point in the grid (starting from 0,0) More... | |
| agx::Real | getDeformability (const size_t x, const size_t y) const |
| agx::Real | getDepthForMaxCompression () const |
| agx::Real | getInverseFrictionMultiplier () const |
| returns the inverse friction multiplier. More... | |
| const agx::Material * | getMaterial (const size_t x, const size_t y) const |
| const agx::Material * | getMaterial (const size_t materialIndex) const |
| size_t | getMaterialIndex (const size_t x, const size_t y) const |
| SizeTConstMaterialRefPairTable::const_iterator | getMaterialIndexBeginIterator () const |
| Returns begin iterator to the materials on this terrain. More... | |
| SizeTConstMaterialRefPairTable::const_iterator | getMaterialIndexEndIterator () const |
| Returns end iterator to the materials on this terrain. More... | |
| agx::Real | getMaxCompressionMultiplier () const |
| size_t | getNumberOfVertices () const |
| agx::FrictionModel::SolveType | getParticleFrictionSolveType () const |
| const agx::Material * | getParticleMaterial (const size_t x, const size_t y) const |
| const agx::Material * | getParticleMaterial (const size_t materialIndex) const |
| agx::Real | getPossibleCompression (agx::Real deformability, agx::Real oldCompression, agx::Real maxYoungsMultiplier) |
| size_t | getResolutionX () const |
| size_t | getResolutionY () const |
| agx::Real | getShovelGroundCuttingForce () const |
| agxStream::StorageAgent * | getStorageAgent () const override |
| agx::Real | getTanOfTheAngleOfRepose (const size_t x, const size_t y) const |
| size_t | getVectorIndex (size_t x, size_t y) const |
| bool | isValid () const |
| void | remove (const agx::Material *material) |
| Removes a material from the terrain. More... | |
| virtual void | restore (agxStream::InputArchive &in) override |
| virtual void | setCompression (size_t x, size_t y, const agx::Real val) |
| Set the compression at a specified grid point (x,y) More... | |
| void | setDepthForMaxCompression (agx::Real depthForMaxCompression) |
| Set the depth for maximum compression. More... | |
| void | setInverseFrictionMultiplier (agx::Real inverseFrictionMultiplier) |
| Set the inverse friction multiplier. More... | |
| virtual void | setMaterialMapping (const std::string &filePath) |
| Maps materials to grid points. More... | |
| void | setMaterialMapping (const size_t x, const size_t y, const size_t materialIndex) |
| Maps materials to grid points. More... | |
| void | setMaxCompressionMultiplier (agx::Real maxCompressionMultiplier) |
| Set how much harder than default Young's modulus the ground can get by being compressed? More... | |
| void | setMaxYoungsChangePerTimestep (agx::Real maxScaleOfYoungsOneTimestep) |
| Due to high velocities we may have deep Terrain penetrations. More... | |
| void | setParticleFrictionSolveType (agx::FrictionModel::SolveType solveType) |
| Set the solve type of the particles when they interact with each other. More... | |
| void | setShovelGroundCuttingForce (agx::Real force) |
| When a shovel is cutting through the terrain, the user has the ability to set a minimum force that is needed to cut through the ground. More... | |
| virtual void | store (agxStream::OutputArchive &out) const override |
Public Member Functions inherited from agx::Referenced | |
| Referenced () | |
| Default constructor. More... | |
| Referenced (const Referenced &) | |
| 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 |
| int | getReferenceCount () const |
| template<typename T > | |
| bool | is () const |
| Subclass test. More... | |
| Referenced & | operator= (const Referenced &) |
| Assignment operator. Will increment the number of references to the referenced object. 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 | 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... | |
Public Member Functions inherited from agxStream::Serializable | |
| virtual | ~Serializable () |
| Destructor for normal C++ use but hidden from SWIG bindings. More... | |
| bool | getEnableSerialization () const |
| bool | getEnableUuidGeneration () |
| agx::UInt32 | getIndex () const |
| This index is given at creation of this object. More... | |
| agx::Uuid | getUuid () const |
| bool | isFinished () const |
| void | setEnableSerialization (bool flag) |
| Set to false to disable serialization of this object. More... | |
| void | setFinished () |
| Tells this class that it is restored correctly and should not be deleted during destruction of an Archive. More... | |
| void | setUuid (const agx::Uuid &uuid) |
| Explicitly set a Uuid on a serializable object. More... | |
Static Public Member Functions | |
| static agxStream::Serializable * | create () |
| static agxStream::Serializable * | create (agxStream::InputArchive &) |
| static const char * | getConstructClassId () |
Static Public Member Functions inherited from agx::Referenced | |
| template<typename T > | |
| static bool | ValidateCast (const Referenced *object) |
Static Public Member Functions inherited from agxStream::Serializable | |
| static void | setEnableUuidGeneration (bool flag) |
| Specify if there should be UUID:s generated for each new Serializable object. By default it is enabled. More... | |
Protected Member Functions | |
| TerrainDataInterface () | |
| virtual | ~TerrainDataInterface () |
| void | allocateDynamicHeightFieldParticles (Terrain *terrain) |
| virtual const agx::FrictionModel * | calculateContactMaterialProperties (ConstContactMaterialVector &contactMaterials, agx::ContactMaterial &newCM, const agx::Real totalYoungsModulus) |
| Uses all found contactMaterials for a geometry contact, and creates a temporary contact material. More... | |
| agx::Real | calculateSurfaceViscosity (agx::Real frictionCoefficient) |
| void | clearImpactVolumeData () |
| Resets the number of impactVolumeDatas used. More... | |
| bool | collectNearbyVertices (const Terrain *terrain, ImpactVolumeData &ivd) const |
| void | createContactMaterials (agxSDK::Simulation *simulation, agx::Real adhesiveOverlap, agx::Real particleYoungsMultiplier) |
| Create contact materials for everything interacting with particles (including particle-particle contact materials) return nullptr if no material was created. More... | |
| agx::ContactMaterialRef | createParticleContactMaterial (agxSDK::Simulation *simulation, const agx::Material *mat1, const agx::Material *mat2, const bool adhesiveForce, agx::Real adhesiveOverlap, agx::Real youngsParticleMultiplier, agx::Real surfaceViscosity=agx::Real(0), agx::FrictionModel::SolveType frictionSolveType=agx::FrictionModel::SPLIT) |
| virtual agx::MaterialRef | createParticleMaterial (const agx::Material *material, const agx::Real particleAdhesion) |
| void | disableDynamicHeightFieldParticles (size_t numberOfUsedParticles) |
| size_t | getAvalancheHeatMapSize () |
| size_t | getAvalancheHeatMapValue (const size_t index) |
| bool | getData (const agxModel::Terrain *terrain, const agx::Vec3 pos, ImpactVolumeData &ivd) const |
| bool | getData (const agxModel::Terrain *terrain, const agxCollide::ContactPoint &cp, ImpactVolumeData &ivd) const |
| agx::RigidBodyRefVector & | getDynamicHeightFieldParticles () |
| ImpactVolumeData * | getImpactVolumeData (agxCollide::ContactPoint *cp, const Terrain *terrain) |
| Calculates ImpactVolumeData from a given contact point. More... | |
| bool | getMaterialsAreDirty () const |
| returns true if DEFORMABILITY or YOUNGS_SCALER has been set More... | |
| agx::RigidBody * | getParticle () |
| bool | getTriangleIndexPoints (const Terrain *terrain, const agx::Vec3 point, ImpactVolumeData &ivd) const |
| bool | hasParticles () |
| void | regretParticleFromBack (size_t indexFromBack) |
| void | removeExistingParticleParticleContactMaterials (agxSDK::Simulation *simulation) |
| Clear existing contact materials created for particles. More... | |
| virtual agx::Real | scaleDeformation (agx::Real lastDeformation, agx::Real deformability) const |
| 2^( 1 + lastDeformation * deformability ) = newYoungs / lastYoungs we have set maxvalue of RHS More... | |
| void | setCompression (agx::Real val) |
| Set the deformation at all grid points. More... | |
| void | tickDownAvalancheHeatMap () |
| integrate heat map More... | |
| void | updateAvalanceHeatMap (const size_t vectorIndex, const size_t value) |
| Set the number of time steps left for avalanches at a vertex. More... | |
| void | updateAvalanceHeatMap (const size_t x, const size_t y, const size_t value) |
| void | updateCompression (size_t x, size_t y, agx::Real deltaDiggingHeightShrink, agx::Real compressionFromOverlap) |
Protected Member Functions inherited from agx::Referenced | |
| virtual | ~Referenced () |
| Destructor. More... | |
| void | allocateObserverVector () const |
| void | deleteUsingDeleteHandler () const |
Protected Member Functions inherited from agxStream::Serializable | |
| Serializable () | |
| Default constructor. More... | |
| Serializable (const Serializable &other) | |
| Copy constructor. More... | |
| void | generateUuid () |
Static Protected Member Functions | |
| static agx::Real | compressionMultiplier (agx::Real deformability, agx::Real compression) |
| Calculate a multiplier for how much harder the ground gets given a compression and its deformability. More... | |
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. More... | |
This class implements an interface for how the terrain accesses the data it needs to access data items for each grid point of the terrain.
This class is responsible for holding and allowing a Terrain to access data for writing and reading.
It holds data for:
User may set:
Definition at line 122 of file TerrainDataInterface.h.
| agxModel::TerrainDataInterface::TerrainDataInterface | ( | const agxCollide::HeightField * | heightField, |
| const agx::Material * | defaultTerrainMaterial = nullptr |
||
| ) |
| heightField | - size of this will give the internal data structures a correct size. |
| defaultTerrainMaterial | - If there are grid points which the user has not given any material, they will get this material. |
|
protected |
|
protectedvirtual |
| void agxModel::TerrainDataInterface::add | ( | const agx::Material * | material, |
| const size_t | materialIndex, | ||
| const agx::Real | particleAdhesion = agx::Real(0), |
||
| const agx::Real | deformability = agx::Real(0), |
||
| agx::Real | angleOfRepose = agx::Real(0) |
||
| ) |
Adds a material to the terrain.
| material | - a material for a positions at the Terrain |
| materialIndex | - will map all grid points in the materialIndexMap with this positive integer to material |
| particleAdhesion | - the adhesion between particles created at the grid points with materialIndex |
| deformability | - agxData::Value of how fast the terrain gets harder at grid points with materialIndex |
| angleOfRepose | - the angle of repose of the material. (for piles for example), compressed ground has larger angle (scaled linearly with hardness from compression, and wetness of material) |
| void agxModel::TerrainDataInterface::addExternalMaterial | ( | agx::Material * | material, |
| agx::Real | surfaceViscosity = agx::Real(1E-3) |
||
| ) |
Add an external material to the terrain.
(Make terrain know about it) Add those materials that will collide with particles. These materials will have solve type SPLIT against particles created by digging in the terrain. For all materials not added, the contact material between them and the particles created by the terrain will be implicit, and very soft.
|
protected |
|
protectedvirtual |
Uses all found contactMaterials for a geometry contact, and creates a temporary contact material.
| contactMaterials | - vector containing all found contact materials (usually for a set of contact points) |
| newCM | - a temporary contact material (with isInternal == true) to modify. |
| totalYoungsModulus | - the total sum of all Young's modulus at the very same contact points where we found the contact materials. But the values summed up is found using calculateYoungsModulus() (above) |
|
protected |
|
virtual |
Calculate the YoungsModulus value for a given grid point.
| x,y | - Coordinate of grid point |
| defaultYoungsModulus | - the value of Young's modulus, if the ground was not deformed |
| deformability | - value of how fast the ground gets harder |
|
protected |
Resets the number of impactVolumeDatas used.
Pool is still of same size.
|
protected |
|
staticprotected |
Calculate a multiplier for how much harder the ground gets given a compression and its deformability.
| deformability | - the local terrain deformability(see terrain.h for definition) |
| compression | - how compressed the ground got (length units). |
|
inlinestatic |
Definition at line 358 of file TerrainDataInterface.h.
|
inlinestatic |
Definition at line 358 of file TerrainDataInterface.h.
|
protected |
Create contact materials for everything interacting with particles (including particle-particle contact materials) return nullptr if no material was created.
|
protected |
|
protectedvirtual |
| material | - material for Terrain. |
| particleAdhesion | - wanted adhesive force between particles created from Terrain at gridpoint with material. |
|
protected |
|
protected |
|
protected |
|
inlineoverridevirtual |
Reimplemented from agxStream::Serializable.
Definition at line 358 of file TerrainDataInterface.h.
|
virtual |
|
inlinestatic |
Definition at line 358 of file TerrainDataInterface.h.
| void agxModel::TerrainDataInterface::getCoordinates | ( | size_t | i, |
| size_t & | x, | ||
| size_t & | y | ||
| ) | const |
Get the x,y coordinate of the i:th point in the grid (starting from 0,0)
| void agxModel::TerrainDataInterface::getCoordinates | ( | size_t | i, |
| int & | x, | ||
| int & | y | ||
| ) | const |
Get the x,y coordinate of the i:th point in the grid (starting from 0,0)
|
protected |
|
protected |
| agx::Real agxModel::TerrainDataInterface::getDeformability | ( | const size_t | x, |
| const size_t | y | ||
| ) | const |
| x | - grid x coordinate |
| y | - grid y coordinate |
| agx::Real agxModel::TerrainDataInterface::getDepthForMaxCompression | ( | ) | const |
|
protected |
|
protected |
Calculates ImpactVolumeData from a given contact point.
| agx::Real agxModel::TerrainDataInterface::getInverseFrictionMultiplier | ( | ) | const |
returns the inverse friction multiplier.
| const agx::Material* agxModel::TerrainDataInterface::getMaterial | ( | const size_t | x, |
| const size_t | y | ||
| ) | const |
| x | - grid x coordinate |
| y | - grid y coordinate |
| const agx::Material* agxModel::TerrainDataInterface::getMaterial | ( | const size_t | materialIndex | ) | const |
| materialIndex | - the index that maps to the wanted agx::Material for Terrain |
| size_t agxModel::TerrainDataInterface::getMaterialIndex | ( | const size_t | x, |
| const size_t | y | ||
| ) | const |
| x | - grid x coordinate |
| y | - grid y coordinate |
| SizeTConstMaterialRefPairTable::const_iterator agxModel::TerrainDataInterface::getMaterialIndexBeginIterator | ( | ) | const |
Returns begin iterator to the materials on this terrain.
| SizeTConstMaterialRefPairTable::const_iterator agxModel::TerrainDataInterface::getMaterialIndexEndIterator | ( | ) | const |
Returns end iterator to the materials on this terrain.
|
protected |
returns true if DEFORMABILITY or YOUNGS_SCALER has been set
| agx::Real agxModel::TerrainDataInterface::getMaxCompressionMultiplier | ( | ) | const |
| size_t agxModel::TerrainDataInterface::getNumberOfVertices | ( | ) | const |
|
protected |
| agx::FrictionModel::SolveType agxModel::TerrainDataInterface::getParticleFrictionSolveType | ( | ) | const |
| const agx::Material* agxModel::TerrainDataInterface::getParticleMaterial | ( | const size_t | x, |
| const size_t | y | ||
| ) | const |
| x | - grid x coordinate |
| y | - grid y coordinate |
| const agx::Material* agxModel::TerrainDataInterface::getParticleMaterial | ( | const size_t | materialIndex | ) | const |
| materialIndex | - the index that maps to the wanted agx::Material for particles |
| agx::Real agxModel::TerrainDataInterface::getPossibleCompression | ( | agx::Real | deformability, |
| agx::Real | oldCompression, | ||
| agx::Real | maxYoungsMultiplier | ||
| ) |
| deformability | - value of how easy it is to deform the terrain locally. |
| oldCompression | - the previous compression at that local position. |
| maxYoungsMultiplier | - the maximum number of times harder the ground is allowed to become due to a new impact. |
| size_t agxModel::TerrainDataInterface::getResolutionX | ( | ) | const |
| size_t agxModel::TerrainDataInterface::getResolutionY | ( | ) | const |
| agx::Real agxModel::TerrainDataInterface::getShovelGroundCuttingForce | ( | ) | const |
|
inlineoverridevirtual |
Implements agxStream::Serializable.
Definition at line 358 of file TerrainDataInterface.h.
| agx::Real agxModel::TerrainDataInterface::getTanOfTheAngleOfRepose | ( | const size_t | x, |
| const size_t | y | ||
| ) | const |
| x | - grid x coordinate |
| y | - grid y coordinate |
|
protected |
| size_t agxModel::TerrainDataInterface::getVectorIndex | ( | size_t | x, |
| size_t | y | ||
| ) | const |
|
protected |
| bool agxModel::TerrainDataInterface::isValid | ( | ) | const |
|
protected |
| void agxModel::TerrainDataInterface::remove | ( | const agx::Material * | material | ) |
Removes a material from the terrain.
|
protected |
Clear existing contact materials created for particles.
|
overridevirtual |
|
protectedvirtual |
2^( 1 + lastDeformation * deformability ) = newYoungs / lastYoungs we have set maxvalue of RHS
Scale lastDeformation if necessary. If maxYoungsChange is set to zero, the terrain can't be modified
| lastDeformation | - the deformation due to geometry overlap |
| deformability | - the deformability value for the vertex with the geometry overlap |
|
virtual |
Set the compression at a specified grid point (x,y)
| x,y | coordinates of grid point |
| val | - New value to be set at specified grid point. |
|
protected |
Set the deformation at all grid points.
| val | - New value to be set at specified grid point. |
| void agxModel::TerrainDataInterface::setDepthForMaxCompression | ( | agx::Real | depthForMaxCompression | ) |
Set the depth for maximum compression.
When digging, the ground is more compressed the deeper we get. Here we can set at which depth the ground gets maximum compression
| void agxModel::TerrainDataInterface::setInverseFrictionMultiplier | ( | agx::Real | inverseFrictionMultiplier | ) |
Set the inverse friction multiplier.
(This is only used for directly solved particles). Since the friction coefficient is infinite when using directly solved friction, we scale the viscosity instead. The viscosity has an inverse relation to how large the friction force can get. Setting the inverse friction multiplier to zero will give infinitely dry friction. All other values will give some sort of viscous friction. The higher value the less friction.
|
virtual |
Maps materials to grid points.
Sets values between 0 and MAX_NUMBER_MATERIALS to all grid points
| filePath | - path to .PNG file |
| void agxModel::TerrainDataInterface::setMaterialMapping | ( | const size_t | x, |
| const size_t | y, | ||
| const size_t | materialIndex | ||
| ) |
Maps materials to grid points.
Sets values between 0 and MAX_NUMBER_MATERIALS to all grid points
| x | - x position in height field. |
| y | - y position in height field. |
| materialIndex | - index of material in m_indexToMaterial hash table. |
| void agxModel::TerrainDataInterface::setMaxCompressionMultiplier | ( | agx::Real | maxCompressionMultiplier | ) |
Set how much harder than default Young's modulus the ground can get by being compressed?
| maxCompressionMultiplier | - the number of times harder, must be >= 1 and a multiple of 2.(2,4,8,16,32,64...). Will be clamped to the nearest integer that gives = log2(maxCompressionMultiplier^2) |
| void agxModel::TerrainDataInterface::setMaxYoungsChangePerTimestep | ( | agx::Real | maxScaleOfYoungsOneTimestep | ) |
Due to high velocities we may have deep Terrain penetrations.
The terrain is deformed using the depth of the contacts. We need a rule for how much the terrain can deform during one timestep. Here a maxium value of the increase of stiffness can be set.
| maxScaleOfYoungsOneTimestep | - the number of times youngs modulus can increase during one timestep |
| void agxModel::TerrainDataInterface::setParticleFrictionSolveType | ( | agx::FrictionModel::SolveType | solveType | ) |
Set the solve type of the particles when they interact with each other.
The solveType will define the type that the friction will get between particles. ITERATIVE, SPLIT or DIRECT (default is ITERATIVE)
| void agxModel::TerrainDataInterface::setShovelGroundCuttingForce | ( | agx::Real | force | ) |
When a shovel is cutting through the terrain, the user has the ability to set a minimum force that is needed to cut through the ground.
|
overridevirtual |
|
protected |
integrate heat map
|
protected |
Set the number of time steps left for avalanches at a vertex.
| vectorIndex | - index for vertex |
| value | - the number of time steps left for triggering an avalanche |
|
protected |
|
protected |
| x | - vertex X height field position |
| y | - vertex Y height field position |
| deltaDiggingHeightShrink | - height change due to digging (could be negative, which leads to less compressed ground, when particles merge or soil is pusched TO (x,y) vertex) |
| compressionFromOverlap | - the compression of the geometry impact. |
|
protected |
Definition at line 489 of file TerrainDataInterface.h.
|
protected |
Definition at line 487 of file TerrainDataInterface.h.
|
protected |
Definition at line 510 of file TerrainDataInterface.h.
|
protected |
Definition at line 490 of file TerrainDataInterface.h.
|
protected |
Definition at line 514 of file TerrainDataInterface.h.
|
protected |
Definition at line 515 of file TerrainDataInterface.h.
|
protected |
Definition at line 485 of file TerrainDataInterface.h.
|
protected |
Definition at line 512 of file TerrainDataInterface.h.
|
protected |
Definition at line 506 of file TerrainDataInterface.h.
|
protected |
Definition at line 488 of file TerrainDataInterface.h.
|
protected |
Definition at line 517 of file TerrainDataInterface.h.
|
protected |
Definition at line 518 of file TerrainDataInterface.h.
|
protected |
Definition at line 502 of file TerrainDataInterface.h.
|
protected |
Definition at line 508 of file TerrainDataInterface.h.
|
protected |
Definition at line 499 of file TerrainDataInterface.h.
|
protected |
Definition at line 494 of file TerrainDataInterface.h.
|
protected |
Definition at line 492 of file TerrainDataInterface.h.
|
protected |
Definition at line 504 of file TerrainDataInterface.h.
|
protected |
Definition at line 496 of file TerrainDataInterface.h.
|
protected |
Definition at line 497 of file TerrainDataInterface.h.
|
protected |
Definition at line 500 of file TerrainDataInterface.h.