aboutsummaryrefslogtreecommitdiff
path: root/Tools/CodeGen/TestThorn.m
blob: bb2f4a382969602fd8acd17b866d7afa3937553a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
(* $Id$ *)

$Path = Flatten[{"../../Tools/CodeGen", "../../Tools/MathematicaMisc", "../../Tools/External", ".", $Path}];


BeginPackage["TestThorn`", "Thorn`", "MapLookup`"]

{Bx, By, Bz, gInv11, gInv12, g11rhs, g11, K11}

Begin["Private`"];

$ContextPath = Join[{"sym`"}, $ContextPath];

(* Interface *)

group1 = 
  {Name -> "SHIFT", 
   VariableType -> "real", 
   Timelevels -> 3, 
   GridType -> "GF",
   Comment -> "Time derivatives of the shift", 
   Visibility -> "public",
   Variables -> {Bx, By, Bz}};


if = CreateInterface[
       "evolveGR", {admbase , admmacros , boundary, coordgauge, spacemask, 
                    staticconformal},
        {"one.h", "two.h"}, {group1}, Friends -> {"admcoupling"}];

(* Schedule *)

sch = 
  CreateSchedule[
    {{Group -> "admbase::metric", Timelevels -> 3}},
    {},
    {{Name -> "ADM_BSSN_CalcRHSfn", 
        SchedulePoint -> "in POSTINITIAL before ExternalLapse",
        Language -> "C", 
        SynchronizedGroups -> {"ADM_BSSN_gamma"},
        TriggerGroups -> {"trig"},
        StorageGroups -> {{Group -> "ADM_BSSN_gamma", Timelevels -> 3}},
        Conditional -> {Parameter -> "my_param", Value -> "something"},
        Comment -> "a function"}}];

(* Makefile *)

mf =
  CreateMakefile[{"one.c", "two.c", "three.c"}];

(* Parameter file *)

par = 
  CreateParam[
    {Implementations ->
       {{Name -> "grid",
         UsedParameters -> {{Name -> "domain", Type -> "KEYWORD"},
                            {Name -> "quadrant_direction", Type -> "KEYWORD"},
                            {Name -> "bitant_plane", Type -> "KEYWORD"}},
         ExtendedParameters -> {{Name -> "lapse_evolution_method", Type -> "KEYWORD",
                                 Default -> "", Description -> "Which lapse method to use",
                                 AllowedValues -> {{Value -> "geodesic", Description -> "Geodesic slicing"},
                                                   {Value -> "harmonic", Description -> "Harmonic slicing"},
                                                   {Value -> "1+log", Description -> "Generalized 1+log slicing"}}}}}},
     NewParameters -> {{Name -> "fisheye_scale", Type -> "REAL", Description -> "Asymptotic coordinate scale (fisheye factor)",
                        Default -> 1.0, Visibility -> "private",
                        AllowedValues -> {{Value -> 0.0, Description -> "Positive please"}}}}}];


(* Precompmacros source file *)

precomp =
  CreatePrecompMacros[{h11,h22,h33}];

(* MoL Source file *)

molreg = 
  CreateMoLRegistrationSource[
    {EvolvedGFs -> {h11, h12}, PrimitiveGFs -> {trK}, BaseImplementation -> "ADMBase", ThornName -> "MyMoL"}];

(* Startup file *)

startup = CreateStartupFile["MyTestThorn", "MyTestThorn: A test thorn for Kranc"];

(* Setter file *)

debug = False;

setter = CreateSetterSource[
 {{Name -> "MyMoL_ImportVariables",
   Calculation -> 
     {Shorthands -> {gInv11, gInv12},
      GridFunctions -> {g11rhs, g11, K11},
      Equations -> {{g11rhs -> Log[g11] + D11[K11] - D22[K22] + gInv11 + gInv12}, {}}}}}, debug];

srcs = {{Filename -> "MoLRegister.c", Contents -> molreg},
        {Filename -> "Setter.c", Contents -> setter},
        {Filename -> "precompMacros.h", Contents -> precomp},
        {Filename -> "Startup.c", Contents -> startup}};

th = {Name -> "MyTestThorn", Directory -> ".", Interface -> if,
      Schedule -> sch, Param -> par, Makefile -> mf,
      Sources -> srcs};

CreateThorn[th];

End[];
EndPackage[];