aboutsummaryrefslogtreecommitdiff
path: root/Tools/CodeGen/Thorn.m
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/CodeGen/Thorn.m')
-rw-r--r--Tools/CodeGen/Thorn.m74
1 files changed, 1 insertions, 73 deletions
diff --git a/Tools/CodeGen/Thorn.m b/Tools/CodeGen/Thorn.m
index 009fdfd..9165aec 100644
--- a/Tools/CodeGen/Thorn.m
+++ b/Tools/CodeGen/Thorn.m
@@ -24,89 +24,17 @@
parts of a Cactus thorn and assemble them. *)
BeginPackage["Thorn`", "CodeGen`", "CodeGenC`", "CodeGenCactus`", "CodeGenKranc`", "CodeGenCalculation`",
- "CalculationBoundaries`", "MapLookup`", "KrancGroups`", "Helpers`",
+ "MapLookup`", "KrancGroups`", "Helpers`",
"Errors`", "Kranc`", "CaKernel`", "Vectorisation`", "DGFE`", "OpenCL`"];
(* These functions are externally visible, and comprise the public
interface to this package. *)
CreateThorn::usage = "Create a general Cactus thorn from
a thorn specification structure";
-CreateSetterSource::usage = "";
Begin["`Private`"];
-(* ------------------------------------------------------------------------
- Setter
- ------------------------------------------------------------------------ *)
-
-(* calculation = {Name -> "ClassicADM_Setter",
- optional Before -> {functions},
- optional After -> {functions},
- Shorthands -> {gInv11, ...},
- GridFunctions -> {g11rhs, K11},
- CollectList -> {hInv11, hInv22, ...},
- optional DeclarationIncludes -> {include file list},
- optional LoopPreIncludes -> {include file list},
- Equations -> {{K11_rhs -> 2 A K11, ...}...}} *)
-
-
-(* Given a list of Calculation structures as defined above, create a
- CodeGen representation of a source file that defines a function for
- each Calculation. *)
-
-Options[CreateSetterSource] = ThornOptions;
-
-CreateSetterSource[calcs_, debug_, include_,
- opts:OptionsPattern[]] :=
- Module[{calc = First[calcs],bodyFunction},
-
- If[!MatchQ[include, _List],
- ThrowError["CreateSetterSource: Include should be a list but is in fact " <> ToString[include]]];
-
- SetDataType[If[OptionValue[UseVectors],VectorisationType[], "CCTK_REAL"]];
-
- {FileHeader["C"],
-
- "#define KRANC_" <> ToUpperCase[CodeGenC`SOURCELANGUAGE] <> "\n\n",
-
- If[CodeGenC`SOURCELANGUAGE == "C",
- {IncludeSystemFile["assert.h"],
- IncludeSystemFile["math.h"],
- IncludeSystemFile["stdio.h"],
- IncludeSystemFile["stdlib.h"],
- IncludeSystemFile["string.h"]},
- {"\n"}
- ],
-
- Map[IncludeFile, Join[{"cctk.h", "cctk_Arguments.h", "cctk_Parameters.h",
- (*"precomputations.h",*) "GenericFD.h", "Differencing.h"},
- include,
- {"cctk_Loop.h", "loopcontrol.h"},
- If[OptionValue[UseOpenCL], OpenCLIncludeFiles[], {}],
- If[OptionValue[UseVectors], VectorisationIncludeFiles[], {}]]],
- CalculationMacros[OptionValue[UseVectors]],
-
- (* For each function structure passed, create the function and
- insert it *)
-
- CalculationBoundariesFunction[First[calcs]],
-
- bodyFunction = DefineFunction[lookup[calc,Name]<>"_Body", "static void", "const cGH* restrict const cctkGH, const int dir, const int face, const CCTK_REAL normal[3], const CCTK_REAL tangentA[3], const CCTK_REAL tangentB[3], const int imin[3], const int imax[3], const int n_subblock_gfs, CCTK_REAL* restrict const subblock_gfs[]",
- {
- "DECLARE_CCTK_ARGUMENTS;\n",
- "DECLARE_CCTK_PARAMETERS;\n\n",
- #
- }] &;
-
- calc = Join[calc, {BodyFunction -> bodyFunction,
- CallerFunction -> True,
- LoopFunction -> (GenericGridLoop[lookup[calc,Name],#,opts] &),
- GFAccessFunction -> ({#,"[","index","]"} &),
- InitFDVariables -> InitialiseFDVariables[OptionValue[UseVectors]],
- MacroPointer -> True}];
-
- CreateCalculationFunction[calc, opts]}];
(* ------------------------------------------------------------------------
Thorn creation