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

make old algo available again

parent 8557e3f3
No related branches found
No related tags found
No related merge requests found
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#endif #endif
StringXNumber TriangulateOptions_Number[] = { StringXNumber TriangulateOptions_Number[] = {
{GMSH_FULLRC, "Algorithm", NULL, 0.},
{GMSH_FULLRC, "View", NULL, -1.} {GMSH_FULLRC, "View", NULL, -1.}
}; };
...@@ -35,7 +36,8 @@ std::string GMSH_TriangulatePlugin::getHelp() const ...@@ -35,7 +36,8 @@ std::string GMSH_TriangulatePlugin::getHelp() const
return "Plugin(Triangulate) triangulates the points in the " return "Plugin(Triangulate) triangulates the points in the "
"view `View', assuming that all the points belong " "view `View', assuming that all the points belong "
"to a surface that can be projected one-to-one " "to a surface that can be projected one-to-one "
"onto a plane.\n\n" "onto a plane. Algorithm selects the old (0) or new (1) "
"meshing algorithm.\n\n"
"If `View' < 0, the plugin is run on the current view.\n\n" "If `View' < 0, the plugin is run on the current view.\n\n"
"Plugin(Triangulate) creates one new view."; "Plugin(Triangulate) creates one new view.";
} }
...@@ -67,7 +69,8 @@ class PointData : public MVertex { ...@@ -67,7 +69,8 @@ class PointData : public MVertex {
PView *GMSH_TriangulatePlugin::execute(PView *v) PView *GMSH_TriangulatePlugin::execute(PView *v)
{ {
int iView = (int)TriangulateOptions_Number[0].def; int algo = (int)TriangulateOptions_Number[0].def;
int iView = (int)TriangulateOptions_Number[1].def;
PView *v1 = getView(iView, v); PView *v1 = getView(iView, v);
if(!v1) return v; if(!v1) return v;
...@@ -123,7 +126,10 @@ PView *GMSH_TriangulatePlugin::execute(PView *v) ...@@ -123,7 +126,10 @@ PView *GMSH_TriangulatePlugin::execute(PView *v)
} }
delete s; delete s;
#if 0 // old code PView *v2;
PViewDataList *data2;
if(algo == 0) {// using old code
// build a point record structure for the divide and conquer algorithm // build a point record structure for the divide and conquer algorithm
DocRecord doc(points.size()); DocRecord doc(points.size());
...@@ -145,8 +151,8 @@ PView *GMSH_TriangulatePlugin::execute(PView *v) ...@@ -145,8 +151,8 @@ PView *GMSH_TriangulatePlugin::execute(PView *v)
} }
// create output (using unperturbed data) // create output (using unperturbed data)
PView *v2 = new PView(); v2 = new PView();
PViewDataList *data2 = getDataList(v2); data2 = getDataList(v2);
for(int i = 0; i < doc.numTriangles; i++){ for(int i = 0; i < doc.numTriangles; i++){
int a = doc.triangles[i].a; int a = doc.triangles[i].a;
int b = doc.triangles[i].b; int b = doc.triangles[i].b;
...@@ -184,7 +190,9 @@ PView *GMSH_TriangulatePlugin::execute(PView *v) ...@@ -184,7 +190,9 @@ PView *GMSH_TriangulatePlugin::execute(PView *v)
vec->push_back(p[nod]->v[3 + numComp * step + comp]); vec->push_back(p[nod]->v[3 + numComp * step + comp]);
} }
#else // new code }
else{ // new code
Msg::Info("Using new triangulation code"); Msg::Info("Using new triangulation code");
std::vector<MTriangle*> tris; std::vector<MTriangle*> tris;
for(unsigned int i = 0; i < points.size(); i++) { for(unsigned int i = 0; i < points.size(); i++) {
...@@ -195,8 +203,8 @@ PView *GMSH_TriangulatePlugin::execute(PView *v) ...@@ -195,8 +203,8 @@ PView *GMSH_TriangulatePlugin::execute(PView *v)
} }
delaunayMeshIn2D(points, tris); delaunayMeshIn2D(points, tris);
PView *v2 = new PView(); v2 = new PView();
PViewDataList *data2 = getDataList(v2); data2 = getDataList(v2);
for(unsigned int i = 0; i < tris.size(); i++){ for(unsigned int i = 0; i < tris.size(); i++){
PointData *p[3]; PointData *p[3];
p[0] = (PointData*)tris[i]->getVertex(0); p[0] = (PointData*)tris[i]->getVertex(0);
...@@ -226,7 +234,8 @@ PView *GMSH_TriangulatePlugin::execute(PView *v) ...@@ -226,7 +234,8 @@ PView *GMSH_TriangulatePlugin::execute(PView *v)
vec->push_back(p[nod]->v[3 + numComp * step + comp]); vec->push_back(p[nod]->v[3 + numComp * step + comp]);
delete tris[i]; delete tris[i];
} }
#endif
}
for(unsigned int i = 0; i < points.size(); i++) for(unsigned int i = 0; i < points.size(); i++)
delete points[i]; delete points[i];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment