Skip to content
Snippets Groups Projects
Commit bcae5c77 authored by Tom Fischer's avatar Tom Fischer
Browse files

[MeL] Extract createMaterialIDsBasedSubMesh() to own file

parent 9cffe665
No related branches found
No related tags found
No related merge requests found
......@@ -418,14 +418,4 @@ bool isBaseNode(Node const& node,
return local_index < n_base_nodes;
}
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
......@@ -309,10 +309,6 @@ bool isBaseNode(Node const& node,
std::pair<double, double> minMaxEdgeLength(
std::vector<Element*> const& elements);
std::unique_ptr<MeshLib::Mesh> createMaterialIDsBasedSubMesh(
MeshLib::Mesh const& mesh, std::vector<int> const& material_ids,
std::string const& name_for_created_mesh);
/// MeshLib specific, lazy, non-owning, non-mutating, composable range views.
namespace views
{
......
/**
* \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/MeshEditing/DuplicateMeshComponents.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
/**
* \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
*
*/
#pragma once
#include <memory>
#include <string>
#include <vector>
namespace MeshLib
{
class Mesh;
std::unique_ptr<MeshLib::Mesh> createMaterialIDsBasedSubMesh(
MeshLib::Mesh const& mesh, std::vector<int> const& material_ids,
std::string const& name_for_created_mesh);
} // namespace MeshLib
......@@ -16,6 +16,7 @@
#include "BaseLib/ConfigTree.h"
#include "BaseLib/StringTools.h" // required for splitMaterialIDString
#include "MeshLib/Mesh.h"
#include "MeshLib/Utils/createMaterialIDsBasedSubMesh.h"
#include "MeshLib/Utils/transformMeshToNodePartitionedMesh.h"
#ifdef USE_PETSC
#include "MeshLib/NodePartitionedMesh.h"
......
......@@ -12,10 +12,10 @@
#include <memory>
#include <numeric>
#include "MeshLib/Elements/Element.h"
#include "MeshLib/Mesh.h"
#include "MeshLib/Node.h"
#include "MeshToolsLib/MeshGenerators/MeshGenerator.h"
#include "MeshLib/Utils/createMaterialIDsBasedSubMesh.h"
using namespace MeshLib;
......
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