diff --git a/ProcessLib/ProcessVariable.cpp b/ProcessLib/ProcessVariable.cpp index 9b03c01720fd2e21ecdcba2b9f97ff6c0d135943..49a331b6f48ad6eda1e9c88d51c9059211703ae7 100644 --- a/ProcessLib/ProcessVariable.cpp +++ b/ProcessLib/ProcessVariable.cpp @@ -286,6 +286,15 @@ void ProcessVariable::updateDeactivatedSubdomains(double const time) { _ids_of_active_elements.clear(); + // If none of the deactivated subdomains is active at current time, then the + // _ids_of_active_elements remain empty. + if (std::none_of( + begin(_deactivated_subdomains), end(_deactivated_subdomains), + [&](auto const& ds) { return ds->isInTimeSupportInterval(time); })) + { + return; + } + auto const* const material_ids = MeshLib::materialIDs(_mesh); auto is_active_in_subdomain = [&](std::size_t const i,