6#include <unordered_map>
15template <
typename MeshElement>
18template <
typename IntegrationPolicy_>
22 typename IntegrationPolicy_::IntegrationMethod meth{order};
25 std::vector<MathLib::WeightedPoint> wps;
28 for (
unsigned ip = 0; ip < np; ++ip)
30 wps.emplace_back(meth.getWeightedPoint(ip));
32 if (wps.back() != meth.getWeightedPoint(ip))
34 throw std::runtime_error(
35 "createGenericIntegrationMethod mismatch for ip=" +
36 std::to_string(ip) +
", order=" + std::to_string(order) +
44template <
typename MeshElement>
46 std::unordered_map<std::type_index,
47 std::vector<NumLib::GenericIntegrationMethod>>&
48 integration_methods_by_mesh_element_type,
49 unsigned const max_order)
51 std::vector<NumLib::GenericIntegrationMethod> integration_methods;
52 integration_methods.reserve(max_order + 1);
56 integration_methods.push_back(std::move(invalidMethod));
58 for (
unsigned order = 1; order <= max_order; ++order)
60 integration_methods.push_back(
65 integration_methods_by_mesh_element_type.emplace(
66 std::type_index(
typeid(MeshElement)), std::move(integration_methods));
70 std::unordered_map<std::type_index,
71 std::vector<NumLib::GenericIntegrationMethod>>&
72 integration_methods_by_mesh_element_type)
75 integration_methods_by_mesh_element_type,
80 std::unordered_map<std::type_index,
81 std::vector<NumLib::GenericIntegrationMethod>>&
82 integration_methods_by_mesh_element_type)
92 std::unordered_map<std::type_index,
93 std::vector<NumLib::GenericIntegrationMethod>>&
94 integration_methods_by_mesh_element_type)
106 integration_methods_by_mesh_element_type, 4);
109 integration_methods_by_mesh_element_type, 4);
113 std::unordered_map<std::type_index,
114 std::vector<NumLib::GenericIntegrationMethod>>&
115 integration_methods_by_mesh_element_type)
124 integration_methods_by_mesh_element_type, 4);
127 integration_methods_by_mesh_element_type, 4);
130 integration_methods_by_mesh_element_type, 4);
133 integration_methods_by_mesh_element_type, 4);
146 integration_methods_by_mesh_element_type, 4 );
149 integration_methods_by_mesh_element_type, 4 );
152static std::unordered_map<std::type_index,
153 std::vector<NumLib::GenericIntegrationMethod>>
156 std::unordered_map<std::type_index,
157 std::vector<NumLib::GenericIntegrationMethod>>
158 integration_methods_by_mesh_element_type;
165 return integration_methods_by_mesh_element_type;
173 if (order.
order == 0)
178 OGS_FATAL(
"An integration order of 0 is not supported.");
192 static const std::unordered_map<
194 std::vector<NumLib::GenericIntegrationMethod>>
198 integration_methods_by_mesh_element_type.find(mesh_element_type);
199 it != integration_methods_by_mesh_element_type.end())
201 auto& integration_methods = it->second;
203 if (order.
order >= integration_methods.size())
206 "Integration order {} is not supported for mesh elements of "
209 mesh_element_type.name());
212 return integration_methods[order.
order];
216 "No integration methods are available for mesh elements of type {}",
217 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 putIntegrationMethodsForDim0(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 const max_order)
NumLib::GaussLegendreIntegrationPolicy< MeshElement > IntegrationPolicy
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
std::string typeToString()
GenericIntegrationMethod const & getIntegrationMethod(std::type_index const mesh_element_type, IntegrationOrder const order)