1#ifndef GET_FROM_TYPE_OR_FUNCTOR_HH_
2#define GET_FROM_TYPE_OR_FUNCTOR_HH_
9 template <
class,
int,
int>
class FieldMatrix;
21 template <
class Type,
class Source=Type>
struct Get;
23 template <
class Type,
class Source>
25 Get(){ source_ =
nullptr; }
26 explicit Get(Source
const& source) : source_(&source){}
27 Get(
Get const& get) : source_(get.source_){}
33 if(source_ !=
nullptr)
return (*source_)();
34 else throw DetailedException(std::string(
"Source has not been initialized!"),__FILE__,__LINE__);
38 Source
const* source_;
42 struct Get<Type,Type>{
43 Get(){ type_ =
nullptr; }
44 explicit Get(Type
const& type) : type_(&type){}
45 Get(
Get const& get) : type_(get.type_){}
51 if(type_ !=
nullptr)
return *type_;
52 else throw DetailedException(std::string(
"Type has not been initialized!"),__FILE__,__LINE__);
59 template <
class Scalar,
int dim,
class Type>
61 typedef typename Type::SubType
type;
64 template <
class Scalar,
int dim>
A wrapper class for conveniently providing exceptions with context information.
Get & operator=(Get const &get)
Type const & operator()() const
Get object from reference or functor. Is itself a functor.
Get & operator=(Get const &get)
Get(Source const &source)
Dune::FieldMatrix< Scalar, dim-1, dim-1 > type