OGS
ShapeMatrixCache.h
Go to the documentation of this file.
1
11#pragma once
12
13#include <boost/mp11.hpp>
14
17
18namespace NumLib
19{
20namespace detail
21{
22template <typename ElementTraitsLagrange>
23using GetMeshElement = typename ElementTraitsLagrange::Element;
24
25template <typename ElementTraitsLagrange>
27 typename ElementTraitsLagrange::ShapeFunction;
28
29template <typename ElementTraitsLagrange>
31 typename ElementTraitsLagrange::LowerOrderShapeFunction;
32
33template <typename ShapeFunction>
35 // dim does not matter, here, but
36 // NumLib::detail::naturalCoordinatesMappingComputeShapeMatrices<>()
37 // must be instantiated for this dim.
38 ShapeMatrixPolicyType<ShapeFunction, 3 /* dim */>;
39
40template <typename ShapeMatrixPolicy>
41using GetShapeMatrix_N = typename ShapeMatrixPolicy::ShapeMatrices::ShapeType;
42} // namespace detail
43
45{
47
49 boost::mp11::mp_transform<detail::GetMeshElement, ETLs>;
50
51 // Higher order shape functions
52
54 boost::mp11::mp_transform<detail::GetShapeFunctionHigherOrder, ETLs>;
56 boost::mp11::mp_transform<detail::GetShapeMatrixPolicy,
59 boost::mp11::mp_transform<detail::GetShapeMatrix_N,
61
62 // std::tuple<std::vector<ShapeMatrix_N>, ...>
64 boost::mp11::mp_transform<std::vector, ShapeMatricesHigherOrder_N>;
65
66 static_assert(
68 boost::mp11::mp_rename<ShapeMatrixVectorsHigherOrder_N,
69 std::tuple>>,
70 "The type alias ShapeMatrixVectorsHigherOrder_N must be a "
71 "std::tuple<...>.");
72
73 // Lower order shape functions
74
76 boost::mp11::mp_transform<detail::GetShapeFunctionLowerOrder, ETLs>;
78 boost::mp11::mp_transform<detail::GetShapeMatrixPolicy,
81 boost::mp11::mp_transform<detail::GetShapeMatrix_N,
83
84 // std::tuple<std::vector<ShapeMatrix_N>, ...>
86 boost::mp11::mp_transform<std::vector, ShapeMatricesLowerOrder_N>;
87
88 static_assert(
89 std::is_same_v<
91 boost::mp11::mp_rename<ShapeMatrixVectorsLowerOrder_N, std::tuple>>,
92 "The type alias ShapeMatrixVectorsLowerOrder_N must be a "
93 "std::tuple<...>.");
94
95public:
96 explicit ShapeMatrixCache(unsigned const integration_order);
97
98 template <typename MeshElement>
99 auto const& NsHigherOrder() const
100 {
101 using Index = boost::mp11::mp_find<MeshElements, MeshElement>;
102 return std::get<Index::value>(Nss_higher_order_);
103 }
104
105 template <typename MeshElement>
106 auto const& NsLowerOrder() const
107 {
108 using Index = boost::mp11::mp_find<MeshElements, MeshElement>;
109 return std::get<Index::value>(Nss_lower_order_);
110 }
111
114 static constexpr std::size_t size()
115 {
116 return boost::mp11::mp_size<ETLs>::value;
117 }
118
119 template <typename MeshElement>
121 boost::mp11::mp_at<ShapeFunctionsHigherOrder,
122 boost::mp11::mp_find<MeshElements, MeshElement>>;
123
124 template <typename MeshElement>
126 boost::mp11::mp_at<ShapeFunctionsLowerOrder,
127 boost::mp11::mp_find<MeshElements, MeshElement>>;
128
129private:
132};
133} // namespace NumLib
boost::mp11::mp_transform< std::vector, ShapeMatricesLowerOrder_N > ShapeMatrixVectorsLowerOrder_N
auto const & NsLowerOrder() const
boost::mp11::mp_transform< detail::GetMeshElement, ETLs > MeshElements
boost::mp11::mp_transform< detail::GetShapeMatrixPolicy, ShapeFunctionsHigherOrder > ShapeMatrixPoliciesHigherOrder
boost::mp11::mp_transform< detail::GetShapeFunctionHigherOrder, ETLs > ShapeFunctionsHigherOrder
boost::mp11::mp_transform< detail::GetShapeFunctionLowerOrder, ETLs > ShapeFunctionsLowerOrder
boost::mp11::mp_at< ShapeFunctionsLowerOrder, boost::mp11::mp_find< MeshElements, MeshElement > > ShapeFunctionLowerOrder
ShapeMatrixCache(unsigned const integration_order)
boost::mp11::mp_transform< std::vector, ShapeMatricesHigherOrder_N > ShapeMatrixVectorsHigherOrder_N
static constexpr std::size_t size()
boost::mp11::mp_at< ShapeFunctionsHigherOrder, boost::mp11::mp_find< MeshElements, MeshElement > > ShapeFunctionHigherOrder
boost::mp11::mp_transform< detail::GetShapeMatrix_N, ShapeMatrixPoliciesHigherOrder > ShapeMatricesHigherOrder_N
NumLib::AllElementTraitsLagrange ETLs
boost::mp11::mp_transform< detail::GetShapeMatrixPolicy, ShapeFunctionsLowerOrder > ShapeMatrixPoliciesLowerOrder
boost::mp11::mp_transform< detail::GetShapeMatrix_N, ShapeMatrixPoliciesLowerOrder > ShapeMatricesLowerOrder_N
ShapeMatrixVectorsLowerOrder_N Nss_lower_order_
auto const & NsHigherOrder() const
ShapeMatrixVectorsHigherOrder_N Nss_higher_order_
typename ElementTraitsLagrange::ShapeFunction GetShapeFunctionHigherOrder
typename ElementTraitsLagrange::Element GetMeshElement
typename ShapeMatrixPolicy::ShapeMatrices::ShapeType GetShapeMatrix_N
typename ElementTraitsLagrange::LowerOrderShapeFunction GetShapeFunctionLowerOrder
ShapeMatrixPolicyType< ShapeFunction, 3 > GetShapeMatrixPolicy
BaseLib::TMP::Map_t< ElementTraitsLagrange, MeshLib::AllElementTypes > AllElementTraitsLagrange