OGS
ProcessLib::HeatTransportBHE::LocalDataInitializer< LocalAssemblerInterface, LocalAssemblerDataSoil, LocalAssemblerDataBHE, ConstructorArgs > Class Template Referencefinal

Detailed Description

template<typename LocalAssemblerInterface, template< typename > class LocalAssemblerDataSoil, template< typename, typename > class LocalAssemblerDataBHE, typename... ConstructorArgs>
class ProcessLib::HeatTransportBHE::LocalDataInitializer< LocalAssemblerInterface, LocalAssemblerDataSoil, LocalAssemblerDataBHE, ConstructorArgs >

The LocalDataInitializer is a functor creating a local assembler data with corresponding to the mesh element type shape functions and calling initialization of the new local assembler data. For example for MeshLib::Quad a local assembler data with template argument NumLib::ShapeQuad4 is created.

Definition at line 42 of file LocalDataInitializer.h.

#include <LocalDataInitializer.h>

Collaboration diagram for ProcessLib::HeatTransportBHE::LocalDataInitializer< LocalAssemblerInterface, LocalAssemblerDataSoil, LocalAssemblerDataBHE, ConstructorArgs >:
[legend]

Classes

struct  IsNDElement
 

Public Types

using LADataIntfPtr = std::unique_ptr<LocalAssemblerInterface>
 

Public Member Functions

 LocalDataInitializer (NumLib::LocalToGlobalIndexMap const &dof_table, NumLib::IntegrationOrder const integration_order)
 
LADataIntfPtr operator() (std::size_t const, MeshLib::Element const &mesh_item, std::unordered_map< std::size_t, BHE::BHETypes * > const &element_to_bhe_map, ConstructorArgs &&... args) const
 

Private Types

using LADataBuilder
 

Static Private Member Functions

template<typename ShapeFunction >
static LADataBuilder makeLocalAssemblerBuilder (NumLib::IntegrationOrder const integration_order)
 
template<typename ShapeFunction >
static LADataBuilder makeLocalAssemblerBuilderBHE (NumLib::IntegrationOrder const integration_order)
 

Private Attributes

std::unordered_map< std::type_index, LADataBuilder_builder
 Mapping of element types to local assembler constructors.
 
NumLib::LocalToGlobalIndexMap const & _dof_table
 

Member Typedef Documentation

◆ LADataBuilder

template<typename LocalAssemblerInterface , template< typename > class LocalAssemblerDataSoil, template< typename, typename > class LocalAssemblerDataBHE, typename... ConstructorArgs>
using ProcessLib::HeatTransportBHE::LocalDataInitializer< LocalAssemblerInterface, LocalAssemblerDataSoil, LocalAssemblerDataBHE, ConstructorArgs >::LADataBuilder
private
Initial value:
std::function<LADataIntfPtr(
MeshLib::Element const& e,
std::unordered_map<std::size_t, BHE::BHETypes*> const&
element_to_bhe_map,
ConstructorArgs&&...)>
std::unique_ptr< LocalAssemblerInterface > LADataIntfPtr

Definition at line 126 of file LocalDataInitializer.h.

◆ LADataIntfPtr

template<typename LocalAssemblerInterface , template< typename > class LocalAssemblerDataSoil, template< typename, typename > class LocalAssemblerDataBHE, typename... ConstructorArgs>
using ProcessLib::HeatTransportBHE::LocalDataInitializer< LocalAssemblerInterface, LocalAssemblerDataSoil, LocalAssemblerDataBHE, ConstructorArgs >::LADataIntfPtr = std::unique_ptr<LocalAssemblerInterface>

Definition at line 55 of file LocalDataInitializer.h.

Constructor & Destructor Documentation

◆ LocalDataInitializer()

template<typename LocalAssemblerInterface , template< typename > class LocalAssemblerDataSoil, template< typename, typename > class LocalAssemblerDataBHE, typename... ConstructorArgs>
ProcessLib::HeatTransportBHE::LocalDataInitializer< LocalAssemblerInterface, LocalAssemblerDataSoil, LocalAssemblerDataBHE, ConstructorArgs >::LocalDataInitializer ( NumLib::LocalToGlobalIndexMap const & dof_table,
NumLib::IntegrationOrder const integration_order )
inlineexplicit

Definition at line 57 of file LocalDataInitializer.h.

60 : _dof_table(dof_table)
61 {
62 // 3D soil elements
63 using Enabled3DElementTraits =
65 std::declval<IsNDElement<3>>()));
66
68 [this, integration_order]<typename ET>(ET*)
69 {
70 using MeshElement = typename ET::Element;
71 using ShapeFunction = typename ET::ShapeFunction;
72
73 _builder[std::type_index(typeid(MeshElement))] =
75 });
76
77 // 1D BHE elements
78 using Enabled1DElementTraits =
80 std::declval<IsNDElement<1>>()));
81
83 [this, integration_order]<typename ET>(ET*)
84 {
85 using MeshElement = typename ET::Element;
86 using ShapeFunction = typename ET::ShapeFunction;
87
88 _builder[std::type_index(typeid(MeshElement))] =
90 integration_order);
91 });
92 }
static LADataBuilder makeLocalAssemblerBuilderBHE(NumLib::IntegrationOrder const integration_order)
static LADataBuilder makeLocalAssemblerBuilder(NumLib::IntegrationOrder const integration_order)
std::unordered_map< std::type_index, LADataBuilder > _builder
Mapping of element types to local assembler constructors.
NumLib::LocalToGlobalIndexMap const & _dof_table
void foreach(Function &&f)
Definition TMP.h:157
decltype(auto) filter(Pred pred)
Definition TMP.h:78

References BaseLib::TMP::filter(), and BaseLib::TMP::foreach().

Member Function Documentation

◆ makeLocalAssemblerBuilder()

template<typename LocalAssemblerInterface , template< typename > class LocalAssemblerDataSoil, template< typename, typename > class LocalAssemblerDataBHE, typename... ConstructorArgs>
template<typename ShapeFunction >
static LADataBuilder ProcessLib::HeatTransportBHE::LocalDataInitializer< LocalAssemblerInterface, LocalAssemblerDataSoil, LocalAssemblerDataBHE, ConstructorArgs >::makeLocalAssemblerBuilder ( NumLib::IntegrationOrder const integration_order)
inlinestaticprivate

Definition at line 133 of file LocalDataInitializer.h.

135 {
136 return [integration_order](
137 MeshLib::Element const& e,
138 std::unordered_map<std::size_t, BHE::BHETypes*> const&
139 /* unused */,
140 ConstructorArgs&&... args) -> LADataIntfPtr
141 {
142 auto const& integration_method = NumLib::IntegrationMethodRegistry::
143 template getIntegrationMethod<
144 typename ShapeFunction::MeshElement>(integration_order);
145
146 if (e.getDimension() == 3) // soil elements
147 {
148 return LADataIntfPtr{new LocalAssemblerDataSoil<ShapeFunction>{
149 e, integration_method,
150 std::forward<ConstructorArgs>(args)...}};
151 }
152
153 return nullptr;
154 };
155 }
virtual constexpr unsigned getDimension() const =0
Get dimension of the mesh element.
GenericIntegrationMethod const & getIntegrationMethod(std::type_index const mesh_element_type, IntegrationOrder const order)

References MeshLib::Element::getDimension().

◆ makeLocalAssemblerBuilderBHE()

template<typename LocalAssemblerInterface , template< typename > class LocalAssemblerDataSoil, template< typename, typename > class LocalAssemblerDataBHE, typename... ConstructorArgs>
template<typename ShapeFunction >
static LADataBuilder ProcessLib::HeatTransportBHE::LocalDataInitializer< LocalAssemblerInterface, LocalAssemblerDataSoil, LocalAssemblerDataBHE, ConstructorArgs >::makeLocalAssemblerBuilderBHE ( NumLib::IntegrationOrder const integration_order)
inlinestaticprivate

Definition at line 158 of file LocalDataInitializer.h.

160 {
161 return [integration_order](
162 MeshLib::Element const& e,
163 std::unordered_map<std::size_t, BHE::BHETypes*> const&
164 element_to_bhe_map,
165 ConstructorArgs&&... args) -> LADataIntfPtr
166 {
167 auto const& integration_method = NumLib::IntegrationMethodRegistry::
168 template getIntegrationMethod<
169 typename ShapeFunction::MeshElement>(integration_order);
170
171 auto& bhe = *element_to_bhe_map.at(e.getID());
172
173 if (std::holds_alternative<BHE::BHE_1U>(bhe))
174 {
175 return LADataIntfPtr{
176 new LocalAssemblerDataBHE<ShapeFunction, BHE::BHE_1U>{
177 e, integration_method, std::get<BHE::BHE_1U>(bhe),
178 std::forward<ConstructorArgs>(args)...}};
179 }
180
181 if (std::holds_alternative<BHE::BHE_CXA>(bhe))
182 {
183 return LADataIntfPtr{
184 new LocalAssemblerDataBHE<ShapeFunction, BHE::BHE_CXA>{
185 e, integration_method, std::get<BHE::BHE_CXA>(bhe),
186 std::forward<ConstructorArgs>(args)...}};
187 }
188
189 if (std::holds_alternative<BHE::BHE_CXC>(bhe))
190 {
191 return LADataIntfPtr{
192 new LocalAssemblerDataBHE<ShapeFunction, BHE::BHE_CXC>{
193 e, integration_method, std::get<BHE::BHE_CXC>(bhe),
194 std::forward<ConstructorArgs>(args)...}};
195 }
196
197 if (std::holds_alternative<BHE::BHE_2U>(bhe))
198 {
199 return LADataIntfPtr{
200 new LocalAssemblerDataBHE<ShapeFunction, BHE::BHE_2U>{
201 e, integration_method, std::get<BHE::BHE_2U>(bhe),
202 std::forward<ConstructorArgs>(args)...}};
203 }
204
205 if (std::holds_alternative<BHE::BHE_1P>(bhe))
206 {
207 return LADataIntfPtr{
208 new LocalAssemblerDataBHE<ShapeFunction, BHE::BHE_1P>{
209 e, integration_method, std::get<BHE::BHE_1P>(bhe),
210 std::forward<ConstructorArgs>(args)...}};
211 }
212 OGS_FATAL(
213 "Trying to create local assembler for an unknown BHE type.");
214 };
215 }
#define OGS_FATAL(...)
Definition Error.h:26
std::size_t getID() const
Returns the ID of the element.
Definition Element.h:89

References MeshLib::Element::getID(), and OGS_FATAL.

◆ operator()()

template<typename LocalAssemblerInterface , template< typename > class LocalAssemblerDataSoil, template< typename, typename > class LocalAssemblerDataBHE, typename... ConstructorArgs>
LADataIntfPtr ProcessLib::HeatTransportBHE::LocalDataInitializer< LocalAssemblerInterface, LocalAssemblerDataSoil, LocalAssemblerDataBHE, ConstructorArgs >::operator() ( std::size_t const ,
MeshLib::Element const & mesh_item,
std::unordered_map< std::size_t, BHE::BHETypes * > const & element_to_bhe_map,
ConstructorArgs &&... args ) const
inline

Returns data pointer to the newly created local assembler data.

Attention
The index id is not necessarily the mesh item's id. Especially when having multiple meshes it will differ from the latter.

Definition at line 99 of file LocalDataInitializer.h.

105 {
106 auto const type_idx = std::type_index(typeid(mesh_item));
107 auto const it = _builder.find(type_idx);
108
109 if (it == _builder.end())
110 {
111 OGS_FATAL(
112 "You are trying to build a local assembler for an unknown mesh "
113 "element type ({:s})."
114 " Maybe you have disabled this mesh element type in your build "
115 "configuration, or a mesh element order does not match shape "
116 "function order given in the project file.",
117 type_idx.name());
118 }
119
120 return it->second(mesh_item,
121 element_to_bhe_map,
122 std::forward<ConstructorArgs>(args)...);
123 }

References OGS_FATAL.

Member Data Documentation

◆ _builder

template<typename LocalAssemblerInterface , template< typename > class LocalAssemblerDataSoil, template< typename, typename > class LocalAssemblerDataBHE, typename... ConstructorArgs>
std::unordered_map<std::type_index, LADataBuilder> ProcessLib::HeatTransportBHE::LocalDataInitializer< LocalAssemblerInterface, LocalAssemblerDataSoil, LocalAssemblerDataBHE, ConstructorArgs >::_builder
private

Mapping of element types to local assembler constructors.

Definition at line 218 of file LocalDataInitializer.h.

◆ _dof_table

template<typename LocalAssemblerInterface , template< typename > class LocalAssemblerDataSoil, template< typename, typename > class LocalAssemblerDataBHE, typename... ConstructorArgs>
NumLib::LocalToGlobalIndexMap const& ProcessLib::HeatTransportBHE::LocalDataInitializer< LocalAssemblerInterface, LocalAssemblerDataSoil, LocalAssemblerDataBHE, ConstructorArgs >::_dof_table
private

Definition at line 220 of file LocalDataInitializer.h.


The documentation for this class was generated from the following file: