From 5b14d2790a841fc09630e27a186cc981f2fb95e6 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Tue, 2 Apr 2013 16:58:49 +0000 Subject: [PATCH] new "-open" and "-merge" command line args to select how to open/merge the files on the command line --- Common/CommandLine.cpp | 11 +++++++++++ Common/Gmsh.cpp | 20 ++++++++++++++++++-- doc/texinfo/commandline.texi | 6 ++++++ doc/texinfo/opt_plugin.texi | 2 +- 4 files changed, 36 insertions(+), 3 deletions(-) diff --git a/Common/CommandLine.cpp b/Common/CommandLine.cpp index eeaa49507e..2decad5527 100644 --- a/Common/CommandLine.cpp +++ b/Common/CommandLine.cpp @@ -115,6 +115,9 @@ std::vector<std::pair<std::string, std::string> > GetUsage() #endif s.push_back(mp("Other options:", "")); s.push_back(mp("-", "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")); #if defined(HAVE_FLTK) s.push_back(mp("-a, -g, -m, -s, -p", "Start in automatic, geometry, mesh, solver or " "post-processing mode")); @@ -396,6 +399,14 @@ void GetOptions(int argc, char *argv[]) CTX::instance()->files.push_back("-new"); i++; } + else if(!strcmp(argv[i] + 1, "open")) { + CTX::instance()->files.push_back("-open"); + i++; + } + else if(!strcmp(argv[i] + 1, "merge")) { + CTX::instance()->files.push_back("-merge"); + i++; + } else if(!strcmp(argv[i] + 1, "pid")) { fprintf(stdout, "%d\n", GetProcessId()); fflush(stdout); diff --git a/Common/Gmsh.cpp b/Common/Gmsh.cpp index 1f3ce8f230..5b2cf7d9f3 100644 --- a/Common/Gmsh.cpp +++ b/Common/Gmsh.cpp @@ -158,9 +158,17 @@ int GmshBatch() Msg::Info("Started on %s", Msg::GetLaunchDate().c_str()); OpenProject(GModel::current()->getFileName()); - for(unsigned int i = 1; i < CTX::instance()->files.size(); i++){ + bool open = false; + for(unsigned int i = 0; i < CTX::instance()->files.size(); i++){ + if(i == 0 && CTX::instance()->files[0][0] != '-') continue; if(CTX::instance()->files[i] == "-new") new GModel(); + else if(CTX::instance()->files[i] == "-merge") + open = false; + else if(CTX::instance()->files[i] == "-open") + open = true; + else if(open) + OpenProject(CTX::instance()->files[i]); else MergeFile(CTX::instance()->files[i]); } @@ -239,11 +247,19 @@ int GmshFLTK(int argc, char **argv) // open project file and merge all other input files if(FlGui::getOpenedThroughMacFinder().empty()){ OpenProject(GModel::current()->getFileName()); - for(unsigned int i = 1; i < CTX::instance()->files.size(); i++){ + bool open = false; + for(unsigned int i = 0; i < CTX::instance()->files.size(); i++){ + if(i == 0 && CTX::instance()->files[0][0] != '-') continue; if(CTX::instance()->files[i] == "-new"){ GModel::current()->setVisibility(0); new GModel(); } + else if(CTX::instance()->files[i] == "-merge") + open = false; + else if(CTX::instance()->files[i] == "-open") + open = true; + else if(open) + OpenProject(CTX::instance()->files[i]); else MergeFile(CTX::instance()->files[i]); } diff --git a/doc/texinfo/commandline.texi b/doc/texinfo/commandline.texi index 4ff7de1c19..188cd3fff0 100644 --- a/doc/texinfo/commandline.texi +++ b/doc/texinfo/commandline.texi @@ -115,6 +115,12 @@ OpenGL quad-buffered stereo rendering (requires special graphic card) @ftable @code @item - Parse input files, then exit +@item -new +Create new model before merge next file +@item -merge +Merge next files +@item -open +Open next files @item -a, -g, -m, -s, -p Start in automatic, geometry, mesh, solver or post-processing mode @item -pid diff --git a/doc/texinfo/opt_plugin.texi b/doc/texinfo/opt_plugin.texi index 04191d64c1..89eb3baa25 100644 --- a/doc/texinfo/opt_plugin.texi +++ b/doc/texinfo/opt_plugin.texi @@ -93,7 +93,7 @@ Default value: @code{0} @end table @item Plugin(Crack) -Plugin(Crack) creates a crack around the physical group +Plugin(Crack) creates a crack around the physical group `PhysicalGroup' of dimension `Dimension' (1 or 2). The plugin duplicates the vertices and the elements on the crack and stores them in a new discrete curve (Dimension = 1) or surface (Dimension = 2). The elements touching the crack on the negative side are modified to use the newly generated vertices. Numeric options: @table @code @item Dimension -- GitLab