G+Smo  23.12.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsReadFile< T > Class Template Reference

Detailed Description

template<class T = real_t>
class gismo::gsReadFile< T >

Reads an object from a data file, if such the requested object exists in the file.

See Also
gsFileData
Template Parameters
Tarithmentic type

Public Member Functions

 gsReadFile (std::string const &fn)
 Opens a file and reads an object into a smartpointer (uPtr). More...
 
 gsReadFile (std::string const &fn, index_t id)
 Opens a file and reads an object into a smartpointer (uPtr). More...
 
template<class Obj >
 gsReadFile (std::string const &fn, Obj &result)
 Opens a file and reads an object into result. More...
 
 gsReadFile (std::string const &fn, gsMultiPatch< T > &result)
 Opens a file and reads a gsMultiPatch object into result. More...
 
template<class Obj >
 operator memory::shared_ptr< Obj > ()
 Allows to convert a gsReadFile to a sharead pointer.
 
 operator memory::unique_ptr< gsBasis< T > > ()
 Allows to read a file into a gsBasis.
 
 operator memory::unique_ptr< gsCurve< T > > ()
 Allows to read a file into a gsCurve.
 
 operator memory::unique_ptr< gsFunctionExpr< T > > () const
 Allows to read a function expression.
 
 operator memory::unique_ptr< gsGeometry< T > > ()
 Allows to read a file into a gsGeometry.
 
 operator memory::unique_ptr< gsMesh< T > > ()
 Allows to read a gsMesh.
 
 operator memory::unique_ptr< gsMultiPatch< T > > ()
 Allows to convert a gsReadFile to a gsMultipatch.
 
 operator memory::unique_ptr< gsPde< T > > ()
 Allows to read a PDE.
 
 operator memory::unique_ptr< gsPlanarDomain< T > > ()
 Allows to read a file into a gsBasis.
 
 operator memory::unique_ptr< gsPoissonPde< T > > ()
 Read a poisson PDE.
 
template<class Obj >
 operator memory::unique_ptr< Obj > ()
 Allows to read an Object from a file.
 
 operator std::vector< memory::unique_ptr< gsBasis< T > > > ()
 Allows to read a file into a vector of gsBasis.
 

Private Attributes

gsFileData< T > m_data
 File data as a Gismo xml tree.
 

Constructor & Destructor Documentation

gsReadFile ( std::string const &  fn)
inline

Opens a file and reads an object into a smartpointer (uPtr).

This is used in conjuction with cast operators and depends on the type of object.

For gsBasis there exists a cast opterator to std::vector<gsBasis<T>::uPtr>.

If read fails, value inside smartpointer is null. Example of usage:

gsFunctionExpr<>::uPtr expr;
if(expr = gsReadFile<real_t>("/path/to/file.xml"))
gsInfo << *expr;
Parameters
fnfilename string
gsReadFile ( std::string const &  fn,
index_t  id 
)
inline

Opens a file and reads an object into a smartpointer (uPtr).

This is used in conjuction with cast operators and depends on the type of object.

For gsBasis there exists a cast opterator to std::vector<gsBasis<T>::uPtr>.

If read fails, value inside smartpointer is null. Example of usage:

gsFunctionExpr<>::uPtr expr;
if(expr = gsReadFile<real_t>("/path/to/file.xml"))
gsInfo << *expr;
Parameters
fnfilename string
id
gsReadFile ( std::string const &  fn,
Obj &  result 
)
inline

Opens a file and reads an object into result.

Example of usage:

std::string filename = "/path/to/file.xml";
gsMultiPatch<> MP;
gsReadFile<>(filenane, MP);
Exceptions
std::runtime_errorError reading file.
Parameters
[in]fnfilename string
[out]resultobject to read into
gsReadFile ( std::string const &  fn,
gsMultiPatch< T > &  result 
)
inline

Opens a file and reads a gsMultiPatch object into result.

Example of usage:

std::string filename = "/path/to/file.xml";
gsMultiPatch<> MP;
gsReadFile<>(filenane, MP);
Exceptions
std::runtime_errorError reading file.
Parameters
[in]fnfilename string
[out]resultgsMultiPatch object to read into