From 280918d745c9c9ba4d0ed3f39d38f6151aa98840 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Mon, 28 Jun 2004 20:36:14 +0000
Subject: [PATCH] more fixes for netgen

---
 Mesh/3D_Mesh.cpp        |  6 ++++--
 Mesh/3D_Mesh_Netgen.cpp |  7 +++++--
 Mesh/Generator.cpp      | 13 +++++++------
 Netgen/nglib_addon.cpp  |  3 +++
 4 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/Mesh/3D_Mesh.cpp b/Mesh/3D_Mesh.cpp
index d6a9c7f390..60e5b5b492 100644
--- a/Mesh/3D_Mesh.cpp
+++ b/Mesh/3D_Mesh.cpp
@@ -1,4 +1,4 @@
-// $Id: 3D_Mesh.cpp,v 1.62 2004-06-26 21:34:50 geuzaine Exp $
+// $Id: 3D_Mesh.cpp,v 1.63 2004-06-28 20:36:14 geuzaine Exp $
 //
 // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 //
@@ -1024,6 +1024,7 @@ void Maillage_Volume(void *data, void *dum)
     POINTS_TREE = THEM->Simplexes;
     Tree_Action(v->Simplexes, add_points);
 
+#if 0 // this is full of bugs :-)
     if(CTX.mesh.quality) {
       extern void SwapEdges3D(Mesh * M, Volume * v, double GammaPrescribed,
                               bool order);
@@ -1034,8 +1035,9 @@ void Maillage_Volume(void *data, void *dum)
       Msg(STATUS3, "Swapping edges (last pass)");
       SwapEdges3D(THEM, v, CTX.mesh.quality, true);
     }
+#endif
 
-#if 0 // this is wrong
+#if 0 // this is full of bugs, too :-)
     if(CTX.mesh.nb_smoothing) {
       Msg(STATUS3, "Smoothing volume %d", v->Num);
       tnxe = Tree_Create (sizeof (NXE), compareNXE);
diff --git a/Mesh/3D_Mesh_Netgen.cpp b/Mesh/3D_Mesh_Netgen.cpp
index 15094430e2..2ebfebf366 100644
--- a/Mesh/3D_Mesh_Netgen.cpp
+++ b/Mesh/3D_Mesh_Netgen.cpp
@@ -1,4 +1,4 @@
-// $Id: 3D_Mesh_Netgen.cpp,v 1.5 2004-06-28 19:00:22 geuzaine Exp $
+// $Id: 3D_Mesh_Netgen.cpp,v 1.6 2004-06-28 20:36:14 geuzaine Exp $
 //
 // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 //
@@ -168,8 +168,11 @@ void Netgen::MeshVolume()
   Vertex **vtable = (Vertex **)Malloc(nbv * sizeof(Vertex*));
   
   // Get existing vertices
-  for(int i = 0; i < List_Nbr(_vertices); i++)
+  for(int i = 0; i < List_Nbr(_vertices); i++){
     List_Read(_vertices, i, &vtable[i]);
+    Tree_Insert(_vol->Vertices, &vtable[i]);
+    Tree_Insert(THEM->Vertices, &vtable[i]);
+  }
 
   // Create new volume vertices
   for(int i = List_Nbr(_vertices); i < nbv; i++) {
diff --git a/Mesh/Generator.cpp b/Mesh/Generator.cpp
index 8512c6bb46..601b825f80 100644
--- a/Mesh/Generator.cpp
+++ b/Mesh/Generator.cpp
@@ -1,4 +1,4 @@
-// $Id: Generator.cpp,v 1.55 2004-06-28 19:00:22 geuzaine Exp $
+// $Id: Generator.cpp,v 1.56 2004-06-28 20:36:14 geuzaine Exp $
 //
 // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 //
@@ -302,11 +302,12 @@ void Maillage_Dimension_3(Mesh * M)
   Free_Volume_But_Not_Elements(&v, NULL);
 
   // optimize quality
-  //if(CTX.mesh.quality) {
-  //for(int i = 0; i < List_Nbr(list); i++){
-  //  List_Read(list, i, &v);
-  //  Optimize_Netgen(v);
-  // }
+  if(CTX.mesh.quality) {
+    for(int i = 0; i < List_Nbr(list); i++){
+      List_Read(list, i, &v);
+      Optimize_Netgen(v);
+    }
+  }
 
   List_Delete(list);
 
diff --git a/Netgen/nglib_addon.cpp b/Netgen/nglib_addon.cpp
index 9b1c88a817..51d379a965 100644
--- a/Netgen/nglib_addon.cpp
+++ b/Netgen/nglib_addon.cpp
@@ -13,6 +13,9 @@ Ng_Result NgAddOn_OptimizeVolumeMesh (Ng_Mesh * mesh, Ng_Meshing_Parameters * mp
   mparam.maxh = mp->maxh;
   mparam.meshsizefilename = mp->meshsize_filename;
 
+  m->CalcLocalH();
+
+  //MeshVolume (mparam, *m);
   RemoveIllegalElements (*m);
   OptimizeVolume (mparam, *m, NULL);
 
-- 
GitLab