From aa6dcc8283b1013bc315306f751c2d80b477f212 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov <dmitri.naumov@ufz.de> Date: Thu, 1 Jul 2021 16:45:58 +0200 Subject: [PATCH] [PL] Unify CreateLocalAsm and LocalDataInit style. --- .../HydroMechanics/CreateLocalAssemblers.h | 9 ++--- .../HydroMechanics/LocalDataInitializer.h | 31 ++++++++------- .../RichardsMechanics/CreateLocalAssemblers.h | 4 +- .../RichardsMechanics/LocalDataInitializer.h | 30 +++++++------- .../SmallDeformation/CreateLocalAssemblers.h | 8 +--- .../SmallDeformation/LocalDataInitializer.h | 7 ++-- ProcessLib/StokesFlow/CreateLocalAssemblers.h | 5 +-- ProcessLib/StokesFlow/LocalDataInitializer.h | 10 ++--- ProcessLib/TH2M/CreateLocalAssemblers.h | 1 + ProcessLib/TH2M/LocalDataInitializer.h | 5 ++- .../CreateLocalAssemblers.h | 3 +- .../LocalDataInitializer.h | 39 ++++++++++--------- .../LocalDataInitializer.h | 30 +++++++------- ProcessLib/Utils/CreateLocalAssemblers.h | 5 +-- ProcessLib/Utils/LocalDataInitializer.h | 16 ++++---- 15 files changed, 97 insertions(+), 106 deletions(-) diff --git a/ProcessLib/HydroMechanics/CreateLocalAssemblers.h b/ProcessLib/HydroMechanics/CreateLocalAssemblers.h index f4c10031e61..d71df6cb31c 100644 --- a/ProcessLib/HydroMechanics/CreateLocalAssemblers.h +++ b/ProcessLib/HydroMechanics/CreateLocalAssemblers.h @@ -12,10 +12,8 @@ #include <vector> #include "BaseLib/Logging.h" - -#include "NumLib/DOF/LocalToGlobalIndexMap.h" - #include "LocalDataInitializer.h" +#include "NumLib/DOF/LocalToGlobalIndexMap.h" namespace ProcessLib { @@ -65,8 +63,9 @@ void createLocalAssemblers( * The first two template parameters cannot be deduced from the arguments. * Therefore they always have to be provided manually. */ -template <int GlobalDim, template <typename, typename, typename, int> - class LocalAssemblerImplementation, +template <int GlobalDim, + template <typename, typename, typename, int> + class LocalAssemblerImplementation, typename LocalAssemblerInterface, typename... ExtraCtorArgs> void createLocalAssemblers( const unsigned /*dimension*/, diff --git a/ProcessLib/HydroMechanics/LocalDataInitializer.h b/ProcessLib/HydroMechanics/LocalDataInitializer.h index cfcaf5b0653..47f7da36a7b 100644 --- a/ProcessLib/HydroMechanics/LocalDataInitializer.h +++ b/ProcessLib/HydroMechanics/LocalDataInitializer.h @@ -109,16 +109,16 @@ namespace ProcessLib::HydroMechanics /// 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::Line a local assembler data with template argument -/// NumLib::ShapeLine2 is created. +/// For example for MeshLib::Quad a local assembler data with template argument +/// NumLib::ShapeQuad4 is created. /// /// \attention This is modified version of the ProcessLib::LocalDataInitializer /// class which does not include line or point elements. For the shape functions /// of order 2 (used for displacement) a shape function of order 1 will be used -/// for the pressure. +/// for the scalar variables. template <typename LocalAssemblerInterface, template <typename, typename, typename, int> class LocalAssemblerData, - unsigned GlobalDim, typename... ConstructorArgs> + int GlobalDim, typename... ConstructorArgs> class LocalDataInitializer final { public: @@ -134,7 +134,7 @@ public: if (shapefunction_order == 1) { - // /// Quads and Hexahedra /////////////////////////////////// + // /// Quads and Hexahedra /////////////////////////////////// #if (OGS_ENABLED_ELEMENTS & ENABLED_ELEMENT_TYPE_QUAD) != 0 && \ OGS_MAX_ELEMENT_DIM >= 2 && OGS_MAX_ELEMENT_ORDER >= 1 @@ -162,7 +162,7 @@ public: makeLocalAssemblerBuilder<NumLib::ShapeHex8>(); #endif - // /// Simplices //////////////////////////////////////////////// + // /// Simplices //////////////////////////////////////////////// #if (OGS_ENABLED_ELEMENTS & ENABLED_ELEMENT_TYPE_TRI) != 0 && \ OGS_MAX_ELEMENT_DIM >= 2 && OGS_MAX_ELEMENT_ORDER >= 1 @@ -188,7 +188,7 @@ public: makeLocalAssemblerBuilder<NumLib::ShapeTet4>(); #endif - // /// Prisms //////////////////////////////////////////////////// + // /// Prisms //////////////////////////////////////////////////// #if (OGS_ENABLED_ELEMENTS & ENABLED_ELEMENT_TYPE_PRISM) != 0 && \ OGS_MAX_ELEMENT_DIM >= 3 && OGS_MAX_ELEMENT_ORDER >= 1 @@ -202,7 +202,7 @@ public: makeLocalAssemblerBuilder<NumLib::ShapePrism6>(); #endif - // /// Pyramids ////////////////////////////////////////////////// + // /// Pyramids ////////////////////////////////////////////////// #if (OGS_ENABLED_ELEMENTS & ENABLED_ELEMENT_TYPE_PYRAMID) != 0 && \ OGS_MAX_ELEMENT_DIM >= 3 && OGS_MAX_ELEMENT_ORDER >= 1 @@ -218,7 +218,7 @@ public: } else if (shapefunction_order == 2) { - // /// Quads and Hexahedra /////////////////////////////////// + // /// Quads and Hexahedra /////////////////////////////////// #if (OGS_ENABLED_ELEMENTS & ENABLED_ELEMENT_TYPE_QUAD) != 0 && \ OGS_MAX_ELEMENT_DIM >= 2 && OGS_MAX_ELEMENT_ORDER >= 2 @@ -234,7 +234,7 @@ public: makeLocalAssemblerBuilder<NumLib::ShapeHex20>(); #endif - // /// Simplices //////////////////////////////////////////////// + // /// Simplices //////////////////////////////////////////////// #if (OGS_ENABLED_ELEMENTS & ENABLED_ELEMENT_TYPE_TRI) != 0 && \ OGS_MAX_ELEMENT_DIM >= 2 && OGS_MAX_ELEMENT_ORDER >= 2 @@ -248,7 +248,7 @@ public: makeLocalAssemblerBuilder<NumLib::ShapeTet10>(); #endif - // /// Prisms //////////////////////////////////////////////////// + // /// Prisms //////////////////////////////////////////////////// #if (OGS_ENABLED_ELEMENTS & ENABLED_ELEMENT_TYPE_PRISM) != 0 && \ OGS_MAX_ELEMENT_DIM >= 3 && OGS_MAX_ELEMENT_ORDER >= 2 @@ -256,7 +256,7 @@ public: makeLocalAssemblerBuilder<NumLib::ShapePrism15>(); #endif - // /// Pyramids ////////////////////////////////////////////////// + // /// Pyramids ////////////////////////////////////////////////// #if (OGS_ENABLED_ELEMENTS & ENABLED_ELEMENT_TYPE_PYRAMID) != 0 && \ OGS_MAX_ELEMENT_DIM >= 3 && OGS_MAX_ELEMENT_ORDER >= 2 @@ -304,9 +304,10 @@ private: template <typename ShapeFunctionDisplacement, typename ShapeFunctionPressure> - using LAData = LocalAssemblerData< - ShapeFunctionDisplacement, ShapeFunctionPressure, - IntegrationMethod<ShapeFunctionDisplacement>, GlobalDim>; + using LAData = + LocalAssemblerData<ShapeFunctionDisplacement, ShapeFunctionPressure, + IntegrationMethod<ShapeFunctionDisplacement>, + GlobalDim>; /// A helper forwarding to the correct version of makeLocalAssemblerBuilder /// depending whether the global dimension is less than the shape function's diff --git a/ProcessLib/RichardsMechanics/CreateLocalAssemblers.h b/ProcessLib/RichardsMechanics/CreateLocalAssemblers.h index 9f488587606..185a7d21ad3 100644 --- a/ProcessLib/RichardsMechanics/CreateLocalAssemblers.h +++ b/ProcessLib/RichardsMechanics/CreateLocalAssemblers.h @@ -12,10 +12,8 @@ #include <vector> #include "BaseLib/Logging.h" - -#include "NumLib/DOF/LocalToGlobalIndexMap.h" - #include "LocalDataInitializer.h" +#include "NumLib/DOF/LocalToGlobalIndexMap.h" namespace ProcessLib { diff --git a/ProcessLib/RichardsMechanics/LocalDataInitializer.h b/ProcessLib/RichardsMechanics/LocalDataInitializer.h index 2f70f2cad11..8e28131f69b 100644 --- a/ProcessLib/RichardsMechanics/LocalDataInitializer.h +++ b/ProcessLib/RichardsMechanics/LocalDataInitializer.h @@ -109,15 +109,16 @@ namespace ProcessLib::RichardsMechanics /// 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::Line a local assembler data with template argument -/// NumLib::ShapeLine2 is created. +/// For example for MeshLib::Quad a local assembler data with template argument +/// NumLib::ShapeQuad4 is created. +/// /// \attention This is modified version of the ProcessLib::LocalDataInitializer /// class which does not include line or point elements. For the shape functions /// of order 2 (used for displacement) a shape function of order 1 will be used -/// for the pressure. +/// for the scalar variables. template <typename LocalAssemblerInterface, template <typename, typename, typename, int> class LocalAssemblerData, - unsigned GlobalDim, typename... ConstructorArgs> + int GlobalDim, typename... ConstructorArgs> class LocalDataInitializer final { public: @@ -133,7 +134,7 @@ public: if (shapefunction_order == 1) { -// /// Quads and Hexahedra /////////////////////////////////// + // /// Quads and Hexahedra /////////////////////////////////// #if (OGS_ENABLED_ELEMENTS & ENABLED_ELEMENT_TYPE_QUAD) != 0 && \ OGS_MAX_ELEMENT_DIM >= 2 && OGS_MAX_ELEMENT_ORDER >= 1 @@ -161,7 +162,7 @@ public: makeLocalAssemblerBuilder<NumLib::ShapeHex8>(); #endif -// /// Simplices //////////////////////////////////////////////// + // /// Simplices //////////////////////////////////////////////// #if (OGS_ENABLED_ELEMENTS & ENABLED_ELEMENT_TYPE_TRI) != 0 && \ OGS_MAX_ELEMENT_DIM >= 2 && OGS_MAX_ELEMENT_ORDER >= 1 @@ -187,7 +188,7 @@ public: makeLocalAssemblerBuilder<NumLib::ShapeTet4>(); #endif -// /// Prisms //////////////////////////////////////////////////// + // /// Prisms //////////////////////////////////////////////////// #if (OGS_ENABLED_ELEMENTS & ENABLED_ELEMENT_TYPE_PRISM) != 0 && \ OGS_MAX_ELEMENT_DIM >= 3 && OGS_MAX_ELEMENT_ORDER >= 1 @@ -201,7 +202,7 @@ public: makeLocalAssemblerBuilder<NumLib::ShapePrism6>(); #endif -// /// Pyramids ////////////////////////////////////////////////// + // /// Pyramids ////////////////////////////////////////////////// #if (OGS_ENABLED_ELEMENTS & ENABLED_ELEMENT_TYPE_PYRAMID) != 0 && \ OGS_MAX_ELEMENT_DIM >= 3 && OGS_MAX_ELEMENT_ORDER >= 1 @@ -217,7 +218,7 @@ public: } else if (shapefunction_order == 2) { -// /// Quads and Hexahedra /////////////////////////////////// + // /// Quads and Hexahedra /////////////////////////////////// #if (OGS_ENABLED_ELEMENTS & ENABLED_ELEMENT_TYPE_QUAD) != 0 && \ OGS_MAX_ELEMENT_DIM >= 2 && OGS_MAX_ELEMENT_ORDER >= 2 @@ -233,7 +234,7 @@ public: makeLocalAssemblerBuilder<NumLib::ShapeHex20>(); #endif -// /// Simplices //////////////////////////////////////////////// + // /// Simplices //////////////////////////////////////////////// #if (OGS_ENABLED_ELEMENTS & ENABLED_ELEMENT_TYPE_TRI) != 0 && \ OGS_MAX_ELEMENT_DIM >= 2 && OGS_MAX_ELEMENT_ORDER >= 2 @@ -247,7 +248,7 @@ public: makeLocalAssemblerBuilder<NumLib::ShapeTet10>(); #endif -// /// Prisms //////////////////////////////////////////////////// + // /// Prisms //////////////////////////////////////////////////// #if (OGS_ENABLED_ELEMENTS & ENABLED_ELEMENT_TYPE_PRISM) != 0 && \ OGS_MAX_ELEMENT_DIM >= 3 && OGS_MAX_ELEMENT_ORDER >= 2 @@ -255,7 +256,7 @@ public: makeLocalAssemblerBuilder<NumLib::ShapePrism15>(); #endif -// /// Pyramids ////////////////////////////////////////////////// + // /// Pyramids ////////////////////////////////////////////////// #if (OGS_ENABLED_ELEMENTS & ENABLED_ELEMENT_TYPE_PYRAMID) != 0 && \ OGS_MAX_ELEMENT_DIM >= 3 && OGS_MAX_ELEMENT_ORDER >= 2 @@ -271,8 +272,8 @@ public: /// The index \c id is not necessarily the mesh item's id. Especially when /// having multiple meshes it will differ from the latter. LADataIntfPtr operator()(std::size_t const id, - MeshLib::Element const& mesh_item, - ConstructorArgs&&... args) const + MeshLib::Element const& mesh_item, + ConstructorArgs&&... args) const { auto const type_idx = std::type_index(typeid(mesh_item)); auto const it = _builder.find(type_idx); @@ -319,7 +320,6 @@ private: bool, (GlobalDim >= ShapeFunction::DIM)>*>(nullptr)); } - /// Mapping of element types to local assembler constructors. std::unordered_map<std::type_index, LADataBuilder> _builder; diff --git a/ProcessLib/SmallDeformation/CreateLocalAssemblers.h b/ProcessLib/SmallDeformation/CreateLocalAssemblers.h index dda5435c0a7..42847cd3642 100644 --- a/ProcessLib/SmallDeformation/CreateLocalAssemblers.h +++ b/ProcessLib/SmallDeformation/CreateLocalAssemblers.h @@ -12,10 +12,8 @@ #include <vector> #include "BaseLib/Logging.h" - -#include "NumLib/DOF/LocalToGlobalIndexMap.h" - #include "LocalDataInitializer.h" +#include "NumLib/DOF/LocalToGlobalIndexMap.h" namespace ProcessLib { @@ -46,9 +44,7 @@ void createLocalAssemblers( DBUG("Calling local assembler builder for all mesh elements."); GlobalExecutor::transformDereferenced( - initializer, - mesh_elements, - local_assemblers, + initializer, mesh_elements, local_assemblers, std::forward<ExtraCtorArgs>(extra_ctor_args)...); } diff --git a/ProcessLib/SmallDeformation/LocalDataInitializer.h b/ProcessLib/SmallDeformation/LocalDataInitializer.h index 5091ce175d0..591c27d5b18 100644 --- a/ProcessLib/SmallDeformation/LocalDataInitializer.h +++ b/ProcessLib/SmallDeformation/LocalDataInitializer.h @@ -12,9 +12,9 @@ #include <functional> #include <memory> +#include <type_traits> #include <typeindex> #include <typeinfo> -#include <type_traits> #include <unordered_map> #include "MeshLib/Elements/Elements.h" @@ -212,8 +212,8 @@ public: /// The index \c id is not necessarily the mesh item's id. Especially when /// having multiple meshes it will differ from the latter. LADataIntfPtr operator()(std::size_t const id, - MeshLib::Element const& mesh_item, - ConstructorArgs&&... args) const + MeshLib::Element const& mesh_item, + ConstructorArgs&&... args) const { auto const type_idx = std::type_index(typeid(mesh_item)); auto const it = _builder.find(type_idx); @@ -257,7 +257,6 @@ private: bool, (GlobalDim >= ShapeFunction::DIM)>*>(nullptr)); } - /// Mapping of element types to local assembler constructors. std::unordered_map<std::type_index, LADataBuilder> _builder; diff --git a/ProcessLib/StokesFlow/CreateLocalAssemblers.h b/ProcessLib/StokesFlow/CreateLocalAssemblers.h index 9d3215354d3..06d131e87ef 100644 --- a/ProcessLib/StokesFlow/CreateLocalAssemblers.h +++ b/ProcessLib/StokesFlow/CreateLocalAssemblers.h @@ -11,9 +11,8 @@ #include <vector> -#include "LocalDataInitializer.h" - #include "BaseLib/Logging.h" +#include "LocalDataInitializer.h" #include "NumLib/DOF/LocalToGlobalIndexMap.h" namespace ProcessLib @@ -82,6 +81,6 @@ void createLocalAssemblers( dof_table, shapefunction_order, mesh_elements, local_assemblers, std::forward<ExtraCtorArgs>(extra_ctor_args)...); } - } // namespace StokesFlow + } // namespace ProcessLib diff --git a/ProcessLib/StokesFlow/LocalDataInitializer.h b/ProcessLib/StokesFlow/LocalDataInitializer.h index caaaee96fce..48e1d0f5484 100644 --- a/ProcessLib/StokesFlow/LocalDataInitializer.h +++ b/ProcessLib/StokesFlow/LocalDataInitializer.h @@ -109,16 +109,16 @@ namespace ProcessLib::StokesFlow /// 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::Line a local assembler data with template argument -/// NumLib::ShapeLine2 is created. +/// For example for MeshLib::Quad a local assembler data with template argument +/// NumLib::ShapeQuad4 is created. /// /// \attention This is modified version of the ProcessLib::LocalDataInitializer /// class which does not include line or point elements. For the shape functions /// of order 2 (used for fluid velocity in StokesFlow) a shape function of order -/// 1 will be used for the pressure. +/// 1 will be used for the scalar variables. template <typename LocalAssemblerInterface, template <typename, typename, typename, int> class LocalAssemblerData, - unsigned GlobalDim, typename... ConstructorArgs> + int GlobalDim, typename... ConstructorArgs> class LocalDataInitializer final { public: @@ -253,7 +253,7 @@ private: template <typename ShapeFunction> static LADataBuilder makeLocalAssemblerBuilder(std::true_type* /*unused*/) { - assert(ShapeFunction::ORDER == 2); + static_assert(ShapeFunction::ORDER == 2); using LowerOrderShapeFunction = typename NumLib::LowerDim<ShapeFunction>::type; diff --git a/ProcessLib/TH2M/CreateLocalAssemblers.h b/ProcessLib/TH2M/CreateLocalAssemblers.h index bc4d500bb60..e9a0b86e159 100644 --- a/ProcessLib/TH2M/CreateLocalAssemblers.h +++ b/ProcessLib/TH2M/CreateLocalAssemblers.h @@ -11,6 +11,7 @@ #include <vector> +#include "BaseLib/Logging.h" #include "LocalDataInitializer.h" #include "NumLib/DOF/LocalToGlobalIndexMap.h" diff --git a/ProcessLib/TH2M/LocalDataInitializer.h b/ProcessLib/TH2M/LocalDataInitializer.h index cfce57845dc..816a3184e7d 100644 --- a/ProcessLib/TH2M/LocalDataInitializer.h +++ b/ProcessLib/TH2M/LocalDataInitializer.h @@ -113,8 +113,9 @@ namespace ProcessLib::TH2M /// NumLib::ShapeQuad4 is created. /// /// \attention This is modified version of the ProcessLib::LocalDataInitializer -/// class which does not include line elements, allows only shapefunction of -/// order 2. +/// class which does not include line or point elements. For the shape functions +/// of order 2 (used for displacement) a shape function of order 1 will be used +/// for the scalar variables. template <typename LocalAssemblerInterface, template <typename, typename, typename, int> class LocalAssemblerData, int GlobalDim, typename... ConstructorArgs> diff --git a/ProcessLib/ThermoHydroMechanics/CreateLocalAssemblers.h b/ProcessLib/ThermoHydroMechanics/CreateLocalAssemblers.h index a6d1de75061..b17f0601628 100644 --- a/ProcessLib/ThermoHydroMechanics/CreateLocalAssemblers.h +++ b/ProcessLib/ThermoHydroMechanics/CreateLocalAssemblers.h @@ -9,10 +9,9 @@ #pragma once -#include <spdlog/spdlog.h> - #include <vector> +#include "BaseLib/Logging.h" #include "LocalDataInitializer.h" #include "NumLib/DOF/LocalToGlobalIndexMap.h" diff --git a/ProcessLib/ThermoHydroMechanics/LocalDataInitializer.h b/ProcessLib/ThermoHydroMechanics/LocalDataInitializer.h index 7c3d72105f7..e3c9dad66a4 100644 --- a/ProcessLib/ThermoHydroMechanics/LocalDataInitializer.h +++ b/ProcessLib/ThermoHydroMechanics/LocalDataInitializer.h @@ -113,8 +113,9 @@ namespace ProcessLib::ThermoHydroMechanics /// NumLib::ShapeQuad4 is created. /// /// \attention This is modified version of the ProcessLib::LocalDataInitializer -/// class which does not include line elements, allows only shapefunction of -/// order 2. +/// class which does not include line or point elements. For the shape functions +/// of order 2 (used for displacement) a shape function of order 1 will be used +/// for the scalar variables. template <typename LocalAssemblerInterface, template <typename, typename, typename, int> class LocalAssemblerData, int GlobalDim, typename... ConstructorArgs> @@ -221,46 +222,46 @@ public: #if (OGS_ENABLED_ELEMENTS & ENABLED_ELEMENT_TYPE_QUAD) != 0 && \ OGS_MAX_ELEMENT_DIM >= 2 && OGS_MAX_ELEMENT_ORDER >= 2 - _builder[std::type_index(typeid(MeshLib::Quad8))] = - makeLocalAssemblerBuilder<NumLib::ShapeQuad8>(); - _builder[std::type_index(typeid(MeshLib::Quad9))] = - makeLocalAssemblerBuilder<NumLib::ShapeQuad9>(); + _builder[std::type_index(typeid(MeshLib::Quad8))] = + makeLocalAssemblerBuilder<NumLib::ShapeQuad8>(); + _builder[std::type_index(typeid(MeshLib::Quad9))] = + makeLocalAssemblerBuilder<NumLib::ShapeQuad9>(); #endif #if (OGS_ENABLED_ELEMENTS & ENABLED_ELEMENT_TYPE_CUBOID) != 0 && \ OGS_MAX_ELEMENT_DIM >= 3 && OGS_MAX_ELEMENT_ORDER >= 2 - _builder[std::type_index(typeid(MeshLib::Hex20))] = - makeLocalAssemblerBuilder<NumLib::ShapeHex20>(); + _builder[std::type_index(typeid(MeshLib::Hex20))] = + makeLocalAssemblerBuilder<NumLib::ShapeHex20>(); #endif - // /// Simplices //////////////////////////////////////////////// + // /// Simplices //////////////////////////////////////////////// #if (OGS_ENABLED_ELEMENTS & ENABLED_ELEMENT_TYPE_TRI) != 0 && \ OGS_MAX_ELEMENT_DIM >= 2 && OGS_MAX_ELEMENT_ORDER >= 2 - _builder[std::type_index(typeid(MeshLib::Tri6))] = - makeLocalAssemblerBuilder<NumLib::ShapeTri6>(); + _builder[std::type_index(typeid(MeshLib::Tri6))] = + makeLocalAssemblerBuilder<NumLib::ShapeTri6>(); #endif #if (OGS_ENABLED_ELEMENTS & ENABLED_ELEMENT_TYPE_SIMPLEX) != 0 && \ OGS_MAX_ELEMENT_DIM >= 3 && OGS_MAX_ELEMENT_ORDER >= 2 - _builder[std::type_index(typeid(MeshLib::Tet10))] = - makeLocalAssemblerBuilder<NumLib::ShapeTet10>(); + _builder[std::type_index(typeid(MeshLib::Tet10))] = + makeLocalAssemblerBuilder<NumLib::ShapeTet10>(); #endif - // /// Prisms //////////////////////////////////////////////////// + // /// Prisms //////////////////////////////////////////////////// #if (OGS_ENABLED_ELEMENTS & ENABLED_ELEMENT_TYPE_PRISM) != 0 && \ OGS_MAX_ELEMENT_DIM >= 3 && OGS_MAX_ELEMENT_ORDER >= 2 - _builder[std::type_index(typeid(MeshLib::Prism15))] = - makeLocalAssemblerBuilder<NumLib::ShapePrism15>(); + _builder[std::type_index(typeid(MeshLib::Prism15))] = + makeLocalAssemblerBuilder<NumLib::ShapePrism15>(); #endif - // /// Pyramids ////////////////////////////////////////////////// + // /// Pyramids ////////////////////////////////////////////////// #if (OGS_ENABLED_ELEMENTS & ENABLED_ELEMENT_TYPE_PYRAMID) != 0 && \ OGS_MAX_ELEMENT_DIM >= 3 && OGS_MAX_ELEMENT_ORDER >= 2 - _builder[std::type_index(typeid(MeshLib::Pyramid13))] = - makeLocalAssemblerBuilder<NumLib::ShapePyra13>(); + _builder[std::type_index(typeid(MeshLib::Pyramid13))] = + makeLocalAssemblerBuilder<NumLib::ShapePyra13>(); #endif } } diff --git a/ProcessLib/ThermoRichardsMechanics/LocalDataInitializer.h b/ProcessLib/ThermoRichardsMechanics/LocalDataInitializer.h index 43a8102822d..33bfc6ba690 100644 --- a/ProcessLib/ThermoRichardsMechanics/LocalDataInitializer.h +++ b/ProcessLib/ThermoRichardsMechanics/LocalDataInitializer.h @@ -109,15 +109,16 @@ namespace ProcessLib::ThermoRichardsMechanics /// 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::Line a local assembler data with template argument -/// NumLib::ShapeLine2 is created. +/// For example for MeshLib::Quad a local assembler data with template argument +/// NumLib::ShapeQuad4 is created. +/// /// \attention This is modified version of the ProcessLib::LocalDataInitializer /// class which does not include line or point elements. For the shape functions /// of order 2 (used for displacement) a shape function of order 1 will be used -/// for the pressure. +/// for the scalar variables. template <typename LocalAssemblerInterface, template <typename, typename, typename, int> class LocalAssemblerData, - unsigned GlobalDim, typename... ConstructorArgs> + int GlobalDim, typename... ConstructorArgs> class LocalDataInitializer final { public: @@ -133,7 +134,7 @@ public: if (shapefunction_order == 1) { -// /// Quads and Hexahedra /////////////////////////////////// + // /// Quads and Hexahedra /////////////////////////////////// #if (OGS_ENABLED_ELEMENTS & ENABLED_ELEMENT_TYPE_QUAD) != 0 && \ OGS_MAX_ELEMENT_DIM >= 2 && OGS_MAX_ELEMENT_ORDER >= 1 @@ -161,7 +162,7 @@ public: makeLocalAssemblerBuilder<NumLib::ShapeHex8>(); #endif -// /// Simplices //////////////////////////////////////////////// + // /// Simplices //////////////////////////////////////////////// #if (OGS_ENABLED_ELEMENTS & ENABLED_ELEMENT_TYPE_TRI) != 0 && \ OGS_MAX_ELEMENT_DIM >= 2 && OGS_MAX_ELEMENT_ORDER >= 1 @@ -187,7 +188,7 @@ public: makeLocalAssemblerBuilder<NumLib::ShapeTet4>(); #endif -// /// Prisms //////////////////////////////////////////////////// + // /// Prisms //////////////////////////////////////////////////// #if (OGS_ENABLED_ELEMENTS & ENABLED_ELEMENT_TYPE_PRISM) != 0 && \ OGS_MAX_ELEMENT_DIM >= 3 && OGS_MAX_ELEMENT_ORDER >= 1 @@ -201,7 +202,7 @@ public: makeLocalAssemblerBuilder<NumLib::ShapePrism6>(); #endif -// /// Pyramids ////////////////////////////////////////////////// + // /// Pyramids ////////////////////////////////////////////////// #if (OGS_ENABLED_ELEMENTS & ENABLED_ELEMENT_TYPE_PYRAMID) != 0 && \ OGS_MAX_ELEMENT_DIM >= 3 && OGS_MAX_ELEMENT_ORDER >= 1 @@ -217,7 +218,7 @@ public: } else if (shapefunction_order == 2) { -// /// Quads and Hexahedra /////////////////////////////////// + // /// Quads and Hexahedra /////////////////////////////////// #if (OGS_ENABLED_ELEMENTS & ENABLED_ELEMENT_TYPE_QUAD) != 0 && \ OGS_MAX_ELEMENT_DIM >= 2 && OGS_MAX_ELEMENT_ORDER >= 2 @@ -233,7 +234,7 @@ public: makeLocalAssemblerBuilder<NumLib::ShapeHex20>(); #endif -// /// Simplices //////////////////////////////////////////////// + // /// Simplices //////////////////////////////////////////////// #if (OGS_ENABLED_ELEMENTS & ENABLED_ELEMENT_TYPE_TRI) != 0 && \ OGS_MAX_ELEMENT_DIM >= 2 && OGS_MAX_ELEMENT_ORDER >= 2 @@ -247,7 +248,7 @@ public: makeLocalAssemblerBuilder<NumLib::ShapeTet10>(); #endif -// /// Prisms //////////////////////////////////////////////////// + // /// Prisms //////////////////////////////////////////////////// #if (OGS_ENABLED_ELEMENTS & ENABLED_ELEMENT_TYPE_PRISM) != 0 && \ OGS_MAX_ELEMENT_DIM >= 3 && OGS_MAX_ELEMENT_ORDER >= 2 @@ -255,7 +256,7 @@ public: makeLocalAssemblerBuilder<NumLib::ShapePrism15>(); #endif -// /// Pyramids ////////////////////////////////////////////////// + // /// Pyramids ////////////////////////////////////////////////// #if (OGS_ENABLED_ELEMENTS & ENABLED_ELEMENT_TYPE_PYRAMID) != 0 && \ OGS_MAX_ELEMENT_DIM >= 3 && OGS_MAX_ELEMENT_ORDER >= 2 @@ -271,8 +272,8 @@ public: /// The index \c id is not necessarily the mesh item's id. Especially when /// having multiple meshes it will differ from the latter. LADataIntfPtr operator()(std::size_t const id, - MeshLib::Element const& mesh_item, - ConstructorArgs&&... args) const + MeshLib::Element const& mesh_item, + ConstructorArgs&&... args) const { auto const type_idx = std::type_index(typeid(mesh_item)); auto const it = _builder.find(type_idx); @@ -319,7 +320,6 @@ private: bool, (GlobalDim >= ShapeFunction::DIM)>*>(nullptr)); } - /// Mapping of element types to local assembler constructors. std::unordered_map<std::type_index, LADataBuilder> _builder; diff --git a/ProcessLib/Utils/CreateLocalAssemblers.h b/ProcessLib/Utils/CreateLocalAssemblers.h index 5b42b2b23f8..0c5d827f77a 100644 --- a/ProcessLib/Utils/CreateLocalAssemblers.h +++ b/ProcessLib/Utils/CreateLocalAssemblers.h @@ -12,11 +12,8 @@ #include <vector> #include "BaseLib/Logging.h" - -#include "NumLib/DOF/LocalToGlobalIndexMap.h" - #include "LocalDataInitializer.h" - +#include "NumLib/DOF/LocalToGlobalIndexMap.h" namespace ProcessLib { diff --git a/ProcessLib/Utils/LocalDataInitializer.h b/ProcessLib/Utils/LocalDataInitializer.h index b604e8a1681..61823f9ff9a 100644 --- a/ProcessLib/Utils/LocalDataInitializer.h +++ b/ProcessLib/Utils/LocalDataInitializer.h @@ -117,8 +117,8 @@ namespace ProcessLib /// 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::Line a local assembler data with template argument -/// NumLib::ShapeLine2 is created. +/// For example for MeshLib::Quad a local assembler data with template argument +/// NumLib::ShapeQuad4 is created. template <typename LocalAssemblerInterface, template <typename, typename, unsigned> class LocalAssemblerData, unsigned GlobalDim, typename... ConstructorArgs> @@ -185,7 +185,7 @@ public: makeLocalAssemblerBuilder<NumLib::ShapeHex8>(); #endif -// /// Simplices //////////////////////////////////////////////// + // /// Simplices //////////////////////////////////////////////// #if (OGS_ENABLED_ELEMENTS & ENABLED_ELEMENT_TYPE_TRI) != 0 && \ OGS_MAX_ELEMENT_DIM >= 2 && OGS_MAX_ELEMENT_ORDER >= 1 @@ -211,7 +211,7 @@ public: makeLocalAssemblerBuilder<NumLib::ShapeTet4>(); #endif -// /// Prisms //////////////////////////////////////////////////// + // /// Prisms //////////////////////////////////////////////////// #if (OGS_ENABLED_ELEMENTS & ENABLED_ELEMENT_TYPE_PRISM) != 0 && \ OGS_MAX_ELEMENT_DIM >= 3 && OGS_MAX_ELEMENT_ORDER >= 1 @@ -225,7 +225,7 @@ public: makeLocalAssemblerBuilder<NumLib::ShapePrism6>(); #endif -// /// Pyramids ////////////////////////////////////////////////// + // /// Pyramids ////////////////////////////////////////////////// #if (OGS_ENABLED_ELEMENTS & ENABLED_ELEMENT_TYPE_PYRAMID) != 0 && \ OGS_MAX_ELEMENT_DIM >= 3 && OGS_MAX_ELEMENT_ORDER >= 1 @@ -270,7 +270,7 @@ public: makeLocalAssemblerBuilder<NumLib::ShapeHex20>(); #endif -// /// Simplices //////////////////////////////////////////////// + // /// Simplices //////////////////////////////////////////////// #if (OGS_ENABLED_ELEMENTS & ENABLED_ELEMENT_TYPE_TRI) != 0 && \ OGS_MAX_ELEMENT_DIM >= 2 && OGS_MAX_ELEMENT_ORDER >= 2 @@ -284,7 +284,7 @@ public: makeLocalAssemblerBuilder<NumLib::ShapeTet10>(); #endif -// /// Prisms //////////////////////////////////////////////////// + // /// Prisms //////////////////////////////////////////////////// #if (OGS_ENABLED_ELEMENTS & ENABLED_ELEMENT_TYPE_PRISM) != 0 && \ OGS_MAX_ELEMENT_DIM >= 3 && OGS_MAX_ELEMENT_ORDER >= 2 @@ -292,7 +292,7 @@ public: makeLocalAssemblerBuilder<NumLib::ShapePrism15>(); #endif -// /// Pyramids ////////////////////////////////////////////////// + // /// Pyramids ////////////////////////////////////////////////// #if (OGS_ENABLED_ELEMENTS & ENABLED_ELEMENT_TYPE_PYRAMID) != 0 && \ OGS_MAX_ELEMENT_DIM >= 3 && OGS_MAX_ELEMENT_ORDER >= 2 -- GitLab