Description
Chrono core utilities.
Classes | |
class | ChAbsorbed_Power_Vertical |
Filter for vertical absorbed power. More... | |
class | ChAnalogueFilter |
Base class for simulated analogue filters in the time domain. More... | |
class | ChBenchmarkFixture |
Generic benchmark fixture for Chrono tests. More... | |
class | ChBenchmarkTest |
Base class for a Chrono benchmark test. More... | |
class | ChButterworth_Highpass |
Butterworth high-pass filter. More... | |
class | ChButterworth_Lowpass |
Butterworth low-pass filter. More... | |
class | ChChaseCamera |
Utility class for a generic chase camera which can be associated with any ChBody in a Chrono system. More... | |
class | ChConvexHull2D |
Simple 2D convex hull class. More... | |
class | ChFilterD |
Caclulate the time derivation of an input signal: H(s) = Td * s. More... | |
class | ChFilterI |
Calculate the integral of an input signal in the time domain: H(s) = 1 / ( Ti * s) More... | |
class | ChFilterPD1 |
PD1 controller: H(s) = Kdt1 * ( Td1 * s + 1 ) More... | |
class | ChFilterPDT1 |
PDT1 controller: H(s) = Kp * ( Td1 * s + 1 ) / ( T1 * s + 1) More... | |
class | ChFilterPT1 |
Delay an input signal: H(s) = Kpt1 / ( T1 * s + 1 ) More... | |
class | ChISO2631_1_Wd |
Combined filter Wd. More... | |
class | ChISO2631_1_Wf |
Combined filter Wf. More... | |
class | ChISO2631_1_Wk |
Combined filter Wk. More... | |
class | ChISO2631_5_Wxy |
ISO2631-5 weighting filter for shock like signal in horizontal direction. More... | |
class | ChISO2631_5_Wz |
ISO2631-5 weighting filter for shock like signal in vertical direction. More... | |
class | ChISO2631_Shock_SeatCushionLogger |
Easy to use class for evaluation of ISO 2361-5 shock load on sitting vehicle occupants. More... | |
class | ChISO2631_Vibration_SeatCushionLogger |
Easy to use class for evaluation of ISO 2361-1 vibration load on sitting vehicle occupants Input: 3 seat accelerations x,y,z in [m/s^2]. More... | |
class | ChMovingAverage |
Moving average filter for smoothing a data array. More... | |
class | ChParserAdams |
ADAMS input file parser. More... | |
class | ChParserOpenSim |
OpenSim input file parser. More... | |
class | ChProfileIterator |
An iterator to navigate through the tree. More... | |
class | ChProfileManager |
The Manager for the Profile system. More... | |
class | ChProfileNode |
A node in the Profile Hierarchy Tree. More... | |
class | ChRunningAverage |
Moving average filter for smoothing running data. More... | |
class | ChValidation |
This class provides functionality for validation of simulation results. More... | |
class | CompositeInertia |
Utility class for calculating inertia properties of a composite body. More... | |
class | CProfileSample |
ProfileSampleClass is a simple way to profile a function's scope Use the BT_PROFILE macro at the start of scope to time. More... | |
class | Generator |
Provides functionality for generating sets of bodies with positions drawn from a specified sampler and various mixture properties. More... | |
class | GridSampler |
Sampler for 3D volumes using a regular (equidistant) grid. More... | |
class | HCPSampler |
Sampler for 3D volumes using a Hexagonally Close Packed structure. More... | |
class | MixtureIngredient |
Encapsulation of an ingredient of one of the supported types in a mixture. More... | |
class | PDGrid |
Simple 3D grid utility class for use by the Poisson Disk sampler. More... | |
class | PDSampler |
Sampler for 3D domains (box, sphere, or cylinder) using Poisson Disk Sampling. More... | |
class | Sampler |
Base class for different types of point samplers. More... | |
Typedefs | |
typedef Types< double >::PointVector | PointVectorD |
typedef Types< float >::PointVector | PointVectorF |
typedef std::vector< std::string > | Headers |
Vector of data file headers. | |
typedef std::valarray< double > | DataVector |
Vector of data points. | |
typedef std::vector< DataVector > | Data |
Data table. | |
Enumerations | |
enum | MixtureType { SPHERE, ELLIPSOID, BOX, CYLINDER, CONE, CAPSULE, BISPHERE, ROUNDEDCYLINDER } |
Enumeration of various geometric shapes available for mixtures. | |
enum | POVRayShapeType { SPHERE = 0, SPHERE, ELLIPSOID = 1, ELLIPSOID, BOX = 2, BOX, CYLINDER = 3, CYLINDER, CONVEXHULL = 4, TRIANGLEMESH = 5, BARREL = 6, CAPSULE = 7, CAPSULE, CONE = 8, CONE, ROUNDEDBOX = 9, ROUNDEDCYL = 10, ROUNDEDCONE = 11, BEZIER = 12 } |
enum | POVRayLinkType { REVOLUTE = 0, SPHERICAL = 1, PRISMATIC = 2, UNIVERSAL = 3, DISTANCE = 4, ENGINE = 5, SPRING = 6, TSDA = 7, CYLINDRICAL = 8, REV_SPH = 9 } |
enum | POVRayLineType { SEGMENT = 0, COIL = 1 } |
enum | SamplingType { SamplingType::REGULAR_GRID, SamplingType::POISSON_DISK, SamplingType::HCP_PACK } |
Volumetric sampling method. More... | |
enum | ChNormType { L2_NORM, RMS_NORM, INF_NORM } |
Norm types for validation. | |
Functions | |
double | SignedArea (const ChVector2<> &p1, const ChVector2<> &p2, const ChVector2<> &p3) |
int | Orientation (const ChVector2<> &p1, const ChVector2<> &p2, const ChVector2<> &p3) |
bool | InBetween (const ChVector2<> &p1, const ChVector2<> &p2, const ChVector2<> &p3) |
void | tokenParseError (int expected, std::pair< int, std::string > &got) |
void | parseADMPart (std::string ID, std::vector< std::pair< int, std::string >> &tokens, ChSystem &sys) |
void | parseADMJoint (std::string ID, std::vector< std::pair< int, std::string >> &tokens, ChSystem &sys) |
void | parseADMMarker (std::string ID, std::vector< std::pair< int, std::string >> &tokens, ChSystem &sys) |
ChQuaternion | Q_from_313_angles (double q1, double q2, double q3) |
void | Profile_Get_Ticks (unsigned long int *ticks) |
float | Profile_Get_Tick_Rate (void) |
void | AddSphereGeometry (ChBody *body, std::shared_ptr< ChMaterialSurface > material, 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 | AddEllipsoidGeometry (ChBody *body, std::shared_ptr< ChMaterialSurface > material, 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 | AddBoxGeometry (ChBody *body, std::shared_ptr< ChMaterialSurface > material, 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 | AddBiSphereGeometry (ChBody *body, std::shared_ptr< ChMaterialSurface > material, 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 | AddCapsuleGeometry (ChBody *body, std::shared_ptr< ChMaterialSurface > material, 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 | AddCylinderGeometry (ChBody *body, std::shared_ptr< ChMaterialSurface > material, 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 | AddConeGeometry (ChBody *body, std::shared_ptr< ChMaterialSurface > material, 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. | |
bool | AddTriangleMeshGeometry (ChBody *body, std::shared_ptr< ChMaterialSurface > material, 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. | |
bool | AddTriangleMeshConvexDecomposition (ChBody *body, std::shared_ptr< ChMaterialSurface > material, 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. | |
bool | AddTriangleMeshConvexDecompositionV2 (ChBody *body, std::shared_ptr< ChMaterialSurface > material, 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. | |
bool | AddTriangleMeshConvexDecompositionSplit (ChSystem *system, std::shared_ptr< ChMaterialSurface > material, const std::string &obj_filename, const std::string &name, const ChVector<> &pos, const ChQuaternion<> &rot, double total_mass) |
Add convex hull collision shapes and optionally a corresponding visualization asset to the specified body. | |
void | AddTriangleGeometry (ChBody *body, std::shared_ptr< ChMaterialSurface > material, 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 | AddRoundedBoxGeometry (ChBody *body, std::shared_ptr< ChMaterialSurface > material, 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 | AddRoundedCylinderGeometry (ChBody *body, std::shared_ptr< ChMaterialSurface > material, 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 | AddTorusGeometry (ChBody *body, std::shared_ptr< ChMaterialSurface > material, 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< ChBody > | 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< ChBody > | 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... | |
bool | 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. | |
bool | 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... | |
void | AddConvexCollisionModel (std::shared_ptr< ChBody > body, std::shared_ptr< ChMaterialSurface > material, std::shared_ptr< ChTriangleMeshConnected > convex_mesh, ChConvexDecompositionHACDv2 &convex_shape, const ChVector<> &pos, const ChQuaternion<> &rot, bool use_original_asset) |
void | AddConvexCollisionModel (std::shared_ptr< ChBody > body, std::shared_ptr< ChMaterialSurface > material, std::shared_ptr< ChTriangleMeshConnected > convex_mesh, std::vector< std::vector< ChVector< double >>> &convex_hulls, const ChVector<> &pos, const ChQuaternion<> &rot) |
ChApi void | AddConvexCollisionModel (std::shared_ptr< ChBody > body, std::shared_ptr< ChMaterialSurface > material, 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 | AddConvexCollisionModel (std::shared_ptr< ChBody > body, std::shared_ptr< ChMaterialSurface > material, 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... | |
double | CalcSphereBradius (double radius) |
double | CalcEllipsoidBradius (const ChVector<> &hdims) |
double | CalcBoxBradius (const ChVector<> &hdims) |
double | CalcCapsuleBradius (double radius, double hlen) |
double | CalcCylinderBradius (double radius, double hlen) |
double | CalcConeBradius (double radius, double hlen) |
double | CalcRoundedCylinderBradius (double radius, double hlen, double srad) |
double | CalcRoundedBoxBradius (const ChVector<> &hdims, double srad) |
double | CalcTorusBradius (double radius, double thickness) |
double | CalcSphereVolume (double radius) |
double | CalcEllipsoidVolume (const ChVector<> &hdims) |
double | CalcBoxVolume (const ChVector<> &hdims) |
double | CalcBiSphereVolume (double radius, double cDist) |
double | CalcCapsuleVolume (double radius, double hlen) |
double | CalcCylinderVolume (double radius, double hlen) |
double | CalcConeVolume (double radius, double len) |
double | CalcRoundedCylinderVolume (double radius, double hlen, double srad) |
double | CalcRoundedBoxVolume (const ChVector<> &hdims, double srad) |
double | CalcTorusVolume (double radius, double thickness) |
void | TransformGyration (ChMatrix33<> &J, const ChVector<> &pos, const ChQuaternion<> &rot) |
ChMatrix33 | CalcSphereGyration (double radius, const ChVector<> &pos=ChVector<>(0, 0, 0), const ChQuaternion<> &rot=ChQuaternion<>(1, 0, 0, 0)) |
ChMatrix33 | CalcEllipsoidGyration (const ChVector<> &hdims, const ChVector<> &pos=ChVector<>(0, 0, 0), const ChQuaternion<> &rot=ChQuaternion<>(1, 0, 0, 0)) |
ChMatrix33 | CalcBoxGyration (const ChVector<> &hdims, const ChVector<> &pos=ChVector<>(0, 0, 0), const ChQuaternion<> &rot=ChQuaternion<>(1, 0, 0, 0)) |
ChMatrix33 | CalcBiSphereGyration (double radius, double cDist, const ChVector<> &pos=ChVector<>(0, 0, 0), const ChQuaternion<> &rot=ChQuaternion<>(1, 0, 0, 0)) |
ChMatrix33 | CalcCapsuleGyration (double radius, double hlen, const ChVector<> &pos=ChVector<>(0, 0, 0), const ChQuaternion<> &rot=ChQuaternion<>(1, 0, 0, 0)) |
ChMatrix33 | CalcCylinderGyration (double radius, double hlen, const ChVector<> &pos=ChVector<>(0, 0, 0), const ChQuaternion<> &rot=ChQuaternion<>(1, 0, 0, 0)) |
ChMatrix33 | CalcConeGyration (double radius, double len, const ChVector<> &pos=ChVector<>(0, 0, 0), const ChQuaternion<> &rot=ChQuaternion<>(1, 0, 0, 0)) |
ChMatrix33 | CalcRoundedCylinderGyration (double radius, double hlen, double srad, const ChVector<> &pos=ChVector<>(0, 0, 0), const ChQuaternion<> &rot=ChQuaternion<>(1, 0, 0, 0)) |
ChMatrix33 | CalcRoundedBoxGyration (const ChVector<> &hdims, double srad, const ChVector<> &pos=ChVector<>(0, 0, 0), const ChQuaternion<> &rot=ChQuaternion<>(1, 0, 0, 0)) |
ChMatrix33 | CalcTorusGyration (double radius, double thickness, const ChVector<> &pos=ChVector<>(0, 0, 0), const ChQuaternion<> &rot=ChQuaternion<>(1, 0, 0, 0)) |
void | WriteBodies (ChSystem *system, const std::string &filename, bool active_only=false, bool dump_vel=false, const std::string &delim=",") |
This function dumps to a CSV file pody position, orientation, and optionally linear and angular velocity. More... | |
bool | WriteCheckpoint (ChSystem *system, const std::string &filename) |
Create a CSV file with a checkpoint. | |
void | ReadCheckpoint (ChSystem *system, const std::string &filename) |
Read a CSV file with a checkpoint. | |
void | WriteCamera (const std::string &filename, const ChVector<> &cam_location, const ChVector<> &cam_target, const ChVector<> &camera_upvec, const std::string &delim=",") |
Write CSV output file with camera information for off-line visualization. More... | |
void | WriteVisualizationAssets (ChSystem *system, const std::string &filename, bool body_info=true, const std::string &delim=",") |
Write CSV output file with body and asset information for off-line visualization. More... | |
void | WriteVisualizationAssets (ChSystem *system, const std::string &filename, std::function< bool(const ChBody &)> selector, bool body_info=true, const std::string &delim=",") |
Write CSV output file with body and asset information for off-line visualization. More... | |
void | WriteMeshPovray (geometry::ChTriangleMeshConnected &trimesh, const std::string &mesh_name, const std::string &out_dir, const ChColor &color=ChColor(0.4f, 0.4f, 0.4f), const ChVector<> &pos=ChVector<>(0, 0, 0), const ChQuaternion<> &rot=ChQuaternion<>(1, 0, 0, 0), bool smoothed=false) |
Write the specified mesh as a macro in a PovRay include file. More... | |
bool | WriteMeshPovray (const std::string &obj_filename, const std::string &mesh_name, const std::string &out_dir, const ChColor &color=ChColor(0.4f, 0.4f, 0.4f), const ChVector<> &pos=ChVector<>(0, 0, 0), const ChQuaternion<> &rot=ChQuaternion<>(1, 0, 0, 0)) |
Write the triangular mesh from the specified OBJ file as a macro in a PovRay include file. More... | |
void | WriteCurvePovray (const ChBezierCurve &curve, const std::string &curve_name, const std::string &out_dir, double radius=0.03, const ChColor &col=ChColor(0.8f, 0.8f, 0.2f)) |
Write the specified Bezier curve as a macro in a PovRay include file. | |
template<typename T > | |
CSV_writer & | operator<< (CSV_writer &out, const ChVector< T > &v) |
template<typename T > | |
CSV_writer & | operator<< (CSV_writer &out, const ChQuaternion< T > &q) |
CSV_writer & | operator<< (CSV_writer &out, const ChColor &c) |
template<typename T > | |
CSV_writer & | operator<< (CSV_writer &out, const std::vector< T > &vec) |
std::default_random_engine & | rengine () |
template<typename T > | |
T | sampleTruncatedDist (std::normal_distribution< T > &distribution, T minVal, T maxVal) |
template<typename T > | |
std::vector< ChVector< T > > | 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... | |
bool | Validate (const std::string &sim_filename, const std::string &ref_filename, ChNormType norm_type, double tolerance, DataVector &norms) |
Compare the data in the two specified files. More... | |
ChApi bool | Validate (const Data &sim_data, const Data &ref_data, ChNormType norm_type, double tolerance, DataVector &norms) |
Compare the data in the two specified structures The comparison is done using the specified norm type and tolerance. More... | |
bool | Validate (const std::string &sim_filename, ChNormType norm_type, double tolerance, DataVector &norms) |
Validation of a constraint violation data file. More... | |
ChApi bool | Validate (const Data &sim_data, ChNormType norm_type, double tolerance, DataVector &norms) |
Validation of a constraint violation data structure. More... | |
void | SetValidationDataPath (const std::string &path) |
Set the path to the reference validation data directory. More... | |
const std::string & | GetValidationDataPath () |
Obtain the current path to the reference validation data directory. More... | |
std::string | GetValidationDataFile (const std::string &filename) |
Obtain the complete path to the specified filename. More... | |
Function Documentation
◆ GetValidationDataFile()
ChApi std::string chrono::utils::GetValidationDataFile | ( | const std::string & | filename | ) |
Obtain the complete path to the specified filename.
The given filename is assumed to be relative to the reference validation data directory. (thread safe)
◆ GetValidationDataPath()
const ChApi std::string & chrono::utils::GetValidationDataPath | ( | ) |
Obtain the current path to the reference validation data directory.
(thread safe)
◆ SetValidationDataPath()
ChApi void chrono::utils::SetValidationDataPath | ( | const std::string & | path | ) |
Set the path to the reference validation data directory.
(ATTENTION: not thread safe)
◆ Validate() [1/4]
ChApi bool chrono::utils::Validate | ( | const Data & | sim_data, |
ChNormType | norm_type, | ||
double | tolerance, | ||
DataVector & | norms | ||
) |
Validation of a constraint violation data structure.
The validation is done using the specified norm type and tolerance. The function returns true if the norms of all columns, excluding the first one, are below the given tolerance and false otherwise.
◆ Validate() [2/4]
ChApi bool chrono::utils::Validate | ( | const Data & | sim_data, |
const Data & | ref_data, | ||
ChNormType | norm_type, | ||
double | tolerance, | ||
DataVector & | norms | ||
) |
Compare the data in the two specified structures The comparison is done using the specified norm type and tolerance.
The function returns true if the norms of all column differences are below the given tolerance and false otherwise.
◆ Validate() [3/4]
ChApi bool chrono::utils::Validate | ( | const std::string & | sim_filename, |
ChNormType | norm_type, | ||
double | tolerance, | ||
DataVector & | norms | ||
) |
Validation of a constraint violation data file.
The validation is done using the specified norm type and tolerance. The function returns true if the norms of all columns, excluding the first one, are below the given tolerance and false otherwise. It is assumed that the input file is TAB-delimited.
◆ Validate() [4/4]
ChApi bool chrono::utils::Validate | ( | const std::string & | sim_filename, |
const std::string & | ref_filename, | ||
ChNormType | norm_type, | ||
double | tolerance, | ||
DataVector & | norms | ||
) |
Compare the data in the two specified files.
The comparison is done using the specified norm type and tolerance. The function returns true if the norms of all column differences are below the given tolerance and false otherwise. It is assumed that the input files are TAB-delimited.
◆ WriteBodies()
ChApi void chrono::utils::WriteBodies | ( | ChSystem * | system, |
const std::string & | filename, | ||
bool | active_only = false , |
||
bool | dump_vel = false , |
||
const std::string & | delim = "," |
||
) |
This function dumps to a CSV file pody position, orientation, and optionally linear and angular velocity.
Optionally, only active bodies are processed.
◆ WriteCamera()
ChApi void chrono::utils::WriteCamera | ( | const std::string & | filename, |
const ChVector<> & | cam_location, | ||
const ChVector<> & | cam_target, | ||
const ChVector<> & | camera_upvec, | ||
const std::string & | delim = "," |
||
) |
Write CSV output file with camera information for off-line visualization.
The output file includes three vectors, one per line, for camera position, camera target (look-at point), and camera up vector, respectively.
◆ WriteMeshPovray() [1/2]
ChApi bool chrono::utils::WriteMeshPovray | ( | const std::string & | obj_filename, |
const std::string & | mesh_name, | ||
const std::string & | out_dir, | ||
const ChColor & | color = ChColor(0.4f, 0.4f, 0.4f) , |
||
const ChVector<> & | pos = ChVector<>(0, 0, 0) , |
||
const ChQuaternion<> & | rot = ChQuaternion<>(1, 0, 0, 0) |
||
) |
Write the triangular mesh from the specified OBJ file as a macro in a PovRay include file.
The output file will be "[out_dir]/[mesh_name].inc". The mesh vertices will be transformed to the frame with specified offset and orientation.
◆ WriteMeshPovray() [2/2]
ChApi void chrono::utils::WriteMeshPovray | ( | geometry::ChTriangleMeshConnected & | trimesh, |
const std::string & | mesh_name, | ||
const std::string & | out_dir, | ||
const ChColor & | color = ChColor(0.4f, 0.4f, 0.4f) , |
||
const ChVector<> & | pos = ChVector<>(0, 0, 0) , |
||
const ChQuaternion<> & | rot = ChQuaternion<>(1, 0, 0, 0) , |
||
bool | smoothed = false |
||
) |
Write the specified mesh as a macro in a PovRay include file.
The output file will be "[out_dir]/[mesh_name].inc". The mesh vertices will be transformed to the frame with specified offset and orientation.
◆ WriteVisualizationAssets() [1/2]
ChApi void chrono::utils::WriteVisualizationAssets | ( | ChSystem * | system, |
const std::string & | filename, | ||
bool | body_info = true , |
||
const std::string & | delim = "," |
||
) |
Write CSV output file with body and asset information for off-line visualization.
(1) The first line of the output file contains:
- the number of bodies (0 if no body information is included below)
- the number of visual assets
- the number of links
- the number of TSDA spring-dampers (2) If the number of bodies is not zero, the next block of lines includes information about the rigid bodies. Each line contains 9 values:
- the body identifier
- a flag (1 or 0) indicating whether the body is active or not
- the body position expressed in global frame
- the body orientation (as a quaternion, expressed in global frame) (3) The next block of lines includes information about the visual assets. Each line contains:
- the identifier of the associated body
- a flag (1 or 0) indicating whether the body is active or not
- the asset position expresssed in global frame
- the asset orientation (as a quaternion, expressed in global frame)
- the visualization asset type (an enum value)
- geometry information depending on the type above (4) The next block of lines includes information about the joints. Each line contains:
- the joint type (an enum value)
- joint position and orientation information depending on the type above (5) The next block of lines includes information about TSDA elements. Each line contains:
- the type of visual asset (0 for segment or 1 for coil)
- start point position
- end point position
- Parameters
-
system containg system filename output file name body_info include body state information delim CSV delimitator
◆ WriteVisualizationAssets() [2/2]
ChApi void chrono::utils::WriteVisualizationAssets | ( | ChSystem * | system, |
const std::string & | filename, | ||
std::function< bool(const ChBody &)> | selector, | ||
bool | body_info = true , |
||
const std::string & | delim = "," |
||
) |
Write CSV output file with body and asset information for off-line visualization.
This version uses a discriminator function to select which bodies and assets are included in the output. The function selector receives as argument a body reference and must return 'true' if the body and its assets should be included in the output file and 'false' otherwise.
- Parameters
-
system containg system filename output file name selector select bodies body_info include body state information delim CSV delimitator