/** * \file * * \copyright * Copyright (c) 2012-2023, OpenGeoSys Community (http://www.opengeosys.org) * Distributed under a Modified BSD License. * See accompanying file LICENSE.txt or * http://www.opengeosys.org/project/license * */ #include "getMeshElementsForMaterialIDs.h" #include #include "MeshLib/Elements/Element.h" #include "MeshLib/Mesh.h" namespace MeshLib { std::vector getMeshElementsForMaterialIDs( MeshLib::Mesh const& mesh, std::vector const& selected_material_ids) { auto const material_ids = *materialIDs(mesh); auto const& elements = mesh.getElements(); std::vector selected_elements; for (std::size_t i = 0; i < material_ids.size(); ++i) { if (ranges::contains(selected_material_ids, material_ids[i])) { selected_elements.push_back(elements[i]); } } return selected_elements; } } // namespace MeshLib