MFEM v4.7.0
Finite element discretization library
|
#include <arrays_by_name.hpp>
Public Member Functions | |
ArraysByName ()=default | |
Default constructor. | |
ArraysByName (const ArraysByName &src)=default | |
Copy constructor: deep copy from src. | |
ArraysByName (ArraysByName &&src) noexcept=default | |
Move constructor. | |
int | Size () const |
Return the number of named arrays in the container. | |
std::set< std::string > | GetNames () const |
Return an STL set of strings giving the names of the arrays. | |
bool | EntryExists (const std::string &name) const |
Return true if an array with the given name is present in the container. | |
Array< T > & | operator[] (const std::string &name) |
Reference access to the named entry. | |
const Array< T > & | operator[] (const std::string &name) const |
Const reference access to the named entry. | |
Array< T > & | CreateArray (const std::string &name) |
Create a new empty array with the given name. | |
void | DeleteAll () |
Delete all named arrays from the container. | |
void | DeleteArray (const std::string &name) |
Delete the named array from the container. | |
ArraysByName< T > & | operator= (const ArraysByName< T > &src)=default |
Copy assignment operator: deep copy from 'src'. | |
ArraysByName< T > & | operator= (ArraysByName< T > &&src) noexcept=default |
Move assignment operator. | |
void | Print (std::ostream &out=mfem::out, int width=-1) const |
Print the contents of the container to an output stream. | |
void | Load (std::istream &in) |
Load the contents of the container from an input stream. | |
void | SortAll () |
Sort each named array in the container. | |
void | UniqueAll () |
Remove duplicates from each, previously sorted, named array. | |
iterator | begin () |
STL-like begin. Returns pointer to the first entry of the container. | |
iterator | end () |
STL-like end. Returns pointer after the last entry of the container. | |
const_iterator | begin () const |
STL-like begin. Returns const pointer to the first entry of the container. | |
const_iterator | end () const |
STL-like end. Returns const pointer after the last entry of the container. | |
Protected Types | |
using | container = std::map<std::string,Array<T> > |
Reusing STL map iterators. | |
using | iterator = typename container::iterator |
using | const_iterator = typename container::const_iterator |
Protected Attributes | |
container | data |
Map containing the data sorted alphabetically by name. | |
Container class for storing arrays indexed by strings.
The Array<T> objects stored within this container must all be based on the same underlying generic type T, which must be a trivial type, see std::is_trivial
.
In order to provide some level of protection against typos this class will not create new named arrays when access to unrecognized names is requested. New named arrays must be explicitly created using CreateArray()
. To facilitate this behavior and avoid such errors the method EntryExists()
is provided.
This container does not store pointers to pre-existing arrays. It will copy or move entries as appropriate from existing Array<T> objects into new Array<T> objects stored within this container.
Definition at line 44 of file arrays_by_name.hpp.
|
protected |
Definition at line 50 of file arrays_by_name.hpp.
|
protected |
Reusing STL map iterators.
Definition at line 48 of file arrays_by_name.hpp.
|
protected |
Definition at line 49 of file arrays_by_name.hpp.
|
default |
Default constructor.
|
default |
Copy constructor: deep copy from src.
|
defaultnoexcept |
Move constructor.
|
inline |
STL-like begin. Returns pointer to the first entry of the container.
Definition at line 141 of file arrays_by_name.hpp.
|
inline |
STL-like begin. Returns const pointer to the first entry of the container.
Definition at line 148 of file arrays_by_name.hpp.
|
inline |
Create a new empty array with the given name.
Definition at line 203 of file arrays_by_name.hpp.
|
inline |
Delete all named arrays from the container.
Definition at line 213 of file arrays_by_name.hpp.
|
inline |
Delete the named array from the container.
Definition at line 219 of file arrays_by_name.hpp.
|
inline |
STL-like end. Returns pointer after the last entry of the container.
Definition at line 144 of file arrays_by_name.hpp.
|
inline |
STL-like end. Returns const pointer after the last entry of the container.
Definition at line 152 of file arrays_by_name.hpp.
|
inline |
Return true if an array with the given name is present in the container.
Definition at line 180 of file arrays_by_name.hpp.
|
inline |
Return an STL set of strings giving the names of the arrays.
Definition at line 169 of file arrays_by_name.hpp.
void mfem::ArraysByName< T >::Load | ( | std::istream & | in | ) |
Load the contents of the container from an input stream.
Definition at line 256 of file arrays_by_name.hpp.
|
defaultnoexcept |
Move assignment operator.
|
default |
Copy assignment operator: deep copy from 'src'.
|
inline |
Reference access to the named entry.
Definition at line 186 of file arrays_by_name.hpp.
|
inline |
Const reference access to the named entry.
Definition at line 194 of file arrays_by_name.hpp.
|
inline |
Print the contents of the container to an output stream.
Definition at line 245 of file arrays_by_name.hpp.
|
inline |
Return the number of named arrays in the container.
Definition at line 67 of file arrays_by_name.hpp.
|
inline |
Sort each named array in the container.
Definition at line 227 of file arrays_by_name.hpp.
|
inline |
Remove duplicates from each, previously sorted, named array.
Definition at line 236 of file arrays_by_name.hpp.
|
protected |
Map containing the data sorted alphabetically by name.
Definition at line 53 of file arrays_by_name.hpp.