OGS
InitShapeMatrices.h
Go to the documentation of this file.
1 
10 #pragma once
11 
12 #include <vector>
13 
16 
17 namespace NumLib
18 {
19 template <typename ShapeFunction, typename ShapeMatricesType, int GlobalDim,
20  ShapeMatrixType SelectedShapeMatrixType = ShapeMatrixType::ALL,
21  typename PointContainer>
22 std::vector<typename ShapeMatricesType::ShapeMatrices,
23  Eigen::aligned_allocator<typename ShapeMatricesType::ShapeMatrices>>
24 computeShapeMatrices(MeshLib::Element const& e, bool const is_axially_symmetric,
25  PointContainer const& points)
26 {
27  std::vector<
28  typename ShapeMatricesType::ShapeMatrices,
29  Eigen::aligned_allocator<typename ShapeMatricesType::ShapeMatrices>>
30  shape_matrices;
31 
32  auto const fe =
33  createIsoparametricFiniteElement<ShapeFunction, ShapeMatricesType>(e);
34 
35  shape_matrices.reserve(points.size());
36  for (auto const& p : points)
37  {
38  shape_matrices.emplace_back(ShapeFunction::DIM, e.getDimension(),
39  ShapeFunction::NPOINTS);
40  fe.template computeShapeFunctions<SelectedShapeMatrixType>(
41  p.getCoords(), shape_matrices.back(), GlobalDim,
42  is_axially_symmetric);
43  }
44 
45  return shape_matrices;
46 }
47 
48 template <typename ShapeFunction, typename ShapeMatricesType, int GlobalDim,
49  ShapeMatrixType SelectedShapeMatrixType = ShapeMatrixType::ALL,
50  typename IntegrationMethod>
51 std::vector<typename ShapeMatricesType::ShapeMatrices,
52  Eigen::aligned_allocator<typename ShapeMatricesType::ShapeMatrices>>
53 initShapeMatrices(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<typename IntegrationMethod::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 
70 template <typename ShapeFunction, typename ShapeMatricesType>
72  MeshLib::Element const& e,
73  typename ShapeMatricesType::ShapeMatrices::ShapeType const& N)
74 {
75  auto const fe =
76  createIsoparametricFiniteElement<ShapeFunction, ShapeMatricesType>(e);
77 
78  return fe.interpolateZerothCoordinate(N);
79 }
80 
81 template <typename ShapeFunction, typename ShapeMatricesType>
82 std::array<double, 3> interpolateCoordinates(
83  MeshLib::Element const& e,
84  typename ShapeMatricesType::ShapeMatrices::ShapeType const& N)
85 {
86  auto const fe =
87  createIsoparametricFiniteElement<ShapeFunction, ShapeMatricesType>(e);
88 
89  return fe.interpolateCoordinates(N);
90 }
91 
92 } // namespace NumLib
Definition of the Element class.
virtual constexpr unsigned getDimension() const =0
Get dimension of the mesh element.
double interpolateXCoordinate(MeshLib::Element const &e, typename ShapeMatricesType::ShapeMatrices::ShapeType const &N)
std::vector< typename ShapeMatricesType::ShapeMatrices, Eigen::aligned_allocator< typename ShapeMatricesType::ShapeMatrices > > computeShapeMatrices(MeshLib::Element const &e, bool const is_axially_symmetric, PointContainer const &points)
std::array< double, 3 > interpolateCoordinates(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)
ShapeMatrixType
Shape matrix type to be calculated.
Definition: ShapeMatrices.h:24
@ ALL
calculates all