DUNE-ACFEM (unstable)

densestorage.hh
1 #ifndef __DUNE_ACFEM_EXPRESSIONS_DYNAMICSTORAGE_HH__
2 #define __DUNE_ACFEM_EXPRESSIONS_DYNAMICSTORAGE_HH__
3 
4 #include "expressiontraits.hh"
5 #include "storage.hh"
6 #include "optimizationbase.hh"
7 
8 namespace Dune
9 {
10 
11  namespace ACFem
12  {
13 
14  namespace Expressions
15  {
16 
35  template<class T, class SFINAE = void>
36  struct DenseStorage;
37 
38  template<class T>
39  struct DenseStorage<T, std::enable_if_t<IsScalar<T>::value> >
40  {
41  using Type = FloatingPointClosure<T>;
42  };
43 
44  template<class T>
45  using DenseStorageType = typename DenseStorage<std::decay_t<T> >::Type;
46 
47  template<class T, class Copy = FalseType>
48  constexpr auto denseStorage(T&& t, Copy = Copy{})
49  {
50  return DenseStorageType<T>{};
51  }
52 
53  template<class T>
54  constexpr auto denseStorage(T&& t, TrueType)
55  {
56  return DenseStorageType<T>(std::forward<T>(t));
57  }
58 
59  template<bool copy, class T>
60  constexpr auto denseStorage(T&& t)
61  {
62  return denseStorage(std::forward<T>(t), BoolConstant<copy>{});
63  }
64 
66 
68 
69  } // Expressions
70 
71  } // ACFem
72 
73 } // Dune
74 
75 #endif // __DUNE_ACFEM_EXPRESSIONS_DENSESTORAGE_HH__
typename FloatingPointClosureHelper< T >::Type FloatingPointClosure
Template alias.
Definition: fieldpromotion.hh:74
BoolConstant< true > TrueType
Alias for std::true_type.
Definition: types.hh:107
A traits class which provides a type suitable to store the values of the given expression T and any e...
Definition: densestorage.hh:36
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.80.0 (May 16, 22:29, 2024)