PolyFEM
Loading...
Searching...
No Matches
polyfem::io::CheckpointWriter Class Reference

#include <Checkpoint.hpp>

Classes

class  Impl
 

Public Member Functions

 CheckpointWriter (const std::filesystem::path &path, const json &config, const CheckpointMetadata &metadata)
 
 ~CheckpointWriter ()
 
 CheckpointWriter (const CheckpointWriter &)=delete
 
CheckpointWriter & operator= (const CheckpointWriter &)=delete
 
void write_matrix (const std::string &path, const Eigen::MatrixXd &value)
 
void write_int_matrix (const std::string &path, const Eigen::MatrixXi &value)
 
void write_bytes (const std::string &path, const std::vector< unsigned char > &value)
 
void write_vector (const std::string &path, const std::vector< double > &value)
 
void write_int_vector (const std::string &path, const std::vector< int > &value)
 
void write_long_vector (const std::string &path, const std::vector< long > &value)
 
void write_string (const std::string &path, const std::string &value)
 
void write_long (const std::string &path, long value)
 
void write_double (const std::string &path, double value)
 
void write_attribute (const std::string &path, const std::string &name, long value)
 
void write_attribute (const std::string &path, const std::string &name, const std::string &value)
 
void write_mesh (const std::string &group, const mesh::Mesh &mesh)
 
void write_mesh (const std::string &group, const mesh::MeshData &mesh)
 
void embed_resources (const ResourceIO &resources)
 
void finalize ()
 

Private Attributes

std::unique_ptr< Impl > impl_
 
std::filesystem::path path_
 
std::filesystem::path temporary_path_
 
bool finalized_ = false
 

Detailed Description

Definition at line 34 of file Checkpoint.hpp.

Constructor & Destructor Documentation

◆ CheckpointWriter() [1/2]

polyfem::io::CheckpointWriter::CheckpointWriter ( const std::filesystem::path &  path,
const json &  config,
const CheckpointMetadata &  metadata 
)

◆ ~CheckpointWriter()

polyfem::io::CheckpointWriter::~CheckpointWriter ( )

Definition at line 92 of file Checkpoint.cpp.

References finalized_, impl_, and temporary_path_.

◆ CheckpointWriter() [2/2]

polyfem::io::CheckpointWriter::CheckpointWriter ( const CheckpointWriter &  )
delete

Member Function Documentation

◆ embed_resources()

void polyfem::io::CheckpointWriter::embed_resources ( const ResourceIO &  resources)

Definition at line 169 of file Checkpoint.cpp.

References polyfem::io::ResourceIO::accessed_resources(), polyfem::io::ResourceIO::canonical_path(), polyfem::io::ResourceIO::describe(), polyfem::io::ResourceIO::exists(), impl_, polyfem::io::ResourceIO::is_group(), polyfem::log_and_throw_error(), polyfem::io::ResourceIO::open(), write_bytes(), and write_string().

Referenced by polyfem::varform::VarForm::save_step_state().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ finalize()

void polyfem::io::CheckpointWriter::finalize ( )

Definition at line 207 of file Checkpoint.cpp.

References finalized_, impl_, polyfem::log_and_throw_error(), path_, and temporary_path_.

Referenced by polyfem::varform::VarForm::save_step_state().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=()

CheckpointWriter & polyfem::io::CheckpointWriter::operator= ( const CheckpointWriter &  )
delete

◆ write_attribute() [1/2]

void polyfem::io::CheckpointWriter::write_attribute ( const std::string &  path,
const std::string &  name,
const std::string &  value 
)

Definition at line 112 of file Checkpoint.cpp.

References impl_.

◆ write_attribute() [2/2]

void polyfem::io::CheckpointWriter::write_attribute ( const std::string &  path,
const std::string &  name,
long  value 
)

Definition at line 111 of file Checkpoint.cpp.

References impl_.

Referenced by write_mesh().

Here is the caller graph for this function:

◆ write_bytes()

void polyfem::io::CheckpointWriter::write_bytes ( const std::string &  path,
const std::vector< unsigned char > &  value 
)

Definition at line 104 of file Checkpoint.cpp.

References impl_.

Referenced by embed_resources().

Here is the caller graph for this function:

◆ write_double()

void polyfem::io::CheckpointWriter::write_double ( const std::string &  path,
double  value 
)

Definition at line 110 of file Checkpoint.cpp.

References impl_.

Referenced by polyfem::time_integrator::ImplicitTimeIntegrator::serialize_checkpoint().

Here is the caller graph for this function:

◆ write_int_matrix()

void polyfem::io::CheckpointWriter::write_int_matrix ( const std::string &  path,
const Eigen::MatrixXi &  value 
)

Definition at line 103 of file Checkpoint.cpp.

References impl_.

Referenced by write_mesh().

Here is the caller graph for this function:

◆ write_int_vector()

void polyfem::io::CheckpointWriter::write_int_vector ( const std::string &  path,
const std::vector< int > &  value 
)

Definition at line 106 of file Checkpoint.cpp.

References impl_.

Referenced by polyfem::varform::VarForm::write_checkpoint_ordering(), and write_mesh().

Here is the caller graph for this function:

◆ write_long()

void polyfem::io::CheckpointWriter::write_long ( const std::string &  path,
long  value 
)

Definition at line 109 of file Checkpoint.cpp.

References impl_.

Referenced by polyfem::time_integrator::ImplicitTimeIntegrator::serialize_checkpoint().

Here is the caller graph for this function:

◆ write_long_vector()

void polyfem::io::CheckpointWriter::write_long_vector ( const std::string &  path,
const std::vector< long > &  value 
)

Definition at line 107 of file Checkpoint.cpp.

References impl_.

Referenced by write_mesh().

Here is the caller graph for this function:

◆ write_matrix()

void polyfem::io::CheckpointWriter::write_matrix ( const std::string &  path,
const Eigen::MatrixXd &  value 
)

Definition at line 102 of file Checkpoint.cpp.

References impl_.

Referenced by polyfem::varform::VarForm::serialize_checkpoint(), polyfem::varform::OperatorSplittingVarForm::serialize_checkpoint(), polyfem::time_integrator::ImplicitTimeIntegrator::serialize_checkpoint(), and write_mesh().

Here is the caller graph for this function:

◆ write_mesh() [1/2]

void polyfem::io::CheckpointWriter::write_mesh ( const std::string &  group,
const mesh::Mesh &  mesh 
)

Definition at line 114 of file Checkpoint.cpp.

References polyfem::mesh::Mesh::to_mesh_data(), and write_mesh().

Referenced by polyfem::varform::VarForm::save_step_state(), polyfem::varform::NavierStokesFSIVarForm::serialize_checkpoint(), and write_mesh().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_mesh() [2/2]

◆ write_string()

void polyfem::io::CheckpointWriter::write_string ( const std::string &  path,
const std::string &  value 
)

Definition at line 108 of file Checkpoint.cpp.

References impl_.

Referenced by embed_resources().

Here is the caller graph for this function:

◆ write_vector()

void polyfem::io::CheckpointWriter::write_vector ( const std::string &  path,
const std::vector< double > &  value 
)

Definition at line 105 of file Checkpoint.cpp.

References impl_.

Referenced by write_mesh().

Here is the caller graph for this function:

Member Data Documentation

◆ finalized_

bool polyfem::io::CheckpointWriter::finalized_ = false
private

Definition at line 65 of file Checkpoint.hpp.

Referenced by finalize(), and ~CheckpointWriter().

◆ impl_

◆ path_

std::filesystem::path polyfem::io::CheckpointWriter::path_
private

Definition at line 63 of file Checkpoint.hpp.

Referenced by finalize().

◆ temporary_path_

std::filesystem::path polyfem::io::CheckpointWriter::temporary_path_
private

Definition at line 64 of file Checkpoint.hpp.

Referenced by finalize(), and ~CheckpointWriter().


The documentation for this class was generated from the following files: