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 @@
#endif
StringXNumber TriangulateOptions_Number[] = {
{GMSH_FULLRC, "Algorithm", NULL, 0.},
{GMSH_FULLRC, "View", NULL, -1.}
};
......@@ -35,7 +36,8 @@ std::string GMSH_TriangulatePlugin::getHelp() const
return "Plugin(Triangulate) triangulates the points in the "
"view `View', assuming that all the points belong "
"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"
"Plugin(Triangulate) creates one new view.";
}
......@@ -67,7 +69,8 @@ class PointData : public MVertex {
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);
if(!v1) return v;
......@@ -123,7 +126,10 @@ PView *GMSH_TriangulatePlugin::execute(PView *v)
}
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
DocRecord doc(points.size());
......@@ -145,8 +151,8 @@ PView *GMSH_TriangulatePlugin::execute(PView *v)
}
// create output (using unperturbed data)
PView *v2 = new PView();
PViewDataList *data2 = getDataList(v2);
v2 = new PView();
data2 = getDataList(v2);
for(int i = 0; i < doc.numTriangles; i++){
int a = doc.triangles[i].a;
int b = doc.triangles[i].b;
......@@ -184,7 +190,9 @@ PView *GMSH_TriangulatePlugin::execute(PView *v)
vec->push_back(p[nod]->v[3 + numComp * step + comp]);
}
#else // new code
}
else{ // new code
Msg::Info("Using new triangulation code");
std::vector<MTriangle*> tris;
for(unsigned int i = 0; i < points.size(); i++) {
......@@ -195,8 +203,8 @@ PView *GMSH_TriangulatePlugin::execute(PView *v)
}
delaunayMeshIn2D(points, tris);
PView *v2 = new PView();
PViewDataList *data2 = getDataList(v2);
v2 = new PView();
data2 = getDataList(v2);
for(unsigned int i = 0; i < tris.size(); i++){
PointData *p[3];
p[0] = (PointData*)tris[i]->getVertex(0);
......@@ -226,7 +234,8 @@ PView *GMSH_TriangulatePlugin::execute(PView *v)
vec->push_back(p[nod]->v[3 + numComp * step + comp]);
delete tris[i];
}
#endif
}
for(unsigned int i = 0; i < points.size(); 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