Skip to content
Snippets Groups Projects
Commit 2cc062a3 authored by Dmitri Naumov's avatar Dmitri Naumov
Browse files

[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.
parent 83b65609
No related branches found
No related tags found
No related merge requests found
......@@ -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()
......
......@@ -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
......
......@@ -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>
......
......@@ -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>
......
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