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

[PL/DS] Use unordered set for faster isDeactivated

parent 071980e7
No related branches found
No related tags found
No related merge requests found
......@@ -110,8 +110,8 @@ static DeactivatedSubdomainMesh createDeactivatedSubdomainMesh(
ranges::copy_if(elements, back_inserter(deactivated_elements), is_active,
[](auto const e) { return e->getID(); });
auto bulk_element_ids =
deactivated_elements | MeshLib::views::ids | ranges::to<std::vector>;
auto bulk_element_ids = deactivated_elements | MeshLib::views::ids |
ranges::to<std::unordered_set>;
static int mesh_number = 0;
// Subdomain mesh consisting of deactivated elements.
......
......@@ -34,7 +34,7 @@ bool DeactivatedSubdomain::isDeactivated(MeshLib::Element const& element,
double const time) const
{
auto const& bulk_element_ids = deactivated_subdomain_mesh.bulk_element_ids;
if (!ranges::contains(bulk_element_ids, element.getID()))
if (!bulk_element_ids.contains(element.getID()))
{
return false;
}
......
......@@ -16,6 +16,7 @@
#include <memory>
#include <optional>
#include <string>
#include <unordered_set>
#include <vector>
#include "MathLib/InterpolationAlgorithms/PiecewiseLinearInterpolation.h"
......@@ -40,7 +41,7 @@ struct DeactivatedSubdomainMesh
/// A mesh created from material ids (independent of time) for the
/// deactivated subdomain.
MeshLib::Mesh mesh;
std::vector<std::size_t> bulk_element_ids;
std::unordered_set<std::size_t> bulk_element_ids;
/// Inner nodes owned only by elements of the deactivated subdomain.
/// \see ProcessLib::createDeactivatedSubdomainMesh()
......
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