diff --git a/Applications/Utils/MeshEdit/AddTopLayer.cpp b/Applications/Utils/MeshEdit/AddTopLayer.cpp index c3cdd682190fc3ba0eafafe6398d74f918697e97..1098f13e21283c8ff16050ea8ff94d8b1e20f81f 100644 --- a/Applications/Utils/MeshEdit/AddTopLayer.cpp +++ b/Applications/Utils/MeshEdit/AddTopLayer.cpp @@ -29,6 +29,7 @@ #include "MeshLib/Mesh.h" #include "MeshLib/Node.h" #include "MeshLib/Elements/Elements.h" +#include "MeshLib/MeshSurfaceExtraction.h" MeshLib::Prism* extrudeElement(std::vector<MeshLib::Node*> const& subsfc_nodes, MeshLib::Tri const*const sfc_elem, diff --git a/Applications/Utils/MeshEdit/CreateBoundaryConditionsAlongPolylines.cpp b/Applications/Utils/MeshEdit/CreateBoundaryConditionsAlongPolylines.cpp index 08ccb0cd3a110c4c6100f5a020ac3ac107055dc4..55d4cfc1e6e7a149d66810fc8bf13a5b9ed5c49b 100644 --- a/Applications/Utils/MeshEdit/CreateBoundaryConditionsAlongPolylines.cpp +++ b/Applications/Utils/MeshEdit/CreateBoundaryConditionsAlongPolylines.cpp @@ -36,6 +36,7 @@ // MeshLib #include "MeshLib/Mesh.h" #include "MeshLib/Node.h" +#include "MeshLib/MeshSurfaceExtraction.h" // MeshGeoToolsLib #include "MeshGeoToolsLib/MeshNodeSearcher.h" diff --git a/MeshLib/Mesh.cpp b/MeshLib/Mesh.cpp index af0dac3b2287ed762ec1f2cfd84ce77f67fdcaaa..ed6e1ce61c4168b0c116aeb90738738edd5fe940 100644 --- a/MeshLib/Mesh.cpp +++ b/MeshLib/Mesh.cpp @@ -16,6 +16,7 @@ #include "BaseLib/RunTime.h" +#include "Elements/Element.h" #include "Elements/Tri.h" #include "Elements/Quad.h" #include "Elements/Tet.h" @@ -143,7 +144,7 @@ void Mesh::resetElementsConnectedToNodes() { for (auto node = _nodes.begin(); node != _nodes.end(); ++node) if (*node) - (*node)->_elements.clear(); + (*node)->clearElements(); this->setElementsConnectedToNodes(); } diff --git a/MeshLib/Node.h b/MeshLib/Node.h index cbf789f62e20d5a8d11990fe36a10cb93e6582c3..6b6573ee0d0a3719ff321b1b610c84fb93e0b87d 100644 --- a/MeshLib/Node.h +++ b/MeshLib/Node.h @@ -17,16 +17,10 @@ #include <cstdlib> #include <limits> -#include <set> #include <vector> #include "MathLib/Point3dWithID.h" - -#include "MeshEditing/removeMeshNodes.h" -#include "MeshGenerators/MeshLayerMapper.h" - -#include "MeshSurfaceExtraction.h" -#include "Mesh.h" +#include "MathLib/Vector3.h" namespace MeshLib { @@ -37,12 +31,9 @@ class Element; */ class Node : public MathLib::Point3dWithID { - /* friend functions: */ - friend bool MeshLayerMapper::layerMapping(MeshLib::Mesh &mesh, const GeoLib::Raster &raster, double noDataReplacementValue); - friend MeshLib::Mesh* MeshSurfaceExtraction::getMeshSurface(const MeshLib::Mesh &mesh, const MathLib::Vector3 &dir, double angle, bool keep3dMeshIds); - /* friend classes: */ friend class Mesh; + friend class MeshSurfaceExtraction; friend class MeshRevision; public: @@ -79,6 +70,10 @@ public: return Node(_x[0]-v[0], _x[1]-v[1], _x[2]-v[2]); } + /// Update coordinates of a node. + /// This method automatically also updates the areas/volumes of all connected elements. + virtual void updateCoordinates(double x, double y, double z); + protected: /** * Add an element the node is part of. @@ -86,6 +81,9 @@ protected: */ void addElement(Element* elem) { _elements.push_back(elem); } + /// clear stored elements connecting to this node + void clearElements() { _elements.clear(); } + /// Resets the connected nodes of this node. The connected nodes are /// generated by Mesh::setNodesConnectedByEdges() and /// Mesh::setNodesConnectedByElements(). @@ -97,10 +95,6 @@ protected: /// Sets the ID of a node to the given value. void setID(std::size_t id) { this->_id = id; } - /// Update coordinates of a node. - /// This method automatically also updates the areas/volumes of all connected elements. - virtual void updateCoordinates(double x, double y, double z); - std::vector<Node*> _connected_nodes; std::vector<Element*> _elements; }; /* class */ diff --git a/Tests/MeshLib/TestDuplicate.cpp b/Tests/MeshLib/TestDuplicate.cpp index 210a6b642ace1a0479afa65129fc61d1573238b5..9bd7169e50c842381395e7b9942cbd91ee392e93 100644 --- a/Tests/MeshLib/TestDuplicate.cpp +++ b/Tests/MeshLib/TestDuplicate.cpp @@ -19,6 +19,7 @@ #include "MeshLib/Node.h" #include "Elements/Element.h" #include "MeshEditing/DuplicateMeshComponents.h" +#include "MeshEditing/removeMeshNodes.h" #include "MeshGenerators/MeshGenerator.h" #include "MeshQuality/MeshValidation.h" #include "MathTools.h"