MFEM  v4.5.2
Finite element discretization library
Public Types | Public Member Functions | Protected Attributes | List of all members
mfem::NamedFieldsMap< T > Class Template Reference

Lightweight adaptor over an std::map from strings to pointer to T. More...

#include <datacollection.hpp>

Collaboration diagram for mfem::NamedFieldsMap< T >:
[legend]

Public Types

typedef std::map< std::string, T * > MapType
 
typedef MapType::iterator iterator
 
typedef MapType::const_iterator const_iterator
 

Public Member Functions

void Register (const std::string &fname, T *field, bool own_data)
 Register field field with name fname. More...
 
void Deregister (const std::string &fname, bool own_data)
 Unregister association between field field and name fname. More...
 
void DeleteData (bool own_data)
 Clear all associations between names and fields. More...
 
bool Has (const std::string &fname) const
 Predicate to check if a field is associated with name fname. More...
 
T * Get (const std::string &fname) const
 Get a pointer to the field associated with name fname. More...
 
const MapTypeGetMap () const
 Returns a const reference to the underlying map. More...
 
int NumFields () const
 Returns the number of registered fields. More...
 
iterator begin ()
 Returns a begin iterator to the registered fields. More...
 
const_iterator begin () const
 Returns a begin const iterator to the registered fields. More...
 
iterator end ()
 Returns an end iterator to the registered fields. More...
 
const_iterator end () const
 Returns an end const iterator to the registered fields. More...
 
iterator find (const std::string &fname)
 Returns an iterator to the field fname. More...
 
const_iterator find (const std::string &fname) const
 Returns a const iterator to the field fname. More...
 
void clear ()
 Clears the map of registered fields without reclaiming memory. More...
 

Protected Attributes

MapType field_map
 

Detailed Description

template<typename T>
class mfem::NamedFieldsMap< T >

Lightweight adaptor over an std::map from strings to pointer to T.

Definition at line 30 of file datacollection.hpp.

Member Typedef Documentation

◆ const_iterator

template<typename T>
typedef MapType::const_iterator mfem::NamedFieldsMap< T >::const_iterator

Definition at line 35 of file datacollection.hpp.

◆ iterator

template<typename T>
typedef MapType::iterator mfem::NamedFieldsMap< T >::iterator

Definition at line 34 of file datacollection.hpp.

◆ MapType

template<typename T>
typedef std::map<std::string, T*> mfem::NamedFieldsMap< T >::MapType

Definition at line 33 of file datacollection.hpp.

Member Function Documentation

◆ begin() [1/2]

template<typename T>
iterator mfem::NamedFieldsMap< T >::begin ( )
inline

Returns a begin iterator to the registered fields.

Definition at line 100 of file datacollection.hpp.

◆ begin() [2/2]

template<typename T>
const_iterator mfem::NamedFieldsMap< T >::begin ( ) const
inline

Returns a begin const iterator to the registered fields.

Definition at line 102 of file datacollection.hpp.

◆ clear()

template<typename T>
void mfem::NamedFieldsMap< T >::clear ( )
inline

Clears the map of registered fields without reclaiming memory.

Definition at line 118 of file datacollection.hpp.

◆ DeleteData()

template<typename T>
void mfem::NamedFieldsMap< T >::DeleteData ( bool  own_data)
inline

Clear all associations between names and fields.

Delete associated pointers when own_data is true

Definition at line 67 of file datacollection.hpp.

◆ Deregister()

template<typename T>
void mfem::NamedFieldsMap< T >::Deregister ( const std::string &  fname,
bool  own_data 
)
inline

Unregister association between field field and name fname.

Optionally delete associated pointer if own_data is true

Definition at line 52 of file datacollection.hpp.

◆ end() [1/2]

template<typename T>
iterator mfem::NamedFieldsMap< T >::end ( )
inline

Returns an end iterator to the registered fields.

Definition at line 105 of file datacollection.hpp.

◆ end() [2/2]

template<typename T>
const_iterator mfem::NamedFieldsMap< T >::end ( ) const
inline

Returns an end const iterator to the registered fields.

Definition at line 107 of file datacollection.hpp.

◆ find() [1/2]

template<typename T>
iterator mfem::NamedFieldsMap< T >::find ( const std::string &  fname)
inline

Returns an iterator to the field fname.

Definition at line 110 of file datacollection.hpp.

◆ find() [2/2]

template<typename T>
const_iterator mfem::NamedFieldsMap< T >::find ( const std::string &  fname) const
inline

Returns a const iterator to the field fname.

Definition at line 114 of file datacollection.hpp.

◆ Get()

template<typename T>
T* mfem::NamedFieldsMap< T >::Get ( const std::string &  fname) const
inline

Get a pointer to the field associated with name fname.

Returns
Pointer to field associated with fname or NULL

Definition at line 87 of file datacollection.hpp.

◆ GetMap()

template<typename T>
const MapType& mfem::NamedFieldsMap< T >::GetMap ( ) const
inline

Returns a const reference to the underlying map.

Definition at line 94 of file datacollection.hpp.

◆ Has()

template<typename T>
bool mfem::NamedFieldsMap< T >::Has ( const std::string &  fname) const
inline

Predicate to check if a field is associated with name fname.

Definition at line 80 of file datacollection.hpp.

◆ NumFields()

template<typename T>
int mfem::NamedFieldsMap< T >::NumFields ( ) const
inline

Returns the number of registered fields.

Definition at line 97 of file datacollection.hpp.

◆ Register()

template<typename T>
void mfem::NamedFieldsMap< T >::Register ( const std::string &  fname,
T *  field,
bool  own_data 
)
inline

Register field field with name fname.

Replace existing field associated with fname (and optionally delete associated pointer if own_data is true)

Definition at line 40 of file datacollection.hpp.

Member Data Documentation

◆ field_map

template<typename T>
MapType mfem::NamedFieldsMap< T >::field_map
protected

Definition at line 121 of file datacollection.hpp.


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