From 2cc062a340d176a59b04e65995b668f9e7f1936c Mon Sep 17 00:00:00 2001 From: Dmitri Naumov <github@naumov.de> Date: Tue, 11 Jun 2024 15:05:42 +0200 Subject: [PATCH] [PL] AssemblyMixin; use process' active elements The getActiveElements function of a process is used from now on (as it is correctly handling multiple variable deactivations) and with this the process_id and process_variable are no longer needed as arguments. --- ProcessLib/AssemblyMixin.cpp | 17 ++++++++--------- ProcessLib/AssemblyMixin.h | 13 ++++--------- ProcessLib/TH2M/TH2MProcess.cpp | 3 +-- .../ThermoRichardsMechanicsProcess.cpp | 4 ++-- 4 files changed, 15 insertions(+), 22 deletions(-) diff --git a/ProcessLib/AssemblyMixin.cpp b/ProcessLib/AssemblyMixin.cpp index 0cb49b8b2c1..2b955a23644 100644 --- a/ProcessLib/AssemblyMixin.cpp +++ b/ProcessLib/AssemblyMixin.cpp @@ -14,6 +14,7 @@ #include "MeshLib/Utils/getOrCreateMeshProperty.h" #include "NumLib/DOF/DOFTableUtil.h" +#include "Process.h" namespace { @@ -88,19 +89,18 @@ void AssemblyMixinBase::initializeAssemblyOnSubmeshes( createResiduumVectors(bulk_mesh, residuum_names, pvs); } -void AssemblyMixinBase::updateActiveElements( - ProcessLib::ProcessVariable const& pv) +void AssemblyMixinBase::updateActiveElements(Process const& process) { - DBUG("AssemblyMixinBase updateActiveElements()."); + DBUG("AssemblyMixin updateActiveElements()."); if (ids_state_ == ActiveElementIDsState::UNINITIALIZED) { - updateActiveElementsImpl(pv); + updateActiveElementsImpl(process); return; } ActiveElementIDsState const new_state = - pv.getActiveElementIDs().empty() + process.getActiveElementIDs().empty() ? ActiveElementIDsState::NO_DEACTIVATED_SUBDOMAINS : ActiveElementIDsState::HAS_DEACTIVATED_SUBDOMAINS; @@ -117,15 +117,14 @@ void AssemblyMixinBase::updateActiveElements( // * no -> yes - now there are deactivated subdomains // * yes -> no - no deactivated subdomains anymore // * yes -> yes - deactivated subdomains might have changed - updateActiveElementsImpl(pv); + updateActiveElementsImpl(process); } -void AssemblyMixinBase::updateActiveElementsImpl( - ProcessLib::ProcessVariable const& pv) +void AssemblyMixinBase::updateActiveElementsImpl(Process const& process) { DBUG("AssemblyMixinBase updateActiveElementsImpl()."); - auto const& active_element_ids = pv.getActiveElementIDs(); + auto const& active_element_ids = process.getActiveElementIDs(); ActiveElementIDsState const new_state = active_element_ids.empty() diff --git a/ProcessLib/AssemblyMixin.h b/ProcessLib/AssemblyMixin.h index 58dab3d2488..2d00a31f7df 100644 --- a/ProcessLib/AssemblyMixin.h +++ b/ProcessLib/AssemblyMixin.h @@ -56,7 +56,7 @@ protected: std::vector<std::string> const& residuum_names, std::vector<std::reference_wrapper<ProcessVariable>> const& pvs); - void updateActiveElements(ProcessLib::ProcessVariable const& pv); + void updateActiveElements(ProcessLib::Process const& process); static void copyResiduumVectorsToBulkMesh( GlobalVector const& rhs, @@ -70,7 +70,7 @@ protected: SubmeshAssemblyData const& sad); private: - void updateActiveElementsImpl(ProcessLib::ProcessVariable const& pv); + void updateActiveElementsImpl(Process const& process); protected: std::vector<SubmeshAssemblyData> submesh_assembly_data_; @@ -131,14 +131,9 @@ public: derived().getProcessVariables(process_id)); } - void updateActiveElements(const int process_id) + void updateActiveElements() { - // convention: process variable 0 governs where assembly takes place - // (active element IDs) - ProcessLib::ProcessVariable const& pv = - derived().getProcessVariables(process_id)[0]; - - AssemblyMixinBase::updateActiveElements(pv); + AssemblyMixinBase::updateActiveElements(derived()); } // cppcheck-suppress functionStatic diff --git a/ProcessLib/TH2M/TH2MProcess.cpp b/ProcessLib/TH2M/TH2MProcess.cpp index 416699bedc5..3162a1876a4 100644 --- a/ProcessLib/TH2M/TH2MProcess.cpp +++ b/ProcessLib/TH2M/TH2MProcess.cpp @@ -278,8 +278,7 @@ void TH2MProcess<DisplacementDim>::preTimestepConcreteProcess( *_local_to_global_index_map, *x[process_id], t, dt); } - AssemblyMixin<TH2MProcess<DisplacementDim>>::updateActiveElements( - process_id); + AssemblyMixin<TH2MProcess<DisplacementDim>>::updateActiveElements(); } template <int DisplacementDim> diff --git a/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsProcess.cpp b/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsProcess.cpp index 8d337a1f478..3232236c077 100644 --- a/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsProcess.cpp +++ b/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsProcess.cpp @@ -233,10 +233,10 @@ void ThermoRichardsMechanicsProcess<DisplacementDim, ConstitutiveTraits>:: preTimestepConcreteProcess(std::vector<GlobalVector*> const& /*x*/, const double /*t*/, const double /*dt*/, - const int process_id) + const int /*process_id*/) { AssemblyMixin<ThermoRichardsMechanicsProcess< - DisplacementDim, ConstitutiveTraits>>::updateActiveElements(process_id); + DisplacementDim, ConstitutiveTraits>>::updateActiveElements(); } template <int DisplacementDim, typename ConstitutiveTraits> -- GitLab