template<class T>
Rodin::IO::Loader class

Base template for loading objects from files or streams.

Template parameters
T Type of object to load

Abstract base class template for loading objects from streams or files.

The Loader class provides a common interface for reading objects of type T from input streams or files. This class serves as the foundation for specialized loaders that handle different file formats and object types.

Derived classes must implement:

  • load(std::istream&) - Load object from an input stream
  • getObject() - Access the object being loaded

Usage Example

class MyObjectLoader : public Loader<MyObject>
{
public:
  void load(std::istream& is) override
  {
    // Read from stream and populate object
    is >> getObject();
  }

protected:
  ObjectType& getObject() override
  {
    return m_object;
  }

private:
  MyObject m_object;
};

Derived classes

template<class FES, class Scalar>
class GridFunctionLoader<FileFormat::HDF5, FES, Math::Vector<Scalar>>
HDF5 grid function loader for local grid functions backed by Math::Vector<Scalar>.
template<class FES>
class GridFunctionLoader<FileFormat::MEDIT, FES, Math::Vector<typename FormLanguage::Traits<FES>::ScalarType>>
Reads matrix entries stored as independent MEDIT scalar vertex fields. Higher-order spaces interpolate the vertex field, as required by SolAtVertices.
template<size_t K, class Range>
class GridFunctionLoader<FileFormat::MEDIT, Variational::H1<K, Range, Geometry::Mesh<Context::Local>>, Math::Vector<typename FormLanguage::Traits<Range>::ScalarType>>
MEDIT grid-function loader for local H1 finite element spaces.
template<class Range>
class GridFunctionLoader<FileFormat::MEDIT, Variational::P1<Range, Geometry::Mesh<Context::Local>>, Math::Vector<typename FormLanguage::Traits<Range>::ScalarType>>
MEDIT grid-function loader for local P1 finite element spaces.
template<class FES, class Scalar>
class GridFunctionLoader<FileFormat::MFEM, FES, Math::Vector<Scalar>>
Loads each MFEM component through the scalar family's node mapping.
template<size_t K, class Range>
class GridFunctionLoader<FileFormat::MFEM, Variational::H1<K, Range, Geometry::Mesh<Context::Local>>, Math::Vector<typename FormLanguage::Traits<Range>::ScalarType>>
Specialization for loading H1 grid functions from MFEM format.
template<class Range>
class GridFunctionLoader<FileFormat::MFEM, Variational::P0<Range, Geometry::Mesh<Context::Local>>, Math::Vector<typename FormLanguage::Traits<Range>::ScalarType>>
Loader for P0 (piecewise constant) grid functions in MFEM format.
template<class Range>
class GridFunctionLoader<FileFormat::MFEM, Variational::P1<Range, Geometry::Mesh<Context::Local>>, Math::Vector<typename FormLanguage::Traits<Range>::ScalarType>>
Specialization for loading P1 grid functions from MFEM format.
template<class FES, class Data>
class GridFunctionLoaderBase
Base class for concrete grid function loaders.
template<class FES, class Data>
class GridFunctionLoaderBase
Base class for concrete grid function loaders.
template<class FES, class Data>
class GridFunctionLoaderBase
Base class for concrete grid function loaders.
template<class FES, class Data>
class GridFunctionLoaderBase
Base class for concrete grid function loaders.
template<class Context>
class MeshLoaderBase
Base class for loading meshes from files or streams.

Public types

using ObjectType = T
Type of object being loaded.

Public functions

void load(std::istream& is) pure virtual
Loads object from an input stream.
void load(const boost::filesystem::path& is) virtual
Loads object from a file.

Protected functions

auto getObject() -> ObjectType& pure virtual
Gets a reference to the object being loaded.

Function documentation

template<class T>
void Rodin::IO::Loader<T>::load(std::istream& is) pure virtual

Loads object from an input stream.

Parameters
is in Input stream to read from

This pure virtual method must be implemented by derived classes to read the object data from the provided stream.

template<class T>
void Rodin::IO::Loader<T>::load(const boost::filesystem::path& is) virtual

Loads object from a file.

Parameters
is in Path to the file to load

Opens the file at the specified path and delegates to load(std::istream&). This provides a convenient file-based interface while reusing the stream loading logic.

template<class T>
ObjectType& Rodin::IO::Loader<T>::getObject() pure virtual protected

Gets a reference to the object being loaded.

Returns Reference to the object

This method provides access to the object being populated during loading. Derived classes must implement this to return their internal object reference.