OGS
ShapeMatrixCache.cpp
Go to the documentation of this file.
1
10#include "ShapeMatrixCache.h"
11
12#include <range/v3/range/conversion.hpp>
13#include <range/v3/view/transform.hpp>
14
18namespace
19{
20template <typename ShapeFunction>
21static auto initShapeMatrices(unsigned const integration_order,
22 boost::mp11::mp_identity<ShapeFunction>)
23{
24 using namespace boost::mp11;
25
26 using MeshElement = typename ShapeFunction::MeshElement;
27
28 auto const& integration_method =
29 NumLib::IntegrationMethodRegistry::getIntegrationMethod<MeshElement>(
30 NumLib::IntegrationOrder{integration_order});
31
32 using ShapeMatrixPolicy =
34
35 // The reference element will be used as dummy argument below. That's
36 // sufficient, since we only want to compute the shape matrix N.
38
39 // dim does not matter, here.
40 constexpr int dim = 3;
41 auto sms = NumLib::initShapeMatrices<ShapeFunction,
42 ShapeMatrixPolicy,
43 dim,
45 reference_element.element,
46 false /*is_axially_symmetric*/,
47 integration_method);
48
49 return sms |
50 ranges::views::transform([](auto& sm) { return std::move(sm.N); }) |
51 ranges::to<std::vector>;
52}
53} // namespace
54
55namespace NumLib
56{
57ShapeMatrixCache::ShapeMatrixCache(unsigned const integration_order)
58{
59 using namespace boost::mp11;
60 using Indices = mp_iota<mp_size<ETLs>>;
61
62 mp_for_each<Indices>(
63 [this, integration_order](auto index)
64 {
65 using ETL = mp_at_c<ETLs, index>;
68
69 std::get<index.value>(Nss_higher_order_) = ::initShapeMatrices(
70 integration_order, mp_identity<ShapeFunctionHigherOrder>{});
71
74
75 std::get<index.value>(Nss_lower_order_) = ::initShapeMatrices(
76 integration_order, mp_identity<ShapeFunctionLowerOrder>{});
77 });
78}
79
80} // namespace NumLib
MeshElementType const element
boost::mp11::mp_at< ShapeFunctionsLowerOrder, boost::mp11::mp_find< MeshElements, MeshElement > > ShapeFunctionLowerOrder
ShapeMatrixCache(unsigned const integration_order)
boost::mp11::mp_at< ShapeFunctionsHigherOrder, boost::mp11::mp_find< MeshElements, MeshElement > > ShapeFunctionHigherOrder
ShapeMatrixVectorsLowerOrder_N Nss_lower_order_
ShapeMatrixVectorsHigherOrder_N Nss_higher_order_
typename ElementTraitsLagrange::ShapeFunction GetShapeFunctionHigherOrder
typename ElementTraitsLagrange::LowerOrderShapeFunction GetShapeFunctionLowerOrder
std::vector< typename ShapeMatricesType::ShapeMatrices, Eigen::aligned_allocator< typename ShapeMatricesType::ShapeMatrices > > initShapeMatrices(MeshLib::Element const &e, bool const is_axially_symmetric, IntegrationMethod const &integration_method)
static auto initShapeMatrices(unsigned const integration_order, boost::mp11::mp_identity< ShapeFunction >)