Description

Base class for a Chrono checkpoint database.

A Chrono checkpoint DB can be of SYSTEM type (in which case it contains all states associated with a given system) or of COMPONENT tpe (in which case it contains states for specific subsets of Chrono physics items). The latter option is useful in checkpointing and initializing from a checkpoint sub-assemblies, for example vehicle systems. When importing a checkpoint to initialize a give system (SYSTEM-type checkpoint) or a subset of physics items (COMPONENT-type checkpoint), it is the caller's responsibility to ensure that the target objects (system or component lists) match the number and order in the system from which the checkpoint was generated.

To extract a checkpoint and write a SYSTEM checkpoint file, call:

  cp.Save(sys);
  cp.WriteFile(filename);
  

To write a COMPONENT checkpoint file, call:

  cp.Save(time, components);
  cp.WriteFile(filename);
  

To read a SYSTEM checkpoint file and apply the checkpoint to a system, call:

  cp.ReadFile(filename);
  cp.Load(sys);
  

To read a COMPONENT checkpoint file, call:

  cp.ReadFile(filename);
  cp.Load(time, components);
  ...
  

#include <ChCheckpoint.h>

Inheritance diagram for chrono::ChCheckpoint:

Public Types

enum  Format { Format::ASCII }
 Checkpoint output format. More...
 
enum  Type { Type::SYSTEM, Type::COMPONENT }
 Checkpoint type. More...
 

Public Member Functions

virtual void Initialize ()=0
 Initialize the checkpoint DB.
 
void SetTime (double time)
 
double GetTime () const
 
void Save (ChSystem *sys)
 
void Save (double time, const ChAssembly::Components &components)
 
void Save (const ChAssembly::Components &components)
 
void Load (ChSystem *sys)
 
void Load (double &time, ChAssembly::Components &components)
 
void Load (ChAssembly::Components &components)
 
virtual void ReadFile (const std::string &filename)=0
 Open the checkpoint database from the disk file with the specified name and read the checkpoint.
 
virtual void WriteFile (const std::string &filename)=0
 Write the checkpoint database to a disk file with the specified name.
 

Static Public Member Functions

static std::string GetFormatAsString (Format format)
 Return the provided checkpoint format as a string.
 
static std::string GetTypeAsString (Type type)
 Return the provided checkpoint type as a string.
 

Protected Member Functions

 ChCheckpoint (Type type)
 
void CheckIfSystemType () const
 Verify that the checkpoint is of type SYSTEM.
 
void CheckIfComponentType () const
 Verify that the checkpoint is of type COMPONENT.
 
virtual void SaveState (ChSystem *sys)=0
 Save the entire state of the provided Chrono system. More...
 
virtual void SaveBodies (const std::vector< std::shared_ptr< ChBody >> &bodies)=0
 Save states of the bodies in the provided list. More...
 
virtual void SaveShafts (const std::vector< std::shared_ptr< ChShaft >> &shafts)=0
 Save states of the shafts in the provided list. More...
 
virtual void SaveJoints (const std::vector< std::shared_ptr< ChLink >> &joints)=0
 Save states of the joints in the provided list. More...
 
virtual void SaveCouples (const std::vector< std::shared_ptr< ChShaftsCouple >> &couples)=0
 Save states of the shaft couples in the provided list. More...
 
virtual void SaveLinSprings (const std::vector< std::shared_ptr< ChLinkTSDA >> &springs)=0
 Save states of the linear springs (TSDAs) in the provided list. More...
 
virtual void SaveRotSprings (const std::vector< std::shared_ptr< ChLinkRSDA >> &springs)=0
 Save states of the rotational springs (RSDAs) in the provided list. More...
 
virtual void SaveBodyBodyLoads (const std::vector< std::shared_ptr< ChLoadBodyBody >> &loads)=0
 Save states of the body-body loads in the provided list. More...
 
virtual void SaveLinMotors (const std::vector< std::shared_ptr< ChLinkMotorLinear >> &motors)=0
 Save states of the linear motors in the provided list. More...
 
virtual void SaveRotMotors (const std::vector< std::shared_ptr< ChLinkMotorRotation >> &motors)=0
 Save states of the rotational motors in the provided list. More...
 
virtual void SaveDouble (double value)=0
 Save the specified double value. More...
 
virtual void SaveInteger (int value)=0
 Save the specified integer value. More...
 
virtual void SaveVector (const std::vector< double > &vector)=0
 Save the components of the specified vector of doubles. More...
 
virtual void SaveChVector3 (const ChVector3d &vector)=0
 Save the components of the specified 3D vector (with double values). More...
 
virtual void SaveChQuaternion (const ChQuaterniond &quat)=0
 Save the components of the specified quaternion (with double values). More...
 
virtual void LoadState (ChSystem *sys)=0
 Load the system-level state in the input checkpoint database and initialize the given system with that state. More...
 
virtual void LoadBodies (std::vector< std::shared_ptr< ChBody >> &bodies)=0
 Load body states from the input checkpoint database and set them to the bodies in the provided list. More...
 
virtual void LoadShafts (std::vector< std::shared_ptr< ChShaft >> &shafts)=0
 Load shaft states from the input checkpoint database and set them to the shafts in the provided list. More...
 
virtual void LoadJoints (std::vector< std::shared_ptr< ChLink >> &joints)=0
 Load joint states from the input checkpoint database and set them to the joints in the provided list. More...
 
virtual void LoadCouples (std::vector< std::shared_ptr< ChShaftsCouple >> &couples)=0
 Load couple states from the input checkpoint database and set them to the shaft couples in the provided list. More...
 
virtual void LoadLinSprings (std::vector< std::shared_ptr< ChLinkTSDA >> &springs)=0
 Load spring states from the input checkpoint database and set them to the TSDAs in the provided list. More...
 
virtual void LoadRotSprings (std::vector< std::shared_ptr< ChLinkRSDA >> &springs)=0
 Load spring states from the input checkpoint database and set them to the RSDAs in the provided list. More...
 
virtual void LoadBodyBodyLoads (std::vector< std::shared_ptr< ChLoadBodyBody >> &loads)=0
 Load body-body load states from the input checkpoint database and set them to the loads in the provided list. More...
 
virtual void LoadLinMotors (std::vector< std::shared_ptr< ChLinkMotorLinear >> &motors)=0
 Load motor states from the input checkpoint database and set them to the linear motors in the provided list. More...
 
virtual void LoadRotMotors (std::vector< std::shared_ptr< ChLinkMotorRotation >> &motors)=0
 Load motor states from the input checkpoint database and set them to the rotational motors in the provided list. More...
 
virtual void LoadDouble (double &value)=0
 Load a double value and set it to the provided variable. More...
 
virtual void LoadInteger (int &value)=0
 Load an integer value and set it to the provided variable. More...
 
virtual void LoadVector (std::vector< double > &vector)=0
 Load a sequence of double values and load them in the provided vector. More...
 
virtual void LoadChVector3 (ChVector3d &vector)=0
 Load components of a 3D vector from the input checkpoint database and set them to the provided vector. More...
 
virtual void LoadChQuaternion (ChQuaterniond &quat)=0
 Load components of a quaternion from the input checkpoint database and set them to the provided ChQuaternion. More...
 

Protected Attributes

Type m_type
 checkpoint database type
 
double m_time
 time stamp of the checkpoint
 

Member Enumeration Documentation

◆ Format

Checkpoint output format.

The only option currently supported is ASCII.

Enumerator
ASCII 

ASCII text.

◆ Type

Checkpoint type.

Enumerator
SYSTEM 

system state vector

COMPONENT 

component-wise states

Member Function Documentation

◆ LoadBodies()

virtual void chrono::ChCheckpoint::LoadBodies ( std::vector< std::shared_ptr< ChBody >> &  bodies)
protectedpure virtual

Load body states from the input checkpoint database and set them to the bodies in the provided list.

Only for a COMPONENT type checkpoint DB.

◆ LoadBodyBodyLoads()

virtual void chrono::ChCheckpoint::LoadBodyBodyLoads ( std::vector< std::shared_ptr< ChLoadBodyBody >> &  loads)
protectedpure virtual

Load body-body load states from the input checkpoint database and set them to the loads in the provided list.

Only for a COMPONENT type checkpoint DB.

◆ LoadChQuaternion()

virtual void chrono::ChCheckpoint::LoadChQuaternion ( ChQuaterniond quat)
protectedpure virtual

Load components of a quaternion from the input checkpoint database and set them to the provided ChQuaternion.

Only for a COMPONENT type checkpoint DB.

◆ LoadChVector3()

virtual void chrono::ChCheckpoint::LoadChVector3 ( ChVector3d vector)
protectedpure virtual

Load components of a 3D vector from the input checkpoint database and set them to the provided vector.

Only for a COMPONENT type checkpoint DB.

◆ LoadCouples()

virtual void chrono::ChCheckpoint::LoadCouples ( std::vector< std::shared_ptr< ChShaftsCouple >> &  couples)
protectedpure virtual

Load couple states from the input checkpoint database and set them to the shaft couples in the provided list.

Only for a COMPONENT type checkpoint DB. Note that this list should only include kinematic shaft couples (i.e., no motors).

◆ LoadDouble()

virtual void chrono::ChCheckpoint::LoadDouble ( double &  value)
protectedpure virtual

Load a double value and set it to the provided variable.

Only for a COMPONENT type checkpoint DB.

◆ LoadInteger()

virtual void chrono::ChCheckpoint::LoadInteger ( int &  value)
protectedpure virtual

Load an integer value and set it to the provided variable.

Only for a COMPONENT type checkpoint DB.

◆ LoadJoints()

virtual void chrono::ChCheckpoint::LoadJoints ( std::vector< std::shared_ptr< ChLink >> &  joints)
protectedpure virtual

Load joint states from the input checkpoint database and set them to the joints in the provided list.

Only for a COMPONENT type checkpoint DB. Note that this list should only include kinematic joints (i.e., no motors, springs, bushings).

◆ LoadLinMotors()

virtual void chrono::ChCheckpoint::LoadLinMotors ( std::vector< std::shared_ptr< ChLinkMotorLinear >> &  motors)
protectedpure virtual

Load motor states from the input checkpoint database and set them to the linear motors in the provided list.

Only for a COMPONENT type checkpoint DB.

◆ LoadLinSprings()

virtual void chrono::ChCheckpoint::LoadLinSprings ( std::vector< std::shared_ptr< ChLinkTSDA >> &  springs)
protectedpure virtual

Load spring states from the input checkpoint database and set them to the TSDAs in the provided list.

Only for a COMPONENT type checkpoint DB.

◆ LoadRotMotors()

virtual void chrono::ChCheckpoint::LoadRotMotors ( std::vector< std::shared_ptr< ChLinkMotorRotation >> &  motors)
protectedpure virtual

Load motor states from the input checkpoint database and set them to the rotational motors in the provided list.

Only for a COMPONENT type checkpoint DB.

◆ LoadRotSprings()

virtual void chrono::ChCheckpoint::LoadRotSprings ( std::vector< std::shared_ptr< ChLinkRSDA >> &  springs)
protectedpure virtual

Load spring states from the input checkpoint database and set them to the RSDAs in the provided list.

Only for a COMPONENT type checkpoint DB.

◆ LoadShafts()

virtual void chrono::ChCheckpoint::LoadShafts ( std::vector< std::shared_ptr< ChShaft >> &  shafts)
protectedpure virtual

Load shaft states from the input checkpoint database and set them to the shafts in the provided list.

Only for a COMPONENT type checkpoint DB.

◆ LoadState()

virtual void chrono::ChCheckpoint::LoadState ( ChSystem sys)
protectedpure virtual

Load the system-level state in the input checkpoint database and initialize the given system with that state.

Only for a SYSTEM type checkpoint DB.

◆ LoadVector()

virtual void chrono::ChCheckpoint::LoadVector ( std::vector< double > &  vector)
protectedpure virtual

Load a sequence of double values and load them in the provided vector.

Only for a COMPONENT type checkpoint DB.

◆ SaveBodies()

virtual void chrono::ChCheckpoint::SaveBodies ( const std::vector< std::shared_ptr< ChBody >> &  bodies)
protectedpure virtual

Save states of the bodies in the provided list.

Only for a COMPONENT type checkpoint DB.

◆ SaveBodyBodyLoads()

virtual void chrono::ChCheckpoint::SaveBodyBodyLoads ( const std::vector< std::shared_ptr< ChLoadBodyBody >> &  loads)
protectedpure virtual

Save states of the body-body loads in the provided list.

Only for a COMPONENT type checkpoint DB.

◆ SaveChQuaternion()

virtual void chrono::ChCheckpoint::SaveChQuaternion ( const ChQuaterniond quat)
protectedpure virtual

Save the components of the specified quaternion (with double values).

Only for a COMPONENT type checkpoint DB.

◆ SaveChVector3()

virtual void chrono::ChCheckpoint::SaveChVector3 ( const ChVector3d vector)
protectedpure virtual

Save the components of the specified 3D vector (with double values).

Only for a COMPONENT type checkpoint DB.

◆ SaveCouples()

virtual void chrono::ChCheckpoint::SaveCouples ( const std::vector< std::shared_ptr< ChShaftsCouple >> &  couples)
protectedpure virtual

Save states of the shaft couples in the provided list.

Only for a COMPONENT type checkpoint DB. Note that this list should only include kinematic shaft couples (i.e., no motors).

◆ SaveDouble()

virtual void chrono::ChCheckpoint::SaveDouble ( double  value)
protectedpure virtual

Save the specified double value.

Only for a COMPONENT type checkpoint DB.

◆ SaveInteger()

virtual void chrono::ChCheckpoint::SaveInteger ( int  value)
protectedpure virtual

Save the specified integer value.

Only for a COMPONENT type checkpoint DB.

◆ SaveJoints()

virtual void chrono::ChCheckpoint::SaveJoints ( const std::vector< std::shared_ptr< ChLink >> &  joints)
protectedpure virtual

Save states of the joints in the provided list.

Only for a COMPONENT type checkpoint DB. Note that this list should only include kinematic joints (i.e., no motors, springs, bushings).

◆ SaveLinMotors()

virtual void chrono::ChCheckpoint::SaveLinMotors ( const std::vector< std::shared_ptr< ChLinkMotorLinear >> &  motors)
protectedpure virtual

Save states of the linear motors in the provided list.

Only for a COMPONENT type checkpoint DB.

◆ SaveLinSprings()

virtual void chrono::ChCheckpoint::SaveLinSprings ( const std::vector< std::shared_ptr< ChLinkTSDA >> &  springs)
protectedpure virtual

Save states of the linear springs (TSDAs) in the provided list.

Only for a COMPONENT type checkpoint DB.

◆ SaveRotMotors()

virtual void chrono::ChCheckpoint::SaveRotMotors ( const std::vector< std::shared_ptr< ChLinkMotorRotation >> &  motors)
protectedpure virtual

Save states of the rotational motors in the provided list.

Only for a COMPONENT type checkpoint DB.

◆ SaveRotSprings()

virtual void chrono::ChCheckpoint::SaveRotSprings ( const std::vector< std::shared_ptr< ChLinkRSDA >> &  springs)
protectedpure virtual

Save states of the rotational springs (RSDAs) in the provided list.

Only for a COMPONENT type checkpoint DB.

◆ SaveShafts()

virtual void chrono::ChCheckpoint::SaveShafts ( const std::vector< std::shared_ptr< ChShaft >> &  shafts)
protectedpure virtual

Save states of the shafts in the provided list.

Only for a COMPONENT type checkpoint DB.

◆ SaveState()

virtual void chrono::ChCheckpoint::SaveState ( ChSystem sys)
protectedpure virtual

Save the entire state of the provided Chrono system.

Only for a SYSTEM type checkpoint DB.

◆ SaveVector()

virtual void chrono::ChCheckpoint::SaveVector ( const std::vector< double > &  vector)
protectedpure virtual

Save the components of the specified vector of doubles.

Only for a COMPONENT type checkpoint DB.


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