Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions alpine/LoadBalancer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,18 @@ class LoadBalancer {
fs_m->getStype() == "FEM_PRECON") {
phi_m->updateLayout(*fl);
phi_m->setFieldBC(phi_m->getFieldBC());

if (fs_m->getStype() == "FEM") {
// also update the layout in the FEM space
auto& space = std::get<FEMSolver_t<T, Dim>>(fs_m->getSolver()).getSpace();
space.updateLayout(*fl);
}

if (fs_m->getStype() == "FEM_PRECON") {
// also update the layout in the FEM space
auto& space = std::get<FEMPreconSolver_t<T, Dim>>(fs_m->getSolver()).getSpace();
space.updateLayout(*fl);
}
}

// Update layout with new FieldLayout
Expand Down
8 changes: 8 additions & 0 deletions src/FEM/LagrangeSpace.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,14 @@ namespace ippl {
*/
void initializeElementIndices(Layout_t& layout);

///////////////////////////////////////////////////////////////////////
/**
* @brief Function to update the element partition and the layout of
* fields in the LagrangeSpace if the layout has been changed during
* the simulation (for example by the load balancer).
*/
void updateLayout(Layout_t& layout);

/// Degree of Freedom operations //////////////////////////////////////
///////////////////////////////////////////////////////////////////////

Expand Down
11 changes: 11 additions & 0 deletions src/FEM/LagrangeSpace.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,17 @@ namespace ippl {
});
}

// Update resultField and elementIndices according to changed domain decomposition.
template <typename T, unsigned Dim, unsigned Order, typename ElementType,
typename QuadratureType, typename FieldLHS, typename FieldRHS>
void LagrangeSpace<T, Dim, Order, ElementType, QuadratureType, FieldLHS,
FieldRHS>::updateLayout(Layout_t& layout) {
// repartition elements
initializeElementIndices(layout);
// update layout of resultField member variable
resultField.updateLayout(layout);
}

///////////////////////////////////////////////////////////////////////
/// Degree of Freedom operations //////////////////////////////////////
///////////////////////////////////////////////////////////////////////
Expand Down
Loading