Medusa  1.1
Coordinate Free Mehless Method implementation
shape_flags.hpp
Go to the documentation of this file.
1 #ifndef MEDUSA_BITS_OPERATORS_SHAPE_FLAGS_HPP_
2 #define MEDUSA_BITS_OPERATORS_SHAPE_FLAGS_HPP_
3 
9 #include <string>
10 #include <tuple>
12 
13 namespace mm {
14 
16 namespace sh {
17 
22 typedef unsigned int shape_flags;
23 static const shape_flags d1 = 1;
24 static const shape_flags lap = 2;
25 static const shape_flags d2 = 4;
26 static const shape_flags div = d1;
27 static const shape_flags grad = d1;
28 static const shape_flags graddiv = d2;
29 static const shape_flags all = d1 | d2 | lap;
30 
32 inline std::string str(shape_flags f) {
33  std::string s = "";
34  if (f & sh::d1) s += " d1";
35  if (f & sh::lap) s += " lap";
36  if (f & sh::d2) s += " d2";
37  return s;
38 }
39 
41 template <shape_flags mask, int dim>
43  static_assert(mask < 0, "Type for this mask not defined");
44  typedef void type;
45 };
47 template <int dim> struct operator_tuple<0, dim> {typedef std::tuple<> type; }; // NOLINT
48 template <int dim> struct operator_tuple<lap, dim> {typedef std::tuple<Lap<dim>> type; }; // NOLINT
49 template <int dim> struct operator_tuple<lap|d1, dim> { typedef std::tuple<Lap<dim>, Der1s<dim>> type; }; // NOLINT
50 template <int dim> struct operator_tuple<lap|d2, dim> { typedef std::tuple<Lap<dim>, Der2s<dim>> type; }; // NOLINT
51 template <int dim> struct operator_tuple<lap|d1|d2, dim> { typedef std::tuple<Lap<dim>, Der1s<dim>, Der2s<dim>> type; }; // NOLINT
52 template <int dim> struct operator_tuple<d1, dim> { typedef std::tuple<Der1s<dim>> type; }; // NOLINT
53 template <int dim> struct operator_tuple<d1|d2, dim> { typedef std::tuple<Der1s<dim>, Der2s<dim>> type; }; // NOLINT
54 template <int dim> struct operator_tuple<d2, dim> { typedef std::tuple<Der2s<dim>> type; }; // NOLINT
56 
57 } // namespace sh
58 
59 } // namespace mm
60 
61 #endif // MEDUSA_BITS_OPERATORS_SHAPE_FLAGS_HPP_
mm::sh::d1
static const shape_flags d1
Indicates to calculate d1 shapes.
Definition: shape_flags.hpp:23
mm::sh::div
static const shape_flags div
Indicates to prepare all shapes needed for div.
Definition: shape_flags.hpp:26
mm
Root namespace for the whole library.
Definition: Gaussian.hpp:14
mm::sh::graddiv
static const shape_flags graddiv
Indicates to prepare all shapes needed for graddiv.
Definition: shape_flags.hpp:28
mm::sh::lap
static const shape_flags lap
Indicates to calculate laplace shapes.
Definition: shape_flags.hpp:24
dim
@ dim
Number of elements of this matrix.
Definition: MatrixBaseAddons.hpp:14
mm::sh::shape_flags
unsigned int shape_flags
Type representing flags for shape functions.
Definition: shape_flags.hpp:22
mm::sh::str
std::string str(shape_flags f)
Convert shape flags to a string representation.
Definition: shape_flags.hpp:32
mm::sh::d2
static const shape_flags d2
Indicates to calculate d2 shapes.
Definition: shape_flags.hpp:25
mm::sh::all
static const shape_flags all
Indicates to prepare all shapes, default.
Definition: shape_flags.hpp:29
mm::sh::operator_tuple::type
void type
The type of the operator tuple.
Definition: shape_flags.hpp:43
Operators.hpp
mm::sh::grad
static const shape_flags grad
Indicates to prepare all shapes needed for grad.
Definition: shape_flags.hpp:27
mm::sh::operator_tuple
Converts shape mask to operator tuple type.
Definition: shape_flags.hpp:42