chrono::utils Namespace Reference

Description

Chrono core utilities.

Classes

class  CompositeInertia
 Utility class for calculating inertia properties of a composite body. More...
 
class  ChRunningAverage
 Moving average filter for smoothing running data. More...
 
class  ChMovingAverage
 Moving average filter for smoothing a data array. More...
 
class  ChProfileNode
 A node in the Profile Hierarchy Tree. More...
 
class  ChProfileIterator
 An iterator to navigate through the tree. More...
 
class  ChProfileManager
 The Manager for the Profile system. 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  ChValidation
 This class provides functionality for validation of simulation results. 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< DataVectorData
 Data table.
 

Enumerations

enum  MixtureType {
  SPHERE = 0, ELLIPSOID = 1, BOX = 2, CYLINDER = 3,
  CONE = 8, CAPSULE = 7, BISPHERE, ROUNDEDCYLINDER
}
 
enum  POVRayShapeType {
  SPHERE = 0, ELLIPSOID = 1, BOX = 2, CYLINDER = 3,
  CONVEXHULL = 4, TRIANGLEMESH = 5, BARREL = 6, CAPSULE = 7,
  CONE = 8, ROUNDEDBOX = 9, ROUNDEDCYL = 10, ROUNDEDCONE = 11,
  BEZIER = 12
}
 
enum  POVRayLinkType {
  REVOLUTE = 0, SPHERICAL = 1, PRISMATIC = 2, UNIVERSAL = 3,
  DISTANCE = 4, ENGINE = 5, SPRING = 6, SPRING_CB = 7
}
 
enum  SamplingType { REGULAR_GRID, POISSON_DISK, HCP_PACK }
 
enum  ChNormType { L2_NORM, RMS_NORM, INF_NORM }
 Norm types for validation.
 

Functions

void Profile_Get_Ticks (unsigned long int *ticks)
 
float Profile_Get_Tick_Rate (void)
 
void AddSphereGeometry (ChBody *body, double radius, const ChVector<> &pos, const ChQuaternion<> &rot, bool visualization)
 
void AddEllipsoidGeometry (ChBody *body, const ChVector<> &size, const ChVector<> &pos, const ChQuaternion<> &rot, bool visualization)
 
void AddBoxGeometry (ChBody *body, const ChVector<> &size, const ChVector<> &pos, const ChQuaternion<> &rot, bool visualization)
 
void AddBiSphereGeometry (ChBody *body, double radius, double cDist, const ChVector<> &pos, const ChQuaternion<> &rot, bool visualization)
 
void AddCapsuleGeometry (ChBody *body, double radius, double hlen, const ChVector<> &pos, const ChQuaternion<> &rot, bool visualization)
 
void AddCylinderGeometry (ChBody *body, double radius, double hlen, const ChVector<> &pos, const ChQuaternion<> &rot, bool visualization)
 
void AddConeGeometry (ChBody *body, double radius, double height, const ChVector<> &pos, const ChQuaternion<> &rot, bool visualization)
 
void AddTriangleMeshGeometry (ChBody *body, const std::string &obj_filename, const std::string &name, const ChVector<> &pos, const ChQuaternion<> &rot, bool visualization)
 
void AddTriangleMeshConvexDecomposition (ChBody *body, const std::string &obj_filename, const std::string &name, const ChVector<> &pos, const ChQuaternion<> &rot, float skin_thickness, bool use_original_asset)
 
void AddTriangleMeshConvexDecompositionV2 (ChBody *body, const std::string &obj_filename, const std::string &name, const ChVector<> &pos, const ChQuaternion<> &rot, bool use_original_asset)
 
void AddTriangleMeshConvexDecompositionSplit (ChSystem *system, const std::string &obj_filename, const std::string &name, const ChVector<> &pos, const ChQuaternion<> &rot, std::shared_ptr< ChMaterialSurface > &material, double total_mass)
 
void AddTriangle (ChBody *body, const ChVector<> &vertA, const ChVector<> &vertB, const ChVector<> &vertC, const std::string &name, const ChVector<> &pos, const ChQuaternion<> &rot, bool visualization)
 
void AddRoundedBoxGeometry (ChBody *body, const ChVector<> &size, double srad, const ChVector<> &pos, const ChQuaternion<> &rot, bool visualization)
 
void AddRoundedCylinderGeometry (ChBody *body, double radius, double hlen, double srad, const ChVector<> &pos, const ChQuaternion<> &rot, bool visualization)
 
void AddTorusGeometry (ChBody *body, double radius, double thickness, int segments, int angle, const ChVector<> &pos, const ChQuaternion<> &rot, bool visualization)
 
std::shared_ptr< ChBodyCreateBoxContainer (ChSystem *system, int id, std::shared_ptr< ChMaterialSurfaceBase > mat, const ChVector<> &hdim, double hthick, const ChVector<> &pos, const ChQuaternion<> &rot, bool collide, bool y_up, bool overlap, bool closed)
 
std::shared_ptr< ChBodyCreateCylindricalContainerFromBoxes (ChSystem *system, int id, std::shared_ptr< ChMaterialSurfaceBase > mat, const ChVector<> &hdim, double hthick, int numBoxes, const ChVector<> &pos, const ChQuaternion<> &rot, bool collide, bool overlap, bool closed, bool isBoxBase, bool partialVisualization)
 
void InitializeObject (std::shared_ptr< ChBody > body, double mass, std::shared_ptr< ChMaterialSurfaceBase > mat, const ChVector<> &pos, const ChQuaternion<> &rot, bool collide, bool fixed, int collision_family, int do_not_collide_with)
 
void FinalizeObject (std::shared_ptr< ChBody > body, ChSystem *system)
 
void LoadConvexMesh (const std::string &file_name, ChTriangleMeshConnected &convex_mesh, ChConvexDecompositionHACDv2 &convex_shape, const ChVector<> &pos, const ChQuaternion<> &rot, int hacd_maxhullcount, int hacd_maxhullmerge, int hacd_maxhullvertexes, float hacd_concavity, float hacd_smallclusterthreshold, float hacd_fusetolerance)
 
void LoadConvexHulls (const std::string &file_name, geometry::ChTriangleMeshConnected &convex_mesh, std::vector< std::vector< ChVector< double > > > &convex_hulls)
 
void AddConvexCollisionModel (std::shared_ptr< ChBody > body, ChTriangleMeshConnected &convex_mesh, ChConvexDecompositionHACDv2 &convex_shape, const ChVector<> &pos, const ChQuaternion<> &rot, bool use_original_asset)
 
void AddConvexCollisionModel (std::shared_ptr< ChBody > body, ChTriangleMeshConnected &convex_mesh, std::vector< std::vector< ChVector< double > > > &convex_hulls, const ChVector<> &pos, const ChQuaternion<> &rot)
 
ChApi void AddTriangleMeshConvexDecompositionSplit (ChSystem *system, const std::string &obj_filename, const std::string &name, const ChVector<> &pos, const ChQuaternion<> &rot, std::shared_ptr< ChMaterialSurface > material, double total_mass)
 
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, bool dump_vel, const std::string &delim)
 
bool WriteCheckpoint (ChSystem *system, const std::string &filename)
 
void ReadCheckpoint (ChSystem *system, const std::string &filename)
 
void WriteShapesPovray (ChSystem *system, const std::string &filename, bool body_info, const std::string &delim)
 
void WriteMeshPovray (geometry::ChTriangleMeshConnected trimesh, const std::string &mesh_name, const std::string &out_dir, const ChColor &col, const ChVector<> &pos, const ChQuaternion<> &rot, bool smoothed)
 
void WriteMeshPovray (const std::string &obj_filename, const std::string &mesh_name, const std::string &out_dir, const ChColor &col, const ChVector<> &pos, const ChQuaternion<> &rot)
 
void WriteCurvePovray (const ChBezierCurve &curve, const std::string &curve_name, const std::string &out_dir, double radius, const ChColor &col)
 
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)
 
std::default_random_engine & rengine ()
 
template<typename T >
sampleTruncatedDist (std::normal_distribution< T > &distribution, T minVal, T maxVal)
 
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...
 

Variables

const double Pi = 3.1415926535897932384626433832795
 

Function Documentation

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)

ChApi const std::string & chrono::utils::GetValidationDataPath ( )

Obtain the current path to the reference validation data directory.

(thread safe)

ChApi void chrono::utils::SetValidationDataPath ( const std::string &  path)

Set the path to the reference validation data directory.

(ATTENTION: not thread safe)

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.

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.

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.

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.