diff options
author | Ian Hinder <ian.hinder@aei.mpg.de> | 2012-01-26 23:23:19 -0600 |
---|---|---|
committer | Ian Hinder <ian.hinder@aei.mpg.de> | 2012-01-26 23:23:19 -0600 |
commit | 2146cd5d483f11acd2412754884af41767b78a5d (patch) | |
tree | 6d08dadd2cb873278fc93fdcb2bd365c3a68e6a2 /Tools/CodeGen/CodeGenCactus.m | |
parent | 7cfe4ec6cc6fad4143de194fdb688dc835fd5607 (diff) |
Move CalculationMacros to CodeGenCactus.m
Diffstat (limited to 'Tools/CodeGen/CodeGenCactus.m')
-rw-r--r-- | Tools/CodeGen/CodeGenCactus.m | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/Tools/CodeGen/CodeGenCactus.m b/Tools/CodeGen/CodeGenCactus.m index 733f3bd..b857a27 100644 --- a/Tools/CodeGen/CodeGenCactus.m +++ b/Tools/CodeGen/CodeGenCactus.m @@ -79,7 +79,7 @@ PartitionVarList::usage = ""; DataType::usage = "DataType[] returns a string for the grid function data type (e.g. CCTK_REAL)"; SetDataType::usage = "SetDataType[type] sets a string for the grid function data type (e.g. CCTK_REAL)"; CCLBlock; - +CalculationMacros; Begin["`Private`"]; @@ -701,6 +701,20 @@ DefFn[ CBlock[contents], If[comment === "", "", Quote[comment]],"\n"}]; +CalculationMacros[vectorise_:False] := + CommentedBlock["Define macros used in calculations", + Map[{"#define ", #, "\n"} &, + {"INITVALUE (42)", + "QAD(x) (SQR(SQR(x)))"} ~Join~ + If[vectorise, + {"INV(x) (kdiv(ToReal(1.0),x))", + "SQR(x) (kmul(x,x))", + "CUB(x) (kmul(x,SQR(x)))"}, + {"INV(x) ((1.0) / (x))", + "SQR(x) ((x) * (x))", + "CUB(x) ((x) * (x) * (x))"}] + ]]; + End[]; EndPackage[]; |