Skip to content
Snippets Groups Projects
Commit 2e073285 authored by wenqing's avatar wenqing
Browse files

Merge branch 'fix_warning' into 'master'

A warning fix in NormalTractionBoundaryConditionLocalAssembler

See merge request ogs/ogs!3024
parents 9d568bf1 ad41bc9e
No related branches found
No related tags found
No related merge requests found
...@@ -123,11 +123,27 @@ std::unique_ptr<BoundaryCondition> createBoundaryCondition( ...@@ -123,11 +123,27 @@ std::unique_ptr<BoundaryCondition> createBoundaryCondition(
} }
if (type == "NormalTraction") if (type == "NormalTraction")
{ {
return ProcessLib::NormalTractionBoundaryCondition:: switch (bulk_mesh.getDimension())
createNormalTractionBoundaryCondition( {
config.config, config.boundary_mesh, dof_table, variable_id, case 2:
integration_order, shapefunction_order, return ProcessLib::NormalTractionBoundaryCondition::
bulk_mesh.getDimension(), parameters); createNormalTractionBoundaryCondition<2>(
config.config, config.boundary_mesh, dof_table,
variable_id, integration_order, shapefunction_order,
parameters);
case 3:
return ProcessLib::NormalTractionBoundaryCondition::
createNormalTractionBoundaryCondition<3>(
config.config, config.boundary_mesh, dof_table,
variable_id, integration_order, shapefunction_order,
parameters);
default:
OGS_FATAL(
"NormalTractionBoundaryCondition can not be instantiated "
"for mesh dimensions other than two or three. "
"{}-dimensional mesh was given.",
bulk_mesh.getDimension());
}
} }
if (type == "PhaseFieldIrreversibleDamageOracleBoundaryCondition") if (type == "PhaseFieldIrreversibleDamageOracleBoundaryCondition")
{ {
......
...@@ -22,14 +22,13 @@ namespace ProcessLib ...@@ -22,14 +22,13 @@ namespace ProcessLib
{ {
namespace NormalTractionBoundaryCondition namespace NormalTractionBoundaryCondition
{ {
template <template <typename, typename, unsigned> template <int GlobalDim, template <typename, typename, unsigned>
class LocalAssemblerImplementation> class LocalAssemblerImplementation>
NormalTractionBoundaryCondition<LocalAssemblerImplementation>:: NormalTractionBoundaryCondition<GlobalDim, LocalAssemblerImplementation>::
NormalTractionBoundaryCondition( NormalTractionBoundaryCondition(
unsigned const integration_order, unsigned const shapefunction_order, unsigned const integration_order, unsigned const shapefunction_order,
NumLib::LocalToGlobalIndexMap const& dof_table_bulk, NumLib::LocalToGlobalIndexMap const& dof_table_bulk,
int const variable_id, unsigned const global_dim, int const variable_id, MeshLib::Mesh const& bc_mesh,
MeshLib::Mesh const& bc_mesh,
ParameterLib::Parameter<double> const& pressure) ParameterLib::Parameter<double> const& pressure)
: _bc_mesh(bc_mesh), : _bc_mesh(bc_mesh),
_integration_order(integration_order), _integration_order(integration_order),
...@@ -53,15 +52,15 @@ NormalTractionBoundaryCondition<LocalAssemblerImplementation>:: ...@@ -53,15 +52,15 @@ NormalTractionBoundaryCondition<LocalAssemblerImplementation>::
_dof_table_boundary.reset(dof_table_bulk.deriveBoundaryConstrainedMap( _dof_table_boundary.reset(dof_table_bulk.deriveBoundaryConstrainedMap(
variable_id, component_ids, std::move(bc_mesh_subset))); variable_id, component_ids, std::move(bc_mesh_subset)));
createLocalAssemblers<LocalAssemblerImplementation>( createLocalAssemblers<GlobalDim, LocalAssemblerImplementation>(
global_dim, _bc_mesh.getElements(), *_dof_table_boundary, *_dof_table_boundary, shapefunction_order, _bc_mesh.getElements(),
shapefunction_order, _local_assemblers, _bc_mesh.isAxiallySymmetric(), _local_assemblers, _bc_mesh.isAxiallySymmetric(), _integration_order,
_integration_order, _pressure); _pressure);
} }
template <template <typename, typename, unsigned> template <int GlobalDim, template <typename, typename, unsigned>
class LocalAssemblerImplementation> class LocalAssemblerImplementation>
void NormalTractionBoundaryCondition<LocalAssemblerImplementation>:: void NormalTractionBoundaryCondition<GlobalDim, LocalAssemblerImplementation>::
applyNaturalBC(const double t, std::vector<GlobalVector*> const& x, applyNaturalBC(const double t, std::vector<GlobalVector*> const& x,
int const /*process_id*/, GlobalMatrix& K, GlobalVector& b, int const /*process_id*/, GlobalMatrix& K, GlobalVector& b,
GlobalMatrix* Jac) GlobalMatrix* Jac)
...@@ -71,13 +70,13 @@ void NormalTractionBoundaryCondition<LocalAssemblerImplementation>:: ...@@ -71,13 +70,13 @@ void NormalTractionBoundaryCondition<LocalAssemblerImplementation>::
_local_assemblers, *_dof_table_boundary, t, x, K, b, Jac); _local_assemblers, *_dof_table_boundary, t, x, K, b, Jac);
} }
template <int GlobalDim>
std::unique_ptr<NormalTractionBoundaryCondition< std::unique_ptr<NormalTractionBoundaryCondition<
NormalTractionBoundaryConditionLocalAssembler>> GlobalDim, NormalTractionBoundaryConditionLocalAssembler>>
createNormalTractionBoundaryCondition( createNormalTractionBoundaryCondition(
BaseLib::ConfigTree const& config, MeshLib::Mesh const& bc_mesh, BaseLib::ConfigTree const& config, MeshLib::Mesh const& bc_mesh,
NumLib::LocalToGlobalIndexMap const& dof_table, int const variable_id, NumLib::LocalToGlobalIndexMap const& dof_table, int const variable_id,
unsigned const integration_order, unsigned const shapefunction_order, unsigned const integration_order, unsigned const shapefunction_order,
unsigned const global_dim,
std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters) std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters)
{ {
DBUG("Constructing NormalTractionBoundaryCondition from config."); DBUG("Constructing NormalTractionBoundaryCondition from config.");
...@@ -92,9 +91,9 @@ createNormalTractionBoundaryCondition( ...@@ -92,9 +91,9 @@ createNormalTractionBoundaryCondition(
auto const& pressure = ParameterLib::findParameter<double>( auto const& pressure = ParameterLib::findParameter<double>(
parameter_name, parameters, 1, &bc_mesh); parameter_name, parameters, 1, &bc_mesh);
return std::make_unique<NormalTractionBoundaryCondition< return std::make_unique<NormalTractionBoundaryCondition<
NormalTractionBoundaryConditionLocalAssembler>>( GlobalDim, NormalTractionBoundaryConditionLocalAssembler>>(
integration_order, shapefunction_order, dof_table, variable_id, integration_order, shapefunction_order, dof_table, variable_id, bc_mesh,
global_dim, bc_mesh, pressure); pressure);
} }
} // namespace NormalTractionBoundaryCondition } // namespace NormalTractionBoundaryCondition
......
...@@ -27,8 +27,8 @@ class NormalTractionBoundaryConditionLocalAssemblerInterface; ...@@ -27,8 +27,8 @@ class NormalTractionBoundaryConditionLocalAssemblerInterface;
/// \bar{t} := \sigma \mathbf{n} = p \mathbf{n}, /// \bar{t} := \sigma \mathbf{n} = p \mathbf{n},
/// \f] /// \f]
/// where \f$p\f$ is the value on the boundary given by the parameter tag. /// where \f$p\f$ is the value on the boundary given by the parameter tag.
template <template <typename, typename, unsigned> template <int GlobalDim, template <typename, typename, unsigned>
class LocalAssemblerImplementation> class LocalAssemblerImplementation>
class NormalTractionBoundaryCondition final : public BoundaryCondition class NormalTractionBoundaryCondition final : public BoundaryCondition
{ {
public: public:
...@@ -38,8 +38,7 @@ public: ...@@ -38,8 +38,7 @@ public:
NormalTractionBoundaryCondition( NormalTractionBoundaryCondition(
unsigned const integration_order, unsigned const shapefunction_order, unsigned const integration_order, unsigned const shapefunction_order,
NumLib::LocalToGlobalIndexMap const& dof_table_bulk, NumLib::LocalToGlobalIndexMap const& dof_table_bulk,
int const variable_id, unsigned const global_dim, int const variable_id, MeshLib::Mesh const& bc_mesh,
MeshLib::Mesh const& bc_mesh,
ParameterLib::Parameter<double> const& pressure); ParameterLib::Parameter<double> const& pressure);
/// Calls local assemblers which calculate their contributions to the global /// Calls local assemblers which calculate their contributions to the global
...@@ -72,13 +71,13 @@ private: ...@@ -72,13 +71,13 @@ private:
ParameterLib::Parameter<double> const& _pressure; ParameterLib::Parameter<double> const& _pressure;
}; };
template <int GlobalDim>
std::unique_ptr<NormalTractionBoundaryCondition< std::unique_ptr<NormalTractionBoundaryCondition<
NormalTractionBoundaryConditionLocalAssembler>> GlobalDim, NormalTractionBoundaryConditionLocalAssembler>>
createNormalTractionBoundaryCondition( createNormalTractionBoundaryCondition(
BaseLib::ConfigTree const& config, MeshLib::Mesh const& bc_mesh, BaseLib::ConfigTree const& config, MeshLib::Mesh const& bc_mesh,
NumLib::LocalToGlobalIndexMap const& dof_table, int const variable_id, NumLib::LocalToGlobalIndexMap const& dof_table, int const variable_id,
unsigned const integration_order, unsigned const shapefunction_order, unsigned const integration_order, unsigned const shapefunction_order,
unsigned const global_dim,
std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const&
parameters); parameters);
......
...@@ -21,8 +21,6 @@ ...@@ -21,8 +21,6 @@
namespace ProcessLib namespace ProcessLib
{ {
namespace detail
{
template <unsigned GlobalDim, template <typename, typename, unsigned> template <unsigned GlobalDim, template <typename, typename, unsigned>
class LocalAssemblerImplementation, class LocalAssemblerImplementation,
typename LocalAssemblerInterface, typename... ExtraCtorArgs> typename LocalAssemblerInterface, typename... ExtraCtorArgs>
...@@ -33,6 +31,9 @@ void createLocalAssemblers( ...@@ -33,6 +31,9 @@ void createLocalAssemblers(
std::vector<std::unique_ptr<LocalAssemblerInterface>>& local_assemblers, std::vector<std::unique_ptr<LocalAssemblerInterface>>& local_assemblers,
ExtraCtorArgs&&... extra_ctor_args) ExtraCtorArgs&&... extra_ctor_args)
{ {
static_assert(
GlobalDim == 1 || GlobalDim == 2 || GlobalDim == 3,
"Meshes with dimension greater than three are not supported.");
// Shape matrices initializer // Shape matrices initializer
using LocalDataInitializer = using LocalDataInitializer =
LocalDataInitializer<LocalAssemblerInterface, LocalDataInitializer<LocalAssemblerInterface,
...@@ -51,8 +52,6 @@ void createLocalAssemblers( ...@@ -51,8 +52,6 @@ void createLocalAssemblers(
std::forward<ExtraCtorArgs>(extra_ctor_args)...); std::forward<ExtraCtorArgs>(extra_ctor_args)...);
} }
} // namespace detail
/*! Creates local assemblers for each element of the given \c mesh. /*! Creates local assemblers for each element of the given \c mesh.
* *
* \tparam LocalAssemblerImplementation the individual local assembler type * \tparam LocalAssemblerImplementation the individual local assembler type
...@@ -80,17 +79,17 @@ void createLocalAssemblers( ...@@ -80,17 +79,17 @@ void createLocalAssemblers(
switch (dimension) switch (dimension)
{ {
case 1: case 1:
detail::createLocalAssemblers<1, LocalAssemblerImplementation>( createLocalAssemblers<1, LocalAssemblerImplementation>(
dof_table, shapefunction_order, mesh_elements, local_assemblers, dof_table, shapefunction_order, mesh_elements, local_assemblers,
std::forward<ExtraCtorArgs>(extra_ctor_args)...); std::forward<ExtraCtorArgs>(extra_ctor_args)...);
break; break;
case 2: case 2:
detail::createLocalAssemblers<2, LocalAssemblerImplementation>( createLocalAssemblers<2, LocalAssemblerImplementation>(
dof_table, shapefunction_order, mesh_elements, local_assemblers, dof_table, shapefunction_order, mesh_elements, local_assemblers,
std::forward<ExtraCtorArgs>(extra_ctor_args)...); std::forward<ExtraCtorArgs>(extra_ctor_args)...);
break; break;
case 3: case 3:
detail::createLocalAssemblers<3, LocalAssemblerImplementation>( createLocalAssemblers<3, LocalAssemblerImplementation>(
dof_table, shapefunction_order, mesh_elements, local_assemblers, dof_table, shapefunction_order, mesh_elements, local_assemblers,
std::forward<ExtraCtorArgs>(extra_ctor_args)...); std::forward<ExtraCtorArgs>(extra_ctor_args)...);
break; break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment