diff --git a/Common/CommandLine.cpp b/Common/CommandLine.cpp index 0da979c5a6c851f07b2c1672d3119eb66586640d..e2652527b5ff7ebf3ba254873888526efbf3a384 100644 --- a/Common/CommandLine.cpp +++ b/Common/CommandLine.cpp @@ -43,85 +43,88 @@ const char *GetGmshBuildOS(){ return GMSH_OS; } const char *GetGmshShortLicense(){ return GMSH_SHORT_LICENSE; } const char *GetGmshBuildOptions(){ return GMSH_CONFIG_OPTIONS; } -std::vector<std::string> GetUsage(const std::string &name) +std::vector<std::pair<std::string, std::string> > GetUsage(const std::string &name) { - // If you make changes in this routine, please also change the texinfo - // documentation (doc/texinfo/gmsh.texi) and the man page (doc/gmsh.1) - std::vector<std::string> s; - s.push_back("Usage: " + name + " [options] [files]"); - s.push_back("Geometry options:"); - s.push_back(" -0 Output unrolled geometry, then exit"); - s.push_back(" -tol float Set geometrical tolerance"); - s.push_back(" -match Match geometries and meshes"); - s.push_back("Mesh options:"); - s.push_back(" -1, -2, -3 Perform 1D, 2D or 3D mesh generation, then exit"); - s.push_back(" -format string Select output mesh format (auto (default), msh, msh1, msh2,"); - s.push_back(" unv, vrml, ply2, stl, mesh, bdf, cgns, p3d, diff, med, ...)"); - s.push_back(" -refine Perform uniform mesh refinement, then exit"); - s.push_back(" -part int Partition after batch mesh generation"); - s.push_back(" -partWeight <tri|quad|tet|prism|hex> int"); - s.push_back(" Weight of a triangle/quad/etc. during partitioning"); - s.push_back(" -renumber Renumber the mesh elements after batch mesh generation"); - s.push_back(" -saveall Save all elements (discard physical group definitions)"); - s.push_back(" -o file Specify output file name"); - s.push_back(" -bin Use binary format when available"); - s.push_back(" -parametric Save vertices with their parametric coordinates"); - s.push_back(" -numsubedges Set the number of subdivisions when displaying high order elements"); - s.push_back(" -algo string Select mesh algorithm (meshadapt, del2d, front2d, delquad, "); - s.push_back(" del3d, front3d, mmg3d)"); - s.push_back(" -smooth int Set number of mesh smoothing steps"); - s.push_back(" -order int Set mesh order (1, ..., 5)"); - s.push_back(" -hoOptimize Optimize high order meshes"); - s.push_back(" -hoMindisto float Minimum quality for high-order elements before optimization (0.0->1.0)"); - s.push_back(" -hoNLayers int Number of high order element layers to optimize"); - s.push_back(" -hoElasticity float Poisson ration for the elasticity analogy (-1.0 < nu < 0.5)"); - s.push_back(" -optimize[_netgen] Optimize quality of tetrahedral elements"); - s.push_back(" -optimize_lloyd Optimize 2D meshes using Lloyd algorithm"); - s.push_back(" -clscale float Set global mesh element size scaling factor"); - s.push_back(" -clmin float Set minimum mesh element size"); - s.push_back(" -clmax float Set maximum mesh element size"); - s.push_back(" -anisoMax float Set maximum anisotropy (only used in bamg for now)"); - s.push_back(" -smoothRatio float Set smoothing ration between mesh sizes at nodes of a same edge"); - s.push_back(" (only used in bamg)"); - s.push_back(" -clcurv Automatically compute element sizes from curvatures"); - s.push_back(" -epslc1d Set the accuracy of the evaluation of the LCFIELD for 1D mesh"); - s.push_back(" -swapangle Set the threshold angle (in degree) between two adjacent faces"); - s.push_back(" below which a swap is allowed"); - s.push_back(" -rand float Set random perturbation factor"); - s.push_back(" -bgm file Load background mesh from file"); - s.push_back(" -check Perform various consistency checks on mesh"); - s.push_back(" -mpass int Do several passes on the mesh for complex backround fields"); - s.push_back(" -ignorePartBound Ignore partitions boundaries"); + typedef std::pair<std::string, std::string> mp; + std::vector<mp> s; + s.push_back(mp("Usage: " + name + " [options] [files]", "")); + 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")); + 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, ...)")); + s.push_back(mp("-vmsh float", "Select msh file version")); + 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("-renumber", "Renumber the mesh elements after batch mesh generation")); + s.push_back(mp("-saveall", "Save all elements (discard physical group definitions)")); + s.push_back(mp("-o file", "Specify output file name")); + s.push_back(mp("-bin", "Use binary format when available")); + s.push_back(mp("-parametric", "Save vertices with their parametric coordinates")); + s.push_back(mp("-numsubedges", "Set num of subdivisions for high order element display")); + 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("-hoOptimize", "Optimize high order meshes")); + s.push_back(mp("-hoMindisto float", "Min high-order element quality before optim (0.0->1.0)")); + s.push_back(mp("-hoNLayers int", "Number of high order element layers to optimize")); + s.push_back(mp("-hoElasticity float","Poisson ration for elasticity analogy (nu in [-1.0,0.5])")); + s.push_back(mp("-optimize[_netgen]", "Optimize quality of tetrahedral elements")); + 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")); #if defined(HAVE_FLTK) - s.push_back("Post-processing options:"); - s.push_back(" -link int Select link mode between views (0, 1, 2, 3, 4)"); - s.push_back(" -combine Combine views having identical names into multi-time-step views"); - s.push_back("Display options:"); - s.push_back(" -n Hide all meshes and post-processing views on startup"); - s.push_back(" -nodb Disable double buffering"); - s.push_back(" -fontsize int Specify the font size for the GUI"); - s.push_back(" -theme string Specify FLTK GUI theme"); - s.push_back(" -display string Specify display"); - s.push_back(" -camera Use camera mode view;"); - s.push_back(" -stereo OpenGL quad-buffered stereo rendering (requires special graphic card)"); + 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")); + 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)")); #endif - s.push_back("Other options:"); - s.push_back(" - Parse input files, then exit"); + s.push_back(mp("Other options:", "")); + s.push_back(mp("-", "Parse input files, then exit")); #if defined(HAVE_FLTK) - s.push_back(" -a, -g, -m, -s, -p Start in automatic, geometry, mesh, solver or post-processing mode"); + s.push_back(mp("-a, -g, -m, -s, -p", "Start in automatic, geometry, mesh, solver or " + "post-processing mode")); #endif - s.push_back(" -pid Print process id on stdout"); - s.push_back(" -listen Always listen to incoming connection requests"); - s.push_back(" -watch pattern Pattern of files to merge as they become available"); - s.push_back(" -v int Set verbosity level"); - s.push_back(" -nopopup Don't popup dialog windows in scripts"); - s.push_back(" -string \"string\" Parse option string at startup"); - s.push_back(" -option file Parse option file at startup"); - s.push_back(" -convert files Convert files into latest binary formats, then exit"); - s.push_back(" -vmsh float Select msh file version"); - s.push_back(" -version Show version number"); - s.push_back(" -info Show detailed version information"); - s.push_back(" -help Show this message"); + 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 this message")); return s; } @@ -233,9 +236,17 @@ std::vector<std::pair<std::string, std::string> > GetMouseUsage() void PrintUsage(const std::string &name) { - std::vector<std::string> s = GetUsage(name); - for(unsigned int i = 0; i < s.size(); i++) - Msg::Direct("%s", s[i].c_str()); + std::vector<std::pair<std::string, std::string> > s = GetUsage(name); + for(unsigned int i = 0; i < s.size(); i++){ + std::string a = s[i].first, b = s[i].second; + if(b.empty()){ + Msg::Direct("%s", a.c_str()); + } + else{ + if(a.size() < 20) a.resize(20, ' '); + Msg::Direct(" %s %s", a.c_str(), b.c_str()); + } + } } void GetOptions(int argc, char *argv[]) diff --git a/Common/CommandLine.h b/Common/CommandLine.h index d739e2a92b4299df2dd2bfc9edcb00a2772a57c4..d5f06d16f9d407bf29244204292003c262ec5127 100644 --- a/Common/CommandLine.h +++ b/Common/CommandLine.h @@ -20,7 +20,7 @@ const char *GetGmshBuildOS(); const char *GetGmshShortLicense(); const char *GetGmshBuildOptions(); -std::vector<std::string> GetUsage(const std::string &name); +std::vector<std::pair<std::string, std::string> > GetUsage(const std::string &name); std::vector<std::pair<std::string, std::string> > GetShortcutsUsage(const std::string &ctrl=""); std::vector<std::pair<std::string, std::string> > GetMouseUsage(); void PrintUsage(const std::string &name); diff --git a/Common/Options.cpp b/Common/Options.cpp index 76e56ce96e39775c64c352e80d807fdc06460e05..5c416ccf853b06abf7e32aff2c2777e570055824 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -923,6 +923,20 @@ void PrintOptionsDoc() fprintf(file, "@end table\n"); fclose(file); } + { + FILE *file = fopen("commandline.texi", "w"); + if(!file) { + Msg::Error("Unable to open file 'commandline.texi'"); + return; + } + std::vector<std::pair<std::string, std::string> > s = GetUsage("gmsh"); + fprintf(file, "%s@ftable @code\n", warn); + for(unsigned int i = 0; i < s.size(); i++) + if(s[i].first.size() && s[i].second.size()) + fprintf(file, "@item %s\n%s\n", s[i].first.c_str(), s[i].second.c_str()); + fprintf(file, "@end ftable\n"); + fclose(file); + } } #define GET_VIEW(error_val) \ diff --git a/Fltk/helpWindow.cpp b/Fltk/helpWindow.cpp index f95c89f0ef1fd6094116951fccd5c15bc3ec49d8..695a8630fdf01584c84929332f37c65eb3bf2073 100644 --- a/Fltk/helpWindow.cpp +++ b/Fltk/helpWindow.cpp @@ -142,6 +142,17 @@ helpWindow::helpWindow() s += "For a 1 button mouse, Middle button = Shift+Left button, " "Right button = Alt+Left button."; + + s += "<h3>Command Line Switches</h3>"; + s += "<table border=1>"; + { + std::vector<std::pair<std::string, std::string> > s0 = GetUsage("gmsh"); + for(unsigned int i = 0; i < s0.size(); i++) + if(s0[i].first.size() && s0[i].second.size()) + s += "<tr><td>" + s0[i].first + "</td><td>" + s0[i].second + "</td></tr>"; + } + s += "</table>"; + o->value(s.c_str()); basic->resizable(o); diff --git a/doc/texinfo/commandline.texi b/doc/texinfo/commandline.texi new file mode 100644 index 0000000000000000000000000000000000000000..bc96fcfdc7c739dd893d8ccf9dd2caf038854939 --- /dev/null +++ b/doc/texinfo/commandline.texi @@ -0,0 +1,125 @@ +@c +@c This file is generated automatically by running "gmsh -doc". +@c Do not edit by hand! +@c + +@ftable @code +@item -0 +Output unrolled geometry, then exit +@item -tol float +Set geometrical tolerance +@item -match +Match geometries and meshes +@item -1, -2, -3 +Perform 1D, 2D or 3D mesh generation, then exit +@item -format string +Select output mesh format (auto (default), msh, msh1, msh2, unv, vrml, ply2, stl, mesh, bdf, cgns, p3d, diff, med, ...) +@item -vmsh float +Select msh file version +@item -refine +Perform uniform mesh refinement, then exit +@item -part int +Partition after batch mesh generation +@item -partWeight <tri|quad|tet|prism|hex> int +Weight of a triangle/quad/etc. during partitioning +@item -renumber +Renumber the mesh elements after batch mesh generation +@item -saveall +Save all elements (discard physical group definitions) +@item -o file +Specify output file name +@item -bin +Use binary format when available +@item -parametric +Save vertices with their parametric coordinates +@item -numsubedges +Set num of subdivisions for high order element display +@item -algo string +Select mesh algorithm (meshadapt, del2d, front2d, delquad, del3d, front3d, mmg3d) +@item -smooth int +Set number of mesh smoothing steps +@item -order int +Set mesh order (1, ..., 5) +@item -hoOptimize +Optimize high order meshes +@item -hoMindisto float +Min high-order element quality before optim (0.0->1.0) +@item -hoNLayers int +Number of high order element layers to optimize +@item -hoElasticity float +Poisson ration for elasticity analogy (-1.0 < nu < 0.5) +@item -optimize[_netgen] +Optimize quality of tetrahedral elements +@item -optimize_lloyd +Optimize 2D meshes using Lloyd algorithm +@item -clscale float +Set global mesh element size scaling factor +@item -clmin float +Set minimum mesh element size +@item -clmax float +Set maximum mesh element size +@item -anisoMax float +Set maximum anisotropy (only used in bamg for now) +@item -smoothRatio float +Set smoothing ration between mesh sizes at nodes of a same edge (only used in bamg) +@item -clcurv +Automatically compute element sizes from curvatures +@item -epslc1d +Set accuracy of evaluation of LCFIELD for 1D mesh +@item -swapangle +Set the threshold angle (in degree) between two adjacent faces below which a swap is allowed +@item -rand float +Set random perturbation factor +@item -bgm file +Load background mesh from file +@item -check +Perform various consistency checks on mesh +@item -mpass int +Do several passes on the mesh for complex backround fields +@item -ignorePartBound +Ignore partitions boundaries +@item -link int +Select link mode between views (0, 1, 2, 3, 4) +@item -combine +Combine views having identical names into multi-time-step views +@item -n +Hide all meshes and post-processing views on startup +@item -nodb +Disable double buffering +@item -fontsize int +Specify the font size for the GUI +@item -theme string +Specify FLTK GUI theme +@item -display string +Specify display +@item -camera +Use camera mode view; +@item -stereo +OpenGL quad-buffered stereo rendering (requires special graphic card) +@item - +Parse input files, then exit +@item -a, -g, -m, -s, -p +Start in automatic, geometry, mesh, solver or post-processing mode +@item -pid +Print process id on stdout +@item -listen +Always listen to incoming connection requests +@item -watch pattern +Pattern of files to merge as they become available +@item -v int +Set verbosity level +@item -nopopup +Don't popup dialog windows in scripts +@item -string "string" +Parse option string at startup +@item -option file +Parse option file at startup +@item -convert files +Convert files into latest binary formats, then exit +@item -version +Show version number +@item -info +Show detailed version information +@item -help +Show this message +@end ftable diff --git a/doc/texinfo/gmsh.texi b/doc/texinfo/gmsh.texi index 1062ddf7f47c2177032f12569ce40cc205a00944..63c5571151172a9b71a1c1fb05931e266943afdf 100644 --- a/doc/texinfo/gmsh.texi +++ b/doc/texinfo/gmsh.texi @@ -839,118 +839,7 @@ For the list of all command-line options, see @ref{Command-line options}. @cindex Command-line options @cindex Options, command-line -@noindent Geometry options: - -@ftable @code -@item -0 -Parse all input files, output unrolled geometry, and exit. -@item -tol float -Set geometrical tolerance -@end ftable - -@sp 1 - -@noindent Mesh options: - -@ftable @code -@item -1, -2, -3 -Perform 1D, 2D or 3D mesh generation, then exit -@item -refine -Perform uniform mesh refinement by subdivision, then exit -@item -part int -Partition the mesh after batch mesh generation -@item -saveall -Save all elements (discard physical group definitions) -@item -o file -Specify mesh output file name -@item -format string -Set output mesh format (msh, msh1, msh2, unv, vrml, stl, mesh, bdf, p3d, cgns, med, ...) -@item -bin -Use binary format when available -@item -algo string -Select mesh algorithm (meshadapt, del2d, front2d, del3d, front3d, ...) -@item -smooth int -Set number of mesh smoothing steps -@item -optimize[_netgen] -Optimize quality of tetrahedral elements -@item -order int -Set the order of the generated elements (1, 2) -@item -clscale float -Set mesh element size scaling factor -@item -clmin float -Set minimum mesh element size -@item -clmax float -Set maximum mesh element size -@item -clcurv -Compute mesh element sizes from curvatures -@item -rand float -Set random perturbation factor -@item -bgm file -Load background mesh from file -@item -check file -Perform various consistency checks on mesh -@end ftable - -@sp 1 - -@noindent Post-processing options: - -@ftable @code -@item -link int -Select link mode between views (0, 1, 2, 3, 4) -@item -combine -Combine views having identical names into multi-time-step views -@end ftable - -@sp 1 - -@noindent Display options: - -@ftable @code -@item -n -Hide all meshes and post-processing views on startup -@item -nodb -Disable double buffering -@item -fontsize int -Specify the font size for the GUI -@item -theme string -Specify FLTK GUI theme -@item -display string -Specify display -@end ftable - -@sp 1 - -@noindent Other options: - -@ftable @code -@item - -Parse input files, then exit -@item -a, -g, -m, -s, -p -Start in automatic, geometry, mesh, solver or post-processing mode -@item -pid -Print pid on stdout -@item -listen -Always listen to incoming connection requests. -@item -watch -Pattern of files to merge as they become available. -@item -v int -Set verbosity level -@item -nopopup -Don't popup dialog windows in scripts -@item -string "string" -Parse option string at startup -@item -option file -Parse option file at startup -@item -convert files -Convert files into latest binary formats, then exit -@item -version -Show version number -@item -info -Show detailed version information -@item -help -Show this message -@end ftable +@include commandline.texi @c ------------------------------------------------------------------------- @c Mouse actions