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< MixtureIngredient > | AddMixtureIngredient (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 (SamplingType sType, double 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 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 (SamplingType sType, double dist, 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 (SamplingType sType, double dist, 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 (SamplingType sType, double dist, 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 | 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 | ( | SamplingType | sType, |
double | 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 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 | ( | SamplingType | sType, |
double | dist, | ||
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 | ( | SamplingType | sType, |
double | dist, | ||
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 | ( | SamplingType | sType, |
double | dist, | ||
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.
◆ getBodyIdentifier()
|
inline |
Get/Set the identifier that will be assigned to the next body.
Identifiers are incremented for successively created bodies.
◆ RegisterCreateObjectsCallback()
|
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