aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Hinder <ian.hinder@aei.mpg.de>2010-10-11 22:17:39 +0200
committerIan Hinder <ian.hinder@aei.mpg.de>2010-10-11 22:17:39 +0200
commited0b91feeb27d2c4dc5424dfc23410f20ee3ecc5 (patch)
treedcd352d7f7f9eb26b783db0f8b174033648e762a
parent415c05165be90ff07a0e9bc60a0638f87a6e764a (diff)
KrancGroups: Add a function CheckGroups to check the validity of a groups structure
-rw-r--r--Tools/CodeGen/KrancGroups.m13
1 files changed, 13 insertions, 0 deletions
diff --git a/Tools/CodeGen/KrancGroups.m b/Tools/CodeGen/KrancGroups.m
index 05ebdea..13d53d2 100644
--- a/Tools/CodeGen/KrancGroups.m
+++ b/Tools/CodeGen/KrancGroups.m
@@ -52,6 +52,7 @@ AddGroupExtra;
GroupTimelevels;
allGroupVariables;
NonevolvedTimelevels;
+CheckGroups;
Begin["`Private`"];
@@ -245,6 +246,18 @@ qualifyGFName[gfname_, allgroups_, defaultImp_] :=
allGroupVariables[groups_] :=
Flatten[Map[groupVariables, groups], 1];
+CheckGroups[groups_] :=
+ Module[{vs, names},
+(* If[!MatchQ[{_String, {_Symbol ...}, {_Symbol -> _} ...}],
+ ThrowError["Groups structure should be of the form {name, {vars, ...}, extras}"]]; *)
+
+ vs = Map[ToString, Union[Flatten[Map[groupVariables, groups]]]];
+ names = Map[groupName, groups];
+
+ If[(int = Intersection[vs,names]) =!= {},
+ ThrowError["Variable names and group names must be distinct. Group names which are also variable names:", int]];
+ ];
+
End[];
EndPackage[];