[cig-commits] [commit] master: included an assert that names are unique and an entry in changes.h (7cebe4d)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Wed May 21 07:32:35 PDT 2014


Repository : https://github.com/geodynamics/aspect

On branch  : master
Link       : https://github.com/geodynamics/aspect/compare/497a2179702f669476083a98714879503e0dfa90...6aa7541c733b8fd1cc1b0c74536c8804aaeb7015

>---------------------------------------------------------------

commit 7cebe4d4a9fb651c4770b443c5d4055cd9ee6da5
Author: Juliane Dannberg <dannberg at gfz-potsdam.de>
Date:   Wed May 21 16:31:03 2014 +0200

    included an assert that names are unique and an entry in changes.h


>---------------------------------------------------------------

7cebe4d4a9fb651c4770b443c5d4055cd9ee6da5
 doc/modules/changes.h          | 5 +++++
 source/simulator/parameters.cc | 6 +++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/doc/modules/changes.h b/doc/modules/changes.h
index 2d87933..7746c44 100644
--- a/doc/modules/changes.h
+++ b/doc/modules/changes.h
@@ -5,6 +5,11 @@
  * 1.0. All entries are signed with the names of the author. </p>
  *
  * <ol>
+ * <li>New: Composisitional fields have names now. If no names are specified in 
+ * the input file, the previously used names C_1, C_2, ... are used as a default. 
+ * <br>
+ * (Juliane Dannberg, 2014/05/22)
+
  * <li>New: There is now a new initial temperature condition plugin that can read in
  * solidus temperatures from a file and add perturbations to it. There is also
  * a corresponding data file for initial conditions for Mars from Permentier
diff --git a/source/simulator/parameters.cc b/source/simulator/parameters.cc
index f3b8d24..ad80998 100644
--- a/source/simulator/parameters.cc
+++ b/source/simulator/parameters.cc
@@ -804,7 +804,7 @@ namespace aspect
               "fields needs to either be empty or have length equal to "
               "the number of compositional fields."));
 
-      // check that the names use only allowed characters
+      // check that the names use only allowed characters, are not empty strings and are unique
       for (unsigned int i=0; i<names_of_compositional_fields.size(); ++i)
       {
         Assert (names_of_compositional_fields[i].find_first_not_of("abcdefghijklmnopqrstuvwxyz"
@@ -816,6 +816,10 @@ namespace aspect
         Assert (names_of_compositional_fields[i].size() > 0,
           ExcMessage("Invalid name of field " + names_of_compositional_fields[i] + ". "
             		 "Names of compositional fields need to be non-empty."));
+        for (unsigned int j=0; j<i; ++j)
+          Assert (names_of_compositional_fields[i] != names_of_compositional_fields[j],
+            ExcMessage("Names of compositional fields have to be unique! " + names_of_compositional_fields[i] +
+        		       " is used more than once."));
       }
 
       // default names if list is empty



More information about the CIG-COMMITS mailing list