|
Reference documentation for deal.II version 9.2.0
|
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\)
\(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\)
\(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\)
\(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Go to the documentation of this file.
16 #ifndef dealii_any_data_h
17 #define dealii_any_data_h
24 #include <boost/any.hpp>
48 template <
typename type>
66 template <
typename type>
78 template <
typename type>
93 template <
typename type>
106 template <
typename type>
114 template <
typename type>
125 template <
typename type>
132 template <
typename type>
134 entry(
const unsigned int i);
137 template <
typename type>
139 entry(
const unsigned int i)
const;
142 template <
typename type>
144 read(
const unsigned int i)
const;
147 template <
typename type>
149 read_ptr(
const unsigned int i)
const;
152 template <
typename type>
157 template <
typename type>
159 try_read(
const unsigned int i)
const;
163 name(
const unsigned int i)
const;
172 find(
const std::string &
name)
const;
184 template <
typename type>
186 is_type(
const unsigned int i)
const;
189 template <
class StreamType>
191 list(StreamType &os)
const;
196 <<
"No entry with the name " << arg1 <<
" exists.");
202 <<
"The requested type " << arg1 <<
" and the stored type "
203 << arg2 <<
" must coincide.");
212 <<
"Name at position " << arg1 <<
" is not equal to " << arg2
230 template <
typename type>
235 type *p = boost::any_cast<type>(&
data[i]);
242 template <
typename type>
247 const type *p = boost::any_cast<type>(&
data[i]);
249 p = boost::any_cast<const type>(&
data[i]);
256 template <
typename type>
261 const type *p = boost::any_cast<type>(&
data[i]);
263 p = boost::any_cast<const type>(&
data[i]);
270 template <
typename type>
275 const type *
const *p = boost::any_cast<type *>(&
data[i]);
277 p = boost::any_cast<const type *>(&
data[i]);
284 template <
typename type>
289 const type *
const *p = boost::any_cast<type *>(&
data[i]);
291 p = boost::any_cast<const type *>(&
data[i]);
298 template <
typename type>
303 const type *p = boost::any_cast<type>(&
data[i]);
305 p = boost::any_cast<const type>(&
data[i]);
310 inline const std::string &
321 std::vector<std::string>::const_iterator it =
324 if (it ==
names.end())
327 return it -
names.begin();
341 template <
typename type>
345 return data[i].type() ==
typeid(type);
349 template <
typename type>
353 const unsigned int i =
find(n);
354 type * p = boost::any_cast<type>(&
data[i]);
360 template <
typename type>
364 const unsigned int i =
find(n);
365 const type * p = boost::any_cast<type>(&
data[i]);
372 template <
typename type>
376 const unsigned int i =
find(n);
377 const type * p = boost::any_cast<type>(&
data[i]);
383 template <
typename type>
387 const unsigned int i =
find(n);
388 const type *
const *p = boost::any_cast<type *>(&
data[i]);
390 p = boost::any_cast<const type *>(&
data[i]);
397 template <
typename type>
405 const type *
const *p = boost::any_cast<type *>(&
data[i]);
407 p = boost::any_cast<const type *>(&
data[i]);
412 template <
typename type>
417 std::vector<std::string>::const_iterator it =
420 if (it ==
names.end())
424 unsigned int i = it -
names.begin();
425 const type * p = boost::any_cast<type>(&
data[i]);
430 template <
typename type>
443 for (
unsigned int i = 0; i < other.
size(); ++i)
451 template <
class StreamType>
455 for (
unsigned int i = 0; i <
names.size(); ++i)
457 os << i <<
'\t' <<
names[i] <<
'\t' <<
data[i].type().name() << std::endl;
unsigned int try_find(const std::string &name) const
Try to find index of a named object.
const std::string & name(const unsigned int i) const
Name of object at index.
unsigned int size() const
Number of stored data objects.
#define AssertIndexRange(index, range)
const type * try_read(const std::string &name) const
Dedicated read only access by name without exceptions.
SymmetricTensor< 2, dim, Number > e(const Tensor< 2, dim, Number > &F)
AnyData()=default
Default constructor for empty object.
static ::ExceptionBase & ExcTypeMismatch(std::string arg1, std::string arg2)
The requested type and the stored type are different.
static ::ExceptionBase & ExcNameNotFound(std::string arg1)
An entry with this name does not exist in the AnyData object.
unsigned int find(const std::string &name) const
Find index of a named object.
void list(StreamType &os) const
List the contents to a stream.
std::vector< std::string > names
The names of the stored data.
type entry(const std::string &name)
Access to stored data object by name.
#define DEAL_II_NAMESPACE_OPEN
#define DeclException1(Exception1, type1, outsequence)
const type * try_read_ptr(const std::string &name) const
#define AssertDimension(dim1, dim2)
const type * read_ptr(const std::string &name) const
Dedicated read only access by name for pointer data.
static ::ExceptionBase & ExcNameMismatch(int arg1, std::string arg2)
bool is_type(const unsigned int i) const
Find out if object is of a certain type.
#define Assert(cond, exc)
const type read(const std::string &name) const
Dedicated read only access by name.
static const unsigned int invalid_unsigned_int
#define DEAL_II_NAMESPACE_CLOSE
#define DeclException2(Exception2, type1, type2, outsequence)
std::vector< boost::any > data
The stored data.
void merge(const AnyData &other)
Merge the data of another AnyData to the end of this object.
void add(type entry, const std::string &name)
Add a new data object.