diff options
author | shusa <shusa> | 2004-10-20 17:21:53 +0000 |
---|---|---|
committer | shusa <shusa> | 2004-10-20 17:21:53 +0000 |
commit | 7c3fa0d5058dc3c1342781798ff6fa404384c65b (patch) | |
tree | d97590cf92988d9540313e839f02d860244f50b8 /Tools/CodeGen/CodeGen.m | |
parent | 2ed0bfeaae6340c8bd9b373c4bbc94c984ca2b44 (diff) |
This is a major rework of Kranc-devel, which adds compatibility
with Carpet fixed mesh refinement, standard Cactus boundary conditions and
Lego Excision.
Changes are documented briefly in the ChangeLog file, and I will do more
documentation in the next days, along with necessary adaptions of the examples.
In order to use this, the parameter GenericFD::stencil_size has to be set
(this is necessary to treat real boundaries, since cctk_nghostzones >
stencil size is possible, e.g. for Carpet runs).
Also, it is now necessary that GF names do not coincide with their group names.
This avoids Cactus warnings messages and allows simple names for parameters associated
with standard Cactus boundary conditions.
Note: In order to allow boundary conditions which are consistent with characteristic information,
one-sided differencing will be required, which is not implemented by these changes.
So far this has only been tested by running a Kerr-Schild BH with BSSN, excision, radiative
boundary conditions and excision. An immediate CVS update is not for the faint of the heart -
I will do more testing in the next days.
Diffstat (limited to 'Tools/CodeGen/CodeGen.m')
-rw-r--r-- | Tools/CodeGen/CodeGen.m | 52 |
1 files changed, 34 insertions, 18 deletions
diff --git a/Tools/CodeGen/CodeGen.m b/Tools/CodeGen/CodeGen.m index 2d32ec6..e848470 100644 --- a/Tools/CodeGen/CodeGen.m +++ b/Tools/CodeGen/CodeGen.m @@ -199,7 +199,7 @@ If[SOURCELANGUAGE == "C" || SOURCELANGUAGE == "C++", indentBlock[block], "}\n"}, - {"Do ", name, " = ", start, ", ", endplusone - 1, "\n", + {"Do ", name, " = ", start, ", ", endplusone, "\n", "\n", indentBlock[block], "End Do\n"} @@ -297,9 +297,9 @@ InitialiseFDVariables[] := { If[SOURCELANGUAGE == "Fortran", InitialiseFDSpacingVariablesFortran[], InitialiseFDSpacingVariablesC[]], - AssignVariable["dxi", "1 / dx"], - AssignVariable["dyi", "1 / dy"], - AssignVariable["dzi", "1 / dz"], + AssignVariable["dxi", "1.0 / dx"], + AssignVariable["dyi", "1.0 / dy"], + AssignVariable["dzi", "1.0 / dz"], AssignVariable["hdxi", "0.5 * dxi"], AssignVariable["hdyi", "0.5 * dyi"], AssignVariable["hdzi", "0.5 * dzi"]}]; @@ -315,7 +315,8 @@ DeclareGridLoopVariables[] := Map[DeclareVariable[#, "CCTK_INT"] &, {"i", "j", "k", "istart", "jstart", "kstart", - "iend", "jend", "kend"}], + "iend", "jend", "kend", + "index_offset_x", "index_offset_y", "index_offset_z"}], If[SOURCELANGUAGE == "C", DeclareVariable["index", "CCTK_INT"], "\n"] }]; @@ -328,27 +329,42 @@ arrayElement[var_, i_] := {var, "(", arrayIndex[i], ")"}]; (* Given a C-style variable index, return the corresponding index for - the language currently in use. The idea is that the caller doesn't + the language currently in use. The idea is that the caller does not need to know what language is being used. *) arrayIndex[i_] := If[SOURCELANGUAGE == "C", i, If[NumberQ[i], i+1, {i, " + 1"}]]; -InitialiseGridLoopVariables[] := +InitialiseGridLoopVariables[derivativesUsedSwitch_] := CommentedBlock["Set up variables used in the grid loop for the physical grid points", + + If[ (derivativesUsedSwitch), { - AssignVariable["istart", arrayIndex[arrayElement["cctk_nghostzones", 0]]], - AssignVariable["jstart", arrayIndex[arrayElement["cctk_nghostzones", 1]]], - AssignVariable["kstart", arrayIndex[arrayElement["cctk_nghostzones", 2]]], - - AssignVariable["iend", {arrayIndex[arrayElement["cctk_lsh", 0]], - " - ", arrayElement["cctk_nghostzones", 0]}], - AssignVariable["jend", {arrayIndex[arrayElement["cctk_lsh", 1]], - " - ", arrayElement["cctk_nghostzones", 1]}], - AssignVariable["kend", {arrayIndex[arrayElement["cctk_lsh", 2]], - " - ", arrayElement["cctk_nghostzones", 2]}] - }]; + AssignVariable["index_offset_x", "Max(stencil_width, stencil_width_x)"], + AssignVariable["index_offset_y", "Max(stencil_width, stencil_width_y)"], + AssignVariable["index_offset_z", "Max(stencil_width, stencil_width_z)"], + + AssignVariable["istart", arrayIndex["index_offset_x"]], + AssignVariable["jstart", arrayIndex["index_offset_y"]], + AssignVariable["kstart", arrayIndex["index_offset_z"]], + + AssignVariable["iend", {arrayElement["cctk_lsh", 0], " - index_offset_x"}], + AssignVariable["jend", {arrayElement["cctk_lsh", 1], " - index_offset_y"}], + AssignVariable["kend", {arrayElement["cctk_lsh", 2], " - index_offset_z"}] + }, + + { + AssignVariable["istart", arrayIndex[0]], + AssignVariable["jstart", arrayIndex[0]], + AssignVariable["kstart", arrayIndex[0]], + + AssignVariable["iend", arrayElement["cctk_lsh", 0]], + AssignVariable["jend", arrayElement["cctk_lsh", 1]], + AssignVariable["kend", arrayElement["cctk_lsh", 2]] + }] +]; + ConditionalOnParameter[name_, value_, block_] := SeparatedBlock[ |