From fdd81e2b3ed3711d407ce550ad1fe55fdc5a2e63 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Fri, 7 May 2004 21:13:34 +0000
Subject: [PATCH] re-enabled ONFILE background meshes in the 3D case

---
 Mesh/Simplex.cpp                | 33 +++++---------
 benchmarks/misc/bgmesh/proj.geo | 14 ++++++
 benchmarks/misc/bgmesh/proj.pro | 77 +++++++++++++++++++++++++++++++++
 3 files changed, 102 insertions(+), 22 deletions(-)
 create mode 100644 benchmarks/misc/bgmesh/proj.geo
 create mode 100644 benchmarks/misc/bgmesh/proj.pro

diff --git a/Mesh/Simplex.cpp b/Mesh/Simplex.cpp
index be07806c82..70bec6f985 100644
--- a/Mesh/Simplex.cpp
+++ b/Mesh/Simplex.cpp
@@ -1,4 +1,4 @@
-// $Id: Simplex.cpp,v 1.29 2004-02-07 01:40:22 geuzaine Exp $
+// $Id: Simplex.cpp,v 1.30 2004-05-07 21:13:34 geuzaine Exp $
 //
 // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 //
@@ -27,7 +27,7 @@
 #include "Context.h"
 
 extern Context_T CTX;
-extern Mesh *THEM;
+extern Mesh *THEM, *LOCAL;
 
 int Simplex::TotalAllocated = 0;
 int Simplex::TotalNumber = 0;
@@ -337,15 +337,10 @@ void Simplex::Fourre_Simplexe(Vertex * v1, Vertex * v2, Vertex * v3,
     F[3].V[1] = v3;
     F[3].V[2] = v4;
   }
+
   if(!v4) {
     N = 3;
-    if(FACE_DIMENSION == 1) {
-      //qsort(F[0].V,3,sizeof(Vertex*),compareVertex);
-      Center_Circum();
-      Quality = (double)N *Radius / (V[0]->lc + V[1]->lc + V[2]->lc
-                                     + ((V[3]) ? V[3]->lc : 0.0));
-    }
-    else {
+    if(FACE_DIMENSION != 1) {
       qsort(F[0].V, 3, sizeof(Vertex *), compareVertex);
       return;
     }
@@ -356,19 +351,13 @@ void Simplex::Fourre_Simplexe(Vertex * v1, Vertex * v2, Vertex * v3,
 
   Center_Circum();
 
-  /*
-     extern Mesh *THEM, *LOCAL;
-     if (LOCAL && N == 4 && CTX.mesh.algo == DELAUNAY_ISO && THEM->BGM.Typ == ONFILE){
-     Quality = fabs(Radius) / Lc_XYZ(Center.X, Center.Y, Center.Z, LOCAL);
-     if(Quality < 0.){
-     Msg(WARNING, "Negative simplex quality !?");
-     Quality = 4 * Radius / (V[0]->lc + V[1]->lc + V[2]->lc + V[3]->lc);
-     }
-     }
-   */
-
-  Quality = (double)N *Radius / (V[0]->lc + V[1]->lc + V[2]->lc
-                                 + ((V[3]) ? V[3]->lc : 0.0));
+  if(N == 4 && LOCAL && THEM && THEM->BGM.Typ == ONFILE){
+    Quality = fabs(4. * Radius / Lc_XYZ(Center.X, Center.Y, Center.Z, LOCAL));
+  }
+  else{
+    Quality = (double)N *Radius / (V[0]->lc + V[1]->lc + V[2]->lc + 
+				   ((V[3]) ? V[3]->lc : 0.0));
+  }
 
   for(i = 0; i < N; i++)
     qsort(F[i].V, N - 1, sizeof(Vertex *), compareVertex);
diff --git a/benchmarks/misc/bgmesh/proj.geo b/benchmarks/misc/bgmesh/proj.geo
new file mode 100644
index 0000000000..31caeecb4e
--- /dev/null
+++ b/benchmarks/misc/bgmesh/proj.geo
@@ -0,0 +1,14 @@
+Point(1) = {0.0,0.0,0.0,.25};
+Point(2) = {1,0.0,0.0,.25};         
+Point(3) = {1,1,0.0,.25};         
+Point(4) = {0,1,0.0,.25};         
+Line(1) = {4,3};         
+Line(2) = {3,2};         
+Line(3) = {2,1};         
+Line(4) = {1,4};         
+Line Loop(5) = {2,3,4,1};         
+Plane Surface(6) = {5};         
+Extrude Surface { 6, {0,0.0,1} };         
+Surface Loop(29) = {23,6,15,19,28,27};   
+Volume(30) = {29};   
+Physical Volume(1) = {30};
diff --git a/benchmarks/misc/bgmesh/proj.pro b/benchmarks/misc/bgmesh/proj.pro
new file mode 100644
index 0000000000..b48db486fb
--- /dev/null
+++ b/benchmarks/misc/bgmesh/proj.pro
@@ -0,0 +1,77 @@
+// Moronic getdp input file to create some test post-proessing maps
+
+Group {
+  Omega = Region[ {1} ];
+}
+
+Function {
+  Fct[] = (Sin[Pi*(X[]+1)]+1) * 0.4 + 0.05 ;
+}
+
+Jacobian {
+  { Name JVol ; Case { { Region All ; Jacobian Vol ; } } }
+  { Name JSur ; Case { { Region All ; Jacobian Sur ; } } }
+}
+
+Integration {
+  { Name I1 ;
+    Case { {Type Gauss ;
+            Case { { GeoElement Line        ; NumberOfPoints  4 ; }
+                   { GeoElement Triangle    ; NumberOfPoints  12 ; }
+                   { GeoElement Quadrangle  ; NumberOfPoints  4 ; }
+                   { GeoElement Tetrahedron ; NumberOfPoints  15 ; }
+                   { GeoElement Hexahedron  ; NumberOfPoints  34 ; }
+                   { GeoElement Prism       ; NumberOfPoints  9 ; } 
+                   { GeoElement Pyramid     ; NumberOfPoints  8 ; } }
+           }
+         }
+  }
+}
+
+FunctionSpace {
+  { Name Proj ; Type Form0 ; 
+    BasisFunction {
+      { Name sn ; NameOfCoef phin ; Function BF_Node ;
+        Support Omega ; Entity NodesOf[ All ] ; }
+    }
+  }
+}
+
+Formulation {
+  { Name Proj ; Type FemEquation ;
+    Quantity { 
+      { Name v ; Type Local ; NameOfSpace Proj ; }
+    }
+    Equation {
+      Galerkin { [ Dof{v} , {v} ] ;  In Omega ; Jacobian JVol ; Integration I1 ; }
+      Galerkin { [ -Fct[] , {v} ] ;  In Omega ; Jacobian JVol ; Integration I1 ; }
+    }
+  }
+
+}
+
+Resolution {
+  { Name Proj ;
+    System {
+      { Name Proj ; NameOfFormulation Proj ; Type Complex; Frequency 1; }
+    }
+    Operation { 
+      Generate Proj ; Solve Proj ; SaveSolution Proj ;
+    }
+  }
+
+}
+
+PostProcessing {
+  { Name Proj ; NameOfFormulation Proj  ;
+    Quantity {
+      { Name v ; Value { Term { [ {v} ] ; In Omega ; } } }
+      { Name v3 ; Value { Term { [ Vector[0,{v},0] ] ; In Omega ; } } }
+    }
+  }
+
+}
+
+PostOperation v UsingPost Proj {
+  Print[ v , OnElementsOf Omega , File "proj.pos" ] ;
+}
-- 
GitLab