Description

Collaboration diagram for Utility classes:

Classes

class  chrono::utils::ChConvexHull2D
 Simple 2D convex hull class. More...
 
class  chrono::utils::ChRunningAverage
 Moving average filter for smoothing running data. More...
 
class  chrono::utils::ChMovingAverage
 Moving average filter for smoothing a data array. More...
 
class  chrono::utils::ChAnalogueFilter
 Abstract Base class for simulated analogue filters in the time domain. More...
 
class  chrono::utils::ChParserAdams
 ADAMS input file parser. More...
 
class  chrono::utils::ChParserOpenSim
 OpenSim input file parser. More...
 
class  chrono::utils::MixtureIngredient
 Encapsulation of an ingredient of one of the supported types in a mixture. More...
 
class  chrono::utils::Generator
 Provides functionality for generating sets of bodies with positions drawn from a specified sampler and various mixture properties. More...
 
class  chrono::utils::Sampler< T >
 Base class for different types of point samplers. More...
 
class  chrono::utils::PDGrid< Point >
 Simple 3D grid utility class for use by the Poisson Disk sampler. More...
 
class  chrono::utils::PDSampler< T >
 Sampler for 3D domains (box, sphere, or cylinder) using Poisson Disk Sampling. More...
 
class  chrono::utils::GridSampler< T >
 Sampler for 3D volumes using a regular (equidistant) grid. More...
 
class  chrono::utils::HCPSampler< T >
 Sampler for 3D volumes using a Hexagonally Close Packed structure. More...
 

Macros

#define YY_DECL   int chrono::utils::ChParserAdams::yylex()
 

Enumerations

enum  chrono::utils::MixtureType {
  SPHERE, ELLIPSOID, BOX, CYLINDER,
  CONE, CAPSULE, BISPHERE, ROUNDEDCYLINDER
}
 Enumeration of various geometric shapes available for mixtures.
 
enum  chrono::utils::SamplingType { chrono::utils::SamplingType::REGULAR_GRID, chrono::utils::SamplingType::POISSON_DISK, chrono::utils::SamplingType::HCP_PACK }
 Volumetric sampling method. More...
 

Functions

void chrono::utils::AddSphereGeometry (ChBody *body, double radius, const ChVector<> &pos=ChVector<>(0, 0, 0), const ChQuaternion<> &rot=ChQuaternion<>(1, 0, 0, 0), bool visualization=true)
 Add a sphere collision shape and optionally a corresponding visualization asset to the specified body.
 
void chrono::utils::AddEllipsoidGeometry (ChBody *body, const ChVector<> &size, const ChVector<> &pos=ChVector<>(0, 0, 0), const ChQuaternion<> &rot=ChQuaternion<>(1, 0, 0, 0), bool visualization=true)
 Add an ellipsoid collision shape and optionally a corresponding visualization asset to the specified body.
 
void chrono::utils::AddBoxGeometry (ChBody *body, const ChVector<> &size, const ChVector<> &pos=ChVector<>(0, 0, 0), const ChQuaternion<> &rot=ChQuaternion<>(1, 0, 0, 0), bool visualization=true)
 Add a box collision shape and optionally a corresponding visualization asset to the specified body.
 
void chrono::utils::AddBiSphereGeometry (ChBody *body, double radius, double cDist, const ChVector<> &pos=ChVector<>(0, 0, 0), const ChQuaternion<> &rot=ChQuaternion<>(1, 0, 0, 0), bool visualization=true)
 Add a bisphere collision shape and optionally a corresponding visualization asset to the specified body.
 
void chrono::utils::AddCapsuleGeometry (ChBody *body, double radius, double hlen, const ChVector<> &pos=ChVector<>(0, 0, 0), const ChQuaternion<> &rot=ChQuaternion<>(1, 0, 0, 0), bool visualization=true)
 Add a box capsule shape and optionally a corresponding visualization asset to the specified body.
 
void chrono::utils::AddCylinderGeometry (ChBody *body, double radius, double hlen, const ChVector<> &pos=ChVector<>(0, 0, 0), const ChQuaternion<> &rot=ChQuaternion<>(1, 0, 0, 0), bool visualization=true)
 Add a box cylinder shape and optionally a corresponding visualization asset to the specified body.
 
void chrono::utils::AddConeGeometry (ChBody *body, double radius, double height, const ChVector<> &pos=ChVector<>(0, 0, 0), const ChQuaternion<> &rot=ChQuaternion<>(1, 0, 0, 0), bool visualization=true)
 Add a box cone shape and optionally a corresponding visualization asset to the specified body.
 
void chrono::utils::AddTriangleMeshGeometry (ChBody *body, const std::string &obj_filename, const std::string &name, const ChVector<> &pos=ChVector<>(0, 0, 0), const ChQuaternion<> &rot=ChQuaternion<>(1, 0, 0, 0), bool visualization=true)
 Add a triangular mesh collision shape and optionally a corresponding visualization asset to the specified body.
 
void chrono::utils::AddTriangleMeshConvexDecomposition (ChBody *body, const std::string &obj_filename, const std::string &name, const ChVector<> &pos=ChVector<>(0, 0, 0), const ChQuaternion<> &rot=ChQuaternion<>(1, 0, 0, 0), float skin_thickness=0.0f, bool use_original_asset=true)
 Add convex hull collision shapes and optionally a corresponding visualization asset to the specified body.
 
void chrono::utils::AddTriangleMeshConvexDecompositionV2 (ChBody *body, const std::string &obj_filename, const std::string &name, const ChVector<> &pos=ChVector<>(0, 0, 0), const ChQuaternion<> &rot=ChQuaternion<>(1, 0, 0, 0), bool use_original_asset=true)
 Add convex hull collision shapes and optionally a corresponding visualization asset to the specified body.
 
void chrono::utils::AddTriangleMeshConvexDecompositionSplit (ChSystem *system, const std::string &obj_filename, const std::string &name, const ChVector<> &pos, const ChQuaternion<> &rot, std::shared_ptr< ChMaterialSurfaceNSC > material, double total_mass)
 Add convex hull collision shapes and optionally a corresponding visualization asset to the specified body.
 
void chrono::utils::AddTriangle (ChBody *body, const ChVector<> &vertA, const ChVector<> &vertB, const ChVector<> &vertC, const std::string &name, const ChVector<> &pos=ChVector<>(0, 0, 0), const ChQuaternion<> &rot=ChQuaternion<>(1, 0, 0, 0), bool visualization=true)
 Add a triangle collision shape and optionally a corresponding visualization asset to the specified body.
 
void chrono::utils::AddRoundedBoxGeometry (ChBody *body, const ChVector<> &size, double srad, const ChVector<> &pos=ChVector<>(0, 0, 0), const ChQuaternion<> &rot=ChQuaternion<>(1, 0, 0, 0), bool visualization=true)
 Add a rounded box (sphere-swept box) collision shape and optionally a corresponding visualization asset to the specified body.
 
void chrono::utils::AddRoundedCylinderGeometry (ChBody *body, double radius, double hlen, double srad, const ChVector<> &pos=ChVector<>(0, 0, 0), const ChQuaternion<> &rot=ChQuaternion<>(1, 0, 0, 0), bool visualization=true)
 Add a rounded cylinder (sphere-swept cylinder) collision shape and optionally a corresponding visualization asset to the specified body.
 
void chrono::utils::AddTorusGeometry (ChBody *body, double radius, double thickness, int segments=20, int angle=360, const ChVector<> &pos=ChVector<>(0, 0, 0), const ChQuaternion<> &rot=ChQuaternion<>(1, 0, 0, 0), bool visualization=true)
 Add a torus collision shape (compound object created with capsules) and optionally a corresponding visualization asset to the specified body.
 
std::shared_ptr< ChBodychrono::utils::CreateBoxContainer (ChSystem *system, int id, std::shared_ptr< ChMaterialSurface > mat, const ChVector<> &hdim, double hthick, const ChVector<> &pos=ChVector<>(0, 0, 0), const ChQuaternion<> &rot=ChQuaternion<>(1, 0, 0, 0), bool collide=true, bool y_up=false, bool overlap=true, bool closed=false)
 Create a fixed body with contact and asset geometry representing a box with 5 walls (no top).
 
std::shared_ptr< ChBodychrono::utils::CreateCylindricalContainerFromBoxes (ChSystem *system, int id, std::shared_ptr< ChMaterialSurface > mat, const ChVector<> &hdim, double hthick, int numBoxes, const ChVector<> &pos=ChVector<>(0, 0, 0), const ChQuaternion<> &rot=ChQuaternion<>(1, 0, 0, 0), bool collide=true, bool overlap=true, bool closed=false, bool isBoxBase=true, bool partialVisualization=true)
 Create a cylindrical container body with contact and asset geometry representing a cylindrical container modeled with boxes. More...
 
void chrono::utils::InitializeObject (std::shared_ptr< ChBody > body, double mass, std::shared_ptr< ChMaterialSurface > mat, const ChVector<> &pos, const ChQuaternion<> &rot, bool collide, bool fixed, int collision_family, int do_not_collide_with)
 
void chrono::utils::FinalizeObject (std::shared_ptr< ChBody > body, ChSystem *system)
 
void chrono::utils::LoadConvexMesh (const std::string &file_name, geometry::ChTriangleMeshConnected &convex_mesh, collision::ChConvexDecompositionHACDv2 &convex_shape, const ChVector<> &pos=ChVector<>(0, 0, 0), const ChQuaternion<> &rot=ChQuaternion<>(1, 0, 0, 0), int hacd_maxhullcount=1024, int hacd_maxhullmerge=256, int hacd_maxhullvertexes=64, float hacd_concavity=0.01f, float hacd_smallclusterthreshold=0.0f, float hacd_fusetolerance=1e-6f)
 Load an object from a Wavefront OBJ file and generate its convex decomposition.
 
void chrono::utils::LoadConvexHulls (const std::string &file_name, geometry::ChTriangleMeshConnected &convex_mesh, std::vector< std::vector< ChVector< double > > > &convex_hulls)
 Given a path to an obj file, loads the obj assuming that the individual objects in the obj are convex hulls, useful when loading a precomputed set of convex hulls. More...
 
ChApi void chrono::utils::AddConvexCollisionModel (std::shared_ptr< ChBody > body, std::shared_ptr< geometry::ChTriangleMeshConnected > convex_mesh, collision::ChConvexDecompositionHACDv2 &convex_shape, const ChVector<> &pos=ChVector<>(0, 0, 0), const ChQuaternion<> &rot=ChQuaternion<>(1, 0, 0, 0), bool use_original_asset=true)
 Given a convex mesh and its decomposition add it to a ChBody use_original_asset can be used to specify if the mesh or the convex decomp should be used for visualization.
 
ChApi void chrono::utils::AddConvexCollisionModel (std::shared_ptr< ChBody > body, std::shared_ptr< geometry::ChTriangleMeshConnected > convex_mesh, std::vector< std::vector< ChVector< double > > > &convex_hulls, const ChVector<> &pos=ChVector<>(0, 0, 0), const ChQuaternion<> &rot=ChQuaternion<>(1, 0, 0, 0))
 Add a convex mesh to an object based on a set of points. More...
 
template<typename T >
std::vector< ChVector< T > > chrono::utils::PDLayerSampler_BOX (ChVector< T > center, ChVector< T > hdims, T diam, T padding_factor=1.02, bool verbose=false)
 Poisson Disk sampler for sampling a 3D box in layers. More...
 

Variables

template<class T >
constexpr T chrono::utils::Pi = T(3.1415926535897932385L)
 

Enumeration Type Documentation

◆ SamplingType

Volumetric sampling method.

Enumerator
REGULAR_GRID 

Regular (equidistant) grid.

POISSON_DISK 

Poisson Disk sampling.

HCP_PACK 

Hexagonally Close Packing.

Function Documentation

◆ AddConvexCollisionModel()

ChApi void chrono::utils::AddConvexCollisionModel ( std::shared_ptr< ChBody body,
std::shared_ptr< geometry::ChTriangleMeshConnected convex_mesh,
std::vector< std::vector< ChVector< double > > > &  convex_hulls,
const ChVector<> &  pos = ChVector<>(0, 0, 0),
const ChQuaternion<> &  rot = ChQuaternion<>(1, 0, 0, 0) 
)

Add a convex mesh to an object based on a set of points.

This version will use the triangle mesh to set the visualization geometry.

◆ CreateCylindricalContainerFromBoxes()

ChApi std::shared_ptr< ChBody > chrono::utils::CreateCylindricalContainerFromBoxes ( ChSystem system,
int  id,
std::shared_ptr< ChMaterialSurface mat,
const ChVector<> &  hdim,
double  hthick,
int  numBoxes,
const ChVector<> &  pos = ChVector<>(0, 0, 0),
const ChQuaternion<> &  rot = ChQuaternion<>(1, 0, 0, 0),
bool  collide = true,
bool  overlap = true,
bool  closed = false,
bool  isBoxBase = true,
bool  partialVisualization = true 
)

Create a cylindrical container body with contact and asset geometry representing a cylindrical container modeled with boxes.

The container is aligned with the z direction. The position refers to the center of the bottom inner circle. Only half of the cylinder is visualized.

◆ LoadConvexHulls()

ChApi void chrono::utils::LoadConvexHulls ( const std::string &  file_name,
geometry::ChTriangleMeshConnected convex_mesh,
std::vector< std::vector< ChVector< double > > > &  convex_hulls 
)

Given a path to an obj file, loads the obj assuming that the individual objects in the obj are convex hulls, useful when loading a precomputed set of convex hulls.

The output of this function is used with AddConvexCollisionModel

◆ PDLayerSampler_BOX()

template<typename T >
std::vector<ChVector<T> > chrono::utils::PDLayerSampler_BOX ( ChVector< T >  center,
ChVector< T >  hdims,
diam,
padding_factor = 1.02,
bool  verbose = false 
)

Poisson Disk sampler for sampling a 3D box in layers.

The computational efficiency of PD sampling degrades as points are added, especially for large volumes. This class provides an alternative sampling method where PD sampling is done in 2D layers, separated by a specified distance (padding_factor * diam). This significantly improves computational efficiency of the sampling but at the cost of discarding the PD uniform distribution properties in the direction orthogonal to the layers.

Parameters
centerCenter of axis-aligned box to fill
hdimsHalf-dimensions along the x, y, and z axes
diamParticle diameter
padding_factorMultiplier on particle diameter for spacing
verboseOutput progress during generation