https://gitlab.opengeosys.org/ogs/ogs.git
Raw File
Tip revision: ba8674409fb488ed221447a1c609bfee6acb7378 authored by Karsten Rink on 06 November 2023, 10:58:09 UTC
Merge branch 'RemoveMeshElementsInvertBoundingBox' into 'master'
Tip revision: ba86744
createMaterialIDsBasedSubMesh.cpp
/**
 * \file
 * \author Karsten Rink
 * \date   2012-05-02
 * \brief Implementation of the Mesh class.
 *
 * \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 "MeshLib/Utils/createMaterialIDsBasedSubMesh.h"

#include "MeshLib/Mesh.h"
#include "MeshLib/Utils/DuplicateMeshComponents.h"
#include "MeshLib/Utils/createMeshFromElementSelection.h"
#include "MeshLib/Utils/getMeshElementsForMaterialIDs.h"

namespace MeshLib
{
std::unique_ptr<MeshLib::Mesh> createMaterialIDsBasedSubMesh(
    MeshLib::Mesh const& mesh, std::vector<int> const& material_ids,
    std::string const& name_for_created_mesh)
{
    auto const elements =
        MeshLib::getMeshElementsForMaterialIDs(mesh, material_ids);
    return MeshLib::createMeshFromElementSelection(
        name_for_created_mesh, MeshLib::cloneElements(elements));
}
}  // namespace MeshLib
back to top