PolyFEM
Loading...
Searching...
No Matches
polyfem::io::HDF5IO Class Referencefinal

HDF5 logical paths always use POSIX separators and roots. More...

#include <ResourceIO.hpp>

Inheritance diagram for polyfem::io::HDF5IO:
[legend]
Collaboration diagram for polyfem::io::HDF5IO:
[legend]

Classes

class  Impl
 

Public Member Functions

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

Private Attributes

std::shared_ptr< Impl > impl_
 
std::filesystem::path file_path_
 
std::string root_
 
std::string storage_root_
 
std::filesystem::path host_directory_
 

Additional Inherited Members

- Protected Member Functions inherited from polyfem::io::ResourceIO
 ResourceIO ()
 
void record_access (const std::string &path) const
 
- Protected Attributes inherited from polyfem::io::ResourceIO
std::shared_ptr< AccessTracker > access_tracker_
 

Detailed Description

HDF5 logical paths always use POSIX separators and roots.

Strings and rank-one uint8 datasets are file resources; other numeric datasets are typed scalars/vectors/matrices. Integer reads reject overflow and floating-point datasets rather than silently truncating them.

Definition at line 101 of file ResourceIO.hpp.

Constructor & Destructor Documentation

◆ HDF5IO()

polyfem::io::HDF5IO::HDF5IO ( const std::filesystem::path &  file,
const std::string &  root = "/",
const std::filesystem::path &  host_directory = {},
const std::string &  storage_root = "" 
)
explicit

Definition at line 376 of file ResourceIO.cpp.

◆ ~HDF5IO()

polyfem::io::HDF5IO::~HDF5IO ( )
overridedefault

Member Function Documentation

◆ canonical_path()

std::string polyfem::io::HDF5IO::canonical_path ( const std::string &  path) const
inlineoverridevirtual

Absolute resource identity, independent of the active reader root.

Implements polyfem::io::ResourceIO.

Definition at line 112 of file ResourceIO.hpp.

References logical_resolve().

Here is the call graph for this function:

◆ describe()

std::string polyfem::io::HDF5IO::describe ( const std::string &  path) const
overridevirtual

Implements polyfem::io::ResourceIO.

Definition at line 576 of file ResourceIO.cpp.

References file_path_, and resolve().

Referenced by materialize(), and read_string().

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

◆ exists()

bool polyfem::io::HDF5IO::exists ( const std::string &  path) const
overridevirtual

Implements polyfem::io::ResourceIO.

Definition at line 425 of file ResourceIO.cpp.

References impl_, and resolve().

Here is the call graph for this function:

◆ file_path()

const std::filesystem::path & polyfem::io::HDF5IO::file_path ( ) const
inline

Definition at line 132 of file ResourceIO.hpp.

References file_path_.

◆ has_attribute()

bool polyfem::io::HDF5IO::has_attribute ( const std::string &  path,
const std::string &  name 
) const
overridevirtual

Implements polyfem::io::ResourceIO.

Definition at line 517 of file ResourceIO.cpp.

References impl_, and resolve().

Here is the call graph for this function:

◆ host_directory()

const std::filesystem::path & polyfem::io::HDF5IO::host_directory ( ) const
inlineoverridevirtual

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

Implements polyfem::io::ResourceIO.

Definition at line 129 of file ResourceIO.hpp.

References host_directory_.

◆ is_group()

bool polyfem::io::HDF5IO::is_group ( const std::string &  path) const
overridevirtual

Implements polyfem::io::ResourceIO.

Definition at line 427 of file ResourceIO.cpp.

References impl_, and resolve().

Referenced by list().

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

◆ list()

std::vector< std::string > polyfem::io::HDF5IO::list ( const std::string &  path) const
overridevirtual

Implements polyfem::io::ResourceIO.

Definition at line 436 of file ResourceIO.cpp.

References entries, impl_, is_group(), logical_resolve(), resolve(), root_, and storage_root_.

Here is the call graph for this function:

◆ logical_resolve()

std::string polyfem::io::HDF5IO::logical_resolve ( const std::string &  path) const

Definition at line 402 of file ResourceIO.cpp.

References root_, and storage_root_.

Referenced by canonical_path(), list(), resolve(), and with_root().

Here is the caller graph for this function:

◆ logical_root()

const std::string & polyfem::io::HDF5IO::logical_root ( ) const
inline

Definition at line 133 of file ResourceIO.hpp.

References root_.

◆ materialize()

fs::path polyfem::io::HDF5IO::materialize ( const std::string &  path) const
overridevirtual

Implements polyfem::io::ResourceIO.

Definition at line 541 of file ResourceIO.cpp.

References describe(), impl_, polyfem::log_and_throw_error(), read_string(), polyfem::io::ResourceIO::record_access(), and resolve().

Referenced by read_int_matrix(), read_long_vector(), and read_matrix().

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

◆ open()

std::unique_ptr< std::istream > polyfem::io::HDF5IO::open ( const std::string &  path,
bool  binary 
) const
overridevirtual

Implements polyfem::io::ResourceIO.

Definition at line 481 of file ResourceIO.cpp.

References read_string().

Here is the call graph for this function:

◆ read_double_vector()

std::vector< double > polyfem::io::HDF5IO::read_double_vector ( const std::string &  path) const
overridevirtual

Implements polyfem::io::ResourceIO.

Definition at line 500 of file ResourceIO.cpp.

References read_matrix().

Here is the call graph for this function:

◆ read_int_matrix()

Eigen::MatrixXi polyfem::io::HDF5IO::read_int_matrix ( const std::string &  path) const
overridevirtual

Implements polyfem::io::ResourceIO.

Definition at line 493 of file ResourceIO.cpp.

References impl_, materialize(), polyfem::io::ResourceIO::record_access(), and resolve().

Referenced by read_int_vector().

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

◆ read_int_vector()

std::vector< int > polyfem::io::HDF5IO::read_int_vector ( const std::string &  path) const
overridevirtual

Implements polyfem::io::ResourceIO.

Definition at line 505 of file ResourceIO.cpp.

References read_int_matrix().

Here is the call graph for this function:

◆ read_integer_attribute()

long polyfem::io::HDF5IO::read_integer_attribute ( const std::string &  path,
const std::string &  name 
) const
overridevirtual

Implements polyfem::io::ResourceIO.

Definition at line 523 of file ResourceIO.cpp.

References impl_, polyfem::io::ResourceIO::record_access(), and resolve().

Here is the call graph for this function:

◆ read_long_vector()

std::vector< long > polyfem::io::HDF5IO::read_long_vector ( const std::string &  path) const
overridevirtual

Implements polyfem::io::ResourceIO.

Definition at line 510 of file ResourceIO.cpp.

References impl_, materialize(), polyfem::io::ResourceIO::record_access(), and resolve().

Here is the call graph for this function:

◆ read_matrix()

Eigen::MatrixXd polyfem::io::HDF5IO::read_matrix ( const std::string &  path) const
overridevirtual

Implements polyfem::io::ResourceIO.

Definition at line 486 of file ResourceIO.cpp.

References impl_, materialize(), polyfem::io::ResourceIO::record_access(), and resolve().

Referenced by read_double_vector().

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

◆ read_shape_attribute()

std::array< long, 2 > polyfem::io::HDF5IO::read_shape_attribute ( const std::string &  path,
const std::string &  name 
) const
overridevirtual

Implements polyfem::io::ResourceIO.

Definition at line 535 of file ResourceIO.cpp.

References impl_, polyfem::io::ResourceIO::record_access(), and resolve().

Here is the call graph for this function:

◆ read_string()

std::string polyfem::io::HDF5IO::read_string ( const std::string &  path) const
overridevirtual

Reimplemented from polyfem::io::ResourceIO.

Definition at line 467 of file ResourceIO.cpp.

References describe(), impl_, polyfem::log_and_throw_error(), polyfem::io::ResourceIO::record_access(), and resolve().

Referenced by materialize(), and open().

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

◆ read_string_attribute()

std::string polyfem::io::HDF5IO::read_string_attribute ( const std::string &  path,
const std::string &  name 
) const
overridevirtual

Implements polyfem::io::ResourceIO.

Definition at line 529 of file ResourceIO.cpp.

References impl_, polyfem::io::ResourceIO::record_access(), and resolve().

Here is the call graph for this function:

◆ resolve()

std::string polyfem::io::HDF5IO::resolve ( const std::string &  path) const

Definition at line 418 of file ResourceIO.cpp.

References logical_resolve(), and storage_root_.

Referenced by describe(), exists(), has_attribute(), is_group(), list(), materialize(), read_int_matrix(), read_integer_attribute(), read_long_vector(), read_matrix(), read_shape_attribute(), read_string(), and read_string_attribute().

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

◆ with_root()

std::unique_ptr< const ResourceIO > polyfem::io::HDF5IO::with_root ( const std::string &  root) const
overridevirtual

Implements polyfem::io::ResourceIO.

Definition at line 393 of file ResourceIO.cpp.

References polyfem::io::ResourceIO::access_tracker_, file_path_, host_directory_, impl_, logical_resolve(), and storage_root_.

Here is the call graph for this function:

Member Data Documentation

◆ file_path_

std::filesystem::path polyfem::io::HDF5IO::file_path_
private

Definition at line 140 of file ResourceIO.hpp.

Referenced by describe(), file_path(), and with_root().

◆ host_directory_

std::filesystem::path polyfem::io::HDF5IO::host_directory_
private

Definition at line 143 of file ResourceIO.hpp.

Referenced by host_directory(), and with_root().

◆ impl_

◆ root_

std::string polyfem::io::HDF5IO::root_
private

Definition at line 141 of file ResourceIO.hpp.

Referenced by list(), logical_resolve(), and logical_root().

◆ storage_root_

std::string polyfem::io::HDF5IO::storage_root_
private

Definition at line 142 of file ResourceIO.hpp.

Referenced by list(), logical_resolve(), resolve(), and with_root().


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