PolyFEM
Loading...
Searching...
No Matches
polyfem::io::ResourceIO Class Referenceabstract

Read-only interface to a hierarchical collection of simulation resources. More...

#include <ResourceIO.hpp>

Inheritance diagram for polyfem::io::ResourceIO:
[legend]

Classes

class  AccessTracker
 

Public Member Functions

virtual ~ResourceIO ()=default
 
virtual std::unique_ptr< const ResourceIO > with_root (const std::string &root) const =0
 
virtual std::string canonical_path (const std::string &path) const =0
 Absolute resource identity, independent of the active reader root.
 
virtual bool exists (const std::string &path) const =0
 
virtual bool is_group (const std::string &path) const =0
 
virtual std::vector< std::string > list (const std::string &path) const =0
 
std::vector< std::string > glob (const std::string &pattern) const
 Glob normalized logical paths using POSIX '*' and '?' wildcards.
 
virtual std::unique_ptr< std::istream > open (const std::string &path, bool binary) const =0
 
virtual std::string read_string (const std::string &path) const
 
virtual Eigen::MatrixXd read_matrix (const std::string &path) const =0
 
virtual Eigen::MatrixXi read_int_matrix (const std::string &path) const =0
 
virtual std::vector< double > read_double_vector (const std::string &path) const =0
 
virtual std::vector< int > read_int_vector (const std::string &path) const =0
 
virtual std::vector< long > read_long_vector (const std::string &path) const =0
 
virtual bool has_attribute (const std::string &path, const std::string &name) const =0
 
virtual long read_integer_attribute (const std::string &path, const std::string &name) const =0
 
virtual std::string read_string_attribute (const std::string &path, const std::string &name) const =0
 
virtual std::array< long, 2 > read_shape_attribute (const std::string &path, const std::string &name) const =0
 
virtual std::filesystem::path materialize (const std::string &path) const =0
 
virtual const std::filesystem::path & host_directory () const =0
 Host directory used only as the base for ordinary filesystem outputs.
 
virtual std::string describe (const std::string &path) const =0
 
std::vector< std::string > accessed_resources () const
 A snapshot of canonical paths consumed so far, including solver setup.
 

Protected Member Functions

 ResourceIO ()
 
void record_access (const std::string &path) const
 

Protected Attributes

std::shared_ptr< AccessTracker > access_tracker_
 

Detailed Description

Read-only interface to a hierarchical collection of simulation resources.

Definition at line 19 of file ResourceIO.hpp.

Constructor & Destructor Documentation

◆ ~ResourceIO()

virtual polyfem::io::ResourceIO::~ResourceIO ( )
virtualdefault

◆ ResourceIO()

polyfem::io::ResourceIO::ResourceIO ( )
protected

Definition at line 187 of file ResourceIO.cpp.

Member Function Documentation

◆ accessed_resources()

std::vector< std::string > polyfem::io::ResourceIO::accessed_resources ( ) const

A snapshot of canonical paths consumed so far, including solver setup.

Tracking remains active for subsequent solves and checkpoint writes.

Definition at line 196 of file ResourceIO.cpp.

References access_tracker_.

Referenced by polyfem::io::CheckpointWriter::embed_resources().

Here is the caller graph for this function:

◆ canonical_path()

virtual std::string polyfem::io::ResourceIO::canonical_path ( const std::string &  path) const
pure virtual

Absolute resource identity, independent of the active reader root.

Implemented in polyfem::io::FileSystemIO, and polyfem::io::HDF5IO.

Referenced by polyfem::io::CheckpointWriter::embed_resources(), and record_access().

Here is the caller graph for this function:

◆ describe()

virtual std::string polyfem::io::ResourceIO::describe ( const std::string &  path) const
pure virtual

◆ exists()

virtual bool polyfem::io::ResourceIO::exists ( const std::string &  path) const
pure virtual

Implemented in polyfem::io::FileSystemIO, and polyfem::io::HDF5IO.

Referenced by polyfem::io::CheckpointWriter::embed_resources(), glob(), polyfem::utils::ExpressionValue::init(), polyfem::mesh::MeshLoader::load_fem(), polyfem::mesh::MeshLoader::load_surface(), and polyfem::mesh::MeshLoader::validate_group().

Here is the caller graph for this function:

◆ glob()

std::vector< std::string > polyfem::io::ResourceIO::glob ( const std::string &  pattern) const

Glob normalized logical paths using POSIX '*' and '?' wildcards.

'**‍/' matches zero or more directories; returned paths omit './'.

Definition at line 202 of file ResourceIO.cpp.

References exists(), polyfem::mesh::find(), is_group(), and list().

Referenced by polyfem::mesh::GeometryLoader::load_obstacles().

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

◆ has_attribute()

virtual bool polyfem::io::ResourceIO::has_attribute ( const std::string &  path,
const std::string &  name 
) const
pure virtual

Implemented in polyfem::io::FileSystemIO, and polyfem::io::HDF5IO.

Referenced by polyfem::mesh::MeshLoader::load_fem(), and polyfem::mesh::MeshLoader::validate_group().

Here is the caller graph for this function:

◆ host_directory()

virtual const std::filesystem::path & polyfem::io::ResourceIO::host_directory ( ) const
pure virtual

Host directory used only as the base for ordinary filesystem outputs.

Implemented in polyfem::io::FileSystemIO, and polyfem::io::HDF5IO.

Referenced by forward_simulation().

Here is the caller graph for this function:

◆ is_group()

virtual bool polyfem::io::ResourceIO::is_group ( const std::string &  path) const
pure virtual

◆ list()

virtual std::vector< std::string > polyfem::io::ResourceIO::list ( const std::string &  path) const
pure virtual

Implemented in polyfem::io::FileSystemIO, and polyfem::io::HDF5IO.

Referenced by glob(), and polyfem::mesh::GeometryLoader::load_obstacles().

Here is the caller graph for this function:

◆ materialize()

virtual std::filesystem::path polyfem::io::ResourceIO::materialize ( const std::string &  path) const
pure virtual

Implemented in polyfem::io::FileSystemIO, and polyfem::io::HDF5IO.

Referenced by polyfem::utils::ExpressionValue::init(), polyfem::mesh::load_collision_proxy_displacement_map(), polyfem::mesh::MeshLoader::load_fem(), and polyfem::mesh::MeshLoader::load_surface().

Here is the caller graph for this function:

◆ open()

virtual std::unique_ptr< std::istream > polyfem::io::ResourceIO::open ( const std::string &  path,
bool  binary 
) const
pure virtual

Implemented in polyfem::io::FileSystemIO, and polyfem::io::HDF5IO.

Referenced by polyfem::assembler::FiberDirection::add_multimaterial(), polyfem::io::CheckpointWriter::embed_resources(), polyfem::problem::NodeValues::load(), polyfem::mesh::MeshLoader::load_fem(), read_string(), and polyfem::problem::KernelProblem::set_parameters().

Here is the caller graph for this function:

◆ read_double_vector()

virtual std::vector< double > polyfem::io::ResourceIO::read_double_vector ( const std::string &  path) const
pure virtual

Implemented in polyfem::io::FileSystemIO, and polyfem::io::HDF5IO.

Referenced by polyfem::mesh::load_collision_proxy_displacement_map(), and polyfem::mesh::MeshLoader::load_fem().

Here is the caller graph for this function:

◆ read_int_matrix()

virtual Eigen::MatrixXi polyfem::io::ResourceIO::read_int_matrix ( const std::string &  path) const
pure virtual

Implemented in polyfem::io::FileSystemIO, and polyfem::io::HDF5IO.

Referenced by polyfem::varform::VarForm::assign_discr_orders(), polyfem::utils::FileSelection::FileSelection(), polyfem::problem::PointBasedTensorProblem::BCValue::init(), polyfem::mesh::MeshLoader::load_fem(), and polyfem::mesh::MeshLoader::load_surface().

Here is the caller graph for this function:

◆ read_int_vector()

virtual std::vector< int > polyfem::io::ResourceIO::read_int_vector ( const std::string &  path) const
pure virtual

Implemented in polyfem::io::FileSystemIO, and polyfem::io::HDF5IO.

Referenced by polyfem::mesh::load_collision_proxy_displacement_map(), polyfem::mesh::MeshLoader::load_fem(), and polyfem::mesh::MeshLoader::load_surface().

Here is the caller graph for this function:

◆ read_integer_attribute()

virtual long polyfem::io::ResourceIO::read_integer_attribute ( const std::string &  path,
const std::string &  name 
) const
pure virtual

Implemented in polyfem::io::FileSystemIO, and polyfem::io::HDF5IO.

Referenced by polyfem::mesh::MeshLoader::load_fem(), polyfem::mesh::MeshLoader::load_surface(), and polyfem::mesh::MeshLoader::validate_group().

Here is the caller graph for this function:

◆ read_long_vector()

virtual std::vector< long > polyfem::io::ResourceIO::read_long_vector ( const std::string &  path) const
pure virtual

Implemented in polyfem::io::FileSystemIO, and polyfem::io::HDF5IO.

Referenced by polyfem::mesh::MeshLoader::load_fem().

Here is the caller graph for this function:

◆ read_matrix()

virtual Eigen::MatrixXd polyfem::io::ResourceIO::read_matrix ( const std::string &  path) const
pure virtual

◆ read_shape_attribute()

virtual std::array< long, 2 > polyfem::io::ResourceIO::read_shape_attribute ( const std::string &  path,
const std::string &  name 
) const
pure virtual

Implemented in polyfem::io::FileSystemIO, and polyfem::io::HDF5IO.

Referenced by polyfem::mesh::load_collision_proxy_displacement_map().

Here is the caller graph for this function:

◆ read_string()

std::string polyfem::io::ResourceIO::read_string ( const std::string &  path) const
virtual

Reimplemented in polyfem::io::HDF5IO.

Definition at line 260 of file ResourceIO.cpp.

References open().

Referenced by polyfem::utils::apply_common_params(), polyfem::utils::apply_common_params(), and polyfem::utils::expand_bc_sidecars().

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

◆ read_string_attribute()

virtual std::string polyfem::io::ResourceIO::read_string_attribute ( const std::string &  path,
const std::string &  name 
) const
pure virtual

Implemented in polyfem::io::FileSystemIO, and polyfem::io::HDF5IO.

Referenced by polyfem::mesh::MeshLoader::validate_group().

Here is the caller graph for this function:

◆ record_access()

void polyfem::io::ResourceIO::record_access ( const std::string &  path) const
protected

Definition at line 189 of file ResourceIO.cpp.

References access_tracker_, and canonical_path().

Referenced by polyfem::io::FileSystemIO::materialize(), polyfem::io::HDF5IO::materialize(), polyfem::io::FileSystemIO::open(), polyfem::io::FileSystemIO::read_int_matrix(), polyfem::io::HDF5IO::read_int_matrix(), polyfem::io::HDF5IO::read_integer_attribute(), polyfem::io::FileSystemIO::read_long_vector(), polyfem::io::HDF5IO::read_long_vector(), polyfem::io::FileSystemIO::read_matrix(), polyfem::io::HDF5IO::read_matrix(), polyfem::io::HDF5IO::read_shape_attribute(), polyfem::io::HDF5IO::read_string(), and polyfem::io::HDF5IO::read_string_attribute().

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

◆ with_root()

virtual std::unique_ptr< const ResourceIO > polyfem::io::ResourceIO::with_root ( const std::string &  root) const
pure virtual

Implemented in polyfem::io::FileSystemIO, and polyfem::io::HDF5IO.

Referenced by polyfem::utils::apply_common_params(), polyfem::OptState::init(), polyfem::State::init(), and polyfem::OptState::run().

Here is the caller graph for this function:

Member Data Documentation

◆ access_tracker_

std::shared_ptr<AccessTracker> polyfem::io::ResourceIO::access_tracker_
protected

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