From d3715377f768ddfbd32bc690cc07e0ffe54e555e Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Wed, 14 Nov 2001 19:00:05 +0000
Subject: [PATCH] fix quadrangle extrusion crash

---
 Makefile            |  6 +++---
 Mesh/3D_Extrude.cpp | 26 +++++++++++++-------------
 Mesh/Vertex.cpp     |  3 +--
 doc/VERSIONS        |  4 ++--
 doc/gmsh.1          |  4 ++--
 doc/gmsh.html       | 18 +++++++++---------
 utils/gmsh.spec     |  4 ++--
 7 files changed, 32 insertions(+), 33 deletions(-)

diff --git a/Makefile b/Makefile
index 008ca92423..ccf492b54c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
-# $Id: Makefile,v 1.161 2001-11-13 13:22:21 geuzaine Exp $
+# $Id: Makefile,v 1.162 2001-11-14 19:00:05 geuzaine Exp $
 
-GMSH_RELEASE = 1.29
+GMSH_RELEASE = 1.30
 
 MAKE = make
 CXX = c++
@@ -306,7 +306,7 @@ compile_linux_gcc-2.95:
 	@for i in $(GMSH_FLTK_DIR); do (cd $$i && $(MAKE) \
            "CXX=$(HOME)/gcc-2.95.3/bin/g++" \
            "CC=$(HOME)/gcc-2.95.3/bin/gcc" \
-           "OPT_FLAGS=-O0" \
+           "OPT_FLAGS=-g" \
            "OS_FLAGS=-D_LITTLE_ENDIAN" \
            "VERSION_FLAGS=-D_FLTK" \
            "GL_INCLUDE=-I/usr/X11R6/include" \
diff --git a/Mesh/3D_Extrude.cpp b/Mesh/3D_Extrude.cpp
index 3cd81601a2..00b45b8563 100644
--- a/Mesh/3D_Extrude.cpp
+++ b/Mesh/3D_Extrude.cpp
@@ -1,4 +1,4 @@
-// $Id: 3D_Extrude.cpp,v 1.49 2001-10-29 08:52:20 geuzaine Exp $
+// $Id: 3D_Extrude.cpp,v 1.50 2001-11-14 19:00:05 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Numeric.h"
@@ -806,7 +806,7 @@ int Extrude_Mesh (Curve * c){
 void copy_mesh (Surface * from, Surface * to){
   List_T *list = Tree2List (from->Simplexes);
   Simplex *s, *news;
-  Vertex **pV, *vi[3], *v;
+  Vertex **pV, *vi[4], *v;
 
   int nb = Tree_Nbr(to->Simplexes);
   if(nb){
@@ -816,25 +816,25 @@ void copy_mesh (Surface * from, Surface * to){
     return;
   }
 
-  for (int i = 0; i < List_Nbr (list); i++){
+  for (int i = 0; i < List_Nbr(list); i++){
     List_Read (list, i, &s);
     for (int j = 0; j < 4; j++){
       if(s->V[j]){
 	v = s->V[j];
-	vi[j] = Create_Vertex (++THEM->MaxPointNum, v->Pos.X,
-			       v->Pos.Y, v->Pos.Z, v->lc, v->u);
-	ep->Extrude (ep->mesh.NbLayer - 1, ep->mesh.NbElmLayer[ep->mesh.NbLayer - 1],
-		     vi[j]->Pos.X, vi[j]->Pos.Y, vi[j]->Pos.Z);
-	if (Vertex_Bound && (pV = (Vertex **) Tree_PQuery (Vertex_Bound, &vi[j]))){
-	  //Crash gcc2.95! Free_Vertex(&vi[j],0);
+	vi[j] = Create_Vertex(++THEM->MaxPointNum, v->Pos.X,
+			      v->Pos.Y, v->Pos.Z, v->lc, v->u);
+	ep->Extrude(ep->mesh.NbLayer - 1, ep->mesh.NbElmLayer[ep->mesh.NbLayer - 1],
+		    vi[j]->Pos.X, vi[j]->Pos.Y, vi[j]->Pos.Z);
+	if (Vertex_Bound && (pV = (Vertex **) Tree_PQuery(Vertex_Bound, &vi[j]))){
+	  Free_Vertex(&vi[j],0);
 	  vi[j] = *pV;
 	}
 	else{
-	  Tree_Insert (THEM->Vertices, &vi[j]);
-	  Tree_Insert (Vertex_Bound, &vi[j]);
+	  Tree_Insert(THEM->Vertices, &vi[j]);
+	  Tree_Insert(Vertex_Bound, &vi[j]);
 	}
-	if (ToAdd)
-	  Tree_Insert (ToAdd, &vi[j]);
+	if(ToAdd)
+	  Tree_Insert(ToAdd, &vi[j]);
       }
       else{
 	vi[j] = NULL;
diff --git a/Mesh/Vertex.cpp b/Mesh/Vertex.cpp
index 371cbee2b9..7cb296b911 100644
--- a/Mesh/Vertex.cpp
+++ b/Mesh/Vertex.cpp
@@ -1,4 +1,4 @@
-// $Id: Vertex.cpp,v 1.11 2001-10-29 08:52:20 geuzaine Exp $
+// $Id: Vertex.cpp,v 1.12 2001-11-14 19:00:05 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Numeric.h"
@@ -111,7 +111,6 @@ int compareVertex (const void *a, const void *b){
   w = (Vertex **) b;
   i = abs ((*q)->Num);
   j = abs ((*w)->Num);
-
   return (i - j);
 }
 
diff --git a/doc/VERSIONS b/doc/VERSIONS
index 58015cf925..1992953af7 100644
--- a/doc/VERSIONS
+++ b/doc/VERSIONS
@@ -1,6 +1,6 @@
-$Date: 2001-11-14 15:31:30 $
+$Date: 2001-11-14 19:00:05 $
 
-New in 1.30: Interface polish; various small bug fixes and additions;
+New in 1.30: Interface polish; fix crash when extruding quadrangles;
 
 New in 1.29: Translations and rotations can now be combined in
 extrusions; fixed coherence bug in Extrude Line; various small
diff --git a/doc/gmsh.1 b/doc/gmsh.1
index 0e0429788a..56ebac25c2 100644
--- a/doc/gmsh.1
+++ b/doc/gmsh.1
@@ -5,7 +5,7 @@
 .\" Copyright (c) 2000-2001 J.-F. Remacle, C. Geuzaine
 .\" 
 .\" ======================================================================
-.TH Gmsh 1 "12 November 2001" "Version 1.29" "Gmsh Manual Pages"
+.TH Gmsh 1 "12 November 2001" "Version 1.30" "Gmsh Manual Pages"
 .UC 4
 .\" ======================================================================
 .SH NAME
@@ -225,6 +225,6 @@ Remacle (Remacle@scorec.rpi.edu).
 .SH SEE ALSO
 .BR getdp (1),
 .br
-Gmsh examples (\fI/usr/doc/gmsh-1.29/\fR),
+Gmsh examples (\fI/usr/doc/gmsh-1.30/\fR),
 .br
 Gmsh homepage (\fIhttp://www.geuz.org/gmsh/\fR).
diff --git a/doc/gmsh.html b/doc/gmsh.html
index c407b27bc4..32fe3fae16 100644
--- a/doc/gmsh.html
+++ b/doc/gmsh.html
@@ -27,7 +27,7 @@ generator with built-in pre- and post-processing facilities</h1>
 <p>
 <h3 align="center">Christophe Geuzaine and Jean-François Remacle</h3>
 <p>
-<h3 align=center>Version <a href="doc/VERSIONS">1.29</a>, 13 November 2001</h3>
+<h3 align=center>Version <a href="doc/VERSIONS">1.30</a>, 15 November 2001</h3>
 <p>
 
 <h2>Description</h2>
@@ -185,14 +185,14 @@ name="opengl-footmark"><sup>1</sup></a>. The only thing required if
 you use Gmsh is to mention it in your work. The tutorial and demo
 files are included in the archives.
 <ul>
-<li><A href="/gmsh/bin/gmsh-1.29-Windows.zip">Windows zip archive (95/98/NT)</A>
-<li><A href="/gmsh/bin/gmsh-1.29-1.i386.rpm">Linux RPM (Red Hat 6.2 and compatible, i386, glibc 2.1)</A> 
-<li><A href="/gmsh/bin/gmsh-1.29-Linux.tgz">Linux tarball (i386, glibc 2.1)</A> 
-<li><A href="/gmsh/bin/gmsh-1.29-OSF1.tgz">Compaq Tru64 tarball (OSF 4.0)</A> 
-<li><A href="/gmsh/bin/gmsh-1.29-SunOS.tgz">Sun tarball (SunOS 5.5)</A> 
-<li><A href="/gmsh/bin/gmsh-1.29-AIX.tgz">IBM tarball (AIX)</A> 
-<li><A href="/gmsh/bin/gmsh-1.29-IRIX.tgz">SGI IRIX tarball (IRIX 6.5)</A> 
-<li><A href="/gmsh/bin/gmsh-1.29-HP-UX.tgz">HP tarball (HPUX 10.20)</A>
+<li><A href="/gmsh/bin/gmsh-1.30-Windows.zip">Windows zip archive (95/98/NT)</A>
+<li><A href="/gmsh/bin/gmsh-1.30-1.i386.rpm">Linux RPM (Red Hat 6.2 and compatible, i386, glibc 2.1)</A> 
+<li><A href="/gmsh/bin/gmsh-1.30-Linux.tgz">Linux tarball (i386, glibc 2.1)</A> 
+<li><A href="/gmsh/bin/gmsh-1.30-OSF1.tgz">Compaq Tru64 tarball (OSF 4.0)</A> 
+<li><A href="/gmsh/bin/gmsh-1.30-SunOS.tgz">Sun tarball (SunOS 5.5)</A> 
+<li><A href="/gmsh/bin/gmsh-1.30-AIX.tgz">IBM tarball (AIX)</A> 
+<li><A href="/gmsh/bin/gmsh-1.30-IRIX.tgz">SGI IRIX tarball (IRIX 6.5)</A> 
+<li><A href="/gmsh/bin/gmsh-1.30-HP-UX.tgz">HP tarball (HPUX 10.20)</A>
 </ul>
 
 <p>
diff --git a/utils/gmsh.spec b/utils/gmsh.spec
index cc4ee21960..1f8672d5e0 100644
--- a/utils/gmsh.spec
+++ b/utils/gmsh.spec
@@ -1,7 +1,7 @@
 Summary: A 3D mesh generator with pre- and post-processing facilities
 Name: gmsh
-Version: 1.29
-Source: gmsh-1.29.tar.gz
+Version: 1.30
+Source: gmsh-1.30.tar.gz
 Release: 1
 Copyright: distributable
 Group: Applications/Engineering
-- 
GitLab