AGX Dynamics  2.37.2.0
agxModel::TerrainDataInterface Class Reference

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...
 

Protected Attributes

SizeTVector m_avalancheHeatMap
 
agx::RealVector m_compression
 
agx::Real m_depthForMaxCompression
 
agx::RigidBodyRefVector m_dynamicHeightFieldParticles
 
ConstMaterialRefVector m_externalMaterialsInteractingWithParticles
 
agx::RealVector m_externalMaterialSurfaceViscosity
 
ImpactVolumeDataRefVector m_impactVolumeDataStorage
 
SizeTConstMaterialRefPairTable m_indexToMaterial
 
agx::Real m_inverseFrictionMultiplier
 
SizeTVector m_materialIndexMap
 
agx::RealVector m_materialIndexToDeformability
 
agx::RealVector m_materialIndexToTanOfAngleOfRepose
 
bool m_materialsAreDirty
 
agx::Real m_maxCompressionMultiplier
 
agx::Real m_maxYoungsChangePerTimestepPOW2
 
size_t m_numberOfUsedImpactVolumes
 
size_t m_numberOfUsedParticles
 
agx::FrictionModel::SolveType m_particleFrictionSolveType
 
size_t m_resolutionX
 
size_t m_resolutionY
 
agx::Real m_shovelGroundCuttingForce
 
- Protected Attributes inherited from agx::Referenced
Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Detailed Description

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:

  • Mapping all gridpoints to a pair of agx::Material. The first material in the material pair is for the Terrain and second is for the particles created at a position on the Terrain. The difference between the materials is the adhesion value.
  • Mapping all grid points to a deformability value. A value describing how fast a material becomes harder due to deformation.
  • Storage of deformation at each grid point.

User may set:

  • The MaxYoungsChangePerTimestep. At big penetrations, we don't want large deformations. This is a value determining the maximum number of times the ground can become harder(youngs modulus), during one timestep.
  • The ShovelFrictionMultiplier. When a shovel is cutting through the terrain, the friction is measured using the friction coefficient from the shovel/Terrain contact material, and a normal force found from the penetration depth, youngs modulus and adhesion. This multiplier could tweak that value, for wanted behavior.
  • Materials as ExternalMaterialsInteractingWithParticles. For example wheel-particle interaction could is something of low interest. Then, by adding the wheel material as an external material interacting with particles, we get iterative friction, and less time in the solver. The bucket/shovel-material maybe also could be added, but that means there is possible penetration through the bucket/shovel. But by making the shovel geometries thick, that might be avoided.

Definition at line 122 of file TerrainDataInterface.h.

Constructor & Destructor Documentation

◆ TerrainDataInterface() [1/2]

agxModel::TerrainDataInterface::TerrainDataInterface ( const agxCollide::HeightField *  heightField,
const agx::Material *  defaultTerrainMaterial = nullptr 
)
Parameters
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.

◆ TerrainDataInterface() [2/2]

agxModel::TerrainDataInterface::TerrainDataInterface ( )
protected

◆ ~TerrainDataInterface()

virtual agxModel::TerrainDataInterface::~TerrainDataInterface ( )
protectedvirtual

Member Function Documentation

◆ add()

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.

Parameters
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)

◆ addExternalMaterial()

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.

◆ allocateDynamicHeightFieldParticles()

void agxModel::TerrainDataInterface::allocateDynamicHeightFieldParticles ( Terrain *  terrain)
protected

◆ calculateContactMaterialProperties()

virtual const agx::FrictionModel* agxModel::TerrainDataInterface::calculateContactMaterialProperties ( ConstContactMaterialVector &  contactMaterials,
agx::ContactMaterial &  newCM,
const agx::Real  totalYoungsModulus 
)
protectedvirtual

Uses all found contactMaterials for a geometry contact, and creates a temporary contact material.

Parameters
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)
Returns
the first found FrictionModel held by any of the contactMaterials.

◆ calculateSurfaceViscosity()

agx::Real agxModel::TerrainDataInterface::calculateSurfaceViscosity ( agx::Real  frictionCoefficient)
protected

◆ calculateYoungsModulus()

virtual agx::Real agxModel::TerrainDataInterface::calculateYoungsModulus ( size_t  x,
size_t  y,
agx::Real  defaultYoungsModulus,
agx::Real  deformability,
agx::Real  localDepth = agx::Real(0) 
) const
virtual

Calculate the YoungsModulus value for a given grid point.

  • If grid point is invalid, the defaultYoungsModulus will be returned
    Parameters
    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
    Returns
    the current YoungsModulus value for the requested grid point.

◆ clearImpactVolumeData()

void agxModel::TerrainDataInterface::clearImpactVolumeData ( )
protected

Resets the number of impactVolumeDatas used.

Pool is still of same size.

◆ collectNearbyVertices()

bool agxModel::TerrainDataInterface::collectNearbyVertices ( const Terrain *  terrain,
ImpactVolumeData &  ivd 
) const
protected

◆ compressionMultiplier()

static agx::Real agxModel::TerrainDataInterface::compressionMultiplier ( agx::Real  deformability,
agx::Real  compression 
)
staticprotected

Calculate a multiplier for how much harder the ground gets given a compression and its deformability.

Parameters
deformability- the local terrain deformability(see terrain.h for definition)
compression- how compressed the ground got (length units).

◆ create() [1/2]

static agxStream::Serializable* agxModel::TerrainDataInterface::create ( )
inlinestatic

Definition at line 358 of file TerrainDataInterface.h.

◆ create() [2/2]

static agxStream::Serializable* agxModel::TerrainDataInterface::create ( agxStream::InputArchive &  )
inlinestatic

Definition at line 358 of file TerrainDataInterface.h.

◆ createContactMaterials()

void agxModel::TerrainDataInterface::createContactMaterials ( agxSDK::Simulation *  simulation,
agx::Real  adhesiveOverlap,
agx::Real  particleYoungsMultiplier 
)
protected

Create contact materials for everything interacting with particles (including particle-particle contact materials) return nullptr if no material was created.

◆ createParticleContactMaterial()

agx::ContactMaterialRef agxModel::TerrainDataInterface::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 
)
protected

◆ createParticleMaterial()

virtual agx::MaterialRef agxModel::TerrainDataInterface::createParticleMaterial ( const agx::Material *  material,
const agx::Real  particleAdhesion 
)
protectedvirtual
Parameters
material- material for Terrain.
particleAdhesion- wanted adhesive force between particles created from Terrain at gridpoint with material.
Returns
- new agx::Material, identical to material, except for the adhesion value

◆ disableDynamicHeightFieldParticles()

void agxModel::TerrainDataInterface::disableDynamicHeightFieldParticles ( size_t  numberOfUsedParticles)
protected

◆ getAvalancheHeatMapSize()

size_t agxModel::TerrainDataInterface::getAvalancheHeatMapSize ( )
protected

◆ getAvalancheHeatMapValue()

size_t agxModel::TerrainDataInterface::getAvalancheHeatMapValue ( const size_t  index)
protected

◆ getClassName()

const char* agxModel::TerrainDataInterface::getClassName ( ) const
inlineoverridevirtual
Returns
the class name of this class.

Reimplemented from agxStream::Serializable.

Definition at line 358 of file TerrainDataInterface.h.

◆ getCompression()

virtual agx::Real agxModel::TerrainDataInterface::getCompression ( size_t  x,
size_t  y 
) const
virtual
Returns
the current deformation at position x,y (length units)

◆ getConstructClassId()

static const char* agxModel::TerrainDataInterface::getConstructClassId ( )
inlinestatic

Definition at line 358 of file TerrainDataInterface.h.

◆ getCoordinates() [1/2]

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)

◆ getCoordinates() [2/2]

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)

◆ getData() [1/2]

bool agxModel::TerrainDataInterface::getData ( const agxModel::Terrain *  terrain,
const agx::Vec3  pos,
ImpactVolumeData &  ivd 
) const
protected

◆ getData() [2/2]

bool agxModel::TerrainDataInterface::getData ( const agxModel::Terrain *  terrain,
const agxCollide::ContactPoint &  cp,
ImpactVolumeData &  ivd 
) const
protected

◆ getDeformability()

agx::Real agxModel::TerrainDataInterface::getDeformability ( const size_t  x,
const size_t  y 
) const
Parameters
x- grid x coordinate
y- grid y coordinate
Returns
deformability at grid point [x,y]

◆ getDepthForMaxCompression()

agx::Real agxModel::TerrainDataInterface::getDepthForMaxCompression ( ) const
Returns
the depth for maximum compression.

◆ getDynamicHeightFieldParticles()

agx::RigidBodyRefVector& agxModel::TerrainDataInterface::getDynamicHeightFieldParticles ( )
protected

◆ getImpactVolumeData()

ImpactVolumeData* agxModel::TerrainDataInterface::getImpactVolumeData ( agxCollide::ContactPoint *  cp,
const Terrain *  terrain 
)
protected

Calculates ImpactVolumeData from a given contact point.

◆ getInverseFrictionMultiplier()

agx::Real agxModel::TerrainDataInterface::getInverseFrictionMultiplier ( ) const

returns the inverse friction multiplier.

◆ getMaterial() [1/2]

const agx::Material* agxModel::TerrainDataInterface::getMaterial ( const size_t  x,
const size_t  y 
) const
Parameters
x- grid x coordinate
y- grid y coordinate
Returns
agx::Material for Terrain at grid point [x,y]

◆ getMaterial() [2/2]

const agx::Material* agxModel::TerrainDataInterface::getMaterial ( const size_t  materialIndex) const
Parameters
materialIndex- the index that maps to the wanted agx::Material for Terrain
Returns
agx::Material for Terrain at grid point with materialIndex

◆ getMaterialIndex()

size_t agxModel::TerrainDataInterface::getMaterialIndex ( const size_t  x,
const size_t  y 
) const
Parameters
x- grid x coordinate
y- grid y coordinate
Returns
material index at coordinates[x,y]

◆ getMaterialIndexBeginIterator()

SizeTConstMaterialRefPairTable::const_iterator agxModel::TerrainDataInterface::getMaterialIndexBeginIterator ( ) const

Returns begin iterator to the materials on this terrain.

◆ getMaterialIndexEndIterator()

SizeTConstMaterialRefPairTable::const_iterator agxModel::TerrainDataInterface::getMaterialIndexEndIterator ( ) const

Returns end iterator to the materials on this terrain.

◆ getMaterialsAreDirty()

bool agxModel::TerrainDataInterface::getMaterialsAreDirty ( ) const
protected

returns true if DEFORMABILITY or YOUNGS_SCALER has been set

◆ getMaxCompressionMultiplier()

agx::Real agxModel::TerrainDataInterface::getMaxCompressionMultiplier ( ) const
Returns
how much harder than default Young's modulus the ground can get by being compressed?

◆ getNumberOfVertices()

size_t agxModel::TerrainDataInterface::getNumberOfVertices ( ) const
Returns
the Number of grid points for the TerrainData

◆ getParticle()

agx::RigidBody* agxModel::TerrainDataInterface::getParticle ( )
protected

◆ getParticleFrictionSolveType()

agx::FrictionModel::SolveType agxModel::TerrainDataInterface::getParticleFrictionSolveType ( ) const
Returns
the solve type of the particles when they interact with each other.

◆ getParticleMaterial() [1/2]

const agx::Material* agxModel::TerrainDataInterface::getParticleMaterial ( const size_t  x,
const size_t  y 
) const
Parameters
x- grid x coordinate
y- grid y coordinate
Returns
agx::Material for particle to be created at grid point [x,y]

◆ getParticleMaterial() [2/2]

const agx::Material* agxModel::TerrainDataInterface::getParticleMaterial ( const size_t  materialIndex) const
Parameters
materialIndex- the index that maps to the wanted agx::Material for particles
Returns
agx::Material for particle to be created at grid point with materialIndex

◆ getPossibleCompression()

agx::Real agxModel::TerrainDataInterface::getPossibleCompression ( agx::Real  deformability,
agx::Real  oldCompression,
agx::Real  maxYoungsMultiplier 
)
Parameters
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.
Returns
calculated value (in length units) of how much the ground could be compressed at a certain vertex.

◆ getResolutionX()

size_t agxModel::TerrainDataInterface::getResolutionX ( ) const
Returns
the resolution in X of the TerrainData

◆ getResolutionY()

size_t agxModel::TerrainDataInterface::getResolutionY ( ) const
Returns
the resolution in Y of the TerrainData

◆ getShovelGroundCuttingForce()

agx::Real agxModel::TerrainDataInterface::getShovelGroundCuttingForce ( ) const
Returns
the ShovelGroundCuttingForce

◆ getStorageAgent()

agxStream::StorageAgent* agxModel::TerrainDataInterface::getStorageAgent ( ) const
inlineoverridevirtual
Returns
the storage agent

Implements agxStream::Serializable.

Definition at line 358 of file TerrainDataInterface.h.

◆ getTanOfTheAngleOfRepose()

agx::Real agxModel::TerrainDataInterface::getTanOfTheAngleOfRepose ( const size_t  x,
const size_t  y 
) const
Parameters
x- grid x coordinate
y- grid y coordinate
Returns
angle of repose at grid point [x,y]

◆ getTriangleIndexPoints()

bool agxModel::TerrainDataInterface::getTriangleIndexPoints ( const Terrain *  terrain,
const agx::Vec3  point,
ImpactVolumeData &  ivd 
) const
protected

◆ getVectorIndex()

size_t agxModel::TerrainDataInterface::getVectorIndex ( size_t  x,
size_t  y 
) const
Returns
an array index given two grid coordinates.

◆ hasParticles()

bool agxModel::TerrainDataInterface::hasParticles ( )
protected

◆ isValid()

bool agxModel::TerrainDataInterface::isValid ( ) const
Returns
true if resolution is != 0.

◆ regretParticleFromBack()

void agxModel::TerrainDataInterface::regretParticleFromBack ( size_t  indexFromBack)
protected

◆ remove()

void agxModel::TerrainDataInterface::remove ( const agx::Material *  material)

Removes a material from the terrain.

◆ removeExistingParticleParticleContactMaterials()

void agxModel::TerrainDataInterface::removeExistingParticleParticleContactMaterials ( agxSDK::Simulation *  simulation)
protected

Clear existing contact materials created for particles.

◆ restore()

virtual void agxModel::TerrainDataInterface::restore ( agxStream::InputArchive &  in)
overridevirtual

◆ scaleDeformation()

virtual agx::Real agxModel::TerrainDataInterface::scaleDeformation ( agx::Real  lastDeformation,
agx::Real  deformability 
) const
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

Parameters
lastDeformation- the deformation due to geometry overlap
deformability- the deformability value for the vertex with the geometry overlap
Returns
- the scaled deformation value

◆ setCompression() [1/2]

virtual void agxModel::TerrainDataInterface::setCompression ( size_t  x,
size_t  y,
const agx::Real  val 
)
virtual

Set the compression at a specified grid point (x,y)

Parameters
x,ycoordinates of grid point
val- New value to be set at specified grid point.

◆ setCompression() [2/2]

void agxModel::TerrainDataInterface::setCompression ( agx::Real  val)
protected

Set the deformation at all grid points.

Parameters
val- New value to be set at specified grid point.

◆ setDepthForMaxCompression()

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

◆ setInverseFrictionMultiplier()

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.

◆ setMaterialMapping() [1/2]

virtual void agxModel::TerrainDataInterface::setMaterialMapping ( const std::string &  filePath)
virtual

Maps materials to grid points.

Sets values between 0 and MAX_NUMBER_MATERIALS to all grid points

Parameters
filePath- path to .PNG file

◆ setMaterialMapping() [2/2]

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

Parameters
x- x position in height field.
y- y position in height field.
materialIndex- index of material in m_indexToMaterial hash table.

◆ setMaxCompressionMultiplier()

void agxModel::TerrainDataInterface::setMaxCompressionMultiplier ( agx::Real  maxCompressionMultiplier)

Set how much harder than default Young's modulus the ground can get by being compressed?

Parameters
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)

◆ setMaxYoungsChangePerTimestep()

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.

Parameters
maxScaleOfYoungsOneTimestep- the number of times youngs modulus can increase during one timestep

◆ setParticleFrictionSolveType()

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)

◆ setShovelGroundCuttingForce()

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.

◆ store()

virtual void agxModel::TerrainDataInterface::store ( agxStream::OutputArchive &  out) const
overridevirtual

◆ tickDownAvalancheHeatMap()

void agxModel::TerrainDataInterface::tickDownAvalancheHeatMap ( )
protected

integrate heat map

◆ updateAvalanceHeatMap() [1/2]

void agxModel::TerrainDataInterface::updateAvalanceHeatMap ( const size_t  vectorIndex,
const size_t  value 
)
protected

Set the number of time steps left for avalanches at a vertex.

Parameters
vectorIndex- index for vertex
value- the number of time steps left for triggering an avalanche

◆ updateAvalanceHeatMap() [2/2]

void agxModel::TerrainDataInterface::updateAvalanceHeatMap ( const size_t  x,
const size_t  y,
const size_t  value 
)
protected

◆ updateCompression()

void agxModel::TerrainDataInterface::updateCompression ( size_t  x,
size_t  y,
agx::Real  deltaDiggingHeightShrink,
agx::Real  compressionFromOverlap 
)
protected
Parameters
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.

Member Data Documentation

◆ m_avalancheHeatMap

SizeTVector agxModel::TerrainDataInterface::m_avalancheHeatMap
protected

Definition at line 489 of file TerrainDataInterface.h.

◆ m_compression

agx::RealVector agxModel::TerrainDataInterface::m_compression
protected

Definition at line 487 of file TerrainDataInterface.h.

◆ m_depthForMaxCompression

agx::Real agxModel::TerrainDataInterface::m_depthForMaxCompression
protected

Definition at line 510 of file TerrainDataInterface.h.

◆ m_dynamicHeightFieldParticles

agx::RigidBodyRefVector agxModel::TerrainDataInterface::m_dynamicHeightFieldParticles
protected

Definition at line 490 of file TerrainDataInterface.h.

◆ m_externalMaterialsInteractingWithParticles

ConstMaterialRefVector agxModel::TerrainDataInterface::m_externalMaterialsInteractingWithParticles
protected

Definition at line 514 of file TerrainDataInterface.h.

◆ m_externalMaterialSurfaceViscosity

agx::RealVector agxModel::TerrainDataInterface::m_externalMaterialSurfaceViscosity
protected

Definition at line 515 of file TerrainDataInterface.h.

◆ m_impactVolumeDataStorage

ImpactVolumeDataRefVector agxModel::TerrainDataInterface::m_impactVolumeDataStorage
protected

Definition at line 485 of file TerrainDataInterface.h.

◆ m_indexToMaterial

SizeTConstMaterialRefPairTable agxModel::TerrainDataInterface::m_indexToMaterial
protected

Definition at line 512 of file TerrainDataInterface.h.

◆ m_inverseFrictionMultiplier

agx::Real agxModel::TerrainDataInterface::m_inverseFrictionMultiplier
protected

Definition at line 506 of file TerrainDataInterface.h.

◆ m_materialIndexMap

SizeTVector agxModel::TerrainDataInterface::m_materialIndexMap
protected

Definition at line 488 of file TerrainDataInterface.h.

◆ m_materialIndexToDeformability

agx::RealVector agxModel::TerrainDataInterface::m_materialIndexToDeformability
protected

Definition at line 517 of file TerrainDataInterface.h.

◆ m_materialIndexToTanOfAngleOfRepose

agx::RealVector agxModel::TerrainDataInterface::m_materialIndexToTanOfAngleOfRepose
protected

Definition at line 518 of file TerrainDataInterface.h.

◆ m_materialsAreDirty

bool agxModel::TerrainDataInterface::m_materialsAreDirty
protected

Definition at line 502 of file TerrainDataInterface.h.

◆ m_maxCompressionMultiplier

agx::Real agxModel::TerrainDataInterface::m_maxCompressionMultiplier
protected

Definition at line 508 of file TerrainDataInterface.h.

◆ m_maxYoungsChangePerTimestepPOW2

agx::Real agxModel::TerrainDataInterface::m_maxYoungsChangePerTimestepPOW2
protected

Definition at line 499 of file TerrainDataInterface.h.

◆ m_numberOfUsedImpactVolumes

size_t agxModel::TerrainDataInterface::m_numberOfUsedImpactVolumes
protected

Definition at line 494 of file TerrainDataInterface.h.

◆ m_numberOfUsedParticles

size_t agxModel::TerrainDataInterface::m_numberOfUsedParticles
protected

Definition at line 492 of file TerrainDataInterface.h.

◆ m_particleFrictionSolveType

agx::FrictionModel::SolveType agxModel::TerrainDataInterface::m_particleFrictionSolveType
protected

Definition at line 504 of file TerrainDataInterface.h.

◆ m_resolutionX

size_t agxModel::TerrainDataInterface::m_resolutionX
protected

Definition at line 496 of file TerrainDataInterface.h.

◆ m_resolutionY

size_t agxModel::TerrainDataInterface::m_resolutionY
protected

Definition at line 497 of file TerrainDataInterface.h.

◆ m_shovelGroundCuttingForce

agx::Real agxModel::TerrainDataInterface::m_shovelGroundCuttingForce
protected

Definition at line 500 of file TerrainDataInterface.h.


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