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

 Generator (ChSystem *system)
 
std::shared_ptr< MixtureIngredientAddMixtureIngredient (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).
 
int getBodyIdentifier () const
 Get/Set the identifier that will be assigned to the next body. More...
 
void setBodyIdentifier (int id)
 
void CreateObjectsBox (Sampler< double > &sampler, const ChVector<> &pos, const ChVector<> &hdims, const ChVector<> &vel=ChVector<>(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 ChVector<> &dist, const ChVector<> &pos, const ChVector<> &hdims, const ChVector<> &vel=ChVector<>(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 (Sampler< double > &sampler, const ChVector<> &pos, float radius, float halfHeight, const ChVector<> &vel=ChVector<>(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 (Sampler< double > &sampler, const ChVector<> &pos, float radius, float halfHeight, const ChVector<> &vel=ChVector<>(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 (Sampler< double > &sampler, const ChVector<> &pos, float radius, float halfHeight, const ChVector<> &vel=ChVector<>(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 (Sampler< double > &sampler, const ChVector<> &pos, float radius, const ChVector<> &vel=ChVector<>(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 MixtureIngredient
 

Member Function Documentation

◆ CreateObjectsBox() [1/2]

void chrono::utils::Generator::CreateObjectsBox ( const ChVector<> &  dist,
const ChVector<> &  pos,
const ChVector<> &  hdims,
const ChVector<> &  vel = ChVector<>(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.

◆ CreateObjectsBox() [2/2]

void chrono::utils::Generator::CreateObjectsBox ( Sampler< double > &  sampler,
const ChVector<> &  pos,
const ChVector<> &  hdims,
const ChVector<> &  vel = ChVector<>(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.

◆ CreateObjectsCylinderX()

void chrono::utils::Generator::CreateObjectsCylinderX ( Sampler< double > &  sampler,
const ChVector<> &  pos,
float  radius,
float  halfHeight,
const ChVector<> &  vel = ChVector<>(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::Generator::CreateObjectsCylinderY ( Sampler< double > &  sampler,
const ChVector<> &  pos,
float  radius,
float  halfHeight,
const ChVector<> &  vel = ChVector<>(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::Generator::CreateObjectsCylinderZ ( Sampler< double > &  sampler,
const ChVector<> &  pos,
float  radius,
float  halfHeight,
const ChVector<> &  vel = ChVector<>(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::Generator::CreateObjectsSphere ( Sampler< double > &  sampler,
const ChVector<> &  pos,
float  radius,
const ChVector<> &  vel = ChVector<>(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.

◆ getBodyIdentifier()

int chrono::utils::Generator::getBodyIdentifier ( ) const
inline

Get/Set the identifier that will be assigned to the next body.

Identifiers are incremented for successively created bodies.

◆ RegisterCreateObjectsCallback()

void chrono::utils::Generator::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.


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