diff --git a/Gui/DataView/MshLayerMapper.cpp b/Gui/DataView/MshLayerMapper.cpp index 7a1bd056bb3c6160ac0ca2e0c7f39092c1d68bc8..6d4580d6f19a9a9ff4df00fed145a5177176d5f7 100644 --- a/Gui/DataView/MshLayerMapper.cpp +++ b/Gui/DataView/MshLayerMapper.cpp @@ -29,6 +29,7 @@ #include "Elements/Hex.h" #include "Elements/Pyramid.h" #include "Elements/Prism.h" +#include "MeshEditing/removeMeshNodes.h" #include "MeshSurfaceExtraction.h" #include "MathTools.h" @@ -219,7 +220,7 @@ int MshLayerMapper::LayerMapping(MeshLib::Mesh* new_mesh, const std::string &ras if (noData_nodes.size() < (nNodes - 2)) { WARN("MshLayerMapper::LayerMapping(): Removing %d mesh nodes at NoData values.", noData_nodes.size()); - MeshLib::Mesh* red_mesh = MeshLib::removeMeshNodes(new_mesh, noData_nodes); + MeshLib::Mesh* red_mesh = MeshLib::removeMeshNodes(*new_mesh, noData_nodes); if (new_mesh->getNElements() == 0) { delete new_mesh; diff --git a/MeshLib/MeshEditing/removeMeshEntities.cpp b/MeshLib/MeshEditing/ElementExtraction.cpp similarity index 75% rename from MeshLib/MeshEditing/removeMeshEntities.cpp rename to MeshLib/MeshEditing/ElementExtraction.cpp index 86c5dfcf16aa3a8107b96a7a749772b4d345a6a6..6c18fa0f5907bcb10860b2b5c8c2f02a5c41f85a 100644 --- a/MeshLib/MeshEditing/removeMeshEntities.cpp +++ b/MeshLib/MeshEditing/ElementExtraction.cpp @@ -2,7 +2,7 @@ * \file * \author Karsten Rink * \date 2013-04-04 - * \brief Implementation of removeMeshEntities. + * \brief Implementation of ElementExtraction. * * \copyright * Copyright (c) 2013, OpenGeoSys Community (http://www.opengeosys.org) @@ -12,7 +12,7 @@ * */ -#include "removeMeshEntities.h" +#include "ElementExtraction.h" #include "Mesh.h" #include "Elements/Element.h" #include "AABB.h" @@ -21,16 +21,16 @@ namespace MeshLib { -MeshElementRemoval::MeshElementRemoval(const MeshLib::Mesh &mesh) +ElementExtraction::ElementExtraction(const MeshLib::Mesh &mesh) : _mesh(mesh) { } -MeshElementRemoval::~MeshElementRemoval() +ElementExtraction::~ElementExtraction() { } -MeshLib::Mesh* MeshElementRemoval::removeMeshElements() const +MeshLib::Mesh* ElementExtraction::removeMeshElements() const { INFO("Removing total %d elements...", _marked_elements.size()); std::vector<MeshLib::Element*> tmp_elems = excludeElements(_mesh.getElements(), _marked_elements); @@ -43,7 +43,7 @@ MeshLib::Mesh* MeshElementRemoval::removeMeshElements() const return new MeshLib::Mesh(_mesh.getName(), new_nodes, new_elems); } -void MeshElementRemoval::searchByMaterialID(const std::vector<MeshLib::Element*> & ele_vec, unsigned matID) +void ElementExtraction::searchByMaterialID(const std::vector<MeshLib::Element*> & ele_vec, unsigned matID) { std::vector<std::size_t> matchedIDs; std::size_t i = 0; @@ -55,7 +55,7 @@ void MeshElementRemoval::searchByMaterialID(const std::vector<MeshLib::Element*> this->updateUnion(matchedIDs); } -void MeshElementRemoval::searchByElementType(const std::vector<MeshLib::Element*> & ele_vec, MeshElemType eleType) +void ElementExtraction::searchByElementType(const std::vector<MeshLib::Element*> & ele_vec, MeshElemType eleType) { std::vector<std::size_t> matchedIDs; std::size_t i = 0; @@ -67,7 +67,7 @@ void MeshElementRemoval::searchByElementType(const std::vector<MeshLib::Element* this->updateUnion(matchedIDs); } -void MeshElementRemoval::searchByZeroContent(const std::vector<MeshLib::Element*> & ele_vec) +void ElementExtraction::searchByZeroContent(const std::vector<MeshLib::Element*> & ele_vec) { std::vector<std::size_t> matchedIDs; std::size_t i = 0; @@ -79,7 +79,7 @@ void MeshElementRemoval::searchByZeroContent(const std::vector<MeshLib::Element* this->updateUnion(matchedIDs); } -void MeshElementRemoval::searchByBoundingBox(const std::vector<MeshLib::Element*> & ele_vec, const MeshLib::Node &x1, const MeshLib::Node &x2) +void ElementExtraction::searchByBoundingBox(const std::vector<MeshLib::Element*> & ele_vec, const MeshLib::Node &x1, const MeshLib::Node &x2) { std::vector<MeshLib::Node> extent; extent.push_back(x1); extent.push_back(x2); @@ -101,7 +101,7 @@ void MeshElementRemoval::searchByBoundingBox(const std::vector<MeshLib::Element* this->updateUnion(matchedIDs); } -void MeshElementRemoval::updateUnion(const std::vector<std::size_t> &vec) +void ElementExtraction::updateUnion(const std::vector<std::size_t> &vec) { std::vector<std::size_t> vec_temp(vec.size() + _marked_elements.size()); auto it = std::set_union(vec.begin(), vec.end(), _marked_elements.begin(), _marked_elements.end(), vec_temp.begin()); @@ -109,7 +109,7 @@ void MeshElementRemoval::updateUnion(const std::vector<std::size_t> &vec) _marked_elements.assign(vec_temp.begin(), vec_temp.end()); } -std::vector<MeshLib::Element*> MeshElementRemoval::excludeElements(const std::vector<MeshLib::Element*> & vec_src_eles, const std::vector<std::size_t> &vec_removed) const +std::vector<MeshLib::Element*> ElementExtraction::excludeElements(const std::vector<MeshLib::Element*> & vec_src_eles, const std::vector<std::size_t> &vec_removed) const { std::vector<MeshLib::Element*> vec_dest_eles(vec_src_eles.size() - vec_removed.size()); std::size_t k=0; @@ -122,7 +122,7 @@ std::vector<MeshLib::Element*> MeshElementRemoval::excludeElements(const std::ve return vec_dest_eles; } -void MeshElementRemoval::copyNodesElements( const std::vector<MeshLib::Node*> &src_nodes, const std::vector<MeshLib::Element*> &src_elems, +void ElementExtraction::copyNodesElements( const std::vector<MeshLib::Node*> &src_nodes, const std::vector<MeshLib::Element*> &src_elems, std::vector<MeshLib::Node*> &dst_nodes, std::vector<MeshLib::Element*> &dst_elems) const { // copy nodes diff --git a/MeshLib/MeshEditing/removeMeshEntities.h b/MeshLib/MeshEditing/ElementExtraction.h similarity index 87% rename from MeshLib/MeshEditing/removeMeshEntities.h rename to MeshLib/MeshEditing/ElementExtraction.h index 29819fc5e7bb81b4ff17fd098c667752848cbe10..30893c9223a72bc3e53a1eb620542680c143f385 100644 --- a/MeshLib/MeshEditing/removeMeshEntities.h +++ b/MeshLib/MeshEditing/ElementExtraction.h @@ -2,7 +2,7 @@ * \file * \author Karsten Rink * \date 2013-04-04 - * \brief Definition of the removeMeshEntities + * \brief Definition of the ElementExtraction * * \copyright * Copyright (c) 2013, OpenGeoSys Community (http://www.opengeosys.org) @@ -12,8 +12,8 @@ * */ -#ifndef REMOVEMESHENTITIES_H -#define REMOVEMESHENTITIES_H +#ifndef ELEMENTEXTRACTION_H +#define ELEMENTEXTRACTION_H #include <vector> #include "MeshEnums.h" @@ -25,12 +25,12 @@ namespace MeshLib { class Mesh; class Element; -class MeshElementRemoval +class ElementExtraction { public: - MeshElementRemoval::MeshElementRemoval(const MeshLib::Mesh &mesh); + ElementExtraction(const MeshLib::Mesh &mesh); - MeshElementRemoval::~MeshElementRemoval(); + ~ElementExtraction(); /// Removes all mesh elements marked by search-methods. MeshLib::Mesh* removeMeshElements() const; @@ -65,4 +65,4 @@ private: } // end namespace MeshLib -#endif //REMOVEMESHENTITIES_H +#endif //ELEMENTEXTRACTION_H diff --git a/MeshLib/Node.h b/MeshLib/Node.h index 7565c559c93b22dde23c1a0e499a95721131faa9..1e8df76542c71b08a73590b16ac5e4e8229c1beb 100644 --- a/MeshLib/Node.h +++ b/MeshLib/Node.h @@ -22,7 +22,7 @@ #include "PointWithID.h" #include "Mesh.h" -#include "MeshEditing/removeMeshEntities.h" +#include "MeshEditing/removeMeshNodes.h" #include "MeshSurfaceExtraction.h" #ifdef OGS_BUILD_GUI #include "../Gui/DataView/MshLayerMapper.h"