OGS
ProcessLib::LIE::SmallDeformation::LocalDataInitializer< LocalAssemblerInterface, LocalAssemblerDataMatrix, LocalAssemblerDataMatrixNearFracture, LocalAssemblerDataFracture, GlobalDim, ConstructorArgs > Class Template Referencefinal

Detailed Description

template<typename LocalAssemblerInterface, template< typename, int > class LocalAssemblerDataMatrix, template< typename, int > class LocalAssemblerDataMatrixNearFracture, template< typename, int > class LocalAssemblerDataFracture, int GlobalDim, typename... ConstructorArgs>
class ProcessLib::LIE::SmallDeformation::LocalDataInitializer< LocalAssemblerInterface, LocalAssemblerDataMatrix, LocalAssemblerDataMatrixNearFracture, LocalAssemblerDataFracture, GlobalDim, 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::LIE::SmallDeformation::LocalDataInitializer< LocalAssemblerInterface, LocalAssemblerDataMatrix, LocalAssemblerDataMatrixNearFracture, LocalAssemblerDataFracture, GlobalDim, ConstructorArgs >:
[legend]

Classes

struct  IsElementEnabled
 

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 id, MeshLib::Element const &mesh_item, ConstructorArgs &&... args) const
 

Private Types

using LADataBuilder
 

Static Private Member Functions

template<typename ShapeFunction >
static LADataBuilder makeLocalAssemblerBuilder (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, int > class LocalAssemblerDataMatrix, template< typename, int > class LocalAssemblerDataMatrixNearFracture, template< typename, int > class LocalAssemblerDataFracture, int GlobalDim, typename... ConstructorArgs>
using ProcessLib::LIE::SmallDeformation::LocalDataInitializer< LocalAssemblerInterface, LocalAssemblerDataMatrix, LocalAssemblerDataMatrixNearFracture, LocalAssemblerDataFracture, GlobalDim, ConstructorArgs >::LADataBuilder
private
Initial value:
std::function<LADataIntfPtr(
MeshLib::Element const& e,
std::size_t const n_variables,
std::size_t const local_matrix_size,
std::vector<unsigned> const& dofIndex_to_localIndex,
ConstructorArgs&&...)>
std::unique_ptr< LocalAssemblerInterface > LADataIntfPtr

Definition at line 149 of file LocalDataInitializer.h.

◆ LADataIntfPtr

template<typename LocalAssemblerInterface , template< typename, int > class LocalAssemblerDataMatrix, template< typename, int > class LocalAssemblerDataMatrixNearFracture, template< typename, int > class LocalAssemblerDataFracture, int GlobalDim, typename... ConstructorArgs>
using ProcessLib::LIE::SmallDeformation::LocalDataInitializer< LocalAssemblerInterface, LocalAssemblerDataMatrix, LocalAssemblerDataMatrixNearFracture, LocalAssemblerDataFracture, GlobalDim, ConstructorArgs >::LADataIntfPtr = std::unique_ptr<LocalAssemblerInterface>

Definition at line 60 of file LocalDataInitializer.h.

Constructor & Destructor Documentation

◆ LocalDataInitializer()

template<typename LocalAssemblerInterface , template< typename, int > class LocalAssemblerDataMatrix, template< typename, int > class LocalAssemblerDataMatrixNearFracture, template< typename, int > class LocalAssemblerDataFracture, int GlobalDim, typename... ConstructorArgs>
ProcessLib::LIE::SmallDeformation::LocalDataInitializer< LocalAssemblerInterface, LocalAssemblerDataMatrix, LocalAssemblerDataMatrixNearFracture, LocalAssemblerDataFracture, GlobalDim, ConstructorArgs >::LocalDataInitializer ( NumLib::LocalToGlobalIndexMap const & dof_table,
NumLib::IntegrationOrder const integration_order )
inlineexplicit

Definition at line 62 of file LocalDataInitializer.h.

65 : _dof_table(dof_table)
66 {
67 // REMARKS: At the moment, only a 2D mesh with 1D elements are
68 // supported.
69
70 using EnabledElementTraits =
72 std::declval<IsElementEnabled>()));
73
75 [this, integration_order]<typename ET>(ET*)
76 {
77 using MeshElement = typename ET::Element;
78 using ShapeFunction = typename ET::ShapeFunction;
79
80 _builder[std::type_index(typeid(MeshElement))] =
82 });
83 }
static LADataBuilder makeLocalAssemblerBuilder(NumLib::IntegrationOrder const integration_order)
std::unordered_map< std::type_index, LADataBuilder > _builder
Mapping of element types to local assembler constructors.
void foreach(Function &&f)
Definition TMP.h:157
decltype(auto) filter(Pred pred)
Definition TMP.h:78

References ProcessLib::LIE::SmallDeformation::LocalDataInitializer< LocalAssemblerInterface, LocalAssemblerDataMatrix, LocalAssemblerDataMatrixNearFracture, LocalAssemblerDataFracture, GlobalDim, ConstructorArgs >::_builder, BaseLib::TMP::filter(), BaseLib::TMP::foreach(), and ProcessLib::LIE::SmallDeformation::LocalDataInitializer< LocalAssemblerInterface, LocalAssemblerDataMatrix, LocalAssemblerDataMatrixNearFracture, LocalAssemblerDataFracture, GlobalDim, ConstructorArgs >::makeLocalAssemblerBuilder().

Member Function Documentation

◆ makeLocalAssemblerBuilder()

template<typename LocalAssemblerInterface , template< typename, int > class LocalAssemblerDataMatrix, template< typename, int > class LocalAssemblerDataMatrixNearFracture, template< typename, int > class LocalAssemblerDataFracture, int GlobalDim, typename... ConstructorArgs>
template<typename ShapeFunction >
static LADataBuilder ProcessLib::LIE::SmallDeformation::LocalDataInitializer< LocalAssemblerInterface, LocalAssemblerDataMatrix, LocalAssemblerDataMatrixNearFracture, LocalAssemblerDataFracture, GlobalDim, ConstructorArgs >::makeLocalAssemblerBuilder ( NumLib::IntegrationOrder const integration_order)
inlinestaticprivate

Generates a function that creates a new LocalAssembler of type LAData<ShapeFunction>. Only functions with shape function's dimension less or equal to the global dimension are instantiated, e.g. following combinations of shape functions and global dimensions: (Line2, 1), (Line2, 2), (Line2, 3), (Hex20, 3) but not (Hex20, 2) or (Hex20, 1).

Definition at line 162 of file LocalDataInitializer.h.

164 {
165 return [integration_order](
166 MeshLib::Element const& e,
167 std::size_t const n_variables,
168 std::size_t const local_matrix_size,
169 std::vector<unsigned> const& dofIndex_to_localIndex,
170 ConstructorArgs&&... args)
171 {
172 auto const& integration_method = NumLib::IntegrationMethodRegistry::
173 template getIntegrationMethod<
174 typename ShapeFunction::MeshElement>(integration_order);
175
176 if (e.getDimension() == GlobalDim)
177 {
178 if (dofIndex_to_localIndex.empty())
179 {
180 return LADataIntfPtr{
181 new LocalAssemblerDataMatrix<ShapeFunction, GlobalDim>{
182 e, local_matrix_size, integration_method,
183 std::forward<ConstructorArgs>(args)...}};
184 }
185
186 return LADataIntfPtr{
187 new LocalAssemblerDataMatrixNearFracture<ShapeFunction,
188 GlobalDim>{
189 e, n_variables, local_matrix_size,
190 dofIndex_to_localIndex, integration_method,
191 std::forward<ConstructorArgs>(args)...}};
192 }
193 return LADataIntfPtr{
194 new LocalAssemblerDataFracture<ShapeFunction, GlobalDim>{
195 e, n_variables, local_matrix_size, dofIndex_to_localIndex,
196 integration_method,
197 std::forward<ConstructorArgs>(args)...}};
198 };
199 }
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().

Referenced by ProcessLib::LIE::SmallDeformation::LocalDataInitializer< LocalAssemblerInterface, LocalAssemblerDataMatrix, LocalAssemblerDataMatrixNearFracture, LocalAssemblerDataFracture, GlobalDim, ConstructorArgs >::LocalDataInitializer().

◆ operator()()

template<typename LocalAssemblerInterface , template< typename, int > class LocalAssemblerDataMatrix, template< typename, int > class LocalAssemblerDataMatrixNearFracture, template< typename, int > class LocalAssemblerDataFracture, int GlobalDim, typename... ConstructorArgs>
LADataIntfPtr ProcessLib::LIE::SmallDeformation::LocalDataInitializer< LocalAssemblerInterface, LocalAssemblerDataMatrix, LocalAssemblerDataMatrixNearFracture, LocalAssemblerDataFracture, GlobalDim, ConstructorArgs >::operator() ( std::size_t const id,
MeshLib::Element const & mesh_item,
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 90 of file LocalDataInitializer.h.

93 {
94 auto const type_idx = std::type_index(typeid(mesh_item));
95 auto const it = _builder.find(type_idx);
96
97 if (it == _builder.end())
98 {
100 "You are trying to build a local assembler for an unknown mesh "
101 "element type ({:s})."
102 " Maybe you have disabled this mesh element type in your build "
103 "configuration, or a mesh element order does not match shape "
104 "function order given in the project file.",
105 type_idx.name());
106 }
107
108 auto const n_local_dof = _dof_table.getNumberOfElementDOF(id);
109 auto const n_global_components =
111 auto const varIDs = _dof_table.getElementVariableIDs(id);
112
113 std::vector<unsigned> dofIndex_to_localIndex;
114 if (mesh_item.getDimension() < GlobalDim ||
115 n_global_components > GlobalDim)
116 {
117 dofIndex_to_localIndex.resize(n_local_dof);
118 unsigned dof_id = 0;
119 unsigned local_id = 0;
120 for (auto i : varIDs)
121 {
122 for (int j = 0; j < _dof_table.getNumberOfVariableComponents(i);
123 j++)
124 {
125 auto const& ms = _dof_table.getMeshSubset(i, j);
126 auto const mesh_id = ms.getMeshID();
127 for (unsigned k = 0; k < mesh_item.getNumberOfNodes(); k++)
128 {
129 MeshLib::Location l(mesh_id,
131 getNodeIndex(mesh_item, k));
132 auto global_index = _dof_table.getGlobalIndex(l, i, j);
133 if (global_index != NumLib::MeshComponentMap::nop)
134 {
135 dofIndex_to_localIndex[dof_id++] = local_id;
136 }
137 local_id++;
138 }
139 }
140 }
141 }
142
143 return it->second(mesh_item, varIDs.size(), n_local_dof,
144 dofIndex_to_localIndex,
145 std::forward<ConstructorArgs>(args)...);
146 }
#define OGS_FATAL(...)
Definition Error.h:26
std::size_t getMeshID() const
return this mesh ID
Definition MeshSubset.h:76
std::size_t getNumberOfElementDOF(std::size_t const mesh_item_id) const
GlobalIndexType getGlobalIndex(MeshLib::Location const &l, int const variable_id, int const component_id) const
int getNumberOfVariableComponents(int variable_id) const
MeshLib::MeshSubset const & getMeshSubset(int const variable_id, int const component_id) const
std::size_t getNumberOfElementComponents(std::size_t const mesh_item_id) const
std::vector< int > getElementVariableIDs(std::size_t const mesh_item_id) const
static constexpr NUMLIB_EXPORT GlobalIndexType const nop
std::size_t getNodeIndex(Element const &element, unsigned const idx)
Definition Element.cpp:219

References ProcessLib::LIE::SmallDeformation::LocalDataInitializer< LocalAssemblerInterface, LocalAssemblerDataMatrix, LocalAssemblerDataMatrixNearFracture, LocalAssemblerDataFracture, GlobalDim, ConstructorArgs >::_builder, ProcessLib::LIE::SmallDeformation::LocalDataInitializer< LocalAssemblerInterface, LocalAssemblerDataMatrix, LocalAssemblerDataMatrixNearFracture, LocalAssemblerDataFracture, GlobalDim, ConstructorArgs >::_dof_table, MeshLib::Element::getDimension(), NumLib::LocalToGlobalIndexMap::getElementVariableIDs(), NumLib::LocalToGlobalIndexMap::getGlobalIndex(), MeshLib::MeshSubset::getMeshID(), NumLib::LocalToGlobalIndexMap::getMeshSubset(), NumLib::LocalToGlobalIndexMap::getNumberOfElementComponents(), NumLib::LocalToGlobalIndexMap::getNumberOfElementDOF(), MeshLib::Element::getNumberOfNodes(), NumLib::LocalToGlobalIndexMap::getNumberOfVariableComponents(), MeshLib::Node, NumLib::MeshComponentMap::nop, and OGS_FATAL.

Member Data Documentation

◆ _builder

template<typename LocalAssemblerInterface , template< typename, int > class LocalAssemblerDataMatrix, template< typename, int > class LocalAssemblerDataMatrixNearFracture, template< typename, int > class LocalAssemblerDataFracture, int GlobalDim, typename... ConstructorArgs>
std::unordered_map<std::type_index, LADataBuilder> ProcessLib::LIE::SmallDeformation::LocalDataInitializer< LocalAssemblerInterface, LocalAssemblerDataMatrix, LocalAssemblerDataMatrixNearFracture, LocalAssemblerDataFracture, GlobalDim, ConstructorArgs >::_builder
private

◆ _dof_table

template<typename LocalAssemblerInterface , template< typename, int > class LocalAssemblerDataMatrix, template< typename, int > class LocalAssemblerDataMatrixNearFracture, template< typename, int > class LocalAssemblerDataFracture, int GlobalDim, typename... ConstructorArgs>
NumLib::LocalToGlobalIndexMap const& ProcessLib::LIE::SmallDeformation::LocalDataInitializer< LocalAssemblerInterface, LocalAssemblerDataMatrix, LocalAssemblerDataMatrixNearFracture, LocalAssemblerDataFracture, GlobalDim, ConstructorArgs >::_dof_table
private

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