Skip to content
Snippets Groups Projects
Commit 745705e6 authored by Dmitri Naumov's avatar Dmitri Naumov
Browse files

Merge pull request #759 from norihiro-w/node-independent

fix circular dependency between Node and Mesh
parents 5f16b2c7 1b2342ff
No related branches found
No related tags found
No related merge requests found
......@@ -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,
......
......@@ -36,6 +36,7 @@
// MeshLib
#include "MeshLib/Mesh.h"
#include "MeshLib/Node.h"
#include "MeshLib/MeshSurfaceExtraction.h"
// MeshGeoToolsLib
#include "MeshGeoToolsLib/MeshNodeSearcher.h"
......
......@@ -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();
}
......
......@@ -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 */
......
......@@ -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"
......
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