Skip to content
Snippets Groups Projects
Commit 6c3468cc authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

if argc/argv is not provided, don't load option files (this is what is usually...

if argc/argv is not provided, don't load option files (this is what is usually expected when using Gmsh as a lib)
parent f04986af
No related branches found
No related tags found
No related merge requests found
...@@ -130,12 +130,15 @@ void GetOptions(int argc, char *argv[]) ...@@ -130,12 +130,15 @@ void GetOptions(int argc, char *argv[])
CTX::instance()->terminal = 1; CTX::instance()->terminal = 1;
#if defined(HAVE_PARSER) #if defined(HAVE_PARSER)
// Parse session and option files if(argc && argv){
// parse session and option file (if argc/argv is not provided skip this
// step: this is usually what is expected when using Gmsh as a library)
ParseFile(CTX::instance()->homeDir + CTX::instance()->sessionFileName, true); ParseFile(CTX::instance()->homeDir + CTX::instance()->sessionFileName, true);
ParseFile(CTX::instance()->homeDir + CTX::instance()->optionsFileName, true); ParseFile(CTX::instance()->homeDir + CTX::instance()->optionsFileName, true);
}
#endif #endif
// Get command line options // get command line options
int i = 1; int i = 1;
while(i < argc) { while(i < argc) {
...@@ -211,8 +214,8 @@ void GetOptions(int argc, char *argv[]) ...@@ -211,8 +214,8 @@ void GetOptions(int argc, char *argv[])
else if (!strcmp(argv[i] + 1,"partWeight")) { else if (!strcmp(argv[i] + 1,"partWeight")) {
i++; i++;
bool check = true; bool check = true;
opt_mesh_partition_partitioner(0,GMSH_SET,2); // set Metis partitioner opt_mesh_partition_partitioner(0, GMSH_SET, 2); // Metis partitioner
opt_mesh_partition_metis_algorithm(0,GMSH_SET,3); // set partGraphKWay w/ weights opt_mesh_partition_metis_algorithm(0, GMSH_SET, 3); // partGraphKWay w/ weights
while (check) { while (check) {
if (argv[i]) { if (argv[i]) {
if (!strcmp(argv[i],"triangle")) { if (!strcmp(argv[i],"triangle")) {
...@@ -777,9 +780,8 @@ void GetOptions(int argc, char *argv[]) ...@@ -777,9 +780,8 @@ void GetOptions(int argc, char *argv[])
#endif #endif
#if defined(__APPLE__) #if defined(__APPLE__)
else if(!strncmp(argv[i] + 1, "psn", 3)) { else if(!strncmp(argv[i] + 1, "psn", 3)) {
// The Mac Finder launches programs with a special command // the Mac Finder launches programs with a special command line argument
// line argument of the form -psn_XXX: just ignore it silently // of the form -psn_XXX: just ignore it silently (and don't exit!)
// (and don't exit!)
i++; i++;
} }
#endif #endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment