From 65938c6db006854a9b9caa2f0be00dc1f038bc73 Mon Sep 17 00:00:00 2001 From: Wenqing Wang Date: Wed, 3 Apr 2024 16:19:02 +0200 Subject: [PATCH] [ProcessLib] Make consistency of the type of dof_tables argument --- ProcessLib/Assembly/AssembledMatrixCache.h | 21 ++++++------- .../ParallelVectorMatrixAssembler.cpp | 5 ++- .../Assembly/ParallelVectorMatrixAssembler.h | 4 +-- ProcessLib/AssemblyMixin.h | 8 ++--- .../ComponentTransportProcess.cpp | 31 +++++++++---------- ProcessLib/HT/HTProcess.cpp | 18 +++++------ .../HeatConduction/HeatConductionProcess.cpp | 8 ++--- .../HeatTransportBHEProcess.cpp | 8 ++--- .../HydroMechanics/HydroMechanicsProcess.cpp | 14 +++------ .../HydroMechanics/HydroMechanicsProcess.cpp | 8 ++--- .../SmallDeformationProcess.cpp | 8 ++--- .../LargeDeformationProcess.cpp | 8 ++--- ProcessLib/LiquidFlow/LiquidFlowProcess.cpp | 8 ++--- .../PhaseField/LocalAssemblerInterface.h | 8 ++--- ProcessLib/PhaseField/PhaseFieldFEM-impl.h | 21 ++++++------- ProcessLib/PhaseField/PhaseFieldFEM.h | 16 +++++----- ProcessLib/PhaseField/PhaseFieldProcess.cpp | 29 ++++++++--------- .../RichardsComponentTransportProcess.cpp | 8 ++--- .../RichardsFlow/RichardsFlowProcess.cpp | 8 ++--- .../RichardsMechanicsProcess.cpp | 14 +++------ .../SmallDeformationProcess.cpp | 8 ++--- .../SmallDeformationNonlocalProcess.cpp | 8 ++--- .../SteadyStateDiffusion.cpp | 8 ++--- ProcessLib/StokesFlow/StokesFlowProcess.cpp | 5 ++- ProcessLib/TES/TESProcess.cpp | 8 ++--- .../ThermalTwoPhaseFlowWithPPProcess.cpp | 8 ++--- .../ThermoHydroMechanicsProcess.cpp | 16 ++++------ .../ThermoMechanicalPhaseFieldProcess.cpp | 14 ++++----- .../ThermoMechanicsProcess.cpp | 21 ++++++------- .../ThermoRichardsFlowProcess.cpp | 11 +++---- .../TwoPhaseFlowWithPPProcess.cpp | 8 ++--- .../TwoPhaseFlowWithPrhoProcess.cpp | 8 ++--- ProcessLib/VectorMatrixAssembler.cpp | 15 ++++----- ProcessLib/VectorMatrixAssembler.h | 20 +++++------- 34 files changed, 184 insertions(+), 227 deletions(-) diff --git a/ProcessLib/Assembly/AssembledMatrixCache.h b/ProcessLib/Assembly/AssembledMatrixCache.h index 3cfafb2d22c..fdc1912b422 100644 --- a/ProcessLib/Assembly/AssembledMatrixCache.h +++ b/ProcessLib/Assembly/AssembledMatrixCache.h @@ -30,16 +30,14 @@ struct AssembledMatrixCache final bool const use_monolithic_scheme); template - void assemble(const double t, double const dt, - std::vector const& x, - std::vector const& x_prev, - int const process_id, GlobalMatrix& M, GlobalMatrix& K, - GlobalVector& b, - std::vector> const& dof_tables, - VectorMatrixAssembler& global_assembler, - VectorOfLocalAssemblers const& local_assemblers, - std::vector const& active_element_ids); + void assemble( + const double t, double const dt, std::vector const& x, + std::vector const& x_prev, int const process_id, + GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, + std::vector const& dof_tables, + VectorMatrixAssembler& global_assembler, + VectorOfLocalAssemblers const& local_assemblers, + std::vector const& active_element_ids); bool isLinear() const { return is_linear_; } @@ -56,8 +54,7 @@ void AssembledMatrixCache::assemble( const double t, double const dt, std::vector const& x, std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, - std::vector> const& - dof_tables, + std::vector const& dof_tables, VectorMatrixAssembler& global_assembler, VectorOfLocalAssemblers const& local_assemblers, std::vector const& active_element_ids) diff --git a/ProcessLib/Assembly/ParallelVectorMatrixAssembler.cpp b/ProcessLib/Assembly/ParallelVectorMatrixAssembler.cpp index 5724e4d9c2d..18d0fa334ee 100644 --- a/ProcessLib/Assembly/ParallelVectorMatrixAssembler.cpp +++ b/ProcessLib/Assembly/ParallelVectorMatrixAssembler.cpp @@ -118,8 +118,7 @@ void ParallelVectorMatrixAssembler::assembleWithJacobian( BaseLib::PolymorphicRandomAccessContainerView< LocalAssemblerInterface> const& local_assemblers, std::vector const& active_elements, - std::vector> const& - dof_tables, + std::vector const& dof_tables, const double t, double const dt, std::vector const& xs, std::vector const& x_prevs, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) @@ -134,7 +133,7 @@ void ParallelVectorMatrixAssembler::assembleWithJacobian( { OGS_FATAL("More than 1 dof table"); } - auto const& dof_table = dof_tables.front().get(); + auto const& dof_table = *(dof_tables.front()); if (xs.size() != 1) { diff --git a/ProcessLib/Assembly/ParallelVectorMatrixAssembler.h b/ProcessLib/Assembly/ParallelVectorMatrixAssembler.h index 8243714b54c..c00ae80eebc 100644 --- a/ProcessLib/Assembly/ParallelVectorMatrixAssembler.h +++ b/ProcessLib/Assembly/ParallelVectorMatrixAssembler.h @@ -27,9 +27,7 @@ class ParallelVectorMatrixAssembler BaseLib::PolymorphicRandomAccessContainerView< LocalAssemblerInterface> const& local_assemblers, std::vector const& active_elements, - std::vector< - std::reference_wrapper> const& - dof_tables, + std::vector const& dof_tables, const double t, double const dt, std::vector const& xs, std::vector const& x_prevs, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac); diff --git a/ProcessLib/AssemblyMixin.h b/ProcessLib/AssemblyMixin.h index 2c498df1686..58dab3d2488 100644 --- a/ProcessLib/AssemblyMixin.h +++ b/ProcessLib/AssemblyMixin.h @@ -190,8 +190,8 @@ class AssemblyMixin : private AssemblyMixinBase GlobalVector& b, Jac&... jac_or_not_jac) { // TODO why not getDOFTables(x.size()); ? - std::vector> const - dof_tables{*derived()._local_to_global_index_map}; + std::vector const dof_tables{ + derived()._local_to_global_index_map.get()}; auto const& loc_asms = derived().local_assemblers_; @@ -211,7 +211,7 @@ class AssemblyMixin : private AssemblyMixinBase MathLib::LinAlg::axpy(b, 1.0, b_submesh); AssemblyMixinBase::copyResiduumVectorsToSubmesh( - b_submesh, dof_tables.front().get(), sad); + b_submesh, *(dof_tables.front()), sad); } NumLib::GlobalVectorProvider::provider.releaseVector(b_submesh); @@ -229,7 +229,7 @@ class AssemblyMixin : private AssemblyMixinBase } AssemblyMixinBase::copyResiduumVectorsToBulkMesh( - b, dof_tables.front().get(), residuum_vectors_bulk_); + b, *(dof_tables.front()), residuum_vectors_bulk_); } }; diff --git a/ProcessLib/ComponentTransport/ComponentTransportProcess.cpp b/ProcessLib/ComponentTransport/ComponentTransportProcess.cpp index 74cfee620f7..20cc202fb64 100644 --- a/ProcessLib/ComponentTransport/ComponentTransportProcess.cpp +++ b/ProcessLib/ComponentTransport/ComponentTransportProcess.cpp @@ -228,17 +228,16 @@ void ComponentTransportProcess::assembleConcreteProcess( ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; - std::vector> - dof_tables; + std::vector dof_tables; if (_use_monolithic_scheme) { - dof_tables.push_back(std::ref(*_local_to_global_index_map)); + dof_tables.push_back(_local_to_global_index_map.get()); } else { - std::generate_n( - std::back_inserter(dof_tables), _process_variables.size(), - [&]() { return std::ref(*_local_to_global_index_map); }); + std::generate_n(std::back_inserter(dof_tables), + _process_variables.size(), + [&]() { return _local_to_global_index_map.get(); }); } _asm_mat_cache.assemble(t, dt, x, x_prev, process_id, M, K, b, dof_tables, @@ -274,11 +273,10 @@ void ComponentTransportProcess::assembleWithJacobianConcreteProcess( ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; - std::vector> - dof_tables; + std::vector dof_tables; std::generate_n(std::back_inserter(dof_tables), _process_variables.size(), - [&]() { return std::ref(*_local_to_global_index_map); }); + [&]() { return _local_to_global_index_map.get(); }); // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( @@ -511,17 +509,16 @@ void ComponentTransportProcess::preOutputConcreteProcess( assembleConcreteProcess(t, dt, x, x_prev, process_id, *M, *K, *b); - std::vector> - dof_tables; + std::vector dof_tables; if (_use_monolithic_scheme) { - dof_tables.push_back(std::ref(*_local_to_global_index_map)); + dof_tables.push_back(_local_to_global_index_map.get()); } else { - std::generate_n( - std::back_inserter(dof_tables), _process_variables.size(), - [&]() { return std::ref(*_local_to_global_index_map); }); + std::generate_n(std::back_inserter(dof_tables), + _process_variables.size(), + [&]() { return _local_to_global_index_map.get(); }); } BaseLib::RunTime time_residuum; @@ -535,7 +532,7 @@ void ComponentTransportProcess::preOutputConcreteProcess( ++variable_id) { transformVariableFromGlobalVector( - residuum, variable_id, dof_tables[0], *_residua[variable_id], + residuum, variable_id, *dof_tables[0], *_residua[variable_id], std::negate()); } } @@ -543,7 +540,7 @@ void ComponentTransportProcess::preOutputConcreteProcess( { auto const residuum = computeResiduum(dt, *x[process_id], *x_prev[process_id], *M, *K, *b); - transformVariableFromGlobalVector(residuum, 0, dof_tables[process_id], + transformVariableFromGlobalVector(residuum, 0, *dof_tables[process_id], *_residua[process_id], std::negate()); } diff --git a/ProcessLib/HT/HTProcess.cpp b/ProcessLib/HT/HTProcess.cpp index f1dd20f1f8b..54029f57210 100644 --- a/ProcessLib/HT/HTProcess.cpp +++ b/ProcessLib/HT/HTProcess.cpp @@ -78,12 +78,11 @@ void HTProcess::assembleConcreteProcess( std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) { - std::vector> - dof_tables; + std::vector dof_tables; if (_use_monolithic_scheme) { DBUG("Assemble HTProcess."); - dof_tables.emplace_back(*_local_to_global_index_map); + dof_tables.emplace_back(_local_to_global_index_map.get()); } else { @@ -99,8 +98,8 @@ void HTProcess::assembleConcreteProcess( "Assemble the equations of single phase fully saturated " "fluid flow process within HTProcess."); } - dof_tables.emplace_back(*_local_to_global_index_map); - dof_tables.emplace_back(*_local_to_global_index_map); + dof_tables.emplace_back(_local_to_global_index_map.get()); + dof_tables.emplace_back(_local_to_global_index_map.get()); } ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; @@ -118,16 +117,15 @@ void HTProcess::assembleWithJacobianConcreteProcess( { DBUG("AssembleWithJacobian HTProcess."); - std::vector> - dof_tables; + std::vector dof_tables; if (!_use_monolithic_scheme) { - dof_tables.emplace_back(std::ref(*_local_to_global_index_map)); + dof_tables.emplace_back(_local_to_global_index_map.get()); } else { - dof_tables.emplace_back(std::ref(*_local_to_global_index_map)); - dof_tables.emplace_back(std::ref(*_local_to_global_index_map)); + dof_tables.emplace_back(_local_to_global_index_map.get()); + dof_tables.emplace_back(_local_to_global_index_map.get()); } // Call global assembler for each local assembly item. diff --git a/ProcessLib/HeatConduction/HeatConductionProcess.cpp b/ProcessLib/HeatConduction/HeatConductionProcess.cpp index 78143280145..bdb0cbdbccb 100644 --- a/ProcessLib/HeatConduction/HeatConductionProcess.cpp +++ b/ProcessLib/HeatConduction/HeatConductionProcess.cpp @@ -102,8 +102,8 @@ void HeatConductionProcess::assembleConcreteProcess( ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; - std::vector> - dof_table = {std::ref(*_local_to_global_index_map)}; + std::vector dof_table = { + _local_to_global_index_map.get()}; _asm_mat_cache.assemble(t, dt, x, x_prev, process_id, M, K, b, dof_table, _global_assembler, _local_assemblers, @@ -119,8 +119,8 @@ void HeatConductionProcess::assembleWithJacobianConcreteProcess( ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; - std::vector> - dof_table = {std::ref(*_local_to_global_index_map)}; + std::vector dof_table = { + _local_to_global_index_map.get()}; // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, diff --git a/ProcessLib/HeatTransportBHE/HeatTransportBHEProcess.cpp b/ProcessLib/HeatTransportBHE/HeatTransportBHEProcess.cpp index 019a1049f07..325501dc69b 100644 --- a/ProcessLib/HeatTransportBHE/HeatTransportBHEProcess.cpp +++ b/ProcessLib/HeatTransportBHE/HeatTransportBHEProcess.cpp @@ -167,8 +167,8 @@ void HeatTransportBHEProcess::assembleConcreteProcess( ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; - std::vector> - dof_table = {std::ref(*_local_to_global_index_map)}; + std::vector dof_table = { + _local_to_global_index_map.get()}; // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, @@ -183,8 +183,8 @@ void HeatTransportBHEProcess::assembleWithJacobianConcreteProcess( { DBUG("AssembleWithJacobian HeatTransportBHE process."); - std::vector> - dof_table = {std::ref(*_local_to_global_index_map)}; + std::vector dof_table = { + _local_to_global_index_map.get()}; ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; // Call global assembler for each local assembly item. diff --git a/ProcessLib/HydroMechanics/HydroMechanicsProcess.cpp b/ProcessLib/HydroMechanics/HydroMechanicsProcess.cpp index ec9b49d76ed..03816784d57 100644 --- a/ProcessLib/HydroMechanics/HydroMechanicsProcess.cpp +++ b/ProcessLib/HydroMechanics/HydroMechanicsProcess.cpp @@ -294,8 +294,8 @@ void HydroMechanicsProcess::assembleConcreteProcess( // only the Newton-Raphson method is employed to simulate coupled HM // processes in this class, this function is actually not used so far. - std::vector> - dof_table = {std::ref(*_local_to_global_index_map)}; + std::vector dof_table = { + _local_to_global_index_map.get()}; GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, @@ -310,8 +310,6 @@ void HydroMechanicsProcess:: std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) { - std::vector> - dof_tables; // For the monolithic scheme bool const use_monolithic_scheme = _process_data.isMonolithicSchemeUsed(); if (use_monolithic_scheme) @@ -319,7 +317,6 @@ void HydroMechanicsProcess:: DBUG( "Assemble the Jacobian of HydroMechanics for the monolithic " "scheme."); - dof_tables.emplace_back(*_local_to_global_index_map); } else { @@ -336,10 +333,9 @@ void HydroMechanicsProcess:: "Assemble the Jacobian equations of mechanical process in " "HydroMechanics for the staggered scheme."); } - dof_tables.emplace_back(*_local_to_global_index_map_with_base_nodes); - dof_tables.emplace_back(*_local_to_global_index_map); } + auto const dof_tables = getDOFTables(x.size()); GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, _local_assemblers, getActiveElementIDs(), dof_tables, t, dt, x, x_prev, @@ -349,13 +345,13 @@ void HydroMechanicsProcess:: { if (use_monolithic_scheme) { - transformVariableFromGlobalVector(b, variable_id, dof_tables[0], + transformVariableFromGlobalVector(b, variable_id, *dof_tables[0], output_vector, std::negate()); } else { - transformVariableFromGlobalVector(b, 0, dof_tables[process_id], + transformVariableFromGlobalVector(b, 0, *dof_tables[process_id], output_vector, std::negate()); } diff --git a/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp b/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp index af57e513a8b..bce65862597 100644 --- a/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp +++ b/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp @@ -451,8 +451,8 @@ void HydroMechanicsProcess::assembleConcreteProcess( { DBUG("Assemble HydroMechanicsProcess."); - std::vector> - dof_table = {std::ref(*_local_to_global_index_map)}; + std::vector dof_table = { + _local_to_global_index_map.get()}; // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, @@ -470,8 +470,8 @@ void HydroMechanicsProcess::assembleWithJacobianConcreteProcess( ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; // Call global assembler for each local assembly item. - std::vector> - dof_table = {std::ref(*_local_to_global_index_map)}; + std::vector dof_table = { + _local_to_global_index_map.get()}; GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, _local_assemblers, pv.getActiveElementIDs(), dof_table, t, dt, x, diff --git a/ProcessLib/LIE/SmallDeformation/SmallDeformationProcess.cpp b/ProcessLib/LIE/SmallDeformation/SmallDeformationProcess.cpp index d0a621dd7e2..e4f33b22df6 100644 --- a/ProcessLib/LIE/SmallDeformation/SmallDeformationProcess.cpp +++ b/ProcessLib/LIE/SmallDeformation/SmallDeformationProcess.cpp @@ -419,8 +419,8 @@ void SmallDeformationProcess::assembleConcreteProcess( ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; - std::vector> - dof_table = {std::ref(*_local_to_global_index_map)}; + std::vector dof_table = { + _local_to_global_index_map.get()}; // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, @@ -439,8 +439,8 @@ void SmallDeformationProcess:: // Call global assembler for each local assembly item. ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; - std::vector> - dof_table = {std::ref(*_local_to_global_index_map)}; + std::vector dof_table = { + _local_to_global_index_map.get()}; GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, _local_assemblers, pv.getActiveElementIDs(), dof_table, t, dt, x, diff --git a/ProcessLib/LargeDeformation/LargeDeformationProcess.cpp b/ProcessLib/LargeDeformation/LargeDeformationProcess.cpp index 762ee94a86f..f19707a2dc2 100644 --- a/ProcessLib/LargeDeformation/LargeDeformationProcess.cpp +++ b/ProcessLib/LargeDeformation/LargeDeformationProcess.cpp @@ -138,8 +138,8 @@ void LargeDeformationProcess::assembleConcreteProcess( ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; - std::vector> - dof_table = {std::ref(*_local_to_global_index_map)}; + std::vector dof_table = { + _local_to_global_index_map.get()}; // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, @@ -160,8 +160,8 @@ void LargeDeformationProcess:: ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; - std::vector> - dof_table = {std::ref(*_local_to_global_index_map)}; + std::vector dof_table = { + _local_to_global_index_map.get()}; // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, diff --git a/ProcessLib/LiquidFlow/LiquidFlowProcess.cpp b/ProcessLib/LiquidFlow/LiquidFlowProcess.cpp index 23f7891cc4d..12b16cc8f0c 100644 --- a/ProcessLib/LiquidFlow/LiquidFlowProcess.cpp +++ b/ProcessLib/LiquidFlow/LiquidFlowProcess.cpp @@ -75,8 +75,8 @@ void LiquidFlowProcess::assembleConcreteProcess( { DBUG("Assemble LiquidFlowProcess."); - std::vector> - dof_table = {std::ref(*_local_to_global_index_map)}; + std::vector dof_table = { + _local_to_global_index_map.get()}; ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; @@ -103,8 +103,8 @@ void LiquidFlowProcess::assembleWithJacobianConcreteProcess( { DBUG("AssembleWithJacobian LiquidFlowProcess."); - std::vector> - dof_table = {std::ref(*_local_to_global_index_map)}; + std::vector dof_table = { + _local_to_global_index_map.get()}; ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; // Call global assembler for each local assembly item. diff --git a/ProcessLib/PhaseField/LocalAssemblerInterface.h b/ProcessLib/PhaseField/LocalAssemblerInterface.h index 1a492b59ad9..90d78743094 100644 --- a/ProcessLib/PhaseField/LocalAssemblerInterface.h +++ b/ProcessLib/PhaseField/LocalAssemblerInterface.h @@ -55,17 +55,13 @@ struct PhaseFieldLocalAssemblerInterface virtual void computeCrackIntegral( std::size_t mesh_item_id, - std::vector< - std::reference_wrapper> const& - dof_tables, + std::vector const& dof_tables, std::vector const& x, double const t, double& crack_volume) = 0; virtual void computeEnergy( std::size_t mesh_item_id, - std::vector< - std::reference_wrapper> const& - dof_tables, + std::vector const& dof_tables, std::vector const& x, double const t, double& elastic_energy, double& surface_energy, double& pressure_work) = 0; diff --git a/ProcessLib/PhaseField/PhaseFieldFEM-impl.h b/ProcessLib/PhaseField/PhaseFieldFEM-impl.h index 3ad450fc8ee..cccd13e0d99 100644 --- a/ProcessLib/PhaseField/PhaseFieldFEM-impl.h +++ b/ProcessLib/PhaseField/PhaseFieldFEM-impl.h @@ -256,18 +256,18 @@ void PhaseFieldLocalAssembler:: template void PhaseFieldLocalAssembler:: - computeCrackIntegral(std::size_t mesh_item_id, - std::vector> const& dof_tables, - std::vector const& x, - double const /*t*/, double& crack_volume) + computeCrackIntegral( + std::size_t mesh_item_id, + std::vector const& dof_tables, + std::vector const& x, double const /*t*/, + double& crack_volume) { std::vector> indices_of_processes; indices_of_processes.reserve(dof_tables.size()); std::transform(dof_tables.begin(), dof_tables.end(), std::back_inserter(indices_of_processes), - [&](NumLib::LocalToGlobalIndexMap const& dof_table) - { return NumLib::getIndices(mesh_item_id, dof_table); }); + [&](auto const dof_table) + { return NumLib::getIndices(mesh_item_id, *dof_table); }); auto local_coupled_xs = getCoupledLocalSolutions(x, indices_of_processes); assert(local_coupled_xs.size() == displacement_size + phasefield_size); @@ -308,8 +308,7 @@ void PhaseFieldLocalAssembler:: template void PhaseFieldLocalAssembler::computeEnergy( std::size_t mesh_item_id, - std::vector> const& - dof_tables, + std::vector const& dof_tables, std::vector const& x, double const t, double& elastic_energy, double& surface_energy, double& pressure_work) { @@ -317,8 +316,8 @@ void PhaseFieldLocalAssembler::computeEnergy( indices_of_processes.reserve(dof_tables.size()); std::transform(dof_tables.begin(), dof_tables.end(), std::back_inserter(indices_of_processes), - [&](NumLib::LocalToGlobalIndexMap const& dof_table) - { return NumLib::getIndices(mesh_item_id, dof_table); }); + [&](auto const dof_table) + { return NumLib::getIndices(mesh_item_id, *dof_table); }); auto const local_coupled_xs = getCoupledLocalSolutions(x, indices_of_processes); diff --git a/ProcessLib/PhaseField/PhaseFieldFEM.h b/ProcessLib/PhaseField/PhaseFieldFEM.h index eaecb31e07c..a3d1e3170c7 100644 --- a/ProcessLib/PhaseField/PhaseFieldFEM.h +++ b/ProcessLib/PhaseField/PhaseFieldFEM.h @@ -308,18 +308,16 @@ class PhaseFieldLocalAssembler : public PhaseFieldLocalAssemblerInterface void computeCrackIntegral( std::size_t mesh_item_id, - std::vector< - std::reference_wrapper> const& - dof_tables, + std::vector const& dof_tables, std::vector const& x, double const t, double& crack_volume) override; - void computeEnergy(std::size_t mesh_item_id, - std::vector> const& dof_tables, - std::vector const& x, double const t, - double& elastic_energy, double& surface_energy, - double& pressure_work) override; + void computeEnergy( + std::size_t mesh_item_id, + std::vector const& dof_tables, + std::vector const& x, double const t, + double& elastic_energy, double& surface_energy, + double& pressure_work) override; Eigen::Map getShapeMatrix( const unsigned integration_point) const override diff --git a/ProcessLib/PhaseField/PhaseFieldProcess.cpp b/ProcessLib/PhaseField/PhaseFieldProcess.cpp index efd46324ce8..e70342ecb2e 100644 --- a/ProcessLib/PhaseField/PhaseFieldProcess.cpp +++ b/ProcessLib/PhaseField/PhaseFieldProcess.cpp @@ -189,8 +189,7 @@ void PhaseFieldProcess::assembleConcreteProcess( { DBUG("Assemble PhaseFieldProcess."); - std::vector> - dof_tables; + std::vector dof_tables; // For the staggered scheme if (process_id == 1) @@ -205,8 +204,8 @@ void PhaseFieldProcess::assembleConcreteProcess( "Assemble the equations of deformation in " "PhaseFieldProcess for the staggered scheme."); } - dof_tables.emplace_back(*_local_to_global_index_map_single_component); - dof_tables.emplace_back(*_local_to_global_index_map); + dof_tables.emplace_back(_local_to_global_index_map_single_component.get()); + dof_tables.emplace_back(_local_to_global_index_map.get()); ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; @@ -223,8 +222,7 @@ void PhaseFieldProcess::assembleWithJacobianConcreteProcess( std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) { - std::vector> - dof_tables; + std::vector dof_tables; // For the staggered scheme if (process_id == 1) @@ -239,8 +237,8 @@ void PhaseFieldProcess::assembleWithJacobianConcreteProcess( "Assemble the Jacobian equations of deformation in " "PhaseFieldProcess for the staggered scheme."); } - dof_tables.emplace_back(*_local_to_global_index_map); - dof_tables.emplace_back(*_local_to_global_index_map_single_component); + dof_tables.emplace_back(_local_to_global_index_map.get()); + dof_tables.emplace_back(_local_to_global_index_map_single_component.get()); ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; @@ -292,11 +290,11 @@ void PhaseFieldProcess::postTimestepConcreteProcess( _process_data.surface_energy = 0.0; _process_data.pressure_work = 0.0; - std::vector> - dof_tables; + std::vector dof_tables; - dof_tables.emplace_back(*_local_to_global_index_map); - dof_tables.emplace_back(*_local_to_global_index_map_single_component); + dof_tables.emplace_back(_local_to_global_index_map.get()); + dof_tables.emplace_back( + _local_to_global_index_map_single_component.get()); ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; @@ -350,11 +348,10 @@ void PhaseFieldProcess::postNonLinearSolverConcreteProcess( return; } - std::vector> - dof_tables; + std::vector dof_tables; - dof_tables.emplace_back(*_local_to_global_index_map); - dof_tables.emplace_back(*_local_to_global_index_map_single_component); + dof_tables.emplace_back(_local_to_global_index_map.get()); + dof_tables.emplace_back(_local_to_global_index_map_single_component.get()); DBUG("PostNonLinearSolver crack volume computation."); diff --git a/ProcessLib/RichardsComponentTransport/RichardsComponentTransportProcess.cpp b/ProcessLib/RichardsComponentTransport/RichardsComponentTransportProcess.cpp index d16bccfe812..8acc88db4da 100644 --- a/ProcessLib/RichardsComponentTransport/RichardsComponentTransportProcess.cpp +++ b/ProcessLib/RichardsComponentTransport/RichardsComponentTransportProcess.cpp @@ -71,8 +71,8 @@ void RichardsComponentTransportProcess::assembleConcreteProcess( { DBUG("Assemble RichardsComponentTransportProcess."); - std::vector> - dof_table = {std::ref(*_local_to_global_index_map)}; + std::vector dof_table = { + _local_to_global_index_map.get()}; ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; // Call global assembler for each local assembly item. @@ -89,8 +89,8 @@ void RichardsComponentTransportProcess::assembleWithJacobianConcreteProcess( { DBUG("AssembleWithJacobian RichardsComponentTransportProcess."); - std::vector> - dof_table = {std::ref(*_local_to_global_index_map)}; + std::vector dof_table = { + _local_to_global_index_map.get()}; ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; // Call global assembler for each local assembly item. diff --git a/ProcessLib/RichardsFlow/RichardsFlowProcess.cpp b/ProcessLib/RichardsFlow/RichardsFlowProcess.cpp index daa404f75f8..5d3b501830c 100644 --- a/ProcessLib/RichardsFlow/RichardsFlowProcess.cpp +++ b/ProcessLib/RichardsFlow/RichardsFlowProcess.cpp @@ -65,8 +65,8 @@ void RichardsFlowProcess::assembleConcreteProcess( { DBUG("Assemble RichardsFlowProcess."); - std::vector> - dof_table = {std::ref(*_local_to_global_index_map)}; + std::vector dof_table = { + _local_to_global_index_map.get()}; ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; // Call global assembler for each local assembly item. @@ -83,8 +83,8 @@ void RichardsFlowProcess::assembleWithJacobianConcreteProcess( { DBUG("AssembleWithJacobian RichardsFlowProcess."); - std::vector> - dof_table = {std::ref(*_local_to_global_index_map)}; + std::vector dof_table = { + _local_to_global_index_map.get()}; ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; // Call global assembler for each local assembly item. diff --git a/ProcessLib/RichardsMechanics/RichardsMechanicsProcess.cpp b/ProcessLib/RichardsMechanics/RichardsMechanicsProcess.cpp index 86d200f93a8..5693ddd663b 100644 --- a/ProcessLib/RichardsMechanics/RichardsMechanicsProcess.cpp +++ b/ProcessLib/RichardsMechanics/RichardsMechanicsProcess.cpp @@ -341,8 +341,8 @@ void RichardsMechanicsProcess::assembleConcreteProcess( { DBUG("Assemble the equations for RichardsMechanics"); - std::vector> - dof_table = {std::ref(*_local_to_global_index_map)}; + std::vector dof_table = { + _local_to_global_index_map.get()}; ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; // Call global assembler for each local assembly item. @@ -359,15 +359,12 @@ void RichardsMechanicsProcess:: std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) { - std::vector> - dof_tables; // For the monolithic scheme if (_use_monolithic_scheme) { DBUG( "Assemble the Jacobian of RichardsMechanics for the monolithic" " scheme."); - dof_tables.emplace_back(*_local_to_global_index_map); } else { @@ -384,12 +381,11 @@ void RichardsMechanicsProcess:: "Assemble the Jacobian equations of mechanical process in " "RichardsMechanics for the staggered scheme."); } - dof_tables.emplace_back(*_local_to_global_index_map_with_base_nodes); - dof_tables.emplace_back(*_local_to_global_index_map); } ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; + auto const dof_tables = getDOFTables(x.size()); GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, _local_assemblers, pv.getActiveElementIDs(), dof_tables, t, dt, x, @@ -399,13 +395,13 @@ void RichardsMechanicsProcess:: { if (_use_monolithic_scheme) { - transformVariableFromGlobalVector(b, variable_id, dof_tables[0], + transformVariableFromGlobalVector(b, variable_id, *dof_tables[0], output_vector, std::negate()); } else { - transformVariableFromGlobalVector(b, 0, dof_tables[process_id], + transformVariableFromGlobalVector(b, 0, *dof_tables[process_id], output_vector, std::negate()); } diff --git a/ProcessLib/SmallDeformation/SmallDeformationProcess.cpp b/ProcessLib/SmallDeformation/SmallDeformationProcess.cpp index deed77efdbf..2b6223c5524 100644 --- a/ProcessLib/SmallDeformation/SmallDeformationProcess.cpp +++ b/ProcessLib/SmallDeformation/SmallDeformationProcess.cpp @@ -140,8 +140,8 @@ void SmallDeformationProcess::assembleConcreteProcess( ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; - std::vector> - dof_table = {std::ref(*_local_to_global_index_map)}; + std::vector dof_table = { + _local_to_global_index_map.get()}; // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, @@ -162,8 +162,8 @@ void SmallDeformationProcess:: ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; - std::vector> - dof_table = {std::ref(*_local_to_global_index_map)}; + std::vector dof_table = { + _local_to_global_index_map.get()}; // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, diff --git a/ProcessLib/SmallDeformationNonlocal/SmallDeformationNonlocalProcess.cpp b/ProcessLib/SmallDeformationNonlocal/SmallDeformationNonlocalProcess.cpp index 9b1ff8f2058..3509dfa03f6 100644 --- a/ProcessLib/SmallDeformationNonlocal/SmallDeformationNonlocalProcess.cpp +++ b/ProcessLib/SmallDeformationNonlocal/SmallDeformationNonlocalProcess.cpp @@ -183,8 +183,8 @@ void SmallDeformationNonlocalProcess::assembleConcreteProcess( { DBUG("Assemble SmallDeformationNonlocalProcess."); - std::vector> - dof_table = {std::ref(*_local_to_global_index_map)}; + std::vector dof_table = { + _local_to_global_index_map.get()}; ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; @@ -222,8 +222,8 @@ void SmallDeformationNonlocalProcess:: { DBUG("AssembleWithJacobian SmallDeformationNonlocalProcess."); - std::vector> - dof_table = {std::ref(*_local_to_global_index_map)}; + std::vector dof_table = { + _local_to_global_index_map.get()}; ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; diff --git a/ProcessLib/SteadyStateDiffusion/SteadyStateDiffusion.cpp b/ProcessLib/SteadyStateDiffusion/SteadyStateDiffusion.cpp index 29c599cc9db..4ff7314f06e 100644 --- a/ProcessLib/SteadyStateDiffusion/SteadyStateDiffusion.cpp +++ b/ProcessLib/SteadyStateDiffusion/SteadyStateDiffusion.cpp @@ -63,8 +63,8 @@ void SteadyStateDiffusion::assembleConcreteProcess( DBUG("Assemble SteadyStateDiffusion."); ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; - std::vector> - dof_table = {std::ref(*_local_to_global_index_map)}; + std::vector dof_table = { + _local_to_global_index_map.get()}; // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, @@ -80,8 +80,8 @@ void SteadyStateDiffusion::assembleWithJacobianConcreteProcess( DBUG("AssembleWithJacobian SteadyStateDiffusion."); ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; - std::vector> - dof_table = {std::ref(*_local_to_global_index_map)}; + std::vector dof_table = { + _local_to_global_index_map.get()}; // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, diff --git a/ProcessLib/StokesFlow/StokesFlowProcess.cpp b/ProcessLib/StokesFlow/StokesFlowProcess.cpp index c8be91caed1..1a9c0f69683 100644 --- a/ProcessLib/StokesFlow/StokesFlowProcess.cpp +++ b/ProcessLib/StokesFlow/StokesFlowProcess.cpp @@ -134,11 +134,10 @@ void StokesFlowProcess::assembleConcreteProcess( { DBUG("Assemble StokesFlowProcess."); - std::vector> - dof_tables; + std::vector dof_tables; assert(_use_monolithic_scheme); { - dof_tables.push_back(std::ref(*_local_to_global_index_map)); + dof_tables.push_back(_local_to_global_index_map.get()); } ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; diff --git a/ProcessLib/TES/TESProcess.cpp b/ProcessLib/TES/TESProcess.cpp index 9d8b15fbb92..d39e8b2c34b 100644 --- a/ProcessLib/TES/TESProcess.cpp +++ b/ProcessLib/TES/TESProcess.cpp @@ -210,8 +210,8 @@ void TESProcess::assembleConcreteProcess( { DBUG("Assemble TESProcess."); - std::vector> - dof_table = {std::ref(*_local_to_global_index_map)}; + std::vector dof_table = { + _local_to_global_index_map.get()}; ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; // Call global assembler for each local assembly item. @@ -226,8 +226,8 @@ void TESProcess::assembleWithJacobianConcreteProcess( std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) { - std::vector> - dof_table = {std::ref(*_local_to_global_index_map)}; + std::vector dof_table = { + _local_to_global_index_map.get()}; ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; // Call global assembler for each local assembly item. diff --git a/ProcessLib/ThermalTwoPhaseFlowWithPP/ThermalTwoPhaseFlowWithPPProcess.cpp b/ProcessLib/ThermalTwoPhaseFlowWithPP/ThermalTwoPhaseFlowWithPPProcess.cpp index 0ade1b3041e..ca2a4a197b3 100644 --- a/ProcessLib/ThermalTwoPhaseFlowWithPP/ThermalTwoPhaseFlowWithPPProcess.cpp +++ b/ProcessLib/ThermalTwoPhaseFlowWithPP/ThermalTwoPhaseFlowWithPPProcess.cpp @@ -87,8 +87,8 @@ void ThermalTwoPhaseFlowWithPPProcess::assembleConcreteProcess( { DBUG("Assemble ThermalTwoPhaseFlowWithPPProcess."); - std::vector> - dof_table = {std::ref(*_local_to_global_index_map)}; + std::vector dof_table = { + _local_to_global_index_map.get()}; ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; // Call global assembler for each local assembly item. @@ -105,8 +105,8 @@ void ThermalTwoPhaseFlowWithPPProcess::assembleWithJacobianConcreteProcess( { DBUG("AssembleWithJacobian ThermalTwoPhaseFlowWithPPProcess."); - std::vector> - dof_table = {std::ref(*_local_to_global_index_map)}; + std::vector dof_table = { + _local_to_global_index_map.get()}; ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; // Call global assembler for each local assembly item. diff --git a/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsProcess.cpp b/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsProcess.cpp index ef56dc1ef21..fb75c653e16 100644 --- a/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsProcess.cpp +++ b/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsProcess.cpp @@ -341,8 +341,8 @@ void ThermoHydroMechanicsProcess::assembleConcreteProcess( { DBUG("Assemble the equations for ThermoHydroMechanics"); - std::vector> - dof_table = {std::ref(*_local_to_global_index_map)}; + std::vector dof_table = { + _local_to_global_index_map.get()}; ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; @@ -359,15 +359,12 @@ void ThermoHydroMechanicsProcess:: std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) { - std::vector> - dof_tables; // For the monolithic scheme if (_use_monolithic_scheme) { DBUG( "Assemble the Jacobian of ThermoHydroMechanics for the monolithic " "scheme."); - dof_tables.emplace_back(*_local_to_global_index_map); } else { @@ -390,13 +387,12 @@ void ThermoHydroMechanicsProcess:: "Assemble the Jacobian equations of mechanical process in " "ThermoHydroMechanics for the staggered scheme."); } - dof_tables.emplace_back(*_local_to_global_index_map_with_base_nodes); - dof_tables.emplace_back(*_local_to_global_index_map_with_base_nodes); - dof_tables.emplace_back(*_local_to_global_index_map); } ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; + auto const dof_tables = getDOFTables(x.size()); + GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, _local_assemblers, pv.getActiveElementIDs(), dof_tables, t, dt, x, @@ -406,13 +402,13 @@ void ThermoHydroMechanicsProcess:: { if (_use_monolithic_scheme) { - transformVariableFromGlobalVector(b, variable_id, dof_tables[0], + transformVariableFromGlobalVector(b, variable_id, *dof_tables[0], output_vector, std::negate()); } else { - transformVariableFromGlobalVector(b, 0, dof_tables[process_id], + transformVariableFromGlobalVector(b, 0, *dof_tables[process_id], output_vector, std::negate()); } diff --git a/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldProcess.cpp b/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldProcess.cpp index 325f7d24c44..7d817d6c0cd 100644 --- a/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldProcess.cpp +++ b/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldProcess.cpp @@ -198,8 +198,8 @@ void ThermoMechanicalPhaseFieldProcess:: { DBUG("Assemble the equations for ThermoMechanicalPhaseFieldProcess."); - std::vector> - dof_table = {std::ref(*_local_to_global_index_map)}; + std::vector dof_table = { + _local_to_global_index_map.get()}; ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; // Call global assembler for each local assembly item. @@ -216,8 +216,6 @@ void ThermoMechanicalPhaseFieldProcess:: std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) { - std::vector> - dof_tables; // For the staggered scheme if (process_id == _mechanics_related_process_id) { @@ -239,11 +237,13 @@ void ThermoMechanicalPhaseFieldProcess:: "Assemble the Jacobian equations of heat conduction in " "ThermoMechanicalPhaseFieldProcess for the staggered scheme."); } + + std::vector dof_tables; dof_tables.emplace_back( - getDOFTableByProcessID(_heat_conduction_process_id)); + &getDOFTableByProcessID(_heat_conduction_process_id)); dof_tables.emplace_back( - getDOFTableByProcessID(_mechanics_related_process_id)); - dof_tables.emplace_back(getDOFTableByProcessID(_phase_field_process_id)); + &getDOFTableByProcessID(_mechanics_related_process_id)); + dof_tables.emplace_back(&getDOFTableByProcessID(_phase_field_process_id)); ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; diff --git a/ProcessLib/ThermoMechanics/ThermoMechanicsProcess.cpp b/ProcessLib/ThermoMechanics/ThermoMechanicsProcess.cpp index fe6b03b1b7e..1135cf0305e 100644 --- a/ProcessLib/ThermoMechanics/ThermoMechanicsProcess.cpp +++ b/ProcessLib/ThermoMechanics/ThermoMechanicsProcess.cpp @@ -210,8 +210,8 @@ void ThermoMechanicsProcess::assembleConcreteProcess( { DBUG("Assemble ThermoMechanicsProcess."); - std::vector> - dof_table = {std::ref(*_local_to_global_index_map)}; + std::vector dof_table = { + _local_to_global_index_map.get()}; ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; // Call global assembler for each local assembly item. @@ -230,15 +230,14 @@ void ThermoMechanicsProcess:: { DBUG("AssembleJacobian ThermoMechanicsProcess."); - std::vector> - dof_tables; + std::vector dof_tables; // For the monolithic scheme if (_use_monolithic_scheme) { DBUG( "Assemble the Jacobian of ThermoMechanics for the monolithic" " scheme."); - dof_tables.emplace_back(*_local_to_global_index_map); + dof_tables.emplace_back(_local_to_global_index_map.get()); } else { @@ -261,14 +260,14 @@ void ThermoMechanicsProcess:: 0) // First: the heat conduction process { dof_tables.emplace_back( - *_local_to_global_index_map_single_component); - dof_tables.emplace_back(*_local_to_global_index_map); + _local_to_global_index_map_single_component.get()); + dof_tables.emplace_back(_local_to_global_index_map.get()); } else // vice versa { - dof_tables.emplace_back(*_local_to_global_index_map); + dof_tables.emplace_back(_local_to_global_index_map.get()); dof_tables.emplace_back( - *_local_to_global_index_map_single_component); + _local_to_global_index_map_single_component.get()); } } @@ -284,13 +283,13 @@ void ThermoMechanicsProcess:: { if (_use_monolithic_scheme) { - transformVariableFromGlobalVector(b, variable_id, dof_tables[0], + transformVariableFromGlobalVector(b, variable_id, *dof_tables[0], output_vector, std::negate()); } else { - transformVariableFromGlobalVector(b, 0, dof_tables[process_id], + transformVariableFromGlobalVector(b, 0, *dof_tables[process_id], output_vector, std::negate()); } diff --git a/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowProcess.cpp b/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowProcess.cpp index d8e28103ea5..98fd56c6f60 100644 --- a/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowProcess.cpp +++ b/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowProcess.cpp @@ -131,8 +131,8 @@ void ThermoRichardsFlowProcess::assembleConcreteProcess( { DBUG("Assemble the equations for ThermoRichardsFlowProcess."); - std::vector> - dof_table = {std::ref(*_local_to_global_index_map)}; + std::vector dof_table = { + _local_to_global_index_map.get()}; ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; // Call global assembler for each local assembly item. @@ -147,13 +147,12 @@ void ThermoRichardsFlowProcess::assembleWithJacobianConcreteProcess( std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) { - std::vector> - dof_tables; + std::vector dof_tables; DBUG( "Assemble the Jacobian of ThermoRichardsFlow for the monolithic " "scheme."); - dof_tables.emplace_back(*_local_to_global_index_map); + dof_tables.emplace_back(_local_to_global_index_map.get()); ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; @@ -163,7 +162,7 @@ void ThermoRichardsFlowProcess::assembleWithJacobianConcreteProcess( auto copyRhs = [&](int const variable_id, auto& output_vector) { - transformVariableFromGlobalVector(b, variable_id, dof_tables[0], + transformVariableFromGlobalVector(b, variable_id, *dof_tables[0], output_vector, std::negate()); }; diff --git a/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPProcess.cpp b/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPProcess.cpp index 5a58d09a01c..ae759a76094 100644 --- a/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPProcess.cpp +++ b/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPProcess.cpp @@ -65,8 +65,8 @@ void TwoPhaseFlowWithPPProcess::assembleConcreteProcess( { DBUG("Assemble TwoPhaseFlowWithPPProcess."); - std::vector> - dof_table = {std::ref(*_local_to_global_index_map)}; + std::vector dof_table = { + _local_to_global_index_map.get()}; ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; // Call global assembler for each local assembly item. @@ -83,8 +83,8 @@ void TwoPhaseFlowWithPPProcess::assembleWithJacobianConcreteProcess( { DBUG("AssembleWithJacobian TwoPhaseFlowWithPPProcess."); - std::vector> - dof_table = {std::ref(*_local_to_global_index_map)}; + std::vector dof_table = { + _local_to_global_index_map.get()}; ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; // Call global assembler for each local assembly item. diff --git a/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoProcess.cpp b/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoProcess.cpp index a6bb9b097b5..5799df57ebf 100644 --- a/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoProcess.cpp +++ b/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoProcess.cpp @@ -65,8 +65,8 @@ void TwoPhaseFlowWithPrhoProcess::assembleConcreteProcess( { DBUG("Assemble TwoPhaseFlowWithPrhoProcess."); - std::vector> - dof_table = {std::ref(*_local_to_global_index_map)}; + std::vector dof_table = { + _local_to_global_index_map.get()}; ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; // Call global assembler for each local assembly item. @@ -83,8 +83,8 @@ void TwoPhaseFlowWithPrhoProcess::assembleWithJacobianConcreteProcess( { DBUG("AssembleWithJacobian TwoPhaseFlowWithPrhoProcess."); - std::vector> - dof_table = {std::ref(*_local_to_global_index_map)}; + std::vector dof_table = { + _local_to_global_index_map.get()}; ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; // Call global assembler for each local assembly item. diff --git a/ProcessLib/VectorMatrixAssembler.cpp b/ProcessLib/VectorMatrixAssembler.cpp index c49ece92442..99f44c61453 100644 --- a/ProcessLib/VectorMatrixAssembler.cpp +++ b/ProcessLib/VectorMatrixAssembler.cpp @@ -11,7 +11,6 @@ #include "VectorMatrixAssembler.h" #include -#include // for std::reference_wrapper. #include "CoupledSolutionsForStaggeredScheme.h" #include "LocalAssemblerInterface.h" @@ -39,8 +38,7 @@ void VectorMatrixAssembler::preAssemble( void VectorMatrixAssembler::assemble( const std::size_t mesh_item_id, LocalAssemblerInterface& local_assembler, - std::vector> const& - dof_tables, + std::vector const& dof_tables, const double t, double const dt, std::vector const& x, std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) @@ -49,8 +47,8 @@ void VectorMatrixAssembler::assemble( indices_of_processes.reserve(dof_tables.size()); transform(cbegin(dof_tables), cend(dof_tables), back_inserter(indices_of_processes), - [&](auto const& dof_table) - { return NumLib::getIndices(mesh_item_id, dof_table); }); + [&](auto const dof_table) + { return NumLib::getIndices(mesh_item_id, *dof_table); }); auto const& indices = indices_of_processes[process_id]; _local_M_data.clear(); @@ -107,8 +105,7 @@ void VectorMatrixAssembler::assemble( void VectorMatrixAssembler::assembleWithJacobian( std::size_t const mesh_item_id, LocalAssemblerInterface& local_assembler, - std::vector> const& - dof_tables, + std::vector const& dof_tables, const double t, double const dt, std::vector const& x, std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) @@ -117,8 +114,8 @@ void VectorMatrixAssembler::assembleWithJacobian( indices_of_processes.reserve(dof_tables.size()); transform(cbegin(dof_tables), cend(dof_tables), back_inserter(indices_of_processes), - [&](auto const& dof_table) - { return NumLib::getIndices(mesh_item_id, dof_table); }); + [&](auto const dof_table) + { return NumLib::getIndices(mesh_item_id, *dof_table); }); auto const& indices = indices_of_processes[process_id]; diff --git a/ProcessLib/VectorMatrixAssembler.h b/ProcessLib/VectorMatrixAssembler.h index d48633d9745..b96fb2219af 100644 --- a/ProcessLib/VectorMatrixAssembler.h +++ b/ProcessLib/VectorMatrixAssembler.h @@ -42,24 +42,20 @@ class VectorMatrixAssembler final //! Assembles\c M, \c K, and \c b. //! \remark Jacobian is not assembled here, see assembleWithJacobian(). - void assemble(std::size_t const mesh_item_id, - LocalAssemblerInterface& local_assembler, - std::vector> const& dof_tables, - double const t, double const dt, - std::vector const& x, - std::vector const& x_prev, - int const process_id, GlobalMatrix& M, GlobalMatrix& K, - GlobalVector& b); + void assemble( + std::size_t const mesh_item_id, + LocalAssemblerInterface& local_assembler, + std::vector const& dof_tables, + double const t, double const dt, std::vector const& x, + std::vector const& x_prev, int const process_id, + GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b); //! Assembles \c M, \c K, \c b, and the Jacobian \c Jac of the residual. //! \note The Jacobian must be assembled. void assembleWithJacobian( std::size_t const mesh_item_id, LocalAssemblerInterface& local_assembler, - std::vector< - std::reference_wrapper> const& - dof_tables, + std::vector const& dof_tables, const double t, double const dt, std::vector const& x, std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac);