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>

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
|
strong |
◆ Type
|
strong |
Member Function Documentation
◆ LoadBodies()
|
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()
|
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()
|
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()
|
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()
|
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()
|
protectedpure virtual |
Load a double value and set it to the provided variable.
Only for a COMPONENT type checkpoint DB.
◆ LoadInteger()
|
protectedpure virtual |
Load an integer value and set it to the provided variable.
Only for a COMPONENT type checkpoint DB.
◆ LoadJoints()
|
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()
|
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()
|
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()
|
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()
|
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()
|
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()
|
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()
|
protectedpure virtual |
Load a sequence of double values and load them in the provided vector.
Only for a COMPONENT type checkpoint DB.
◆ SaveBodies()
|
protectedpure virtual |
Save states of the bodies in the provided list.
Only for a COMPONENT type checkpoint DB.
◆ SaveBodyBodyLoads()
|
protectedpure virtual |
Save states of the body-body loads in the provided list.
Only for a COMPONENT type checkpoint DB.
◆ SaveChQuaternion()
|
protectedpure virtual |
Save the components of the specified quaternion (with double values).
Only for a COMPONENT type checkpoint DB.
◆ SaveChVector3()
|
protectedpure virtual |
Save the components of the specified 3D vector (with double values).
Only for a COMPONENT type checkpoint DB.
◆ SaveCouples()
|
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()
|
protectedpure virtual |
Save the specified double value.
Only for a COMPONENT type checkpoint DB.
◆ SaveInteger()
|
protectedpure virtual |
Save the specified integer value.
Only for a COMPONENT type checkpoint DB.
◆ SaveJoints()
|
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()
|
protectedpure virtual |
Save states of the linear motors in the provided list.
Only for a COMPONENT type checkpoint DB.
◆ SaveLinSprings()
|
protectedpure virtual |
Save states of the linear springs (TSDAs) in the provided list.
Only for a COMPONENT type checkpoint DB.
◆ SaveRotMotors()
|
protectedpure virtual |
Save states of the rotational motors in the provided list.
Only for a COMPONENT type checkpoint DB.
◆ SaveRotSprings()
|
protectedpure virtual |
Save states of the rotational springs (RSDAs) in the provided list.
Only for a COMPONENT type checkpoint DB.
◆ SaveShafts()
|
protectedpure virtual |
Save states of the shafts in the provided list.
Only for a COMPONENT type checkpoint DB.
◆ SaveState()
|
protectedpure virtual |
Save the entire state of the provided Chrono system.
Only for a SYSTEM type checkpoint DB.
◆ SaveVector()
|
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