12#include <unordered_map>
20template <
typename MeshElement>
23template <
typename IntegrationPolicy_>
27 typename IntegrationPolicy_::IntegrationMethod meth{order};
30 std::vector<MathLib::WeightedPoint> wps;
33 for (
unsigned ip = 0; ip < np; ++ip)
35 wps.emplace_back(meth.getWeightedPoint(ip));
37 if (wps.back() != meth.getWeightedPoint(ip))
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());
49template <
typename MeshElement>
51 std::unordered_map<std::type_index,
52 std::vector<NumLib::GenericIntegrationMethod>>&
53 integration_methods_by_mesh_element_type,
56 std::vector<NumLib::GenericIntegrationMethod> integration_methods;
57 integration_methods.reserve(max_order + 1);
61 integration_methods.push_back(std::move(invalidMethod));
63 for (
unsigned order = 1; order <= max_order; ++order)
65 integration_methods.push_back(
70 integration_methods_by_mesh_element_type.emplace(
71 std::type_index(
typeid(MeshElement)), std::move(integration_methods));
75 std::unordered_map<std::type_index,
76 std::vector<NumLib::GenericIntegrationMethod>>&
77 integration_methods_by_mesh_element_type)
80 integration_methods_by_mesh_element_type,
85 std::unordered_map<std::type_index,
86 std::vector<NumLib::GenericIntegrationMethod>>&
87 integration_methods_by_mesh_element_type)
97 std::unordered_map<std::type_index,
98 std::vector<NumLib::GenericIntegrationMethod>>&
99 integration_methods_by_mesh_element_type)
111 integration_methods_by_mesh_element_type, 4);
114 integration_methods_by_mesh_element_type, 4);
118 std::unordered_map<std::type_index,
119 std::vector<NumLib::GenericIntegrationMethod>>&
120 integration_methods_by_mesh_element_type)
129 integration_methods_by_mesh_element_type, 4);
132 integration_methods_by_mesh_element_type, 4);
135 integration_methods_by_mesh_element_type, 4);
138 integration_methods_by_mesh_element_type, 4);
151 integration_methods_by_mesh_element_type, 4 );
154 integration_methods_by_mesh_element_type, 4 );
157static std::unordered_map<std::type_index,
158 std::vector<NumLib::GenericIntegrationMethod>>
161 std::unordered_map<std::type_index,
162 std::vector<NumLib::GenericIntegrationMethod>>
163 integration_methods_by_mesh_element_type;
170 return integration_methods_by_mesh_element_type;
178 if (order.
order == 0)
183 OGS_FATAL(
"An integration order of 0 is not supported.");
197 static const std::unordered_map<
199 std::vector<NumLib::GenericIntegrationMethod>>
203 integration_methods_by_mesh_element_type.find(mesh_element_type);
204 it != integration_methods_by_mesh_element_type.end())
206 auto& integration_methods = it->second;
208 if (order.
order >= integration_methods.size())
211 "Integration order {} is not supported for mesh elements of "
214 mesh_element_type.name());
217 return integration_methods[order.
order];
221 "No integration methods are available for mesh elements of type {}",
222 mesh_element_type.name());
static void putIntegrationMethodsForDim1(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()
static NumLib::GenericIntegrationMethod createGenericIntegrationMethod(unsigned const order)
static void putIntegrationMethodsForDim3(std::unordered_map< std::type_index, std::vector< NumLib::GenericIntegrationMethod > > &integration_methods_by_mesh_element_type)
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 constexpr unsigned MAX_ORDER_REGULAR
static void putIntegrationMethodsForDim2(std::unordered_map< std::type_index, std::vector< NumLib::GenericIntegrationMethod > > &integration_methods_by_mesh_element_type)
unsigned getNumberOfPoints() const
GenericIntegrationMethod const & getIntegrationMethod(std::type_index const mesh_element_type, IntegrationOrder const order)