Description

Provides functionality for generating sets of bodies with positions drawn from a specified sampler and various mixture properties.

Bodies can be generated in different bounding volumes (boxes or cylinders) which can be degenerate (to a rectangle or circle, repsectively).

#include <ChUtilsGenerators.h>

Classes

class  CreateObjectsCallback
 Class to be used as a callback interface for user-defined filtering of initial positions. More...
 

Public Types

typedef Types< double >::PointVector PointVector
 

Public Member Functions

 ChGenerator (ChSystem *system)
 
std::shared_ptr< ChMixtureIngredientAddMixtureIngredient (MixtureType type, double ratio)
 Add a new mixture ingredient of the specified type and in the given ratio (note that the ratios are normalized before creating bodies).
 
void SetStartTag (int tag)
 Set the start value for tags assigned to generated bodies (default: 0). More...
 
void CreateObjectsBox (ChSampler< double > &sampler, const ChVector3d &pos, const ChVector3d &hdims, const ChVector3d &vel=ChVector3d(0, 0, 0))
 Create bodies, according to the current mixture setup, with initial positions given by the specified sampler in the box domain specified by 'pos' and 'hdims'. More...
 
void CreateObjectsBox (const ChVector3d &dist, const ChVector3d &pos, const ChVector3d &hdims, const ChVector3d &vel=ChVector3d(0, 0, 0))
 Create bodies, according to the current mixture setup, with initial positions on a uniform grid with given separations (in x,y,z directions) in the box domain specified by 'pos' and 'hdims'. More...
 
void CreateObjectsCylinderX (ChSampler< double > &sampler, const ChVector3d &pos, float radius, float halfHeight, const ChVector3d &vel=ChVector3d(0, 0, 0))
 Create bodies, according to the current mixture setup, with initial positions given by the specified sampler in the X-aligned cylinder domain specified by 'pos', 'radius' and 'halfHeight'. More...
 
void CreateObjectsCylinderY (ChSampler< double > &sampler, const ChVector3d &pos, float radius, float halfHeight, const ChVector3d &vel=ChVector3d(0, 0, 0))
 Create bodies, according to the current mixture setup, with initial positions given by the specified sampler in the Y-aligned cylinder domain specified by 'pos', 'radius' and 'halfHeight'. More...
 
void CreateObjectsCylinderZ (ChSampler< double > &sampler, const ChVector3d &pos, float radius, float halfHeight, const ChVector3d &vel=ChVector3d(0, 0, 0))
 Create bodies, according to the current mixture setup, with initial positions given by the specified sampler in the Z-aligned cylinder domain specified by 'pos', 'radius' and 'halfHeight'. More...
 
void CreateObjectsSphere (ChSampler< double > &sampler, const ChVector3d &pos, float radius, const ChVector3d &vel=ChVector3d(0, 0, 0))
 Create bodies, according to the current mixture setup, with initial positions given by the specified sampler in the spherical domain specified by 'pos' and 'radius'. More...
 
void RegisterCreateObjectsCallback (std::shared_ptr< CreateObjectsCallback > callback)
 Specify a callback object to be used before creating the bodies. More...
 
void writeObjectInfo (const std::string &filename)
 Write information about the bodies created so far to the specified file (CSV format).
 
unsigned int GetTotalNumBodies () const
 
double GetTotalMass () const
 
double GetTotalVolume () const
 

Friends

class ChMixtureIngredient
 

Member Function Documentation

◆ CreateObjectsBox() [1/2]

void chrono::utils::ChGenerator::CreateObjectsBox ( ChSampler< double > &  sampler,
const ChVector3d pos,
const ChVector3d hdims,
const ChVector3d vel = ChVector3d(0, 0, 0) 
)

Create bodies, according to the current mixture setup, with initial positions given by the specified sampler in the box domain specified by 'pos' and 'hdims'.

Optionally, a constant initial linear velocity can be set for all created bodies.

◆ CreateObjectsBox() [2/2]

void chrono::utils::ChGenerator::CreateObjectsBox ( const ChVector3d dist,
const ChVector3d pos,
const ChVector3d hdims,
const ChVector3d vel = ChVector3d(0, 0, 0) 
)

Create bodies, according to the current mixture setup, with initial positions on a uniform grid with given separations (in x,y,z directions) in the box domain specified by 'pos' and 'hdims'.

Optionally, a constant initial linear velocity can be set for all created bodies.

◆ CreateObjectsCylinderX()

void chrono::utils::ChGenerator::CreateObjectsCylinderX ( ChSampler< double > &  sampler,
const ChVector3d pos,
float  radius,
float  halfHeight,
const ChVector3d vel = ChVector3d(0, 0, 0) 
)

Create bodies, according to the current mixture setup, with initial positions given by the specified sampler in the X-aligned cylinder domain specified by 'pos', 'radius' and 'halfHeight'.

Optionally, a constant initial linear velocity can be set for all created bodies.

◆ CreateObjectsCylinderY()

void chrono::utils::ChGenerator::CreateObjectsCylinderY ( ChSampler< double > &  sampler,
const ChVector3d pos,
float  radius,
float  halfHeight,
const ChVector3d vel = ChVector3d(0, 0, 0) 
)

Create bodies, according to the current mixture setup, with initial positions given by the specified sampler in the Y-aligned cylinder domain specified by 'pos', 'radius' and 'halfHeight'.

Optionally, a constant initial linear velocity can be set for all created bodies.

◆ CreateObjectsCylinderZ()

void chrono::utils::ChGenerator::CreateObjectsCylinderZ ( ChSampler< double > &  sampler,
const ChVector3d pos,
float  radius,
float  halfHeight,
const ChVector3d vel = ChVector3d(0, 0, 0) 
)

Create bodies, according to the current mixture setup, with initial positions given by the specified sampler in the Z-aligned cylinder domain specified by 'pos', 'radius' and 'halfHeight'.

Optionally, a constant initial linear velocity can be set for all created bodies.

◆ CreateObjectsSphere()

void chrono::utils::ChGenerator::CreateObjectsSphere ( ChSampler< double > &  sampler,
const ChVector3d pos,
float  radius,
const ChVector3d vel = ChVector3d(0, 0, 0) 
)

Create bodies, according to the current mixture setup, with initial positions given by the specified sampler in the spherical domain specified by 'pos' and 'radius'.

Optionally, a constant initial linear velocity can be set for all created bodies.

◆ RegisterCreateObjectsCallback()

void chrono::utils::ChGenerator::RegisterCreateObjectsCallback ( std::shared_ptr< CreateObjectsCallback callback)
inline

Specify a callback object to be used before creating the bodies.

The OnCreateObjects() method of the provided callback object will be called before object creation, allowing the user to filter the points at which bodies will be initialized.

◆ SetStartTag()

void chrono::utils::ChGenerator::SetStartTag ( int  tag)
inline

Set the start value for tags assigned to generated bodies (default: 0).

Tags are incremented for successively created bodies.


The documentation for this class was generated from the following files:
  • /builds/uwsbel/chrono/src/chrono/utils/ChUtilsGenerators.h
  • /builds/uwsbel/chrono/src/chrono/utils/ChUtilsGenerators.cpp