OGS
IntegrationMethodRegistry.cpp File Reference

Detailed Description

Definition in file IntegrationMethodRegistry.cpp.

#include "IntegrationMethodRegistry.h"
#include <unordered_map>
#include "BaseLib/Error.h"
#include "GaussLegendreIntegrationPolicy.h"
#include "MeshLib/Elements/Elements.h"
Include dependency graph for IntegrationMethodRegistry.cpp:

Go to the source code of this file.

Namespaces

namespace  NumLib
 
namespace  NumLib::IntegrationMethodRegistry
 

Typedefs

template<typename MeshElement >
using IntegrationPolicy = NumLib::GaussLegendreIntegrationPolicy<MeshElement>
 

Functions

template<typename IntegrationPolicy_ >
static NumLib::GenericIntegrationMethod createGenericIntegrationMethod (unsigned const order)
 
template<typename MeshElement >
static void putIntegrationMethodsFor (std::unordered_map< std::type_index, std::vector< NumLib::GenericIntegrationMethod > > &integration_methods_by_mesh_element_type, unsigned max_order)
 
static void putIntegrationMethodsForDim0 (std::unordered_map< std::type_index, std::vector< NumLib::GenericIntegrationMethod > > &integration_methods_by_mesh_element_type)
 
static void putIntegrationMethodsForDim1 (std::unordered_map< std::type_index, std::vector< NumLib::GenericIntegrationMethod > > &integration_methods_by_mesh_element_type)
 
static void putIntegrationMethodsForDim2 (std::unordered_map< std::type_index, std::vector< NumLib::GenericIntegrationMethod > > &integration_methods_by_mesh_element_type)
 
static void putIntegrationMethodsForDim3 (std::unordered_map< std::type_index, std::vector< NumLib::GenericIntegrationMethod > > &integration_methods_by_mesh_element_type)
 
static std::unordered_map< std::type_index, std::vector< NumLib::GenericIntegrationMethod > > initIntegrationMethods ()
 
GenericIntegrationMethod const & NumLib::IntegrationMethodRegistry::getIntegrationMethod (std::type_index const mesh_element_type, IntegrationOrder const order)
 

Variables

static constexpr unsigned MAX_ORDER_REGULAR = 4u
 

Typedef Documentation

◆ IntegrationPolicy

template<typename MeshElement >
using IntegrationPolicy = NumLib::GaussLegendreIntegrationPolicy<MeshElement>

Definition at line 21 of file IntegrationMethodRegistry.cpp.

Function Documentation

◆ createGenericIntegrationMethod()

template<typename IntegrationPolicy_ >
static NumLib::GenericIntegrationMethod createGenericIntegrationMethod ( unsigned const order)
static

Definition at line 24 of file IntegrationMethodRegistry.cpp.

26{
27 typename IntegrationPolicy_::IntegrationMethod meth{order};
28 unsigned const np = meth.getNumberOfPoints();
29
30 std::vector<MathLib::WeightedPoint> wps;
31 wps.reserve(np);
32
33 for (unsigned ip = 0; ip < np; ++ip)
34 {
35 wps.emplace_back(meth.getWeightedPoint(ip));
36
37 if (wps.back() != meth.getWeightedPoint(ip))
38 {
39 throw std::runtime_error(
40 "createGenericIntegrationMethod mismatch for ip=" +
41 std::to_string(ip) + ", order=" + std::to_string(order) +
42 ", method=" + typeid(decltype(meth)).name());
43 }
44 }
45
46 return NumLib::GenericIntegrationMethod{order, std::move(wps)};
47}

References NumLib::GenericIntegrationMethod::getNumberOfPoints().

Referenced by putIntegrationMethodsFor().

◆ initIntegrationMethods()

static std::unordered_map< std::type_index, std::vector< NumLib::GenericIntegrationMethod > > initIntegrationMethods ( )
static

Definition at line 159 of file IntegrationMethodRegistry.cpp.

160{
161 std::unordered_map<std::type_index,
162 std::vector<NumLib::GenericIntegrationMethod>>
163 integration_methods_by_mesh_element_type;
164
165 putIntegrationMethodsForDim0(integration_methods_by_mesh_element_type);
166 putIntegrationMethodsForDim1(integration_methods_by_mesh_element_type);
167 putIntegrationMethodsForDim2(integration_methods_by_mesh_element_type);
168 putIntegrationMethodsForDim3(integration_methods_by_mesh_element_type);
169
170 return integration_methods_by_mesh_element_type;
171}
static void putIntegrationMethodsForDim1(std::unordered_map< std::type_index, std::vector< NumLib::GenericIntegrationMethod > > &integration_methods_by_mesh_element_type)
static void putIntegrationMethodsForDim3(std::unordered_map< std::type_index, std::vector< NumLib::GenericIntegrationMethod > > &integration_methods_by_mesh_element_type)
static void putIntegrationMethodsForDim0(std::unordered_map< std::type_index, std::vector< NumLib::GenericIntegrationMethod > > &integration_methods_by_mesh_element_type)
static void putIntegrationMethodsForDim2(std::unordered_map< std::type_index, std::vector< NumLib::GenericIntegrationMethod > > &integration_methods_by_mesh_element_type)

References putIntegrationMethodsForDim0(), putIntegrationMethodsForDim1(), putIntegrationMethodsForDim2(), and putIntegrationMethodsForDim3().

Referenced by NumLib::IntegrationMethodRegistry::getIntegrationMethod().

◆ putIntegrationMethodsFor()

template<typename MeshElement >
static void putIntegrationMethodsFor ( std::unordered_map< std::type_index, std::vector< NumLib::GenericIntegrationMethod > > & integration_methods_by_mesh_element_type,
unsigned max_order )
static

Definition at line 50 of file IntegrationMethodRegistry.cpp.

55{
56 std::vector<NumLib::GenericIntegrationMethod> integration_methods;
57 integration_methods.reserve(max_order + 1);
58
59 // order 0 -> no valid weighted points
60 NumLib::GenericIntegrationMethod invalidMethod{0, {}};
61 integration_methods.push_back(std::move(invalidMethod));
62
63 for (unsigned order = 1; order <= max_order; ++order)
64 {
65 integration_methods.push_back(
67 order));
68 }
69
70 integration_methods_by_mesh_element_type.emplace(
71 std::type_index(typeid(MeshElement)), std::move(integration_methods));
72}
static NumLib::GenericIntegrationMethod createGenericIntegrationMethod(unsigned const order)

References createGenericIntegrationMethod().

◆ putIntegrationMethodsForDim0()

static void putIntegrationMethodsForDim0 ( std::unordered_map< std::type_index, std::vector< NumLib::GenericIntegrationMethod > > & integration_methods_by_mesh_element_type)
static

Definition at line 74 of file IntegrationMethodRegistry.cpp.

78{
79 putIntegrationMethodsFor<MeshLib::Point>(
80 integration_methods_by_mesh_element_type,
81 MAX_ORDER_REGULAR /* arbitrary cutoff */);
82}
static constexpr unsigned MAX_ORDER_REGULAR

References MAX_ORDER_REGULAR.

Referenced by initIntegrationMethods().

◆ putIntegrationMethodsForDim1()

static void putIntegrationMethodsForDim1 ( std::unordered_map< std::type_index, std::vector< NumLib::GenericIntegrationMethod > > & integration_methods_by_mesh_element_type)
static

Definition at line 84 of file IntegrationMethodRegistry.cpp.

88{
89 putIntegrationMethodsFor<MeshLib::Line>(
90 integration_methods_by_mesh_element_type, MAX_ORDER_REGULAR);
91
92 putIntegrationMethodsFor<MeshLib::Line3>(
93 integration_methods_by_mesh_element_type, MAX_ORDER_REGULAR);
94}

References MAX_ORDER_REGULAR.

Referenced by initIntegrationMethods().

◆ putIntegrationMethodsForDim2()

static void putIntegrationMethodsForDim2 ( std::unordered_map< std::type_index, std::vector< NumLib::GenericIntegrationMethod > > & integration_methods_by_mesh_element_type)
static

Definition at line 96 of file IntegrationMethodRegistry.cpp.

100{
101 putIntegrationMethodsFor<MeshLib::Quad>(
102 integration_methods_by_mesh_element_type, MAX_ORDER_REGULAR);
103
104 putIntegrationMethodsFor<MeshLib::Quad8>(
105 integration_methods_by_mesh_element_type, MAX_ORDER_REGULAR);
106
107 putIntegrationMethodsFor<MeshLib::Quad9>(
108 integration_methods_by_mesh_element_type, MAX_ORDER_REGULAR);
109
110 putIntegrationMethodsFor<MeshLib::Tri>(
111 integration_methods_by_mesh_element_type, 4);
112
113 putIntegrationMethodsFor<MeshLib::Tri6>(
114 integration_methods_by_mesh_element_type, 4);
115}

References MAX_ORDER_REGULAR.

Referenced by initIntegrationMethods().

◆ putIntegrationMethodsForDim3()

static void putIntegrationMethodsForDim3 ( std::unordered_map< std::type_index, std::vector< NumLib::GenericIntegrationMethod > > & integration_methods_by_mesh_element_type)
static

Definition at line 117 of file IntegrationMethodRegistry.cpp.

121{
122 putIntegrationMethodsFor<MeshLib::Hex>(
123 integration_methods_by_mesh_element_type, MAX_ORDER_REGULAR);
124
125 putIntegrationMethodsFor<MeshLib::Hex20>(
126 integration_methods_by_mesh_element_type, MAX_ORDER_REGULAR);
127
128 putIntegrationMethodsFor<MeshLib::Tet>(
129 integration_methods_by_mesh_element_type, 4);
130
131 putIntegrationMethodsFor<MeshLib::Tet10>(
132 integration_methods_by_mesh_element_type, 4);
133
134 putIntegrationMethodsFor<MeshLib::Prism>(
135 integration_methods_by_mesh_element_type, 4);
136
137 putIntegrationMethodsFor<MeshLib::Prism15>(
138 integration_methods_by_mesh_element_type, 4);
139
140 /* Note: Currently (July 22) OGS has pyramid integration schemes only up to
141 * order 3 (see MathLib/Integration/GaussLegendrePyramid.h), and for order 4
142 * the third order is re-used (see
143 * NumLib/Fem/Integration/IntegrationGaussLegendrePyramid.h).
144 * I.e., a user can request 4th order integration on pyramids and OGS will
145 * just run fine, albeit with a lower integration order.
146 * To keep that behavior, in particular not crash if a user requests 4th
147 * order pyramid integration, we set the limit to 4, here.
148 */
149
150 putIntegrationMethodsFor<MeshLib::Pyramid>(
151 integration_methods_by_mesh_element_type, 4 /* see note above */);
152
153 putIntegrationMethodsFor<MeshLib::Pyramid13>(
154 integration_methods_by_mesh_element_type, 4 /* see note above */);
155}

References MAX_ORDER_REGULAR.

Referenced by initIntegrationMethods().

Variable Documentation

◆ MAX_ORDER_REGULAR

constexpr unsigned MAX_ORDER_REGULAR = 4u
staticconstexpr