/*

Boggus exemples => No time to correct

See J-M Mirebeau FH 2017 ..

a first correction

--- a/examples/plugin/GeometryQA.cpp    Fri Dec 01 16:53:54 2017 +0100
+++ b/examples/plugin/GeometryQA.cpp    Wed Dec 06 10:05:54 2017 +0100
@@ -376,6 +376,7 @@
     Edge **minEdge= new Edge *[nv_iso]();
     Edge **maxEdge= new Edge *[nv_iso]();
     R2   *eigenVec= new R2[nv_iso];
+    cout << " nv = " << nv() << endl;
     for(int i=0; i<nv_iso; i++) eigenVec[i]=vertices[i].getm().eigensys();

     for(int i=0; i<ne_iso; i++){
@@ -400,10 +401,11 @@
     for(int i=0; i<ne_iso; i++){
         Edge *e=&edges[i];
         if(!e->isRepresentative()) continue;
-
+        cout << " nv = " << nv() << " " << ne_oriented() << endl;
+
         const int indexu = vertices.index(e->getu()), indexv = vertices.index(e->getv());
-        bool extru= (e==minEdge[indexu]) || (e==maxEdge[indexu]);
-        bool extrv= (e==minEdge[indexv]) || (e==maxEdge[indexv]);
+        bool extru= indexu<nv_iso && ( (e==minEdge[indexu]) || (e==maxEdge[indexu]));
+        bool extrv= indexv<nv_iso && ( (e==minEdge[indexv]) || (e==maxEdge[indexv]));

         if(!extru && !extrv) continue;
         Edge *const f=e->hRefine2(h, edges, vertices, metric, NULL); //non recursive split.

but after ...

		CheckPtr:  erreur delete []
		CheckPtr:  erreur delete []
Triangulation::hRefineQA : Intermediate anisotropic triangulation contains 540 triangles.
Triangulation::hRefineQA : Final triangulation contains 547 triangles after refinement of the boundary.
Exporting edges
  current line = 14
Assertion fail : (area>0)
	line :281, in file ./../femlib/fem.hpp
Assertion fail : (area>0)
	line :281, in file ./../femlib/fem.hpp
 err code 5 ,  mpirank 0
Process 26872 exited with status = 5 (0x00000005)
*/
load "FreeFemQA"


mesh Th=square(1,1,[x,y]);

func scal = 1/(x+0.2)^2;

//func scal = 5;

func mxx=100*scal;
func mxy=0;
func myy=scal;

Th=adaptmesh(Th,4*scal,0,4*scal,IsMetric=true);
Th=MeshGenQA(Th,mxx,mxy,myy,exportToMathematica=true,exportMetricToMathematica=true,finalRefine=false);
plot(Th,wait=true,ps="o/IsoFFMesh.ps");

//Th=readmesh("triQA.msh");
plot(Th,ps="o/QAMesh.ps");


//mesh Th=readmesh("/Users/jean-mariemirebeau/Library/Developer/Xcode/DerivedData/DelaunayFlip-deaxqdiomhuvirblsdlxiubujmam/Build/Products/Debug/Th.msh");
//plot(Th);

//Le sens Geometry->FF a l'air de marcher.
//Maintenant, il faut le sens inverse.

//mesh Th=square(1,1,[x,y]);
//savemesh(Th,"ThFF.msh");


;
