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>
16 unsigned const integration_order,
17 boost::mp11::mp_identity<ShapeFunction> /*shape_function_tag*/)
18{
19 using namespace boost::mp11;
20
21 using MeshElement = typename ShapeFunction::MeshElement;
22
23 auto const& integration_method =
25 NumLib::IntegrationOrder{integration_order});
26
27 using ShapeMatrixPolicy =
29
30 // The reference element will be used as dummy argument below. That's
31 // sufficient, since we only want to compute the shape matrix N.
33
34 // dim does not matter, here.
35 constexpr int dim = 3;
37 ShapeMatrixPolicy,
38 dim,
40 reference_element.element,
41 false /*is_axially_symmetric*/,
42 integration_method);
43
44 return sms |
45 ranges::views::transform([](auto& sm) { return std::move(sm.N); }) |
46 ranges::to<std::vector>;
47}
48} // namespace
49
50namespace NumLib
51{
52ShapeMatrixCache::ShapeMatrixCache(unsigned const integration_order)
53{
54 using namespace boost::mp11;
55 using Indices = mp_iota<mp_size<ETLs>>;
56
57 mp_for_each<Indices>(
58 [this, integration_order](auto index)
59 {
60 using ETL = mp_at_c<ETLs, index>;
63
64 std::get<index.value>(Nss_higher_order_) = ::initShapeMatrices(
65 integration_order, mp_identity<ShapeFunctionHigherOrder>{});
66
69
70 std::get<index.value>(Nss_lower_order_) = ::initShapeMatrices(
71 integration_order, mp_identity<ShapeFunctionLowerOrder>{});
72 });
73}
74
75} // 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 >)