From 6df83f2de389f4e9d0c860259d2f3a2d933a0585 Mon Sep 17 00:00:00 2001
From: Christoph Lehmann <christoph.lehmann@ufz.de>
Date: Tue, 23 May 2017 16:36:30 +0200
Subject: [PATCH] [App] genStructMesh: added check, added functionality

* some arguments that are mutually exclusive are checked
* --mx now works together with --nx etc.
---
 .../generateStructuredMesh.cpp                | 26 +++++++++++++------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/Applications/Utils/SimpleMeshCreation/generateStructuredMesh.cpp b/Applications/Utils/SimpleMeshCreation/generateStructuredMesh.cpp
index cdc7ce9fbd9..6832c83dcb4 100644
--- a/Applications/Utils/SimpleMeshCreation/generateStructuredMesh.cpp
+++ b/Applications/Utils/SimpleMeshCreation/generateStructuredMesh.cpp
@@ -16,6 +16,7 @@
 #include "Applications/ApplicationsLib/LogogSetup.h"
 
 #include "BaseLib/BuildInfo.h"
+#include "BaseLib/Error.h"
 #include "BaseLib/Subdivision.h"
 #include "BaseLib/TCLAPCustomOutput.h"
 
@@ -179,17 +180,26 @@ int main (int argc, char* argv[])
     vec_div.reserve(dim);
     for (unsigned i=0; i<dim; i++)
     {
-        if (vec_ndivArg[i]->isSet())
-        {
+        if (vec_multiArg[i]->isSet()) {
+            if (vec_ndivArg[i]->isSet()) {
+                // number of partitions in direction is specified
+                vec_d0Arg[i]->isSet() &&
+                    OGS_FATAL(
+                        "Specifying all of --m?, --d?0 and --n? for coordinate "
+                        "\"?\" is not supported.");
+                vec_div.emplace_back(new BaseLib::GradualSubdivisionFixedNum(
+                    length[i], vec_ndivArg[i]->getValue(),
+                    vec_multiArg[i]->getValue()));
+
+            } else {
+                vec_div.emplace_back(new BaseLib::GradualSubdivision(
+                    length[i], vec_d0Arg[i]->getValue(),
+                    vec_dMaxArg[i]->getValue(), vec_multiArg[i]->getValue()));
+            }
+        } else {
             vec_div.emplace_back(
                 new BaseLib::UniformSubdivision(length[i], n_subdivision[i]));
         }
-        else
-        {
-            vec_div.emplace_back(new BaseLib::GradualSubdivision(
-                length[i], vec_d0Arg[i]->getValue(), vec_dMaxArg[i]->getValue(),
-                vec_multiArg[i]->getValue()));
-        }
     }
 
     // generate a mesh
-- 
GitLab