aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Hinder <ian.hinder@aei.mpg.de>2013-09-12 21:46:59 +0200
committerIan Hinder <ian.hinder@aei.mpg.de>2013-09-12 21:46:59 +0200
commit7369286bc4ab997558d90a594d13873f9fd75ba4 (patch)
treefc147285d12befc4904be82ae5063e8f969c2ba2
parentc1bcd9aa9abea66fb6c74bf4956417be6801b574 (diff)
Change method used to determine which variables to set symmetries for in CodeGenSymmetries.m
This is for the old symmetry infrastructure, and the logic doesn't make a lot of sense anyway, but we reproduce it for compatibility reasons. Changes the order of symmetry declarations in RegisterSymmetries.cc.
-rw-r--r--Tools/CodeGen/CodeGenSymmetries.m29
-rw-r--r--Tools/CodeGen/KrancThorn.m2
2 files changed, 25 insertions, 6 deletions
diff --git a/Tools/CodeGen/CodeGenSymmetries.m b/Tools/CodeGen/CodeGenSymmetries.m
index 31e6834..60e898a 100644
--- a/Tools/CodeGen/CodeGenSymmetries.m
+++ b/Tools/CodeGen/CodeGenSymmetries.m
@@ -21,7 +21,7 @@
BeginPackage[
"CodeGenSymmetries`",
{"Errors`", "Helpers`", "Kranc`", "CodeGenCactus`", "MapLookup`", "CodeGenKranc`",
- "CodeGenC`", "CodeGen`"}];
+ "CodeGenC`", "CodeGen`", "KrancGroups`"}];
CreateSymmetriesRegistrationSource::usage = "";
@@ -63,18 +63,38 @@ DefFn[
(* Given a symmetries registration structure as defined above, return a
C CodeGen structure of a source file which will register the symmetries. *)
DefFn[
- CreateSymmetriesRegistrationSource[thornName_String, implementationName_String, GFs_List,
+ CreateSymmetriesRegistrationSource[thornName_String, implementationName_String,
+ declaredGroups_List, groups_List, GFs_List,
reflectionSymmetries_List, debug:(True|False)] :=
Module[
- {spec, j, lang, tmp},
+ {spec, j, lang, tmp, GFs2, nonRHSGroups},
If[debug, Print["Registering Symmetries for: ", GFs]];
lang = CodeGenC`SOURCELANGUAGE;
CodeGenC`SOURCELANGUAGE = "C";
+ (* TODO: symmetries should probably be applied to all groups, but
+ for compatibility, apply them only to the non-RHS groups as
+ this is what was done before *)
+ nonRHSGroups = Select[declaredGroups,
+ (!(lookup[GroupExtras[groupFromName[#, groups]],
+ MoLRHS,
+ False] ||
+ lookup[GroupExtras[groupFromName[#, groups]],
+ GridType,
+ "gf"] === "array")) &];
+
+ GFs2 = variablesFromGroups[nonRHSGroups, groups];
+
+ If[Union[GFs2] =!= Union[GFs],
+ Print["GFs don't match"];
+ Print["GFs = ", Union[GFs]];
+ Print["GFs2 = ", Union[GFs2]];
+ Quit[1]];
+
spec = Map[{FullName -> implementationName <> "::" <> ToString@#,
- Sym -> calcSymmetry[#, Union@reflectionSymmetries]} &, GFs];
+ Sym -> calcSymmetry[#, Union@reflectionSymmetries]} &, GFs2];
tmp = {FileHeader["C"],
@@ -91,7 +111,6 @@ DefFn[
{}]]};
CodeGenC`SOURCELANGUAGE = lang;
-
tmp]];
End[];
diff --git a/Tools/CodeGen/KrancThorn.m b/Tools/CodeGen/KrancThorn.m
index 21d4df0..b49eca0 100644
--- a/Tools/CodeGen/KrancThorn.m
+++ b/Tools/CodeGen/KrancThorn.m
@@ -296,7 +296,7 @@ CreateKrancThorn[groupsOrig_, parentDirectory_, thornName_, opts:OptionsPattern[
{Filename -> "RegisterSymmetries.cc",
Contents -> CreateSymmetriesRegistrationSource[
thornName, implementation,
- allGFs, OptionValue[ReflectionSymmetries], False]}]];
+ declaredGroups, groups, allGFs, OptionValue[ReflectionSymmetries], False]}]];
(* ------------------------------------------------------------------------
Startup source file