OGS
ShapeMatrixCache.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#include "ShapeMatrixCache.h"
5
6#include <range/v3/range/conversion.hpp>
7#include <range/v3/view/transform.hpp>
8
12namespace
13{
14template <typename ShapeFunction>
15static auto initShapeMatrices(unsigned const integration_order,
16 boost::mp11::mp_identity<ShapeFunction>)
17{
18 using namespace boost::mp11;
19
20 using MeshElement = typename ShapeFunction::MeshElement;
21
22 auto const& integration_method =
24 NumLib::IntegrationOrder{integration_order});
25
26 using ShapeMatrixPolicy =
28
29 // The reference element will be used as dummy argument below. That's
30 // sufficient, since we only want to compute the shape matrix N.
32
33 // dim does not matter, here.
34 constexpr int dim = 3;
36 ShapeMatrixPolicy,
37 dim,
39 reference_element.element,
40 false /*is_axially_symmetric*/,
41 integration_method);
42
43 return sms |
44 ranges::views::transform([](auto& sm) { return std::move(sm.N); }) |
45 ranges::to<std::vector>;
46}
47} // namespace
48
49namespace NumLib
50{
51ShapeMatrixCache::ShapeMatrixCache(unsigned const integration_order)
52{
53 using namespace boost::mp11;
54 using Indices = mp_iota<mp_size<ETLs>>;
55
56 mp_for_each<Indices>(
57 [this, integration_order](auto index)
58 {
59 using ETL = mp_at_c<ETLs, index>;
62
63 std::get<index.value>(Nss_higher_order_) = ::initShapeMatrices(
64 integration_order, mp_identity<ShapeFunctionHigherOrder>{});
65
68
69 std::get<index.value>(Nss_lower_order_) = ::initShapeMatrices(
70 integration_order, mp_identity<ShapeFunctionLowerOrder>{});
71 });
72}
73
74} // 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_
GenericIntegrationMethod const & getIntegrationMethod(std::type_index const mesh_element_type, IntegrationOrder const order)
typename ElementTraitsLagrange::ShapeFunction GetShapeFunctionHigherOrder
typename ElementTraitsLagrange::LowerOrderShapeFunction GetShapeFunctionLowerOrder
ShapeMatrixPolicyType< ShapeFunction, 3 > GetShapeMatrixPolicy
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 >)