OGS
ComputeElementVolumeNumerically.cpp
Go to the documentation of this file.
1
13
14#include <typeinfo>
15
24#include "MeshLib/MeshEnums.h"
43
44namespace MeshToolsLib
45{
46template <typename ShapeFunction>
48{
49 // Space dimension is set to 3 in case that 1D or 2D element is inclined.
50 constexpr int space_dim = 3;
52
53 // Integration order is set to 3:
54 auto const& integration_method =
55 NumLib::IntegrationMethodRegistry::template getIntegrationMethod<
56 typename ShapeFunction::MeshElement>(NumLib::IntegrationOrder{3});
57
58 auto const shape_function_data =
60 e, false /*is_axially_symmetric*/, integration_method);
61
62 auto const n_integration_points = integration_method.getNumberOfPoints();
63 double volume = 0.0;
64 for (unsigned ip = 0; ip < n_integration_points; ++ip)
65 {
66 auto const weight = integration_method.getWeightedPoint(ip).getWeight();
67 volume += shape_function_data[ip].detJ * weight;
68 }
69
70 return volume;
71}
72
74{
75 switch (e.getCellType())
76 {
107 default:
108 OGS_FATAL(
109 "Numerical volume calculation is not available for element "
110 "with type {}. ",
112 }
113}
114
115} // namespace MeshToolsLib
Definition of the Element class.
#define OGS_FATAL(...)
Definition Error.h:26
Definition of the Hex class.
Definition of the Line class.
Definition of mesh-related Enumerations.
Definition of the Prism class.
Definition of the Pyramid class.
Definition of the Quad class.
Definition of the Tet class.
Definition of the Tri class.
virtual CellType getCellType() const =0
std::string CellType2String(const CellType t)
Given a MeshElemType this returns the appropriate string.
double computeElementVolumeNumerically(MeshLib::Element const &e)
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)