Skip to content
Snippets Groups Projects
CommandLine.cpp 39 KiB
Newer Older
Christophe Geuzaine's avatar
Christophe Geuzaine committed
// Gmsh - Copyright (C) 1997-2013 C. Geuzaine, J.-F. Remacle
Christophe Geuzaine's avatar
Christophe Geuzaine committed
// See the LICENSE.txt file for license information. Please report all
Christophe Geuzaine's avatar
Christophe Geuzaine committed
// bugs and problems to the public mailing list <gmsh@geuz.org>.
#include <string>
Christophe Geuzaine's avatar
Christophe Geuzaine committed
#include <string.h>
Claudine Bon's avatar
Claudine Bon committed
#include <stdlib.h>
Christophe Geuzaine's avatar
Christophe Geuzaine committed
#include <fstream>
#include "GmshConfig.h"
#include "GmshDefines.h"
#include "GmshVersion.h"
#include "GmshMessage.h"
#include "OpenFile.h"
#include "CommandLine.h"
#include "Context.h"
#include "Options.h"
#include "GModel.h"
#include "CreateFile.h"
#include "OS.h"
#if (FL_MAJOR_VERSION == 1) && (FL_MINOR_VERSION >= 3)
#if defined(HAVE_POST)
Christophe Geuzaine's avatar
Christophe Geuzaine committed
#if defined(HAVE_MESH)
#include "periodical.h"
#endif

int GetGmshMajorVersion(){ return GMSH_MAJOR_VERSION; }
int GetGmshMinorVersion(){ return GMSH_MINOR_VERSION; }
int GetGmshPatchVersion(){ return GMSH_PATCH_VERSION; }
const char *GetGmshExtraVersion(){ return GMSH_EXTRA_VERSION; }
const char *GetGmshVersion(){ return GMSH_VERSION; }
const char *GetGmshBuildDate(){ return GMSH_DATE; }
const char *GetGmshBuildHost(){ return GMSH_HOST; }
const char *GetGmshPackager(){ return GMSH_PACKAGER; }
const char *GetGmshBuildOS(){ return GMSH_OS; }
const char *GetGmshShortLicense(){ return GMSH_SHORT_LICENSE; }
const char *GetGmshBuildOptions(){ return GMSH_CONFIG_OPTIONS; }
Christophe Geuzaine's avatar
Christophe Geuzaine committed
std::vector<std::pair<std::string, std::string> > GetUsage()
  typedef std::pair<std::string, std::string> mp;
  std::vector<mp> s;
  s.push_back(mp("Geometry options:", ""));
  s.push_back(mp("-0",                 "Output unrolled geometry, then exit"));
  s.push_back(mp("-tol float",         "Set geometrical tolerance"));
  s.push_back(mp("-match",             "Match geometries and meshes"));
  s.push_back(mp("Mesh options:", ""));
  s.push_back(mp("-1, -2, -3",         "Perform 1D, 2D or 3D mesh generation, then exit"));
Christophe Geuzaine's avatar
Christophe Geuzaine committed
  s.push_back(mp("-o file",            "Specify output file name"));
  s.push_back(mp("-format string",     "Select output mesh format (auto (default), msh, "
                                       "msh1, msh2, unv, vrml, ply2, stl, mesh, bdf, cgns, "
                                       "p3d, diff, med, ...)"));
Christophe Geuzaine's avatar
Christophe Geuzaine committed
  s.push_back(mp("-bin",               "Use binary format when available"));
  s.push_back(mp("-refine",            "Perform uniform mesh refinement, then exit"));
  s.push_back(mp("-part int",          "Partition after batch mesh generation"));
  s.push_back(mp("-partWeight tri|quad|tet|prism|hex int", "Weight of a triangle/quad/etc. "
                                                           "during partitioning"));
  s.push_back(mp("-saveall",           "Save all elements (discard physical group definitions)"));
  s.push_back(mp("-parametric",        "Save vertices with their parametric coordinates"));
  s.push_back(mp("-algo string",       "Select mesh algorithm (meshadapt, del2d, front2d, "
                                        "delquad, del3d, front3d, mmg3d)"));
  s.push_back(mp("-smooth int",        "Set number of mesh smoothing steps"));
  s.push_back(mp("-order int",         "Set mesh order (1, ..., 5)"));
  s.push_back(mp("-optimize[_netgen]", "Optimize quality of tetrahedral elements"));
Christophe Geuzaine's avatar
Christophe Geuzaine committed
  s.push_back(mp("-optimize_ho",       "Optimize high order meshes"));
  s.push_back(mp("-ho_[min,max,nlayers]", "High-order optimization parameters"));
  s.push_back(mp("-optimize_lloyd",    "Optimize 2D meshes using Lloyd algorithm"));
  s.push_back(mp("-clscale float",     "Set global mesh element size scaling factor"));
  s.push_back(mp("-clmin float",       "Set minimum mesh element size"));
  s.push_back(mp("-clmax float",       "Set maximum mesh element size"));
  s.push_back(mp("-anisoMax float",    "Set maximum anisotropy (only used in bamg for now)"));
  s.push_back(mp("-smoothRatio float", "Set smoothing ration between mesh sizes at nodes of "
                                       "a same edge (only used in bamg)"));
  s.push_back(mp("-clcurv",            "Automatically compute element sizes from curvatures"));
  s.push_back(mp("-epslc1d",           "Set accuracy of evaluation of LCFIELD for 1D mesh"));
  s.push_back(mp("-swapangle",         "Set the threshold angle (in degree) between two adjacent"
                                       " faces below which a swap is allowed"));
  s.push_back(mp("-rand float",        "Set random perturbation factor"));
  s.push_back(mp("-bgm file",          "Load background mesh from file"));
  s.push_back(mp("-check",             "Perform various consistency checks on mesh"));
  s.push_back(mp("-mpass int",         "Do several passes on the mesh for complex backround fields"));
  s.push_back(mp("-ignorePartBound",   "Ignore partitions boundaries"));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#if defined(HAVE_FLTK)
  s.push_back(mp("Post-processing options:", ""));
  s.push_back(mp("-link int",          "Select link mode between views (0, 1, 2, 3, 4)"));
  s.push_back(mp("-combine",           "Combine views having identical names into "
                                       "multi-time-step views"));
  s.push_back(mp("Display options:", ""));
  s.push_back(mp("-n",                 "Hide all meshes and post-processing views on startup"));
  s.push_back(mp("-nodb",              "Disable double buffering"));
Christophe Geuzaine's avatar
Christophe Geuzaine committed
  s.push_back(mp("-numsubedges",       "Set num of subdivisions for high order element display"));
  s.push_back(mp("-fontsize int",      "Specify the font size for the GUI"));
  s.push_back(mp("-theme string",      "Specify FLTK GUI theme"));
  s.push_back(mp("-display string",    "Specify display"));
  s.push_back(mp("-camera",            "Use camera mode view;"));
  s.push_back(mp("-stereo",            "OpenGL quad-buffered stereo rendering (requires "
                                       "special graphic card)"));
  s.push_back(mp("-gamepad",           "Use gamepad controller if available"));
  s.push_back(mp("Other options:", ""));
  s.push_back(mp("-, -parse_and_exit", "Parse input files, then exit"));
  s.push_back(mp("-new",               "Create new model before merge next file"));
  s.push_back(mp("-merge",             "Merge next files"));
  s.push_back(mp("-open",              "Open next files"));
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
#if defined(HAVE_FLTK)
  s.push_back(mp("-a, -g, -m, -s, -p", "Start in automatic, geometry, mesh, solver or "
                                       "post-processing mode"));
  s.push_back(mp("-pid",               "Print process id on stdout"));
  s.push_back(mp("-listen",            "Always listen to incoming connection requests"));
  s.push_back(mp("-watch pattern",     "Pattern of files to merge as they become available"));
  s.push_back(mp("-v int",             "Set verbosity level"));
  s.push_back(mp("-nopopup",           "Don't popup dialog windows in scripts"));
  s.push_back(mp("-string \"string\"", "Parse option string at startup"));
  s.push_back(mp("-option file",       "Parse option file at startup"));
  s.push_back(mp("-convert files",     "Convert files into latest binary formats, then exit"));
  s.push_back(mp("-version",           "Show version number"));
  s.push_back(mp("-info",              "Show detailed version information"));
  s.push_back(mp("-help",              "Show command line usage"));
Christophe Geuzaine's avatar
Christophe Geuzaine committed
  return s;
}

std::vector<std::pair<std::string, std::string> > GetShortcutsUsage(const std::string &ctrl)
Christophe Geuzaine's avatar
Christophe Geuzaine committed
{
  std::string cc = ctrl;
Christophe Geuzaine's avatar
Christophe Geuzaine committed
#if defined(__APPLE__)
  if(cc.empty()) cc = "Cmd+";
Christophe Geuzaine's avatar
Christophe Geuzaine committed
#else
  if(cc.empty()) cc = "Ctrl+";
Christophe Geuzaine's avatar
Christophe Geuzaine committed
#endif
  typedef std::pair<std::string, std::string> mp;
  std::vector<mp> s;
  s.push_back(mp("Left arrow",     "Go to previous time step"));
  s.push_back(mp("Right arrow",    "Go to next time step"));
  s.push_back(mp("Up arrow",       "Make previous view visible"));
  s.push_back(mp("Down arrow",     "Make next view visible"));
  s.push_back(mp("0",              "Reload project file"));
  s.push_back(mp("1 or F1",        "Mesh lines"));
  s.push_back(mp("2 or F2",        "Mesh surfaces"));
  s.push_back(mp("3 or F3",        "Mesh volumes"));
  s.push_back(mp("Escape",         "Cancel lasso zoom/selection, toggle mouse selection ON/OFF"));
  s.push_back(mp("g",              "Go to geometry module"));
  s.push_back(mp("m",              "Go to mesh module"));
  s.push_back(mp("p",              "Go to post-processing module"));
  s.push_back(mp("s",              "Go to solver module"));
  s.push_back(mp("Shift+a",        "Bring all windows to front"));
  s.push_back(mp("Shift+g",        "Show geometry options"));
  s.push_back(mp("Shift+m",        "Show mesh options"));
  s.push_back(mp("Shift+o",        "Show general options"));
  s.push_back(mp("Shift+p",        "Show post-processing options"));
  s.push_back(mp("Shift+s",        "Show solver options"));
  s.push_back(mp("Shift+u",        "Show post-processing view plugins"));
  s.push_back(mp("Shift+w",        "Show post-processing view options"));
  s.push_back(mp("Shift+Escape",   "Enable full mouse selection"));
  s.push_back(mp(cc + "d",         "Attach/detach menu"));
Christophe Geuzaine's avatar
Christophe Geuzaine committed
  s.push_back(mp(cc + "f",         "Enter full screen"));
  s.push_back(mp(cc + "i",         "Show statistics window"));
  s.push_back(mp(cc + "j",         "Save model options"));
  s.push_back(mp(cc + "l",         "Show message console"));
Christophe Geuzaine's avatar
Christophe Geuzaine committed
#if defined(__APPLE__)
  s.push_back(mp(cc + "m",         "Minimize window"));
Christophe Geuzaine's avatar
Christophe Geuzaine committed
#endif
  s.push_back(mp(cc + "n",         "Create new project file"));
  s.push_back(mp(cc + "o",         "Open project file"));
  s.push_back(mp(cc + "q",         "Quit"));
  s.push_back(mp(cc + "r",         "Rename project file"));
  s.push_back(mp(cc + "s",         "Save file as"));
  s.push_back(mp("Shift+" + cc + "c", "Show clipping plane window"));
  s.push_back(mp("Shift+" + cc + "j", "Save options as default"));
  s.push_back(mp("Shift+" + cc + "m", "Show manipulator window"));
  s.push_back(mp("Shift+" + cc + "n", "Show option window"));
  s.push_back(mp("Shift+" + cc + "o", "Merge file(s)"));
  s.push_back(mp("Shift+" + cc + "s", "Save mesh in default format"));
  s.push_back(mp("Shift+" + cc + "u", "Show plugin window"));
  s.push_back(mp("Shift+" + cc + "v", "Show visibility window"));
  s.push_back(mp("Alt+a",          "Loop through axes modes"));
  s.push_back(mp("Alt+b",          "Hide/show bounding boxes"));
  s.push_back(mp("Alt+c",          "Loop through predefined color schemes"));
  s.push_back(mp("Alt+e",          "Hide/Show element outlines for visible post-pro views"));
  s.push_back(mp("Alt+f",          "Change redraw mode (fast/full)"));
  s.push_back(mp("Alt+h",          "Hide/show all post-processing views"));
  s.push_back(mp("Alt+i",          "Hide/show all post-processing view scales"));
  s.push_back(mp("Alt+l",          "Hide/show geometry lines"));
  s.push_back(mp("Alt+m",          "Toggle visibility of all mesh entities"));
  s.push_back(mp("Alt+n",          "Hide/show all post-processing view annotations"));
  s.push_back(mp("Alt+o",          "Change projection mode (orthographic/perspective)"));
  s.push_back(mp("Alt+p",          "Hide/show geometry points"));
  s.push_back(mp("Alt+r",          "Loop through range modes for visible post-pro views"));
Loading
Loading full blame...