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 phsics 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 write a SYSTEM checkpoint file, call:

  WriteState(...);
  WriteFile(...);
  

To write a COMPONENT checkpoint file, call:

  WriteTime(...);
  WriteBodies(...);
  WriteShafts(...);
  ...
  WriteFile(...);
  

To read a SYSTEM checkpoint file, call:

  OpenFile(...);
  ReadState(...);
  

To read a COMPONENT checkpoint file, call:

  OpenFile(...);
  ReadTime(...);
  ReadBodies(...);
  ReadShafts(...);
  ...
  

#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.
 
virtual void WriteState (ChSystem *sys)=0
 Write the entire state of the provided Chrono system. More...
 
virtual void WriteTime (double time)=0
 Write the checkpoint time. More...
 
virtual void WriteBodies (const std::vector< std::shared_ptr< ChBody >> &bodies)=0
 Write states of the bodies in the provided list. More...
 
virtual void WriteShafts (const std::vector< std::shared_ptr< ChShaft >> &shafts)=0
 Write states of the shafts in the provided list. More...
 
virtual void WriteJoints (const std::vector< std::shared_ptr< ChLink >> &joints)=0
 Write states of the joints in the provided list. More...
 
virtual void WriteCouples (const std::vector< std::shared_ptr< ChShaftsCouple >> &couples)=0
 Write states of the shaft couples in the provided list. More...
 
virtual void WriteLinSprings (const std::vector< std::shared_ptr< ChLinkTSDA >> &springs)=0
 Write states of the linear springs (TSDAs) in the provided list. More...
 
virtual void WriteRotSprings (const std::vector< std::shared_ptr< ChLinkRSDA >> &springs)=0
 Write states of the rotational springs (RSDAs) in the provided list. More...
 
virtual void WriteBodyBodyLoads (const std::vector< std::shared_ptr< ChLoadBodyBody >> &loads)=0
 Write states of the body-body loads in the provided list. More...
 
virtual void WriteLinMotors (const std::vector< std::shared_ptr< ChLinkMotorLinear >> &motors)=0
 Write states of the linear motors in the provided list. More...
 
virtual void WriteRotMotors (const std::vector< std::shared_ptr< ChLinkMotorRotation >> &motors)=0
 Write states of the rotational motors in the provided list. More...
 
virtual void WriteFile (const std::string &filename)=0
 Write the checkpoint database to a disk file with the specified name.
 
virtual void OpenFile (const std::string &filename)=0
 Open the checkpoint database from the disk file with the specified name.
 
virtual void ReadState (ChSystem *sys)=0
 Read the system-level state in the input checkpoint database and initialize the given system with that state. More...
 
virtual void ReadTime (double &time)=0
 Read the checkpoint time from the input checkpoint database. More...
 
virtual void ReadBodies (std::vector< std::shared_ptr< ChBody >> &bodies)=0
 Read body states from the input checkpoint database and set them to the bodies in the provided list. More...
 
virtual void ReadShafts (std::vector< std::shared_ptr< ChShaft >> &shafts)=0
 Read shaft states from the input checkpoint database and set them to the shafts in the provided list. More...
 
virtual void ReadJoints (std::vector< std::shared_ptr< ChLink >> &joints)=0
 Read joint states from the input checkpoint database and set them to the joints in the provided list. More...
 
virtual void ReadCouples (std::vector< std::shared_ptr< ChShaftsCouple >> &couples)=0
 Read couple states from the input checkpoint database and set them to the shaft couples in the provided list. More...
 
virtual void ReadLinSprings (std::vector< std::shared_ptr< ChLinkTSDA >> &springs)=0
 Read spring states from the input checkpoint database and set them to the TSDAs in the provided list. More...
 
virtual void ReadRotSprings (std::vector< std::shared_ptr< ChLinkRSDA >> &springs)=0
 Read spring states from the input checkpoint database and set them to the RSDAs in the provided list. More...
 
virtual void ReadBodyBodyLoads (std::vector< std::shared_ptr< ChLoadBodyBody >> &loads)=0
 Read body-body load states from the input checkpoint database and set them to the loads in the provided list. More...
 
virtual void ReadLinMotors (std::vector< std::shared_ptr< ChLinkMotorLinear >> &motors)=0
 Read motor states from the input checkpoint database and set them to the linear motors in the provided list. More...
 
virtual void ReadRotMotors (std::vector< std::shared_ptr< ChLinkMotorRotation >> &motors)=0
 Read motor states from the input checkpoint database and set them to the rotational motors in the provided list. More...
 

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.
 

Protected Attributes

Type m_type
 checkpoint database type
 

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

◆ ReadBodies()

virtual void chrono::ChCheckpoint::ReadBodies ( std::vector< std::shared_ptr< ChBody >> &  bodies)
pure virtual

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

Only for a COMPONENT type checkpoint DB.

Implemented in chrono::ChCheckpointASCII.

◆ ReadBodyBodyLoads()

virtual void chrono::ChCheckpoint::ReadBodyBodyLoads ( std::vector< std::shared_ptr< ChLoadBodyBody >> &  loads)
pure virtual

Read 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.

Implemented in chrono::ChCheckpointASCII.

◆ ReadCouples()

virtual void chrono::ChCheckpoint::ReadCouples ( std::vector< std::shared_ptr< ChShaftsCouple >> &  couples)
pure virtual

Read 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).

Implemented in chrono::ChCheckpointASCII.

◆ ReadJoints()

virtual void chrono::ChCheckpoint::ReadJoints ( std::vector< std::shared_ptr< ChLink >> &  joints)
pure virtual

Read 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).

Implemented in chrono::ChCheckpointASCII.

◆ ReadLinMotors()

virtual void chrono::ChCheckpoint::ReadLinMotors ( std::vector< std::shared_ptr< ChLinkMotorLinear >> &  motors)
pure virtual

Read 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.

Implemented in chrono::ChCheckpointASCII.

◆ ReadLinSprings()

virtual void chrono::ChCheckpoint::ReadLinSprings ( std::vector< std::shared_ptr< ChLinkTSDA >> &  springs)
pure virtual

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

Only for a COMPONENT type checkpoint DB.

Implemented in chrono::ChCheckpointASCII.

◆ ReadRotMotors()

virtual void chrono::ChCheckpoint::ReadRotMotors ( std::vector< std::shared_ptr< ChLinkMotorRotation >> &  motors)
pure virtual

Read 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.

Implemented in chrono::ChCheckpointASCII.

◆ ReadRotSprings()

virtual void chrono::ChCheckpoint::ReadRotSprings ( std::vector< std::shared_ptr< ChLinkRSDA >> &  springs)
pure virtual

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

Only for a COMPONENT type checkpoint DB.

Implemented in chrono::ChCheckpointASCII.

◆ ReadShafts()

virtual void chrono::ChCheckpoint::ReadShafts ( std::vector< std::shared_ptr< ChShaft >> &  shafts)
pure virtual

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

Only for a COMPONENT type checkpoint DB.

Implemented in chrono::ChCheckpointASCII.

◆ ReadState()

virtual void chrono::ChCheckpoint::ReadState ( ChSystem sys)
pure virtual

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

Only for a SYSTEM type checkpoint DB.

Implemented in chrono::ChCheckpointASCII.

◆ ReadTime()

virtual void chrono::ChCheckpoint::ReadTime ( double &  time)
pure virtual

Read the checkpoint time from the input checkpoint database.

Only for a COMPONENT type checkpoint DB.

Implemented in chrono::ChCheckpointASCII.

◆ WriteBodies()

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

Write states of the bodies in the provided list.

Only for a COMPONENT type checkpoint DB.

Implemented in chrono::ChCheckpointASCII.

◆ WriteBodyBodyLoads()

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

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

Only for a COMPONENT type checkpoint DB.

Implemented in chrono::ChCheckpointASCII.

◆ WriteCouples()

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

Write 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).

Implemented in chrono::ChCheckpointASCII.

◆ WriteJoints()

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

Write 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).

Implemented in chrono::ChCheckpointASCII.

◆ WriteLinMotors()

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

Write states of the linear motors in the provided list.

Only for a COMPONENT type checkpoint DB.

Implemented in chrono::ChCheckpointASCII.

◆ WriteLinSprings()

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

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

Only for a COMPONENT type checkpoint DB.

Implemented in chrono::ChCheckpointASCII.

◆ WriteRotMotors()

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

Write states of the rotational motors in the provided list.

Only for a COMPONENT type checkpoint DB.

Implemented in chrono::ChCheckpointASCII.

◆ WriteRotSprings()

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

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

Only for a COMPONENT type checkpoint DB.

Implemented in chrono::ChCheckpointASCII.

◆ WriteShafts()

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

Write states of the shafts in the provided list.

Only for a COMPONENT type checkpoint DB.

Implemented in chrono::ChCheckpointASCII.

◆ WriteState()

virtual void chrono::ChCheckpoint::WriteState ( ChSystem sys)
pure virtual

Write the entire state of the provided Chrono system.

Only for a SYSTEM type checkpoint DB.

Implemented in chrono::ChCheckpointASCII.

◆ WriteTime()

virtual void chrono::ChCheckpoint::WriteTime ( double  time)
pure virtual

Write the checkpoint time.

Only for a COMPONENT type checkpoint DB.

Implemented in chrono::ChCheckpointASCII.


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