Loader
Base template for loading objects from files or streams.
Defined in Rodin/IO/Loader.h
template < class T> class Loader;
| 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
| Derived class | Description |
|---|---|
GridFunctionLoader<FileFormat::HDF5, …>publicFull typeGridFunctionLoader< FileFormat::HDF5, FES, Math::Vector< Scalar > > | HDF5 grid function loader for local grid functions backed by Math::Vector<Scalar>. |
GridFunctionLoaderBase<FES, DataType>publicFull typeGridFunctionLoaderBase< FES, DataType > | Base class for concrete grid function loaders. |
MeshLoaderBase<ContextType>publicFull typeMeshLoaderBase< ContextType > | Base class for loading meshes from files or streams. |
See moreSee less
| Derived class | Description |
|---|---|
GridFunctionLoader<FileFormat::MEDIT, …>publicFull typeGridFunctionLoader< 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. |
GridFunctionLoader<FileFormat::MEDIT, …>publicFull typeGridFunctionLoader< 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. |
GridFunctionLoader<FileFormat::MEDIT, …>publicFull typeGridFunctionLoader< 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. |
GridFunctionLoader<FileFormat::MFEM, …>publicFull typeGridFunctionLoader< FileFormat::MFEM, FES, Math::Vector< Scalar > > | Loads each MFEM component through the scalar family's node mapping. |
GridFunctionLoader<FileFormat::MFEM, …>publicFull typeGridFunctionLoader< 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. |
GridFunctionLoader<FileFormat::MFEM, …>publicFull typeGridFunctionLoader< 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. |
GridFunctionLoader<FileFormat::MFEM, …>publicFull typeGridFunctionLoader< 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. |
GridFunctionLoaderBase<FESType, …>publicFull typeGridFunctionLoaderBase< FESType, DataType > | Base class for concrete grid function loaders. |
GridFunctionLoaderBase<FES, …>publicFull typeGridFunctionLoaderBase< FES, Math::Vector< ScalarType > > | Base class for concrete grid function loaders. |
GridFunctionLoaderBase<FES, …>publicFull typeGridFunctionLoaderBase< FES, Math::Vector< Scalar > > | Base class for concrete grid function loaders. |
Public types
- using ObjectType = T
- Type of object being loaded.
Constructors, destructors, conversion operators
- ~Loader() defaulted virtual
- Destroys the loader through its polymorphic interface.
Public functions
Protected functions
- auto getObject() -> ObjectType& pure virtual
- Gets a reference to the object being loaded.
Function documentation
void 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.
void 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::
ObjectType& 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.