diff options
author | Ian Hinder <ian.hinder@aei.mpg.de> | 2013-09-10 17:14:36 +0200 |
---|---|---|
committer | Ian Hinder <ian.hinder@aei.mpg.de> | 2013-09-10 17:14:36 +0200 |
commit | c8568faddf025e1c392d0d8f4b1cb7d5a8203a5a (patch) | |
tree | 047a2a111fd51e70f75cf9d5639fa6c8af753a7e | |
parent | ab37589937f9481d2346a77d6a71f488ed8b3d4f (diff) |
Interface.m: Generalise the functions for creating group interface structures
The new function is currently only tested against the old structures, it is not actually used. The ordering of the group structures is different, and it is not easy to implement the original ordering.
-rw-r--r-- | Tools/CodeGen/Interface.m | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/Tools/CodeGen/Interface.m b/Tools/CodeGen/Interface.m index b432355..f741def 100644 --- a/Tools/CodeGen/Interface.m +++ b/Tools/CodeGen/Interface.m @@ -108,6 +108,23 @@ rhsODEGroupInterfaceStructure[group_, timelevels_] := Variables -> groupVariables[group] } +declaredGroupInterfaceStructure[group_] := + Module[ + {extras, gridType}, + extras = GroupExtras[group]; + gridType = lookup[extras, GridType, "GF"]; + { + Name -> groupName[group], + VariableType -> "CCTK_REAL", + Timelevels -> lookup[extras, Timelevels, lookup[extras, InterfaceTimelevels, 1]], + GridType -> gridType, + Comment -> groupName[group], + Visibility -> "public", + Tags -> GroupTags[group], + gridType /. {"array" -> Sequence[Dim -> 1, Size -> 1], _ -> Sequence[]}, + Variables -> groupVariables[group] + }]; + Options[CreateKrancInterface] = ThornOptions; CreateKrancInterface[nonevolvedGroups_, evolvedGroups_, rhsGroups_, @@ -118,7 +135,7 @@ CreateKrancInterface[nonevolvedGroups_, evolvedGroups_, rhsGroups_, Module[{registerEvolved, (*registerConstrained,*) nonevolvedGroupStructures, evolvedGroupStructures, rhsGroupStructures, nonevolvedODEGroupStructures, evolvedODEGroupStructures, rhsODEGroupStructures, - groupStructures, interface, getMap}, + groupStructures, interface, getMap, declaredGroupStructures, oldDeclaredGroups}, VerifyGroupNames[nonevolvedGroups]; VerifyGroupNames[evolvedGroups]; VerifyGroupNames[rhsGroups]; @@ -131,6 +148,16 @@ CreateKrancInterface[nonevolvedGroups_, evolvedGroups_, rhsGroups_, VerifyStringList[includeFiles, "IncludeFiles"]; (* These are the aliased functions that are USED by this thorn from other thorns *) + oldDeclaredGroups = Join[nonevolvedGroups, evolvedGroups, rhsGroups, nonevolvedODEGroups, + evolvedODEGroups, rhsODEGroups]; + + If[Union@oldDeclaredGroups =!= Union@declaredGroups, + Print["Group name mismatch:"]; + Print["allGroupNames = ", Union@oldDeclaredGroups]; + Print["declaredGroups = ", Union@Global`declaredGroups]; + Print[""]; + Quit[1]]; + diffCoeff = { Name -> "Diff_coeff", @@ -169,11 +196,27 @@ CreateKrancInterface[nonevolvedGroups_, evolvedGroups_, rhsGroups_, Map[rhsODEGroupInterfaceStructure[groupFromName[#, groups], OptionValue[EvolutionTimelevels]] &, rhsODEGroups]; + declaredGroupStructures = + Map[declaredGroupInterfaceStructure[groupFromName[#, groups]] &, + declaredGroups]; + + groupStructures = Join[nonevolvedGroupStructures, evolvedGroupStructures, rhsGroupStructures, nonevolvedODEGroupStructures, evolvedODEGroupStructures, rhsODEGroupStructures]; + If[Union@groupStructures =!= Union@declaredGroupStructures, + Print["groupStructures =!= declaredGroupStructures:"]; + (* Print["groupStructures = ", Union@groupStructures]; *) + Print["groups = "]; + PrintStructure[groups]; + Print["groupStructures = "]; + PrintStructure[Union@groupStructures]; + Print["declaredGroupStructures = "]; + PrintStructure[Union@declaredGroupStructures]; + Quit[1]]; + interface = Join[CreateInterface[implementation, inheritedImplementations, Join[includeFiles, {CactusBoundary`GetIncludeFiles[]}, {"loopcontrol.h"}, |