From 29fb062b4eb15893dac7019f61967a3482f4227a Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Wed, 17 Dec 2008 21:14:49 +0000
Subject: [PATCH] changed -part command line handling

---
 Common/CommandLine.cpp        | 9 +++++++--
 Plugin/Triangulate.cpp        | 2 +-
 doc/gmsh.1                    | 5 ++++-
 doc/texinfo/command_line.texi | 2 ++
 4 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/Common/CommandLine.cpp b/Common/CommandLine.cpp
index 61c3830bc1..a2595f481b 100644
--- a/Common/CommandLine.cpp
+++ b/Common/CommandLine.cpp
@@ -50,7 +50,7 @@ void Print_Usage(const char *name)
   Msg::Direct("Mesh options:");
   Msg::Direct("  -1, -2, -3            Perform 1D, 2D or 3D mesh generation, then exit");
   Msg::Direct("  -refine               Perform uniform mesh refinement, then exit");
-  Msg::Direct("  -part                 Partition after batch mesh generation");
+  Msg::Direct("  -part int             Partition after batch mesh generation");
   Msg::Direct("  -saveall              Save all elements (discard physical group definitions)");
   Msg::Direct("  -o file               Specify mesh output file name");
   Msg::Direct("  -format string        Set output mesh format (msh, msh1, msh2, unv, vrml, stl, mesh,");
@@ -217,8 +217,13 @@ void Get_Options(int argc, char *argv[])
         i++;
       }
       else if(!strcmp(argv[i] + 1, "part")) {
-        CTX.batch_after_mesh = 1;
         i++;
+        if(argv[i] != NULL){
+          CTX.batch_after_mesh = 1;
+          opt_mesh_partition_num(0, GMSH_SET, atoi(argv[i++]));
+        }
+        else
+	  Msg::Fatal("Missing number");
       }
       else if(!strcmp(argv[i] + 1, "new")) {
         CTX.files.push_back("-new");
diff --git a/Plugin/Triangulate.cpp b/Plugin/Triangulate.cpp
index 21eef2371d..934734571a 100644
--- a/Plugin/Triangulate.cpp
+++ b/Plugin/Triangulate.cpp
@@ -139,7 +139,7 @@ PView *GMSH_TriangulatePlugin::execute(PView *v)
   PViewDataList *data1 = getDataList(v1);
   if(!data1) return v;
 
-  PView *v2 = new PView(true);
+  PView *v2 = new PView(true, data1->getNumElements());
 
   PViewDataList *data2 = getDataList(v2);
   if(!data2) return v;
diff --git a/doc/gmsh.1 b/doc/gmsh.1
index 551bd2caaf..095e074130 100644
--- a/doc/gmsh.1
+++ b/doc/gmsh.1
@@ -1,4 +1,4 @@
-.\" $Id: gmsh.1,v 1.83 2008-04-17 21:05:52 geuzaine Exp $
+.\" $Id: gmsh.1,v 1.84 2008-12-17 21:14:48 geuzaine Exp $
 .TH Gmsh 1 "23 February 2008" "Gmsh 2.2" "Gmsh Manual Pages"
 .UC 4
 .\" ********************************************************************
@@ -42,6 +42,9 @@ the geometry.
 perform the three-dimensional mesh, i.e., discretize all the volumes in
 the geometry.
 .TP 4
+.B \-part int
+partition the mesh after batch mesh generation.
+.TP 4
 .B \-saveall
 save all elements (and discard all physical group definitions).
 .TP 4
diff --git a/doc/texinfo/command_line.texi b/doc/texinfo/command_line.texi
index 416264669f..48c274bcd8 100644
--- a/doc/texinfo/command_line.texi
+++ b/doc/texinfo/command_line.texi
@@ -14,6 +14,8 @@ Set geometrical tolerance
 @ftable @code
 @item -1, -2, -3
 Perform 1D, 2D or 3D mesh generation, then exit
+@item -part int
+Partition the mesh after batch mesh generation.
 @item -saveall
 Save all elements (discard physical group definitions)
 @item -o file
-- 
GitLab