OGS
InitShapeMatrices.h
Go to the documentation of this file.
1
10#pragma once
11
12#include <vector>
13
17
18namespace NumLib
19{
20template <typename ShapeFunction, typename ShapeMatricesType, int GlobalDim,
21 ShapeMatrixType SelectedShapeMatrixType = ShapeMatrixType::ALL,
22 typename PointContainer>
23std::vector<typename ShapeMatricesType::ShapeMatrices,
24 Eigen::aligned_allocator<typename ShapeMatricesType::ShapeMatrices>>
25computeShapeMatrices(MeshLib::Element const& e, bool const is_axially_symmetric,
26 PointContainer const& points)
27{
28 std::vector<
29 typename ShapeMatricesType::ShapeMatrices,
30 Eigen::aligned_allocator<typename ShapeMatricesType::ShapeMatrices>>
31 shape_matrices;
32
33 auto const fe =
35
36 shape_matrices.reserve(points.size());
37 for (auto const& p : points)
38 {
39 shape_matrices.emplace_back(ShapeFunction::DIM, GlobalDim,
40 ShapeFunction::NPOINTS);
41 fe.template computeShapeFunctions<SelectedShapeMatrixType>(
42 p.data(), shape_matrices.back(), GlobalDim, is_axially_symmetric);
43 }
44
45 return shape_matrices;
46}
47
48template <typename ShapeFunction, typename ShapeMatricesType, int GlobalDim,
49 ShapeMatrixType SelectedShapeMatrixType = ShapeMatrixType::ALL,
50 typename IntegrationMethod>
51std::vector<typename ShapeMatricesType::ShapeMatrices,
52 Eigen::aligned_allocator<typename ShapeMatricesType::ShapeMatrices>>
53initShapeMatrices(MeshLib::Element const& e, bool const is_axially_symmetric,
54 IntegrationMethod const& integration_method)
55{
56 int const n_integration_points = integration_method.getNumberOfPoints();
57
58 std::vector<MathLib::WeightedPoint> points;
59 points.reserve(n_integration_points);
60 for (int ip = 0; ip < n_integration_points; ++ip)
61 {
62 points.push_back(integration_method.getWeightedPoint(ip));
63 }
64
65 return computeShapeMatrices<ShapeFunction, ShapeMatricesType, GlobalDim,
66 SelectedShapeMatrixType>(
67 e, is_axially_symmetric, points);
68}
69
70template <typename ShapeFunction, typename ShapeMatricesType>
72 MeshLib::Element const& e,
73 typename ShapeMatricesType::ShapeMatrices::ShapeType const& N)
74{
75 auto const fe =
77
78 return fe.interpolateZerothCoordinate(N);
79}
80
81template <typename ShapeFunction, typename ShapeMatricesType>
82std::array<double, 3> interpolateCoordinates(
83 MeshLib::Element const& e,
84 typename ShapeMatricesType::ShapeMatrices::ShapeType const& N)
85{
86 auto const fe =
88
89 return fe.interpolateCoordinates(N);
90}
91
92} // namespace NumLib
Definition of the Element class.
double interpolateXCoordinate(MeshLib::Element const &e, typename ShapeMatricesType::ShapeMatrices::ShapeType const &N)
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)
std::vector< typename ShapeMatricesType::ShapeMatrices, Eigen::aligned_allocator< typename ShapeMatricesType::ShapeMatrices > > computeShapeMatrices(MeshLib::Element const &e, bool const is_axially_symmetric, PointContainer const &points)
ShapeMatrixType
Shape matrix type to be calculated.
@ ALL
calculates all
std::array< double, 3 > interpolateCoordinates(MeshLib::Element const &e, typename ShapeMatricesType::ShapeMatrices::ShapeType const &N)
NumLib::TemplateIsoparametric< ShapeFunction, ShapeMatricesType > createIsoparametricFiniteElement(MeshLib::Element const &e)