gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
CommandLine.cpp
Go to the documentation of this file.
1 // Gmsh - Copyright (C) 1997-2022 C. Geuzaine, J.-F. Remacle
2 //
3 // See the LICENSE.txt file in the Gmsh root directory for license information.
4 // Please report all issues on https://gitlab.onelab.info/gmsh/gmsh/issues.
5 
6 #include <string>
7 #include <string.h>
8 #include <stdlib.h>
9 #include <iostream>
10 #include <fstream>
11 #include "GmshConfig.h"
12 #include "GmshDefines.h"
13 #include "GmshVersion.h"
14 #include "GmshMessage.h"
15 #include "OpenFile.h"
16 #include "CommandLine.h"
17 #include "Context.h"
18 #include "Options.h"
19 #include "GModel.h"
20 #include "CreateFile.h"
21 #include "OS.h"
22 #include "GmshGlobal.h"
23 #include "StringUtils.h"
24 
25 #if defined(HAVE_FLTK)
26 #include <FL/Fl.H>
27 #if (FL_MAJOR_VERSION == 1) && (FL_MINOR_VERSION >= 4)
28 // OK
29 #elif (FL_MAJOR_VERSION == 1) && (FL_MINOR_VERSION == 3) && (FL_PATCH_VERSION >= 3)
30 // OK
31 #else
32 #error "Gmsh requires FLTK >= 1.3.3"
33 #endif
34 #endif
35 
36 #if defined(HAVE_PETSC)
37 #include "petsc.h"
38 #endif
39 
40 #if defined(HAVE_OCC)
41 #include "Standard_Version.hxx"
42 #endif
43 
44 #if defined(HAVE_MED)
45 #include <med.h>
46 #endif
47 
48 #if defined(HAVE_POST)
49 #include "PView.h"
50 #endif
51 
52 #if defined(HAVE_PARSER)
53 #include "Parser.h"
54 #endif
55 
56 int GetGmshMajorVersion() { return GMSH_MAJOR_VERSION; }
57 int GetGmshMinorVersion() { return GMSH_MINOR_VERSION; }
58 int GetGmshPatchVersion() { return GMSH_PATCH_VERSION; }
59 const char *GetGmshExtraVersion() { return GMSH_EXTRA_VERSION; }
60 const char *GetGmshVersion() { return GMSH_VERSION; }
61 const char *GetGmshBuildDate() { return GMSH_DATE; }
62 const char *GetGmshBuildHost() { return GMSH_HOST; }
63 const char *GetGmshPackager() { return GMSH_PACKAGER; }
64 const char *GetGmshBuildOS() { return GMSH_OS; }
65 const char *GetGmshShortLicense() { return GMSH_SHORT_LICENSE; }
66 const char *GetGmshBuildOptions() { return GMSH_CONFIG_OPTIONS; }
67 
68 std::vector<std::pair<std::string, std::string> > GetUsage()
69 {
70  typedef std::pair<std::string, std::string> mp;
71  std::vector<mp> s;
72  s.push_back(mp("(Related option names, if any, are given between parentheses)",
73  ""));
74  s.push_back(mp("Geometry:", ""));
75  s.push_back(mp("-0", "Output model, then exit"));
76  s.push_back(mp("-tol value", "Set geometrical tolerance (Geometry.Tolerance)"));
77  s.push_back(mp("-match", "Match geometries and meshes"));
78  s.push_back(mp("Mesh:", ""));
79  s.push_back(mp("-1, -2, -3", "Perform 1D, 2D or 3D mesh generation, then exit"));
80  s.push_back(mp("-format string", "Select output mesh format: " +
81  GetKnownFileFormats(true) + " (Mesh.Format)"));
82  s.push_back(mp("-bin", "Create binary files when possible (Mesh.Binary)"));
83  s.push_back(mp("-refine", "Perform uniform mesh refinement, then exit"));
84  s.push_back(mp("-barycentric_refine", "Perform barycentric mesh refinement, "
85  "then exit"));
86  s.push_back(mp("-reclassify angle", "Reclassify surface mesh, then exit"));
87  s.push_back(mp("-reparam angle", "Reparametrize surface mesh, then exit"));
88  s.push_back(mp("-part int", "Partition after batch mesh generation "
89  "(Mesh.NbPartitions)"));
90  s.push_back(mp("-part_weight [tri,quad,tet,hex,pri,pyr,trih] int",
91  "Weight of a triangle/quad/etc. during partitioning "
92  "(Mesh.Partition[Tri,Quad,...]Weight)"));
93  s.push_back(mp("-part_split", "Save mesh partitions in separate files "
94  "(Mesh.PartitionSplitMeshFiles)"));
95  s.push_back(mp("-part_[no_]topo", "Create the partition topology "
96  "(Mesh.PartitionCreateTopology)"));
97  s.push_back(mp("-part_[no_]ghosts", "Create ghost cells "
98  "(Mesh.PartitionCreateGhostCells)"));
99  s.push_back(mp("-part_[no_]physicals", "Create physical groups for partitions "
100  "(Mesh.PartitionCreatePhysicals)"));
101  s.push_back(mp("-part_topo_pro", "Save the partition topology .pro file "
102  "(Mesh.PartitionTopologyFile)"));
103  s.push_back(mp("-preserve_numbering_msh2", "Preserve element numbering in MSH2 "
104  "format (Mesh.PreserveNumberingMsh2)"));
105  s.push_back(mp("-save_all", "Save all elements (Mesh.SaveAll)"));
106  s.push_back(mp("-save_parametric", "Save nodes with their parametric "
107  "coordinates (Mesh.SaveParametric)"));
108  s.push_back(mp("-save_topology", "Save model topology (Mesh.SaveTopology)"));
109  s.push_back(mp("-algo string", "Select mesh algorithm: auto, meshadapt, del2d, "
110  "front2d, delquad, quadqs, initial2d, del3d, front3d, mmg3d, hxt, "
111  "initial3d (Mesh.Algorithm and Mesh.Algorithm3D)"));
112  s.push_back(mp("-smooth int", "Set number of mesh smoothing steps "
113  "(Mesh.Smoothing)"));
114  s.push_back(mp("-order int", "Set mesh order (Mesh.ElementOrder)"));
115  s.push_back(mp("-optimize[_netgen]", "Optimize quality of tetrahedral elements "
116  "(Mesh.Optimize[Netgen])"));
117  s.push_back(mp("-optimize_threshold", "Optimize tetrahedral elements that have a "
118  "quality less than a threshold (Mesh.OptimizeThreshold)"));
119  s.push_back(mp("-optimize_ho", "Optimize high order meshes "
120  "(Mesh.HighOrderOptimize)"));
121  s.push_back(mp("-ho_[min,max,nlayers]", "High-order optimization parameters "
122  "(Mesh.HighOrderThreshold[Min,Max], Mesh.HighOrderNumLayers)"));
123  s.push_back(mp("-clscale value", "Set mesh element size factor "
124  "(Mesh.MeshSizeFactor)"));
125  s.push_back(mp("-clmin value", "Set minimum mesh element size "
126  "(Mesh.MeshSizeMin)"));
127  s.push_back(mp("-clmax value", "Set maximum mesh element size "
128  "(Mesh.MeshSizeMax)"));
129  s.push_back(mp("-clextend value", "Extend mesh element sizes from boundaries "
130  "(Mesh.MeshSizeExtendFromBoundary)"));
131  s.push_back(mp("-clcurv value", "Compute mesh element size from curvature, with "
132  "value the target number of elements per 2*pi radians "
133  "(Mesh.MeshSizeFromCurvature)"));
134  s.push_back(mp("-aniso_max value", "Set maximum anisotropy for bamg "
135  "(Mesh.AnisoMax)"));
136  s.push_back(mp("-smooth_ratio value", "Set smoothing ration between mesh sizes "
137  "at nodes of a same edge for bamg (Mesh.SmoothRatio)"));
138  s.push_back(mp("-epslc1d value", "Set accuracy of evaluation of mesh size field "
139  "for 1D mesh (Mesh.LcIntegrationPrecision)"));
140  s.push_back(mp("-swapangle value", "Set the threshold angle (in degrees) between "
141  "two adjacent faces below which a swap is allowed "
142  "(Mesh.AllowSwapAngle)"));
143  s.push_back(mp("-rand value", "Set random perturbation factor "
144  "(Mesh.RandomFactor)"));
145  s.push_back(mp("-bgm file", "Load background mesh from file"));
146  s.push_back(mp("-check", "Perform various consistency checks on mesh"));
147  s.push_back(mp("-ignore_periocity", "Ignore periodic boundaries "
148  "(Mesh.IgnorePeriodicity)"));
149 #if defined(HAVE_FLTK)
150  s.push_back(mp("Post-processing:", ""));
151  s.push_back(mp("-link int", "Select link mode between views "
152  "(PostProcessing.Link)"));
153  s.push_back(mp("-combine", "Combine views having identical names into "
154  "multi-time-step views"));
155  s.push_back(mp("Solver:", ""));
156  s.push_back(mp("-listen string", "Always listen to incoming connection requests "
157  "(Solver.AlwaysListen) on the given socket "
158  "(uses Solver.SocketName if not specified)"));
159  s.push_back(mp("-minterpreter string", "Name of Octave interpreter "
160  "(Solver.OctaveInterpreter)"));
161  s.push_back(mp("-pyinterpreter string", "Name of Python interpreter "
162  "(Solver.OctaveInterpreter)"));
163  s.push_back(mp("-run", "Run ONELAB solver(s)"));
164  s.push_back(mp("Display:", ""));
165  s.push_back(mp("-n", "Hide all meshes and post-processing views on startup "
166  "(View.Visible, Mesh.[Points,Lines,SurfaceEdges,...])"));
167  s.push_back(mp("-nodb", "Disable double buffering (General.DoubleBuffer)"));
168  s.push_back(mp("-numsubedges", "Set num of subdivisions for high order element "
169  "display (Mesh.NumSubEdges)"));
170  s.push_back(mp("-fontsize int", "Specify the font size for the GUI "
171  "(General.FontSize)"));
172  s.push_back(mp("-theme string", "Specify FLTK GUI theme (General.FltkTheme)"));
173  s.push_back(mp("-display string", "Specify display (General.Display)"));
174  s.push_back(mp("-camera", "Use camera mode view (General.CameraMode)"));
175  s.push_back(mp("-stereo", "OpenGL quad-buffered stereo rendering "
176  "(General.Stereo)"));
177  s.push_back(mp("-gamepad", "Use gamepad controller if available"));
178 #endif
179  s.push_back(mp("Other:", ""));
180  s.push_back(mp("-, -parse_and_exit", "Parse input files, then exit"));
181  s.push_back(mp("-save", "Save output file, then exit"));
182  s.push_back(mp("-o file", "Specify output file name"));
183  s.push_back(mp("-new", "Create new model before merge next file"));
184  s.push_back(mp("-merge", "Merge next files"));
185  s.push_back(mp("-open", "Open next files"));
186  s.push_back(mp("-log filename", "Log all messages to filename"));
187 #if defined(HAVE_FLTK)
188  s.push_back(mp("-a, -g, -m, -s, -p", "Start in automatic, geometry, mesh, "
189  "solver or post-processing mode (General.InitialModule)"));
190 #endif
191  s.push_back(mp("-pid", "Print process id on stdout"));
192  s.push_back(mp("-watch pattern", "Pattern of files to merge as they become "
193  "available (General.WatchFilePattern)"));
194  s.push_back(mp("-bg file", "Load background (image or PDF) file "
195  "(General.BackgroundImageFileName)"));
196  s.push_back(mp("-v int", "Set verbosity level (General.Verbosity)"));
197  s.push_back(mp("-string \"string\"", "Parse command string at startup"));
198  s.push_back(mp("-setnumber name value", "Set constant, ONELAB or option number "
199  "name=value"));
200  s.push_back(mp("-setstring name value", "Set constant, ONELAB or option string "
201  "name=value"));
202  s.push_back(mp("-nopopup", "Don't popup dialog windows in scripts "
203  "(General.NoPopup)"));
204  s.push_back(mp("-noenv", "Don't modify the environment at startup"));
205  s.push_back(mp("-nolocale", "Don't modify the locale at startup"));
206  s.push_back(mp("-option file", "Parse option file at startup"));
207  s.push_back(mp("-convert files", "Convert files into latest binary formats, "
208  "then exit"));
209  s.push_back(mp("-nt int", "Set number of threads (General.NumThreads)"));
210  s.push_back(mp("-cpu", "Report CPU times for all operations"));
211  s.push_back(mp("-version", "Show version number"));
212  s.push_back(mp("-info", "Show detailed version information"));
213  s.push_back(mp("-help", "Show command line usage"));
214  s.push_back(mp("-help_options", "Show all options"));
215  return s;
216 }
217 
218 std::vector<std::pair<std::string, std::string> >
219 GetShortcutsUsage(const std::string &ctrl)
220 {
221  std::string cc = ctrl;
222 #if defined(__APPLE__)
223  if(cc.empty()) cc = "Cmd+";
224 #else
225  if(cc.empty()) cc = "Ctrl+";
226 #endif
227  typedef std::pair<std::string, std::string> mp;
228  std::vector<mp> s;
229  s.push_back(mp("Left arrow", "Go to previous time step"));
230  s.push_back(mp("Right arrow", "Go to next time step"));
231  s.push_back(mp("Up arrow", "Make previous view visible"));
232  s.push_back(mp("Down arrow", "Make next view visible"));
233  s.push_back(mp("0", "Reload geometry"));
234  s.push_back(mp(cc + "0 or 9", "Reload full project"));
235  s.push_back(mp("1 or F1", "Mesh lines"));
236  s.push_back(mp("2 or F2", "Mesh surfaces"));
237  s.push_back(mp("3 or F3", "Mesh volumes"));
238  s.push_back(mp("Escape", "Cancel lasso zoom/selection, toggle mouse "
239  "selection ON/OFF"));
240  s.push_back(mp("e", "End/accept selection in geometry creation mode"));
241  s.push_back(mp("g", "Go to geometry module"));
242  s.push_back(mp("m", "Go to mesh module"));
243  s.push_back(mp("p", "Go to post-processing module"));
244  s.push_back(mp("q", "Abort selection in geometry creation mode"));
245  s.push_back(mp("s", "Go to solver module"));
246  s.push_back(mp("x", "Toggle x coordinate freeze in geometry creation mode"));
247  s.push_back(mp("y", "Toggle y coordinate freeze in geometry creation mode"));
248  s.push_back(mp("z", "Toggle z coordinate freeze in geometry creation mode"));
249  s.push_back(mp("Shift+a", "Bring all windows to front"));
250  s.push_back(mp("Shift+g", "Show geometry options"));
251  s.push_back(mp("Shift+m", "Show mesh options"));
252  s.push_back(mp("Shift+o", "Show general options"));
253  s.push_back(mp("Shift+p", "Show post-processing options"));
254  s.push_back(mp("Shift+s", "Show solver options"));
255  s.push_back(mp("Shift+u", "Show post-processing view plugins"));
256  s.push_back(mp("Shift+w", "Show post-processing view options"));
257  s.push_back(mp("Shift+x", "Move only along x coordinate in geometry "
258  "creation mode"));
259  s.push_back(mp("Shift+y", "Move only along y coordinate in geometry "
260  "creation mode"));
261  s.push_back(mp("Shift+z", "Move only along z coordinate in geometry "
262  "creation mode"));
263  s.push_back(mp("Shift+Escape", "Enable full mouse selection"));
264  s.push_back(mp(cc + "d", "Attach/detach menu"));
265  s.push_back(mp(cc + "e", "Export project"));
266  s.push_back(mp(cc + "f", "Enter full screen"));
267  s.push_back(mp(cc + "i", "Show statistics window"));
268  s.push_back(mp(cc + "j", "Save model options"));
269  s.push_back(mp(cc + "l", "Show message console"));
270 #if defined(__APPLE__)
271  s.push_back(mp(cc + "m", "Minimize window"));
272 #endif
273  s.push_back(mp(cc + "n", "Create new project file"));
274  s.push_back(mp(cc + "o", "Open project file"));
275  s.push_back(mp(cc + "q", "Quit"));
276  s.push_back(mp(cc + "r", "Rename project file"));
277  s.push_back(mp(cc + "s", "Save mesh in default format"));
278  s.push_back(mp("Shift+" + cc + "c", "Show clipping plane window"));
279  s.push_back(mp("Shift+" + cc + "h", "Show current options and workspace "
280  "window"));
281  s.push_back(mp("Shift+" + cc + "j", "Save options as default"));
282  s.push_back(mp("Shift+" + cc + "m", "Show manipulator window"));
283  s.push_back(mp("Shift+" + cc + "n", "Show option window"));
284  s.push_back(mp("Shift+" + cc + "o", "Merge file(s)"));
285  s.push_back(mp("Shift+" + cc + "r", "Open next-to-last opened file"));
286  s.push_back(mp("Shift+" + cc + "u", "Show plugin window"));
287  s.push_back(mp("Shift+" + cc + "v", "Show visibility window"));
288  s.push_back(mp("Alt+a", "Loop through axes modes"));
289  s.push_back(mp("Alt+b", "Hide/show bounding boxes"));
290  s.push_back(mp("Alt+c", "Loop through predefined color schemes"));
291  s.push_back(mp("Alt+e", "Hide/Show element outlines for visible post-pro "
292  "views"));
293  s.push_back(mp("Alt+f", "Change redraw mode (fast/full)"));
294  s.push_back(mp("Alt+h", "Hide/show all post-processing views"));
295  s.push_back(mp("Alt+i", "Hide/show all post-processing view scales"));
296  s.push_back(mp("Alt+l", "Hide/show geometry lines"));
297  s.push_back(mp("Alt+m", "Toggle visibility of all mesh entities"));
298  s.push_back(mp("Alt+n", "Hide/show all post-processing view annotations"));
299  s.push_back(mp("Alt+o", "Change projection mode (orthographic/perspective)"));
300  s.push_back(mp("Alt+p", "Hide/show geometry points"));
301  s.push_back(mp("Alt+r", "Loop through range modes for visible post-pro "
302  "views"));
303  s.push_back(mp("Alt+s", "Hide/show geometry surfaces"));
304  s.push_back(mp("Alt+t", "Loop through interval modes for visible post-pro "
305  "views"));
306  s.push_back(mp("Alt+v", "Hide/show geometry volumes"));
307  s.push_back(mp("Alt+w", "Enable/disable all lighting"));
308  s.push_back(mp("Alt+x", "Set X view"));
309  s.push_back(mp("Alt+y", "Set Y view"));
310  s.push_back(mp("Alt+z", "Set Z view"));
311  s.push_back(mp("Alt+1", "Set 1:1 view"));
312  s.push_back(mp("Alt+Shift+a", "Hide/show small axes"));
313  s.push_back(mp("Alt+Shift+b", "Hide/show mesh volume faces"));
314  s.push_back(mp("Alt+Shift+c", "Loop through predefined colormaps"));
315  s.push_back(mp("Alt+Shift+d", "Hide/show mesh surface faces"));
316  s.push_back(mp("Alt+Shift+l", "Hide/show mesh lines"));
317  s.push_back(mp("Alt+Shift+p", "Hide/show mesh nodes"));
318  s.push_back(mp("Alt+Shift+s", "Hide/show mesh surface edges"));
319  s.push_back(mp("Alt+Shift+t", "Same as Alt+t, but with numeric mode "
320  "included"));
321  s.push_back(mp("Alt+Shift+v", "Hide/show mesh volume edges"));
322  s.push_back(mp("Alt+Shift+x", "Set -X view"));
323  s.push_back(mp("Alt+Shift+y", "Set -Y view"));
324  s.push_back(mp("Alt+Shift+z", "Set -Z view"));
325  s.push_back(mp("Alt+Shift+1", "Reset bounding box around visible entities"));
326  s.push_back(mp("Alt+" + cc + "+1", "Sync scale between viewports"));
327  return s;
328 }
329 
330 std::vector<std::pair<std::string, std::string> > GetMouseUsage()
331 {
332  typedef std::pair<std::string, std::string> mp;
333  std::vector<mp> s;
334  s.push_back(mp("Move", "Highlight the entity under the mouse pointer and "
335  "display its properties / Resize a lasso zoom or a lasso "
336  "(un)selection"));
337  s.push_back(mp("Left button", "Rotate / Select an entity / Accept a lasso "
338  "zoom or a lasso selection"));
339  s.push_back(mp("Ctrl+Left button", "Start a lasso zoom or a lasso "
340  "(un)selection"));
341  s.push_back(mp("Middle button", "Zoom / Unselect an entity / Accept a lasso "
342  "zoom or a lasso unselection"));
343  s.push_back(mp("Ctrl+Middle button", "Orthogonalize display"));
344  s.push_back(mp("Right button", "Pan / Cancel a lasso zoom or a lasso "
345  "(un)selection / Pop-up menu on post-processing view button"));
346  s.push_back(mp("Ctrl+Right button", "Reset to default viewpoint"));
347  return s;
348 }
349 
350 void PrintUsage(const std::string &name)
351 {
352  Msg::Direct("Usage: %s [options] [files]", name.c_str());
353  std::vector<std::pair<std::string, std::string> > s = GetUsage();
354  for(std::size_t i = 0; i < s.size(); i++) {
355  std::string a = s[i].first, b = s[i].second;
356  if(b.empty()) { Msg::Direct("%s", a.c_str()); }
357  else {
358  if(a.size() < 20) a.resize(20, ' ');
359  Msg::Direct(" %s %s", a.c_str(), b.c_str());
360  }
361  }
362 }
363 
364 std::vector<std::string> GetBuildInfo()
365 {
366  std::vector<std::string> s;
367  s.push_back(std::string("Version : ") + GMSH_VERSION);
368  s.push_back(std::string("License : ") + GMSH_SHORT_LICENSE);
369  s.push_back(std::string("Build OS : ") + GMSH_OS);
370  s.push_back(std::string("Build date : ") + GMSH_DATE);
371  s.push_back(std::string("Build host : ") + GMSH_HOST);
372  s.push_back(std::string("Build options :") + GMSH_CONFIG_OPTIONS);
373 #if defined(HAVE_FLTK)
374  {
375  char tmp[256];
376  sprintf(tmp, "%d.%d.%d", FL_MAJOR_VERSION, FL_MINOR_VERSION,
377  FL_PATCH_VERSION);
378  s.push_back(std::string("FLTK version : ") + tmp);
379  }
380 #endif
381 #if defined(HAVE_PETSC)
382  {
383  char tmp[256];
384  sprintf(tmp, "%d.%d.%d (%s arithmtic)", PETSC_VERSION_MAJOR,
385  PETSC_VERSION_MINOR, PETSC_VERSION_SUBMINOR,
386 #if defined(PETSC_USE_COMPLEX)
387  "complex"
388 #else
389  "real"
390 #endif
391  );
392  s.push_back(std::string("PETSc version : ") + tmp);
393  }
394 #endif
395 #if defined(HAVE_OCC)
396  {
397  char tmp[256];
398  sprintf(tmp, "%d.%d.%d", OCC_VERSION_MAJOR, OCC_VERSION_MINOR,
399  OCC_VERSION_MAINTENANCE);
400  s.push_back(std::string("OCC version : ") + tmp);
401  }
402 #endif
403 #if defined(HAVE_MED)
404  {
405  char tmp[256];
406  sprintf(tmp, "%d.%d.%d", MED_NUM_MAJEUR, MED_NUM_MINEUR, MED_NUM_RELEASE);
407  s.push_back(std::string("MED version : ") + tmp);
408  }
409 #endif
410  s.push_back(std::string("Packaged by : ") + GMSH_PACKAGER);
411  s.push_back("Web site : https://gmsh.info");
412  s.push_back("Issue tracker : https://gitlab.onelab.info/gmsh/gmsh/issues");
413  return s;
414 }
415 
417 {
418  std::vector<std::string> s = GetBuildInfo();
419  for(std::size_t i = 0; i < s.size(); i++) Msg::Direct("%s", s[i].c_str());
420 }
421 
422 static bool GetGeometryOption(const std::vector<std::string> &argv,
423  std::size_t &i, bool exitOnError)
424 {
425  if(i < 0 || i >= argv.size()) return false;
426 
427  if(argv[i] == "-0") {
428  CTX::instance()->batch = -1;
429  i++;
430  }
431  else if(argv[i] == "-tol") {
432  i++;
433  if(i < argv.size())
434  opt_geometry_tolerance(0, GMSH_SET, atof(argv[i++].c_str()));
435  else {
436  Msg::Error("Missing number");
437  if(exitOnError) Msg::Exit(1);
438  }
439  }
440  else if(argv[i] == "-match") {
441  i++;
443  }
444  else if(argv[i] == "-scale") {
445  i++;
446  if(i < argv.size())
447  opt_geometry_scaling_factor(0, GMSH_SET, atof(argv[i++].c_str()));
448  else {
449  Msg::Error("Missing number");
450  if(exitOnError) Msg::Exit(1);
451  }
452  }
453  else if(argv[i] == "-autoex") { // FIXME: temporary for auto-extrude testing
455  i++;
456  }
457  else {
458  return false;
459  }
460 
461  return true;
462 }
463 
464 static bool GetMeshOption(const std::vector<std::string> &argv,
465  std::size_t &i, bool exitOnError)
466 {
467  if(i < 0 || i >= argv.size()) return false;
468 
469  if(argv[i] == "-check") {
470  CTX::instance()->batch = -2;
471  i++;
472  }
473  else if(argv[i] == "-1") {
474  CTX::instance()->batch = 1;
475  i++;
476  }
477  else if(argv[i] == "-2") {
478  CTX::instance()->batch = 2;
479  i++;
480  }
481  else if(argv[i] == "-3") {
482  CTX::instance()->batch = 3;
483  i++;
484  }
485  else if(argv[i] == "-4") {
486  CTX::instance()->batch = 4;
487  i++;
488  }
489  else if(argv[i] == "-save") {
490  CTX::instance()->batch = 99;
491  i++;
492  }
493  else if(argv[i] == "-refine") {
494  CTX::instance()->batch = 5;
495  i++;
496  }
497  else if(argv[i] == "-barycentric_refine") {
498  CTX::instance()->batch = 6;
499  i++;
500  }
501  else if(argv[i] == "-reclassify") {
502  i++;
503  if(i < argv.size()) {
504  CTX::instance()->batch = 7;
505  CTX::instance()->batchSomeValue = atof(argv[i].c_str());
506  }
507  else {
508  Msg::Error("Missing number");
509  if(exitOnError) Msg::Exit(1);
510  }
511  }
512  else if(argv[i] == "-reparam") {
513  i++;
514  if(i < argv.size()) {
515  CTX::instance()->batch = 8;
516  CTX::instance()->batchSomeValue = atof(argv[i].c_str());
517  }
518  else {
519  Msg::Error("Missing number");
520  if(exitOnError) Msg::Exit(1);
521  }
522  }
523  else if(argv[i] == "-quadlayout") {
524  CTX::instance()->batch = 69;
525  i++;
526  }
527  else if(argv[i] == "-part") {
528  i++;
529  if(i < argv.size()) {
531  opt_mesh_partition_num(0, GMSH_SET, atoi(argv[i++].c_str()));
532  }
533  else {
534  Msg::Error("Missing number");
535  if(exitOnError) Msg::Exit(1);
536  }
537  }
538  else if(argv[i] == "-part_weight" || argv[i] == "-partWeight") {
539  i++;
540  bool check = true;
541  // partGraphKWay w/ weights
543  while(check) {
544  if(i < argv.size()) {
545  if(argv[i] == "tri" || argv[i] == "triangle") {
546  i++;
547  opt_mesh_partition_tri_weight(0, GMSH_SET, atoi(argv[i].c_str()));
548  }
549  else if(argv[i] == "quad" || argv[i] == "quadrangle") {
550  i++;
551  opt_mesh_partition_qua_weight(0, GMSH_SET, atoi(argv[i].c_str()));
552  }
553  else if(argv[i] == "tet" || argv[i] == "tetrahedron") {
554  i++;
555  opt_mesh_partition_tet_weight(0, GMSH_SET, atoi(argv[i].c_str()));
556  }
557  else if(argv[i] == "hex" || argv[i] == "hexahedron") {
558  i++;
559  opt_mesh_partition_hex_weight(0, GMSH_SET, atoi(argv[i].c_str()));
560  }
561  else if(argv[i] == "pri" || argv[i] == "prism") {
562  i++;
563  opt_mesh_partition_pri_weight(0, GMSH_SET, atoi(argv[i].c_str()));
564  }
565  else if(argv[i] == "pyr" || argv[i] == "pyramid") {
566  i++;
567  opt_mesh_partition_pyr_weight(0, GMSH_SET, atoi(argv[i].c_str()));
568  }
569  else if(argv[i] == "trih" || argv[i] == "trihedron") {
570  i++;
572  atoi(argv[i].c_str()));
573  }
574  else {
575  Msg::Error("Bad argument for 'partWeight' (%s)", argv[i].c_str());
576  if(exitOnError) Msg::Exit(1);
577  }
578  i++;
579  }
580  else
581  check = false;
582  }
583  }
584  else if(argv[i] == "-part_split" || argv[i] == "-part_split_files" ||
585  argv[i] == "-oneFilePerPart") {
587  i++;
588  }
589  else if(argv[i] == "-preserve_numbering_msh2" ||
590  argv[i] == "-preserveNumberingMsh2") {
592  i++;
593  }
594  else if(argv[i] == "-part_topo_pro" || argv[i] == "-savePartTopology") {
596  i++;
597  }
598  else if(argv[i] == "-part_topo") {
600  i++;
601  }
602  else if(argv[i] == "-part_no_topo") {
604  i++;
605  }
606  else if(argv[i] == "-part_physicals") {
608  i++;
609  }
610  else if(argv[i] == "-part_no_physicals") {
612  i++;
613  }
614  else if(argv[i] == "-part_ghosts") {
616  i++;
617  }
618  else if(argv[i] == "-part_no_ghosts") {
620  i++;
621  }
622  else if(argv[i] == "-saveall" || argv[i] == "-save_all") {
624  i++;
625  }
626  else if(argv[i] == "-switch_tags") {
628  i++;
629  }
630  else if(argv[i] == "-optimize") {
631  Msg::Warning("The '-optimize' option is now obsolete: "
632  "Gmsh optimizes tetrahedral meshes by default");
633  Msg::Warning("Use '-optimize_threshold threshold' to "
634  "control which elements are optimized");
635  Msg::Warning("Option '-optimize_threshold 0' leads to no optimization");
637  i++;
638  }
639  else if(argv[i] == "-optimize_threshold") {
640  i++;
641  if(i < argv.size())
642  opt_mesh_optimize_threshold(0, GMSH_SET, atof(argv[i++].c_str()));
643  else {
644  Msg::Error("Missing number");
645  if(exitOnError) Msg::Exit(1);
646  }
647  }
648  else if(argv[i] == "-optimize_netgen") {
650  i++;
651  }
652  else if(argv[i] == "-optimize_ho" || argv[i] == "-hoOptimize") {
653  i++;
655  }
656  else if(argv[i] == "-ho_min") {
657  i++;
658  if(i < argv.size())
659  opt_mesh_ho_threshold_min(0, GMSH_SET, atof(argv[i++].c_str()));
660  else {
661  Msg::Error("Missing number");
662  if(exitOnError) Msg::Exit(1);
663  }
664  }
665  else if(argv[i] == "-ho_max") {
666  i++;
667  if(i < argv.size())
668  opt_mesh_ho_threshold_max(0, GMSH_SET, atof(argv[i++].c_str()));
669  else {
670  Msg::Error("Missing number");
671  if(exitOnError) Msg::Exit(1);
672  }
673  }
674  else if(argv[i] == "-ho_nlayers") {
675  i++;
676  if(i < argv.size())
677  opt_mesh_ho_nlayers(0, GMSH_SET, atoi(argv[i++].c_str()));
678  else {
679  Msg::Error("Missing number");
680  if(exitOnError) Msg::Exit(1);
681  }
682  }
683  else if(argv[i] == "-debugSurface") {
684  i++;
685  if(i < argv.size())
686  CTX::instance()->debugSurface = atoi(argv[i++].c_str());
687  else {
688  Msg::Error("Missing number");
689  if(exitOnError) Msg::Exit(1);
690  }
691  }
692  else if(argv[i] == "-aniso_max" || argv[i] == "-anisoMax") {
693  i++;
694  if(i < argv.size())
695  opt_mesh_aniso_max(0, GMSH_SET, atof(argv[i++].c_str()));
696  else {
697  Msg::Error("Missing anisotropy ratio");
698  if(exitOnError) Msg::Exit(1);
699  }
700  }
701  else if(argv[i] == "-smooth_ratio" || argv[i] == "-smoothRatio") {
702  i++;
703  if(i < argv.size())
704  opt_mesh_smooth_ratio(0, GMSH_SET, atof(argv[i++].c_str()));
705  else {
706  Msg::Error("Missing smooth ratio");
707  if(exitOnError) Msg::Exit(1);
708  }
709  }
710  else if(argv[i] == "-bgm") {
711  i++;
712  if(i < argv.size())
713  CTX::instance()->bgmFileName = argv[i++];
714  else {
715  Msg::Error("Missing file name");
716  if(exitOnError) Msg::Exit(1);
717  }
718  }
719  else if(argv[i] == "-size_field") {
720  i++;
721  if(i < argv.size()){
722  CTX::instance()->mesh.nLayersPerGap = atoi(argv[i].c_str());
723  CTX::instance()->batch = 9;
724  }
725  else{
726  Msg::Error("Missing number of layers per gap");
727  if(exitOnError) Msg::Exit(1);
728  }
729  i++;
730  if(i < argv.size()){
731  CTX::instance()->mesh.lcFromCurvature = atoi(argv[i].c_str());
732  if(CTX::instance()->mesh.lcFromCurvature <= 0.)
734  }
735  else{
736  Msg::Error("Missing number of elements density");
737  if(exitOnError) Msg::Exit(1);
738  }
739  i++;
740  if(i < argv.size()){
741  CTX::instance()->mesh.gradation = atof(argv[i].c_str());
742  if(CTX::instance()->mesh.gradation <= 1.){
743  CTX::instance()->mesh.gradation = 1.05;
744  Msg::Info("Gradation must be > 1 : set to 1.05");
745  }
746  }
747  else{
748  Msg::Error("Missing gradation");
749  if(exitOnError) Msg::Exit(1);
750  }
751  }
752  else if(argv[i] == "-vmsh") {
753  i++;
754  if(i < argv.size()) {
755  opt_mesh_msh_file_version(0, GMSH_SET, atof(argv[i++].c_str()));
756  }
757  else {
758  Msg::Error("Missing number");
759  if(exitOnError) Msg::Exit(1);
760  }
761  }
762  else if(argv[i] == "-convert") {
763  i++;
764  CTX::instance()->batch = 1;
765  while(i < argv.size()) {
766  std::string fileName = std::string(argv[i]) + "_new";
767 #if defined(HAVE_POST)
768  std::size_t n = PView::list.size();
769 #endif
770  OpenProject(argv[i]);
771 #if defined(HAVE_POST)
772  // convert post-processing views to latest binary format
773  for(std::size_t j = n; j < PView::list.size(); j++)
774  PView::list[j]->write(fileName, 1, (j == n) ? false : true);
775 #endif
776  // convert mesh to latest binary format
777  if(GModel::current()->getMeshStatus() > 0) {
779  opt_mesh_binary(0, GMSH_SET, 1);
780  CreateOutputFile(fileName, FORMAT_MSH);
781  }
782  i++;
783  }
784  Msg::Exit(0);
785  }
786  else if(argv[i] == "-meshscale") {
787  i++;
788  if(i < argv.size())
789  opt_mesh_scaling_factor(0, GMSH_SET, atof(argv[i++].c_str()));
790  else {
791  Msg::Error("Missing number");
792  if(exitOnError) Msg::Exit(1);
793  }
794  }
795  else if(argv[i] == "-rand") {
796  i++;
797  if(i < argv.size())
798  opt_mesh_rand_factor(0, GMSH_SET, atof(argv[i++].c_str()));
799  else {
800  Msg::Error("Missing number");
801  if(exitOnError) Msg::Exit(1);
802  }
803  }
804  else if(argv[i] == "-clscale") {
805  i++;
806  if(i < argv.size()) {
807  opt_mesh_lc_factor(0, GMSH_SET, atof(argv[i++].c_str()));
808  if(CTX::instance()->mesh.lcFactor <= 0.0) {
809  Msg::Error("Mesh element size factor must be > 0");
810  if(exitOnError) Msg::Exit(1);
811  }
812  }
813  else {
814  Msg::Error("Missing number");
815  if(exitOnError) Msg::Exit(1);
816  }
817  }
818  else if(argv[i] == "-clmin") {
819  i++;
820  if(i < argv.size())
821  opt_mesh_lc_min(0, GMSH_SET, atof(argv[i++].c_str()));
822  else {
823  Msg::Error("Missing number");
824  if(exitOnError) Msg::Exit(1);
825  }
826  }
827  else if(argv[i] == "-clmax") {
828  i++;
829  if(i < argv.size()) {
830  opt_mesh_lc_max(0, GMSH_SET, atof(argv[i++].c_str()));
831  if(CTX::instance()->mesh.lcMax <= 0.0) {
832  Msg::Error("Maximum length size must be > 0");
833  if(exitOnError) Msg::Exit(1);
834  }
835  }
836  else {
837  Msg::Error("Missing number");
838  if(exitOnError) Msg::Exit(1);
839  }
840  }
841  else if(argv[i] == "-clextend") {
842  i++;
843  if(i < argv.size())
844  opt_mesh_lc_extend_from_boundary(0, GMSH_SET, atof(argv[i++].c_str()));
845  else {
846  Msg::Error("Missing number");
847  if(exitOnError) Msg::Exit(1);
848  }
849  }
850  else if(argv[i] == "-ignore_periodicity" ||
851  argv[i] == "-ignorePeriodicity") {
852  i++;
854  }
855  else if(argv[i] == "-edgelmin") {
856  i++;
857  if(i < argv.size())
858  opt_mesh_tolerance_edge_length(0, GMSH_SET, atof(argv[i++].c_str()));
859  else {
860  Msg::Error("Missing number");
861  if(exitOnError) Msg::Exit(1);
862  }
863  }
864  else if(argv[i] == "-epslc1d") {
865  i++;
866  if(i < argv.size()) {
868  atof(argv[i++].c_str()));
869  if(CTX::instance()->mesh.lcIntegrationPrecision <= 0.0) {
870  Msg::Error("Integration accuracy must be > 0");
871  if(exitOnError) Msg::Exit(1);
872  }
873  }
874  else {
875  Msg::Error("Missing number");
876  if(exitOnError) Msg::Exit(1);
877  }
878  }
879  else if(argv[i] == "-swapangle") {
880  i++;
881  if(i < argv.size())
882  opt_mesh_allow_swap_edge_angle(0, GMSH_SET, atof(argv[i++].c_str()));
883  else {
884  Msg::Error("Missing number");
885  if(exitOnError) Msg::Exit(1);
886  }
887  }
888  else if(argv[i] == "-clcurv") {
889  i++;
890  if(i < argv.size()) {
891  opt_mesh_lc_from_curvature(0, GMSH_SET, atof(argv[i++].c_str()));
892  }
893  else {
894  Msg::Error("Missing number");
895  if(exitOnError) Msg::Exit(1);
896  }
897  }
898  else if(argv[i] == "-clcurviso") {
900  i++;
901  }
902  else if(argv[i] == "-smooth") {
903  i++;
904  if(i < argv.size())
905  opt_mesh_nb_smoothing(0, GMSH_SET, atoi(argv[i++].c_str()));
906  else {
907  Msg::Error("Missing number");
908  if(exitOnError) Msg::Exit(1);
909  }
910  }
911  else if(argv[i] == "-order" || argv[i] == "-degree") {
912  i++;
913  if(i < argv.size())
914  opt_mesh_order(0, GMSH_SET, atof(argv[i++].c_str()));
915  else {
916  Msg::Error("Missing number");
917  if(exitOnError) Msg::Exit(1);
918  }
919  }
920  else if(argv[i] == "-numsubedges") {
921  i++;
922  if(i < argv.size())
923  opt_mesh_num_sub_edges(0, GMSH_SET, atof(argv[i++].c_str()));
924  else {
925  Msg::Error("Missing number");
926  if(exitOnError) Msg::Exit(1);
927  }
928  }
929  else if(argv[i] == "-statreport") {
930  i++;
932  if(i < argv.size())
933  CTX::instance()->meshStatReportFileName = argv[i++];
934  else {
935  Msg::Error("Missing argument");
936  if(exitOnError) Msg::Exit(1);
937  }
938  }
939  else if(argv[i] == "-append_statreport") {
940  i++;
942  if(i < argv.size())
943  CTX::instance()->meshStatReportFileName = argv[i++];
944  else {
945  Msg::Error("Missing argument");
946  if(exitOnError) Msg::Exit(1);
947  }
948  }
949  else if(argv[i] == "-bin") {
950  i++;
951  opt_mesh_binary(0, GMSH_SET, 1);
952  }
953  else if(argv[i] == "-save_parametric" || argv[i] == "-parametric") {
954  i++;
956  }
957  else if(argv[i] == "-save_topology" || argv[i] == "-save_entities") {
958  i++;
960  }
961  else if(argv[i] == "-algo") {
962  i++;
963  if(i < argv.size()) {
964  if(argv[i] == "MeshAdapt" || argv[i] == "meshadapt" ||
965  argv[i] == "iso")
967  else if(argv[i] == "auto")
969  else if(argv[i] == "Delaunay2D" || argv[i] == "del2d" ||
970  argv[i] == "tri")
972  else if(argv[i] == "FrontalDelaunay2D" || argv[i] == "front2d" ||
973  argv[i] == "frontal")
975  else if(argv[i] == "bamg")
977  else if(argv[i] == "DelaunayFrontalForQuads" || argv[i] == "delquad")
979  else if(argv[i] == "PackingOfParallelograms" || argv[i] == "pack")
981  else if(argv[i] == "QuadQuasiStructured" || argv[i] == "quadqs")
983  else if(argv[i] == "initial2d")
985  else if(argv[i] == "del3d" || argv[i] == "gmsh3d")
987  else if(argv[i] == "front3d" || argv[i] == "netgen")
989  else if(argv[i] == "mmg3d")
991  else if(argv[i] == "rtree3d")
993  else if(argv[i] == "hxt")
995  else if(argv[i] == "initial3d")
997  else {
998  Msg::Error("Unknown mesh algorithm");
999  if(exitOnError) Msg::Exit(1);
1000  }
1001  i++;
1002  }
1003  else {
1004  Msg::Error("Missing algorithm");
1005  if(exitOnError) Msg::Exit(1);
1006  }
1007  }
1008  else if(argv[i] == "-quad") {
1011  i++;
1012  }
1013  else if(argv[i] == "-format" || argv[i] == "-f") {
1014  i++;
1015  if(i < argv.size()) {
1016  double version = 0.;
1017  int format =
1018  GetFileFormatFromExtension(std::string(".") + argv[i], &version);
1019  if(format < 0) {
1020  Msg::Error("Unknown mesh format '%s'", argv[i].c_str());
1021  if(exitOnError) Msg::Exit(1);
1022  }
1023  else {
1024  opt_mesh_file_format(0, GMSH_SET, format);
1025  if(format == FORMAT_MSH && version > 0.)
1026  opt_mesh_msh_file_version(0, GMSH_SET, version);
1027  }
1028  i++;
1029  }
1030  else {
1031  Msg::Error("Missing format");
1032  if(exitOnError) Msg::Exit(1);
1033  }
1034  }
1035  else if(argv[i] == "-dual") {
1036  opt_mesh_dual(0, GMSH_SET, 1);
1037  i++;
1038  }
1039  else if(argv[i] == "-voronoi") {
1040  opt_mesh_voronoi(0, GMSH_SET, 1);
1041  i++;
1042  }
1043  else if(argv[i] == "-nomesh") {
1044  opt_mesh_nodes(0, GMSH_SET, 0.);
1045  opt_mesh_lines(0, GMSH_SET, 0.);
1050  i++;
1051  }
1052  else {
1053  return false;
1054  }
1055 
1056  return true;
1057 }
1058 
1059 static bool GetPostProcessingOption(const std::vector<std::string> &argv,
1060  std::size_t &i, bool exitOnError)
1061 {
1062  if(i < 0 || i >= argv.size()) return false;
1063 
1064  if(argv[i] == "-noview") {
1065  opt_view_visible(0, GMSH_SET, 0);
1066  i++;
1067  }
1068  else if(argv[i] == "-link") {
1069  i++;
1070  if(i < argv.size())
1071  opt_post_link(0, GMSH_SET, atoi(argv[i++].c_str()));
1072  else {
1073  Msg::Error("Missing number");
1074  if(exitOnError) Msg::Exit(1);
1075  }
1076  }
1077  else if(argv[i] == "-smoothview") {
1078  opt_post_smooth(0, GMSH_SET, 1.);
1079  i++;
1080  }
1081  else if(argv[i] == "-combine") {
1083  i++;
1084  }
1085  else {
1086  return false;
1087  }
1088 
1089  return true;
1090 }
1091 
1092 static bool GetSolverOption(const std::vector<std::string> &argv,
1093  std::size_t &i, bool exitOnError)
1094 {
1095  if(i < 0 || i >= argv.size()) return false;
1096 
1097  if(argv[i] == "-run") {
1098  // same as '-', but will run local Gmsh client (if no other clients are
1099  // requested, e.g. by opening a '.pro' or '.py' file)
1100  CTX::instance()->batch = -99;
1102  i++;
1103  }
1104  else if(argv[i] == "-onelab") {
1105  i++;
1106  if(i + 1 < argv.size() && argv[i + 1].size() && argv[i + 1][0] != '-') {
1107  Msg::InitializeOnelab(argv[i], argv[i + 1]);
1108  i += 2;
1109  }
1110  else if(i < argv.size()) {
1111  Msg::InitializeOnelab(argv[i]);
1112  i += 1;
1113  }
1114  else {
1115  Msg::Error("Missing client name and/or address of ONELAB server");
1116  if(exitOnError) Msg::Exit(1);
1117  }
1118  }
1119  else if(argv[i] == "-socket") {
1120  i++;
1121  if(i < argv.size())
1122  Msg::InitializeOnelab("GmshRemote", argv[i++]);
1123  else {
1124  Msg::Error("Missing string");
1125  if(exitOnError) Msg::Exit(1);
1126  }
1127  CTX::instance()->batch = -3;
1128  }
1129  else if(argv[i] == "-listen") {
1130  i++;
1131  opt_solver_listen(0, GMSH_SET, 1);
1132  if(i < argv.size() && argv[i].size() && argv[i][0] != '-')
1133  opt_solver_socket_name(0, GMSH_SET, argv[i++]);
1134  }
1135  else if(argv[i] == "-minterpreter") {
1136  i++;
1137  if(i < argv.size())
1138  opt_solver_octave_interpreter(0, GMSH_SET, argv[i++]);
1139  else {
1140  Msg::Error("Missing interpreter name");
1141  if(exitOnError) Msg::Exit(1);
1142  }
1143  }
1144  else if(argv[i] == "-pyinterpreter") {
1145  i++;
1146  if(i < argv.size())
1147  opt_solver_python_interpreter(0, GMSH_SET, argv[i++]);
1148  else {
1149  Msg::Error("Missing interpreter name");
1150  if(exitOnError) Msg::Exit(1);
1151  }
1152  }
1153  else {
1154  return false;
1155  }
1156 
1157  return true;
1158 }
1159 
1160 static bool GetOtherOption(const std::vector<std::string> &argv,
1161  std::size_t &i, bool exitOnError)
1162 {
1163  if(i < 0 || i >= argv.size()) return false;
1164 
1165  if(argv[i] == "-" || argv[i] == "-parse_and_exit") {
1166  CTX::instance()->batch = -99;
1167  i++;
1168  }
1169  else if(argv[i] == "-log") {
1170  i++;
1171  if(i < argv.size()) { Msg::SetLogFile(argv[i++]); }
1172  else {
1173  Msg::Error("Missing filename");
1174  if(exitOnError) Msg::Exit(1);
1175  }
1176  }
1177  else if(argv[i] == "-new") {
1178  CTX::instance()->files.push_back("-new");
1179  i++;
1180  }
1181  else if(argv[i] == "-open") {
1182  CTX::instance()->files.push_back("-open");
1183  i++;
1184  }
1185  else if(argv[i] == "-merge") {
1186  CTX::instance()->files.push_back("-merge");
1187  i++;
1188  }
1189  else if(argv[i] == "-pid") {
1190  fprintf(stdout, "%d\n", GetProcessId());
1191  fflush(stdout);
1192  i++;
1193  }
1194  else if(argv[i] == "-a") {
1196  i++;
1197  }
1198  else if(argv[i] == "-g") {
1200  i++;
1201  }
1202  else if(argv[i] == "-m") {
1204  i++;
1205  }
1206  else if(argv[i] == "-s") {
1208  i++;
1209  }
1210  else if(argv[i] == "-p") {
1212  i++;
1213  }
1214  else if(argv[i] == "-nopopup") {
1216  i++;
1217  }
1218  else if(argv[i] == "-watch") {
1219  i++;
1220  if(i < argv.size()) {
1221  std::string tmp = argv[i++];
1222  if(tmp.size() > 2 && tmp[0] == '"' && tmp[tmp.size() - 1] == '"')
1224  tmp.substr(1, tmp.size() - 2));
1225  else
1227  }
1228  else {
1229  Msg::Error("Missing string");
1230  if(exitOnError) Msg::Exit(1);
1231  }
1232  }
1233  else if(argv[i] == "-string") {
1234  i++;
1235  if(i < argv.size())
1236  ParseString(argv[i++]);
1237  else {
1238  Msg::Error("Missing string");
1239  if(exitOnError) Msg::Exit(1);
1240  }
1241  }
1242  else if(argv[i] == "-setstring") {
1243  i++;
1244  if(i + 1 < argv.size()) {
1245  std::string n(argv[i]), cat, opt, v = argv[i + 1], olName;
1246  int index = 0;
1247  if(SplitOptionName(n, cat, opt, index)) {
1248  GmshSetStringOption(cat, opt, v, index);
1249  }
1250  else if(IsOnelabName(n, olName)) {
1251  Msg::SetOnelabString(olName, v, true, true);
1252  }
1253  else {
1254 #if defined(HAVE_PARSER)
1255  gmsh_yystringsymbols[n] = std::vector<std::string>(1, v);
1256 #endif
1257  Msg::GetCommandLineStrings()[n] = v;
1258  }
1259  i += 2;
1260  }
1261  else {
1262  Msg::Error("Missing name and/or value for string definition");
1263  if(exitOnError) Msg::Exit(1);
1264  }
1265  }
1266  else if(argv[i] == "-setnumber") {
1267  i++;
1268  if(i + 1 < argv.size()) {
1269  std::string n(argv[i]), cat, opt, olName;
1270  double v = atof(argv[i + 1].c_str());
1271  int index = 0;
1272  if(SplitOptionName(n, cat, opt, index)) {
1273  GmshSetNumberOption(cat, opt, v, index);
1274  }
1275  else if(IsOnelabName(n, olName)) {
1276  Msg::SetOnelabNumber(olName, v, true, true);
1277  }
1278  else {
1279 #if defined(HAVE_PARSER)
1280  gmsh_yysymbols[n].value = std::vector<double>(1, v);
1281 #endif
1282  Msg::GetCommandLineNumbers()[n] = std::vector<double>(1, v);
1283  }
1284  i += 2;
1285  }
1286  else {
1287  Msg::Error("Missing name and/or value for number definition");
1288  if(exitOnError) Msg::Exit(1);
1289  }
1290  }
1291  else if(argv[i] == "-setlist" || argv[i] == "-setlistofnumbers") {
1292  i++;
1293  if(i + 1 < argv.size() && argv[i].size() && argv[i][0] != '-') {
1294  std::string n(argv[i]);
1295  std::vector<double> v;
1296  int s = atoi(argv[i + 1].c_str()), j = 0;
1297  i += 2;
1298  while(j < s && i < argv.size()) {
1299  v.push_back(atof(argv[i].c_str()));
1300  i++;
1301  j++;
1302  }
1303  if(j < s) {
1304  Msg::Error("Missing values in list (got %d instead of %d)", j, s);
1305  if(exitOnError) Msg::Exit(1);
1306  }
1307 #if defined(HAVE_PARSER)
1308  gmsh_yysymbols[n].value = v;
1309 #endif
1310  Msg::GetCommandLineNumbers()[n] = v;
1311  }
1312  else {
1313  Msg::Error(
1314  "Missing name and/or value for definition of list of numbers");
1315  if(exitOnError) Msg::Exit(1);
1316  }
1317  }
1318  else if(argv[i] == "-option") {
1319  i++;
1320  if(i < argv.size())
1321  ParseFile(argv[i++], true);
1322  else {
1323  Msg::Error("Missing file name");
1324  if(exitOnError) Msg::Exit(1);
1325  }
1326  }
1327  else if(argv[i] == "-cpu") {
1328  Msg::SetInfoCpu(true);
1329  Msg::SetInfoMem(true);
1330  i++;
1331  }
1332  else if(argv[i] == "-o") {
1333  i++;
1334  if(i < argv.size())
1335  CTX::instance()->outputFileName = argv[i++];
1336  else {
1337  Msg::Error("Missing file name");
1338  if(exitOnError) Msg::Exit(1);
1339  }
1340  }
1341  else if(argv[i] == "-windows") {
1342  i++;
1343  if(i < argv.size())
1344  CTX::instance()->numWindows = atoi(argv[i++].c_str());
1345  else {
1346  Msg::Error("Missing number");
1347  if(exitOnError) Msg::Exit(1);
1348  }
1349  }
1350  else if(argv[i] == "-tiles") {
1351  i++;
1352  if(i < argv.size())
1353  CTX::instance()->numTiles = atoi(argv[i++].c_str());
1354  else {
1355  Msg::Error("Missing number");
1356  if(exitOnError) Msg::Exit(1);
1357  }
1358  }
1359  else if(argv[i] == "-bg") {
1360  i++;
1361  if(i < argv.size())
1363  else {
1364  Msg::Error("Missing filename");
1365  if(exitOnError) Msg::Exit(1);
1366  }
1367  }
1368  else if(argv[i] == "-version" || argv[i] == "--version") {
1369  fprintf(stdout, "%s\n", GMSH_VERSION);
1370  fflush(stdout);
1371  Msg::Exit(0);
1372  }
1373  else if(argv[i] == "-info" || argv[i] == "--info") {
1374  PrintBuildInfo();
1375  Msg::Exit(0);
1376  }
1377  else if(argv[i] == "-help" || argv[i] == "--help") {
1378  Msg::Direct("Gmsh, a 3D mesh generator with pre- and post-processing "
1379  "facilities");
1380  Msg::Direct("Copyright (C) 1997-2022 C. Geuzaine and J.-F. Remacle");
1381  PrintUsage(argv[0]);
1382  Msg::Exit(0);
1383  }
1384  else if(argv[i] == "-help_options") {
1385  std::vector<std::string> s;
1386  PrintOptions(0, GMSH_FULLRC, 0, 1, nullptr, &s);
1387  for(std::size_t i = 0; i < s.size(); i++)
1388  Msg::Direct("%s\n", s[i].c_str());
1389  Msg::Exit(0);
1390  }
1391  else if(argv[i] == "-v" || argv[i] == "-verbose") {
1392  i++;
1393  if(i < argv.size())
1394  Msg::SetVerbosity(atoi(argv[i++].c_str()));
1395  else {
1396  Msg::Error("Missing number");
1397  if(exitOnError) Msg::Exit(1);
1398  }
1399  }
1400  else if(argv[i] == "-nt") {
1401  i++;
1402  if(i < argv.size())
1403  opt_general_num_threads(0, GMSH_SET, atoi(argv[i++].c_str()));
1404  else {
1405  Msg::Error("Missing number");
1406  if(exitOnError) Msg::Exit(1);
1407  }
1408  }
1409  else if(argv[i] == "-n") {
1410  opt_view_visible(0, GMSH_SET, 0);
1411  opt_mesh_nodes(0, GMSH_SET, 0.);
1412  opt_mesh_lines(0, GMSH_SET, 0.);
1417  i++;
1418  }
1419  else if(argv[i] == "-nodb") {
1421  i++;
1422  }
1423  else if(argv[i] == "-camera") {
1425  i++;
1426  }
1427  else if(argv[i] == "-stereo") {
1429  i++;
1430  }
1431  else if(argv[i] == "-gamepad") {
1432  opt_general_gamepad(0, GMSH_SET, 1.);
1433  i++;
1434  }
1435  else if(argv[i] == "-fontsize") {
1436  i++;
1437  if(i < argv.size())
1438  opt_general_fontsize(0, GMSH_SET, atoi(argv[i++].c_str()));
1439  else {
1440  Msg::Error("Missing number");
1441  if(exitOnError) Msg::Exit(1);
1442  }
1443  }
1444  else if(argv[i] == "-deltafontsize") {
1445  i++;
1446  if(i < argv.size())
1447  CTX::instance()->deltaFontSize = atoi(argv[i++].c_str());
1448  else {
1449  Msg::Error("Missing number");
1450  if(exitOnError) Msg::Exit(1);
1451  }
1452  }
1453  else if(argv[i] == "-theme" || argv[i] == "-scheme") {
1454  i++;
1455  if(i < argv.size())
1456  opt_general_gui_theme(0, GMSH_SET, argv[i++]);
1457  else {
1458  Msg::Error("Missing argument");
1459  if(exitOnError) Msg::Exit(1);
1460  }
1461  }
1462  else if(argv[i] == "-display") {
1463  i++;
1464  if(i < argv.size())
1465  opt_general_display(0, GMSH_SET, argv[i++]);
1466  else {
1467  Msg::Error("Missing argument");
1468  if(exitOnError) Msg::Exit(1);
1469  }
1470  }
1471  else {
1472  return false;
1473  }
1474 
1475  return true;
1476 }
1477 
1478 void GetOptions(bool readConfigFiles, bool exitOnError)
1479 {
1480  // print messages on terminal (use special 99 value so that we can detect if
1481  // it was later set to 1 in the option file)
1482  int terminal = CTX::instance()->terminal;
1483  CTX::instance()->terminal = 99;
1484 
1485 #if defined(HAVE_PARSER)
1486  if(readConfigFiles) {
1487  ParseFile(CTX::instance()->homeDir + CTX::instance()->sessionFileName,
1488  true);
1489  ParseFile(CTX::instance()->homeDir + CTX::instance()->optionsFileName,
1490  true);
1491  }
1492 #endif
1493 
1494  std::vector<std::string> &argv(Msg::GetCommandLineArgs());
1495 
1496  if(argv.size()) Msg::SetExecutableName(argv[0]);
1497 
1498  // get command line options
1499  std::size_t i = 1;
1500  while(i < argv.size()) {
1501  if(argv[i].size() && argv[i][0] == '-') {
1502  if(GetGeometryOption(argv, i, exitOnError)) {
1503  }
1504  else if(GetMeshOption(argv, i, exitOnError)) {
1505  }
1506  else if(GetPostProcessingOption(argv, i, exitOnError)) {
1507  }
1508  else if(GetSolverOption(argv, i, exitOnError)) {
1509  }
1510  else if(GetOtherOption(argv, i, exitOnError)) {
1511  }
1512  else if(argv[i] == "-term") {
1513  terminal = 1;
1514  i++;
1515  }
1516 #if defined(__APPLE__)
1517  else if(argv[i] == "-psn") {
1518  // the Mac Finder launches programs with a special command line argument
1519  // of the form -psn_XXX: just ignore it silently (and don't exit!)
1520  i++;
1521  }
1522 #endif
1523  else {
1524 #if defined(HAVE_PETSC) || defined(HAVE_MPI)
1525  // unknown options might be used by PETSc or MPI
1526  Msg::Warning("Skipping unknown option '%s'", argv[i].c_str());
1527  i++;
1528 #else
1529  Msg::Error("Unknown option '%s'", argv[i].c_str());
1530  PrintUsage(argv[0]);
1531  Msg::Exit(1);
1532 #endif
1533  }
1534  }
1535  else {
1536  CTX::instance()->files.push_back(argv[i++]);
1537  }
1538  }
1539 
1540  if(CTX::instance()->files.empty()) {
1541  std::string base = (getenv("PWD") ? "" : CTX::instance()->homeDir);
1542  GModel::current()->setFileName(base + CTX::instance()->defaultFileName);
1543  }
1544  else
1545  GModel::current()->setFileName(CTX::instance()->files[0]);
1546 
1547  if(CTX::instance()->terminal == 99) CTX::instance()->terminal = terminal;
1548 }
GetSolverOption
static bool GetSolverOption(const std::vector< std::string > &argv, std::size_t &i, bool exitOnError)
Definition: CommandLine.cpp:1092
opt_mesh_volume_faces
double opt_mesh_volume_faces(OPT_ARGS_NUM)
Definition: Options.cpp:5480
opt_general_num_threads
double opt_general_num_threads(OPT_ARGS_NUM)
Definition: Options.cpp:4145
GetKnownFileFormats
std::string GetKnownFileFormats(bool onlyMeshFormats)
Definition: CreateFile.cpp:173
CreateFile.h
GetProcessId
int GetProcessId()
Definition: OS.cpp:414
GetMouseUsage
std::vector< std::pair< std::string, std::string > > GetMouseUsage()
Definition: CommandLine.cpp:330
opt_mesh_partition_split_mesh_files
double opt_mesh_partition_split_mesh_files(OPT_ARGS_NUM)
Definition: Options.cpp:5705
CTX::deltaFontSize
int deltaFontSize
Definition: Context.h:264
SplitOptionName
bool SplitOptionName(const std::string &fullName, std::string &category, std::string &name, int &index)
Definition: StringUtils.cpp:156
opt_mesh_smooth_ratio
double opt_mesh_smooth_ratio(OPT_ARGS_NUM)
Definition: Options.cpp:5599
GMSH_SET
#define GMSH_SET
Definition: Options.h:12
Msg::GetCommandLineStrings
static std::map< std::string, std::string > & GetCommandLineStrings()
Definition: GmshMessage.cpp:297
CTX::bgmFileName
std::string bgmFileName
Definition: Context.h:141
contextMeshOptions::lcFromCurvature
int lcFromCurvature
Definition: Context.h:27
GetGmshPackager
const char * GetGmshPackager()
Definition: CommandLine.cpp:63
CTX::createAppendMeshStatReport
int createAppendMeshStatReport
Definition: Context.h:151
ALGO_3D_MMG3D
#define ALGO_3D_MMG3D
Definition: GmshDefines.h:253
opt_mesh_partition_create_topology
double opt_mesh_partition_create_topology(OPT_ARGS_NUM)
Definition: Options.cpp:5773
Msg::SetInfoMem
static void SetInfoMem(bool val)
Definition: GmshMessage.cpp:335
opt_mesh_ho_threshold_max
double opt_mesh_ho_threshold_max(OPT_ARGS_NUM)
Definition: Options.cpp:6202
opt_mesh_lc_extend_from_boundary
double opt_mesh_lc_extend_from_boundary(OPT_ARGS_NUM)
Definition: Options.cpp:5110
opt_solver_socket_name
std::string opt_solver_socket_name(OPT_ARGS_STR)
Definition: Options.cpp:1439
CTX::homeDir
std::string homeDir
Definition: Context.h:147
Msg::Info
static void Info(const char *fmt,...)
Definition: GmshMessage.cpp:587
OS.h
opt_mesh_file_format
double opt_mesh_file_format(OPT_ARGS_NUM)
Definition: Options.cpp:5668
opt_mesh_binary
double opt_mesh_binary(OPT_ARGS_NUM)
Definition: Options.cpp:5803
GetShortcutsUsage
std::vector< std::pair< std::string, std::string > > GetShortcutsUsage(const std::string &ctrl)
Definition: CommandLine.cpp:219
opt_mesh_optimize_threshold
double opt_mesh_optimize_threshold(OPT_ARGS_NUM)
Definition: Options.cpp:4867
CreateOutputFile
void CreateOutputFile(const std::string &fileName, int format, bool status)
Definition: CreateFile.cpp:290
Msg::Warning
static void Warning(const char *fmt,...)
Definition: GmshMessage.cpp:543
opt_general_watch_file_pattern
std::string opt_general_watch_file_pattern(OPT_ARGS_STR)
Definition: Options.cpp:1324
opt_mesh_partition_create_physicals
double opt_mesh_partition_create_physicals(OPT_ARGS_NUM)
Definition: Options.cpp:5767
Msg::Error
static void Error(const char *fmt,...)
Definition: GmshMessage.cpp:482
CTX::post
struct CTX::@0 post
opt_mesh_lc_integration_precision
double opt_mesh_lc_integration_precision(OPT_ARGS_NUM)
Definition: Options.cpp:5126
opt_mesh_nb_smoothing
double opt_mesh_nb_smoothing(OPT_ARGS_NUM)
Definition: Options.cpp:5878
opt_mesh_algo3d
double opt_mesh_algo3d(OPT_ARGS_NUM)
Definition: Options.cpp:6058
Msg::SetExecutableName
static void SetExecutableName(const std::string &name)
Definition: GmshMessage.cpp:367
ALGO_2D_PACK_PRLGRMS
#define ALGO_2D_PACK_PRLGRMS
Definition: GmshDefines.h:245
opt_mesh_lines
double opt_mesh_lines(OPT_ARGS_NUM)
Definition: Options.cpp:5281
opt_mesh_partition_metis_algorithm
double opt_mesh_partition_metis_algorithm(OPT_ARGS_NUM)
Definition: Options.cpp:6564
opt_general_gamepad
double opt_general_gamepad(OPT_ARGS_NUM)
Definition: Options.cpp:3530
GetGmshBuildHost
const char * GetGmshBuildHost()
Definition: CommandLine.cpp:62
PView.h
opt_mesh_msh_file_version
double opt_mesh_msh_file_version(OPT_ARGS_NUM)
Definition: Options.cpp:5681
GetGeometryOption
static bool GetGeometryOption(const std::vector< std::string > &argv, std::size_t &i, bool exitOnError)
Definition: CommandLine.cpp:422
opt_mesh_partition_hex_weight
double opt_mesh_partition_hex_weight(OPT_ARGS_NUM)
Definition: Options.cpp:5719
opt_mesh_ho_optimize
double opt_mesh_ho_optimize(OPT_ARGS_NUM)
Definition: Options.cpp:6167
CTX::files
std::vector< std::string > files
Definition: Context.h:140
opt_mesh_surface_faces
double opt_mesh_surface_faces(OPT_ARGS_NUM)
Definition: Options.cpp:5450
GmshMessage.h
opt_post_smooth
double opt_post_smooth(OPT_ARGS_NUM)
Definition: Options.cpp:6828
GetGmshPatchVersion
int GetGmshPatchVersion()
Definition: CommandLine.cpp:58
CTX::batch
int batch
Definition: Context.h:203
opt_mesh_partition_trih_weight
double opt_mesh_partition_trih_weight(OPT_ARGS_NUM)
Definition: Options.cpp:5737
GetGmshVersion
const char * GetGmshVersion()
Definition: CommandLine.cpp:60
GetMeshOption
static bool GetMeshOption(const std::vector< std::string > &argv, std::size_t &i, bool exitOnError)
Definition: CommandLine.cpp:464
opt_solver_python_interpreter
std::string opt_solver_python_interpreter(OPT_ARGS_STR)
Definition: Options.cpp:1678
GetPostProcessingOption
static bool GetPostProcessingOption(const std::vector< std::string > &argv, std::size_t &i, bool exitOnError)
Definition: CommandLine.cpp:1059
opt_geometry_scaling_factor
double opt_geometry_scaling_factor(OPT_ARGS_NUM)
Definition: Options.cpp:4759
GetGmshMinorVersion
int GetGmshMinorVersion()
Definition: CommandLine.cpp:57
opt_general_fontsize
double opt_general_fontsize(OPT_ARGS_NUM)
Definition: Options.cpp:2181
CTX::numTiles
int numTiles
Definition: Context.h:173
GetOtherOption
static bool GetOtherOption(const std::vector< std::string > &argv, std::size_t &i, bool exitOnError)
Definition: CommandLine.cpp:1160
opt_mesh_aniso_max
double opt_mesh_aniso_max(OPT_ARGS_NUM)
Definition: Options.cpp:5605
opt_general_camera_mode
double opt_general_camera_mode(OPT_ARGS_NUM)
Definition: Options.cpp:3641
ParseString
void ParseString(const std::string &str, bool inCurrentModelDir)
Definition: OpenFile.cpp:259
Msg::SetOnelabString
static void SetOnelabString(const std::string &name, const std::string &val, bool visible=true, bool persistent=false, bool readOnly=false, int changedValue=3, const std::string &kind="")
Definition: GmshMessage.cpp:1021
opt_mesh_lc_min
double opt_mesh_lc_min(OPT_ARGS_NUM)
Definition: Options.cpp:4997
opt_solver_octave_interpreter
std::string opt_solver_octave_interpreter(OPT_ARGS_STR)
Definition: Options.cpp:1689
CTX::instance
static CTX * instance()
Definition: Context.cpp:122
ALGO_2D_FRONTAL_QUAD
#define ALGO_2D_FRONTAL_QUAD
Definition: GmshDefines.h:244
PrintOptions
void PrintOptions(int num, int level, int diff, int help, const char *filename, std::vector< std::string > *vec)
Definition: Options.cpp:636
opt_mesh_nodes
double opt_mesh_nodes(OPT_ARGS_NUM)
Definition: Options.cpp:5270
contextMeshOptions::gradation
double gradation
Definition: Context.h:52
GetGmshShortLicense
const char * GetGmshShortLicense()
Definition: CommandLine.cpp:65
GModel::setFileName
void setFileName(const std::string &fileName)
Definition: GModel.cpp:123
opt_mesh_algo_recombine
double opt_mesh_algo_recombine(OPT_ARGS_NUM)
Definition: Options.cpp:5945
FORMAT_MSH
#define FORMAT_MSH
Definition: GmshDefines.h:10
gmsh_yysymbols
std::map< std::string, gmsh_yysymbol > gmsh_yysymbols
Definition: Gmsh.tab.cpp:643
Msg::InitializeOnelab
static void InitializeOnelab(const std::string &name, const std::string &sockname="")
Definition: GmshMessage.cpp:1155
OpenProject
void OpenProject(const std::string &fileName, bool errorIfMissing)
Definition: OpenFile.cpp:718
ALGO_2D_FRONTAL
#define ALGO_2D_FRONTAL
Definition: GmshDefines.h:242
opt_general_stereo_mode
double opt_general_stereo_mode(OPT_ARGS_NUM)
Definition: Options.cpp:3597
opt_solver_listen
double opt_solver_listen(OPT_ARGS_NUM)
Definition: Options.cpp:6715
opt_mesh_scaling_factor
double opt_mesh_scaling_factor(OPT_ARGS_NUM)
Definition: Options.cpp:4965
GMSH_FULLRC
#define GMSH_FULLRC
Definition: Options.h:20
opt_post_link
double opt_post_link(OPT_ARGS_NUM)
Definition: Options.cpp:6816
opt_general_nopopup
double opt_general_nopopup(OPT_ARGS_NUM)
Definition: Options.cpp:2914
opt_mesh_lc_from_curvature_iso
double opt_mesh_lc_from_curvature_iso(OPT_ARGS_NUM)
Definition: Options.cpp:5066
opt_mesh_dual
double opt_mesh_dual(OPT_ARGS_NUM)
Definition: Options.cpp:6358
GmshSetStringOption
void GmshSetStringOption(const std::string &category, const std::string &name, std::string value, int index)
Definition: GmshGlobal.cpp:140
opt_mesh_partition_qua_weight
double opt_mesh_partition_qua_weight(OPT_ARGS_NUM)
Definition: Options.cpp:5743
opt_mesh_voronoi
double opt_mesh_voronoi(OPT_ARGS_NUM)
Definition: Options.cpp:6364
opt_general_gui_theme
std::string opt_general_gui_theme(OPT_ARGS_STR)
Definition: Options.cpp:1330
opt_mesh_ho_nlayers
double opt_mesh_ho_nlayers(OPT_ARGS_NUM)
Definition: Options.cpp:6190
opt_mesh_partition_tet_weight
double opt_mesh_partition_tet_weight(OPT_ARGS_NUM)
Definition: Options.cpp:5749
PrintBuildInfo
void PrintBuildInfo()
Definition: CommandLine.cpp:416
CTX::outputFileName
std::string outputFileName
Definition: Context.h:141
GmshDefines.h
opt_mesh_partition_create_ghost_cells
double opt_mesh_partition_create_ghost_cells(OPT_ARGS_NUM)
Definition: Options.cpp:5779
opt_mesh_volume_edges
double opt_mesh_volume_edges(OPT_ARGS_NUM)
Definition: Options.cpp:5465
GetGmshBuildDate
const char * GetGmshBuildDate()
Definition: CommandLine.cpp:61
opt_mesh_allow_swap_edge_angle
double opt_mesh_allow_swap_edge_angle(OPT_ARGS_NUM)
Definition: Options.cpp:6135
Msg::Exit
static void Exit(int level)
Definition: GmshMessage.cpp:384
CTX::mesh
contextMeshOptions mesh
Definition: Context.h:313
GetGmshBuildOptions
const char * GetGmshBuildOptions()
Definition: CommandLine.cpp:66
Parser.h
ALGO_2D_MESHADAPT
#define ALGO_2D_MESHADAPT
Definition: GmshDefines.h:238
opt_mesh_order
double opt_mesh_order(OPT_ARGS_NUM)
Definition: Options.cpp:6152
ALGO_3D_HXT
#define ALGO_3D_HXT
Definition: GmshDefines.h:255
opt_mesh_partition_num
double opt_mesh_partition_num(OPT_ARGS_NUM)
Definition: Options.cpp:6554
opt_geometry_tolerance
double opt_geometry_tolerance(OPT_ARGS_NUM)
Definition: Options.cpp:4317
opt_mesh_preserve_numbering_msh2
double opt_mesh_preserve_numbering_msh2(OPT_ARGS_NUM)
Definition: Options.cpp:6611
opt_mesh_lc_max
double opt_mesh_lc_max(OPT_ARGS_NUM)
Definition: Options.cpp:5012
opt_mesh_tolerance_edge_length
double opt_mesh_tolerance_edge_length(OPT_ARGS_NUM)
Definition: Options.cpp:5027
CTX::geom
contextGeometryOptions geom
Definition: Context.h:311
ALGO_3D_FRONTAL
#define ALGO_3D_FRONTAL
Definition: GmshDefines.h:252
GmshGlobal.h
StringUtils.h
GetGmshMajorVersion
int GetGmshMajorVersion()
Definition: CommandLine.cpp:56
CTX::meshStatReportFileName
std::string meshStatReportFileName
Definition: Context.h:143
opt_general_display
std::string opt_general_display(OPT_ARGS_STR)
Definition: Options.cpp:1147
PrintUsage
void PrintUsage(const std::string &name)
Definition: CommandLine.cpp:350
opt_general_background_image_filename
std::string opt_general_background_image_filename(OPT_ARGS_STR)
Definition: Options.cpp:1153
opt_mesh_save_all
double opt_mesh_save_all(OPT_ARGS_NUM)
Definition: Options.cpp:6376
ALGO_3D_RTREE
#define ALGO_3D_RTREE
Definition: GmshDefines.h:254
Msg::GetCommandLineNumbers
static std::map< std::string, std::vector< double > > & GetCommandLineNumbers()
Definition: GmshMessage.cpp:292
Msg::Direct
static void Direct(const char *fmt,...)
Definition: GmshMessage.cpp:634
CTX::debugSurface
int debugSurface
Definition: Context.h:138
Context.h
opt_mesh_optimize
double opt_mesh_optimize(OPT_ARGS_NUM)
Definition: Options.cpp:4851
Msg::GetCommandLineArgs
static std::vector< std::string > & GetCommandLineArgs()
Definition: GmshMessage.cpp:277
opt_general_initial_context
double opt_general_initial_context(OPT_ARGS_NUM)
Definition: Options.cpp:2163
opt_mesh_rand_factor
double opt_mesh_rand_factor(OPT_ARGS_NUM)
Definition: Options.cpp:5137
contextMeshOptions::algo2d
int algo2d
Definition: Context.h:29
GetBuildInfo
std::vector< std::string > GetBuildInfo()
Definition: CommandLine.cpp:364
ALGO_2D_INITIAL_ONLY
#define ALGO_2D_INITIAL_ONLY
Definition: GmshDefines.h:240
gmsh_yystringsymbols
std::map< std::string, std::vector< std::string > > gmsh_yystringsymbols
Definition: Gmsh.tab.cpp:644
GetGmshBuildOS
const char * GetGmshBuildOS()
Definition: CommandLine.cpp:64
GetFileFormatFromExtension
int GetFileFormatFromExtension(const std::string &ext, double *version)
Definition: CreateFile.cpp:34
CTX::combineTime
int combineTime
Definition: Context.h:318
opt_mesh_ho_threshold_min
double opt_mesh_ho_threshold_min(OPT_ARGS_NUM)
Definition: Options.cpp:6196
ALGO_3D_DELAUNAY
#define ALGO_3D_DELAUNAY
Definition: GmshDefines.h:250
opt_mesh_recombine_all
double opt_mesh_recombine_all(OPT_ARGS_NUM)
Definition: Options.cpp:5965
opt_mesh_save_topology
double opt_mesh_save_topology(OPT_ARGS_NUM)
Definition: Options.cpp:6401
ALGO_2D_AUTO
#define ALGO_2D_AUTO
Definition: GmshDefines.h:239
ALGO_3D_INITIAL_ONLY
#define ALGO_3D_INITIAL_ONLY
Definition: GmshDefines.h:251
Msg::SetVerbosity
static void SetVerbosity(int val)
Definition: GmshMessage.cpp:249
Options.h
CTX::batchAfterMesh
int batchAfterMesh
Definition: Context.h:205
CTX::launchSolverAtStartup
int launchSolverAtStartup
Definition: Context.h:155
GetGmshExtraVersion
const char * GetGmshExtraVersion()
Definition: CommandLine.cpp:59
opt_mesh_switch_elem_tags
double opt_mesh_switch_elem_tags(OPT_ARGS_NUM)
Definition: Options.cpp:6466
GModel.h
CommandLine.h
opt_general_double_buffer
double opt_general_double_buffer(OPT_ARGS_NUM)
Definition: Options.cpp:3322
opt_mesh_num_sub_edges
double opt_mesh_num_sub_edges(OPT_ARGS_NUM)
Definition: Options.cpp:4922
GetOptions
void GetOptions(bool readConfigFiles, bool exitOnError)
Definition: CommandLine.cpp:1478
opt_mesh_algo2d
double opt_mesh_algo2d(OPT_ARGS_NUM)
Definition: Options.cpp:5889
opt_mesh_lc_from_curvature
double opt_mesh_lc_from_curvature(OPT_ARGS_NUM)
Definition: Options.cpp:5049
IsOnelabName
bool IsOnelabName(const std::string &name, std::string &cleanName)
Definition: StringUtils.cpp:225
Msg::SetOnelabNumber
static void SetOnelabNumber(const std::string &name, double val, bool visible=true, bool persistent=false, bool readOnly=false, int changedValue=3)
Definition: GmshMessage.cpp:987
GetUsage
std::vector< std::pair< std::string, std::string > > GetUsage()
Definition: CommandLine.cpp:68
PView::list
static std::vector< PView * > list
Definition: PView.h:112
opt_mesh_partition_tri_weight
double opt_mesh_partition_tri_weight(OPT_ARGS_NUM)
Definition: Options.cpp:5755
opt_mesh_partition_pri_weight
double opt_mesh_partition_pri_weight(OPT_ARGS_NUM)
Definition: Options.cpp:5725
CTX::terminal
int terminal
Definition: Context.h:167
ALGO_2D_DELAUNAY
#define ALGO_2D_DELAUNAY
Definition: GmshDefines.h:241
opt_view_visible
double opt_view_visible(OPT_ARGS_NUM)
Definition: Options.cpp:7634
contextGeometryOptions::autoExtrude
int autoExtrude
Definition: Context.h:98
ParseFile
int ParseFile(const std::string &fileName, bool close, bool errorIfMissing)
Definition: OpenFile.cpp:177
opt_mesh_lc_factor
double opt_mesh_lc_factor(OPT_ARGS_NUM)
Definition: Options.cpp:4976
opt_mesh_save_parametric
double opt_mesh_save_parametric(OPT_ARGS_NUM)
Definition: Options.cpp:6388
opt_geometry_match_geom_and_mesh
double opt_geometry_match_geom_and_mesh(OPT_ARGS_NUM)
Definition: Options.cpp:4832
ALGO_2D_QUAD_QUASI_STRUCT
#define ALGO_2D_QUAD_QUASI_STRUCT
Definition: GmshDefines.h:247
ALGO_2D_BAMG
#define ALGO_2D_BAMG
Definition: GmshDefines.h:243
GmshSetNumberOption
void GmshSetNumberOption(const std::string &category, const std::string &name, double value, int index)
Definition: GmshGlobal.cpp:147
opt_mesh_surface_edges
double opt_mesh_surface_edges(OPT_ARGS_NUM)
Definition: Options.cpp:5435
opt_mesh_optimize_netgen
double opt_mesh_optimize_netgen(OPT_ARGS_NUM)
Definition: Options.cpp:4878
OpenFile.h
CTX::batchSomeValue
double batchSomeValue
Definition: Context.h:207
opt_mesh_partition_pyr_weight
double opt_mesh_partition_pyr_weight(OPT_ARGS_NUM)
Definition: Options.cpp:5731
GModel::current
static GModel * current(int index=-1)
Definition: GModel.cpp:136
CTX::numWindows
int numWindows
Definition: Context.h:173
opt_mesh_ignore_periodicity
double opt_mesh_ignore_periodicity(OPT_ARGS_NUM)
Definition: Options.cpp:6617
Msg::SetLogFile
static void SetLogFile(const std::string &name)
Definition: GmshMessage.cpp:259
opt_mesh_partition_save_topology_file
double opt_mesh_partition_save_topology_file(OPT_ARGS_NUM)
Definition: Options.cpp:5712
Msg::SetInfoCpu
static void SetInfoCpu(bool val)
Definition: GmshMessage.cpp:330
contextMeshOptions::nLayersPerGap
int nLayersPerGap
Definition: Context.h:51