diff options
author | Ian Hinder <ian.hinder@aei.mpg.de> | 2010-04-03 09:53:23 +0100 |
---|---|---|
committer | Ian Hinder <ian.hinder@aei.mpg.de> | 2010-04-03 09:53:23 +0100 |
commit | dcb8fe4196f0e758b9ce8b02f698b3ac40665cc9 (patch) | |
tree | 0522db3f2d1d943cbf971d536932d104586cd925 /Tools/CodeGen/KrancThorn.m | |
parent | 077267b146ca7e73522c671d3c6892a1bd1cbe7c (diff) |
KrancThorn.m: Split into sections
Diffstat (limited to 'Tools/CodeGen/KrancThorn.m')
-rw-r--r-- | Tools/CodeGen/KrancThorn.m | 42 |
1 files changed, 36 insertions, 6 deletions
diff --git a/Tools/CodeGen/KrancThorn.m b/Tools/CodeGen/KrancThorn.m index c1f8b25..1f69333 100644 --- a/Tools/CodeGen/KrancThorn.m +++ b/Tools/CodeGen/KrancThorn.m @@ -67,6 +67,10 @@ CreateGroupFromTensor::usage = ""; Begin["`Private`"]; +(* -------------------------------------------------------------------------- + Utility functions + -------------------------------------------------------------------------- *) + VerifyGroups[gs_] := If[!ListQ[gs], ThrowError["Not a list of group definitions: ", gs], @@ -103,6 +107,10 @@ Module[{used, unrecognized}, replaceDots[x_] := x /. (dot[y_] :> Symbol[ToString[y] <> "rhs"]); +(* -------------------------------------------------------------------------- + Thorn generation (main entry point for non-tensorial thorns) + -------------------------------------------------------------------------- *) + Options[CreateKrancThorn] = ThornOptions; CreateKrancThorn[groupsOrig_, parentDirectory_, thornName_, opts:OptionsPattern[]] := @@ -268,6 +276,10 @@ CreateKrancThorn[groupsOrig_, parentDirectory_, thornName_, opts:OptionsPattern[ InfoMessage[Terse, "Creating thorn"]; CreateThorn[thornspec]]; +(* -------------------------------------------------------------------------- + Functions related to calculations + -------------------------------------------------------------------------- *) + CalculationEvolvedVars[calc_] := Module[{eqs, evolved, lhss}, VerifyNewCalculation[calc]; @@ -300,6 +312,19 @@ extractNonevolvedGroups[declaredGroups_, calcs_, groups_] := Return[nonevolvedGroups]]; +(* -------------------------------------------------------------------------- + Configuration file + -------------------------------------------------------------------------- *) + +createKrancConfiguration[opts:OptionsPattern[]] := + Module[{configuration}, + configuration = CreateConfiguration[opts]; + Return[configuration]]; + +(* -------------------------------------------------------------------------- + Interface and variable definitions + -------------------------------------------------------------------------- *) + nonevolvedGroupInterfaceStructure[group_] := { Name -> groupName[group], @@ -340,11 +365,6 @@ nonevolvedTimelevels[group_] := Module[{tls = GroupTimelevels[group]}, If[ tls === False, 1, tls]]; -createKrancConfiguration[opts:OptionsPattern[]] := - Module[{configuration}, - configuration = CreateConfiguration[opts]; - Return[configuration]]; - Options[createKrancInterface] = ThornOptions; createKrancInterface[nonevolvedGroups_, evolvedGroups_, rhsGroups_, groups_, @@ -414,6 +434,10 @@ createKrancInterface[nonevolvedGroups_, evolvedGroups_, rhsGroups_, groups_, CactusBoundary`GetUsedFunctions[]]]; Return[interface]]; +(* -------------------------------------------------------------------------- + Parameter definitions + -------------------------------------------------------------------------- *) + VerifyQualifiedName[name_] := If[! StringQ[name] || ! StringMatchQ[name, "*::*"], ThrowError["Not a name with an implementation:", name]]; @@ -627,6 +651,10 @@ createKrancParam[evolvedGroups_, nonevolvedGroups_, groups_, thornName_, Return[param] ]; +(* -------------------------------------------------------------------------- + Scheduling + -------------------------------------------------------------------------- *) + simpleGroupStruct[groupName_, timelevels_] := { Group -> groupName, @@ -794,7 +822,9 @@ createKrancMoLRegister[evolvedGroupNames_, nonevolvedGroupNames_, groups_, imple molregister = CreateMoLRegistrationSource[molspec, False]; Return[molregister]]; -(* Tensorial wrapper *) +(* -------------------------------------------------------------------------- + Tensors + -------------------------------------------------------------------------- *) CreateKrancThornTT[groups_, parentDirectory_, thornName_, opts___] := Module[{calcs, expCalcs, expGroups, options, derivs, expDerivs, reflectionSymmetries, declaredGroups}, |