Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dgfe'
Browse files Browse the repository at this point in the history
Conflicts:
	Tools/CodeGen/CalculationFunction.m
  • Loading branch information
barrywardell committed Feb 17, 2012
2 parents 2b4de59 + 5ad2f1b commit 1ab860f
Showing 1 changed file with 38 additions and 13 deletions.
51 changes: 38 additions & 13 deletions Tools/CodeGen/CalculationFunction.m
Expand Up @@ -378,7 +378,7 @@ pathalogical enough (e.g. {s1 -> s2, s2 -> s1} would not be
shorts, eqs, parameters, parameterRules, odeGroups,
functionName, dsUsed, groups, pddefs, cleancalc, eqLoop, where,
addToStencilWidth, pDefs, haveCondTextuals, condTextuals, calc,
kernelCall, DGFEDefs, DGFECall, debug, imp, gridName, stencilSize},
kernelCall, DGFEDefs, DGFEInit, DGFECall, debug, imp, gridName, stencilSize},

debug = OptionValue[Debug];
imp = lookup[calcp, Implementation];
Expand Down Expand Up @@ -480,21 +480,21 @@ pathalogical enough (e.g. {s1 -> s2, s2 -> s1} would not be

kernelCall = Switch[where,
Everywhere,
"GenericFD_LoopOverEverything(cctkGH, &" <> bodyFunctionName <> ");\n",
"GenericFD_LoopOverEverything(cctkGH, " <> bodyFunctionName <> ");\n",
Interior,
"GenericFD_LoopOverInterior(cctkGH, &" <> bodyFunctionName <> ");\n",
"GenericFD_LoopOverInterior(cctkGH, " <> bodyFunctionName <> ");\n",
InteriorNoSync,
"GenericFD_LoopOverInterior(cctkGH, &" <> bodyFunctionName <> ");\n",
"GenericFD_LoopOverInterior(cctkGH, " <> bodyFunctionName <> ");\n",
Boundary,
"GenericFD_LoopOverBoundary(cctkGH, &" <> bodyFunctionName <> ");\n",
"GenericFD_LoopOverBoundary(cctkGH, " <> bodyFunctionName <> ");\n",
BoundaryWithGhosts,
"GenericFD_LoopOverBoundaryWithGhosts(cctkGH, &" <> bodyFunctionName <> ");\n",
"GenericFD_LoopOverBoundaryWithGhosts(cctkGH, " <> bodyFunctionName <> ");\n",
_,
ThrowError["Unknown 'Where' entry in calculation " <>
functionName <> ": " <> ToString[where]]];

DGFEDefs =
If[OptionValue[UseDGFE] && lookupDefault[cleancalc, UseDGFE, False],
If[OptionValue[UseDGFE],
Module[
{name, lhss, gfsInLHS, vars},
InfoMessage[InfoFull, "Generating DGFE boilerplate"];
Expand Down Expand Up @@ -671,24 +671,47 @@ pathalogical enough (e.g. {s1 -> s2, s2 -> s1} would not be
"}",
"",
"",
"",
"/* A solver, DGFE's equivalent of cctkGH */",
"static "<>name<>"_solver *solver = NULL;",
"",
"",
"",
"/* Call the pointwise DGFE derivative operator */",
"#undef PDstandardNth1",
"#undef PDstandardNth2",
"#undef PDstandardNth3",
"#define PDstandardNth1(u) (solver->diff<hrscc::policy::x>(&(u)[-index], i,j,k))",
"#define PDstandardNth2(u) (solver->diff<hrscc::policy::y>(&(u)[-index], i,j,k))",
"#define PDstandardNth3(u) (solver->diff<hrscc::policy::z>(&(u)[-index], i,j,k))",
"",
"",
""
} // Flatten // Map[# <> "\n" &, #] &],
{}
];

DGFEInit =
If[OptionValue[UseDGFE],
Module[
{name},
name = lookup[cleancalc, Name];
{
"",
"if (not solver) solver = new "<>name<>"_method(cctkGH);"
} // Flatten // Map[# <> "\n" &, #] &],
{}
];

DGFECall =
If[OptionValue[UseDGFE] && lookupDefault[cleancalc, UseDGFE, False],
Module[
{name},
name = lookup[cleancalc, Name];
{
"",
"{",
" static "<>name<>"_solver *solver = NULL;",
" if (not solver) solver = new "<>name<>"_method(cctkGH);",
" solver->compute_rhs();",
" // delete solver;",
"}"
"/* Add the flux terms to the RHS */",
"solver->compute_rhs();"
} // Flatten // Map[# <> "\n" &, #] &],
{}
];
Expand Down Expand Up @@ -778,6 +801,8 @@ pathalogical enough (e.g. {s1 -> s2, s2 -> s1} would not be

If[haveCondTextuals, Map[ConditionalOnParameterTextual["!(" <> # <> ")", "return;\n"] &,condTextuals], {}],

DGFEInit,

kernelCall,

DGFECall,
Expand Down

0 comments on commit 1ab860f

Please sign in to comment.