Skip to content
Snippets Groups Projects
Commit 164b5be9 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

improve reproductibility of 2D mesh algorithm (compare vertices and triangles...

improve reproductibility of 2D mesh algorithm (compare vertices and triangles by number, not by pointer)
parent 1cb47d2a
No related branches found
No related tags found
No related merge requests found
...@@ -25,7 +25,7 @@ class MEdge { ...@@ -25,7 +25,7 @@ class MEdge {
MEdge(MVertex *v0, MVertex *v1) MEdge(MVertex *v0, MVertex *v1)
{ {
_v[0] = v0; _v[1] = v1; _v[0] = v0; _v[1] = v1;
if(_v[1] < _v[0]) { if(_v[1]->getNum() < _v[0]->getNum()) {
_si[0] = 1; _si[0] = 1;
_si[1] = 0; _si[1] = 0;
} }
...@@ -109,12 +109,11 @@ struct Equal_Edge : public std::binary_function<MEdge, MEdge, bool> { ...@@ -109,12 +109,11 @@ struct Equal_Edge : public std::binary_function<MEdge, MEdge, bool> {
struct Less_Edge : public std::binary_function<MEdge, MEdge, bool> { struct Less_Edge : public std::binary_function<MEdge, MEdge, bool> {
bool operator()(const MEdge &e1, const MEdge &e2) const bool operator()(const MEdge &e1, const MEdge &e2) const
{ {
if(e1.getMinVertex() < e2.getMinVertex()) return true; if(e1.getMinVertex()->getNum() < e2.getMinVertex()->getNum()) return true;
if(e1.getMinVertex() > e2.getMinVertex()) return false; if(e1.getMinVertex()->getNum() > e2.getMinVertex()->getNum()) return false;
if(e1.getMaxVertex() < e2.getMaxVertex()) return true; if(e1.getMaxVertex()->getNum() < e2.getMaxVertex()->getNum()) return true;
return false; return false;
} }
}; };
#endif #endif
...@@ -13,13 +13,10 @@ ...@@ -13,13 +13,10 @@
#include "meshGFaceDelaunayInsertion.h" #include "meshGFaceDelaunayInsertion.h"
#include "STensor3.h" #include "STensor3.h"
class GFace; class GFace;
class GVertex; class GVertex;
class MVertex; class MVertex;
class edge_angle { class edge_angle {
public : public :
MVertex *v1, *v2; MVertex *v1, *v2;
...@@ -31,7 +28,7 @@ class edge_angle { ...@@ -31,7 +28,7 @@ class edge_angle {
} }
}; };
typedef std::map<MVertex*, std::vector<MElement*> > v2t_cont; typedef std::map<MVertex*, std::vector<MElement*>, MVertexLessThanNum > v2t_cont;
typedef std::map<MEdge, std::pair<MElement*, MElement*>, Less_Edge> e2t_cont; typedef std::map<MEdge, std::pair<MElement*, MElement*>, Less_Edge> e2t_cont;
template <class T> void buildVertexToElement(std::vector<T*> &eles, v2t_cont &adj){ template <class T> void buildVertexToElement(std::vector<T*> &eles, v2t_cont &adj){
...@@ -51,6 +48,7 @@ template <class T> void buildVertexToElement(std::vector<T*> &eles, v2t_cont &ad ...@@ -51,6 +48,7 @@ template <class T> void buildVertexToElement(std::vector<T*> &eles, v2t_cont &ad
} }
} }
} }
template <class T> void buildEdgeToElement(std::vector<T*> &eles, e2t_cont &adj); template <class T> void buildEdgeToElement(std::vector<T*> &eles, e2t_cont &adj);
void buildVertexToTriangle(std::vector<MTriangle*> &, v2t_cont &adj); void buildVertexToTriangle(std::vector<MTriangle*> &, v2t_cont &adj);
...@@ -184,4 +182,3 @@ class Temporary{ ...@@ -184,4 +182,3 @@ class Temporary{
/***************************************************/ /***************************************************/
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment