From 593762d4e03e79c98be9e3373de19694ae2d22da Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Wed, 5 Apr 2006 19:00:59 +0000
Subject: [PATCH] make "initial mesh only" option visible in scripts

---
 Common/DefaultOptions.h |  2 ++
 Common/Options.cpp      | 10 ++++++++--
 Common/Options.h        |  1 +
 Mesh/2D_Mesh_Aniso.cpp  |  4 +++-
 4 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h
index 0621222d07..7a5cf58c9b 100644
--- a/Common/DefaultOptions.h
+++ b/Common/DefaultOptions.h
@@ -888,6 +888,8 @@ StringXNumber MeshOptions_Number[] = {
   { F|O, "Format" , opt_mesh_format , FORMAT_MSH , 
     "Mesh output format (1=msh, 2=unv, 3=gref, 19=vrml)" },
 
+  { F|O, "InitialOnly" , opt_mesh_initial_only , 0. ,
+    "Only contruct the n-dimensional initial mesh (no refinement)" },
   { F|O, "Interactive" , opt_mesh_interactive , 0. ,
     "Show the construction of 2D anisotropic mesh in real time" },
 
diff --git a/Common/Options.cpp b/Common/Options.cpp
index f0804a7e45..4b65de5966 100644
--- a/Common/Options.cpp
+++ b/Common/Options.cpp
@@ -1,4 +1,4 @@
-// $Id: Options.cpp,v 1.276 2006-03-09 07:56:51 remacle Exp $
+// $Id: Options.cpp,v 1.277 2006-04-05 19:00:59 geuzaine Exp $
 //
 // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 //
@@ -122,7 +122,6 @@ void Init_Options(int num)
 
   // The following defaults cannot be set by the user 
   CTX.batch = 0;
-  CTX.mesh.initial_only = 0;
   CTX.output_filename = NULL;
   CTX.bgm_filename = NULL;
   CTX.files = List_Create(10, 10, sizeof(char*));
@@ -4702,6 +4701,13 @@ double opt_mesh_interactive(OPT_ARGS_NUM)
   return CTX.mesh.interactive;
 }
 
+double opt_mesh_initial_only(OPT_ARGS_NUM)
+{
+  if(action & GMSH_SET)
+    CTX.mesh.initial_only = (int)val;
+  return CTX.mesh.initial_only;
+}
+
 double opt_mesh_use_cut_plane(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET){
diff --git a/Common/Options.h b/Common/Options.h
index 499ef8fb52..cdbe95d5ce 100644
--- a/Common/Options.h
+++ b/Common/Options.h
@@ -460,6 +460,7 @@ double opt_mesh_constrained_bgmesh(OPT_ARGS_NUM);
 double opt_mesh_order(OPT_ARGS_NUM);
 double opt_mesh_dual(OPT_ARGS_NUM);
 double opt_mesh_interactive(OPT_ARGS_NUM);
+double opt_mesh_initial_only(OPT_ARGS_NUM);
 double opt_mesh_use_cut_plane(OPT_ARGS_NUM);
 double opt_mesh_cut_plane_as_surface(OPT_ARGS_NUM);
 double opt_mesh_cut_plane_only_volume(OPT_ARGS_NUM);
diff --git a/Mesh/2D_Mesh_Aniso.cpp b/Mesh/2D_Mesh_Aniso.cpp
index 897de0951d..33aceb4cbb 100644
--- a/Mesh/2D_Mesh_Aniso.cpp
+++ b/Mesh/2D_Mesh_Aniso.cpp
@@ -1,4 +1,4 @@
-// $Id: 2D_Mesh_Aniso.cpp,v 1.49 2006-04-05 18:13:33 geuzaine Exp $
+// $Id: 2D_Mesh_Aniso.cpp,v 1.50 2006-04-05 19:00:59 geuzaine Exp $
 //
 // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 //
@@ -1093,6 +1093,8 @@ int AlgorithmeMaillage2DAnisotropeModeJF(Surface * s)
     Tree_Suppress(s->Simplexes, List_Pointer(Suppress, i));
   }
 
+  if(CTX.mesh.initial_only == 2) return 1;
+
   Msg(STATUS2, "Mesh 2D... (final)");
 
   if(!Tree_Right(s->Simplexes, &simp))
-- 
GitLab