From e0be5e82adfb8140cb5854e744ccf31bbf5f5c8e Mon Sep 17 00:00:00 2001 From: Ian Hinder Date: Tue, 1 Mar 2011 13:43:31 +0100 Subject: Add support for a Jacobian to be applied to all derivatives --- .../Cactus/KrancNumericalTools/GenericFD/param.ccl | 12 ++++++++ .../KrancNumericalTools/GenericFD/src/GenericFD.c | 36 ++++++++++++++++++++++ .../KrancNumericalTools/GenericFD/src/GenericFD.h | 2 ++ 3 files changed, 50 insertions(+) (limited to 'Auxiliary') diff --git a/Auxiliary/Cactus/KrancNumericalTools/GenericFD/param.ccl b/Auxiliary/Cactus/KrancNumericalTools/GenericFD/param.ccl index 91075c9..85de1f9 100644 --- a/Auxiliary/Cactus/KrancNumericalTools/GenericFD/param.ccl +++ b/Auxiliary/Cactus/KrancNumericalTools/GenericFD/param.ccl @@ -30,3 +30,15 @@ CCTK_INT boundary_width "width of boundary (fix later to use Cactus boundary ca { -1:* :: "Any integer" } 1 + +restricted: +CCTK_STRING jacobian_group "Name of group containing Jacobian" STEERABLE=RECOVER +{ + "" :: "String of the form ::" +} "" + +restricted: +CCTK_STRING jacobian_derivative_group "Name of group containing Jacobian derivative" STEERABLE=RECOVER +{ + "" :: "String of the form ::" +} "" diff --git a/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.c b/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.c index f23f8dc..1663231 100644 --- a/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.c +++ b/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.c @@ -508,3 +508,39 @@ void GenericFD_AssertGroupStorage(cGH const * restrict const cctkGH, const char } } } + +/* Return a list of pointers to the members of a named group */ +void GenericFD_GroupDataPointers(cGH const * restrict const cctkGH, const char *group_name, + int nvars, CCTK_REAL **ptrs) +{ + int group_index, status; + cGroup group_info; + + group_index = CCTK_GroupIndex(group_name); + if (group_index < 0) + CCTK_VWarn(CCTK_WARN_ABORT, __LINE__, __FILE__, CCTK_THORNSTRING, + "Error return %d trying to get group index for group \'%s\'", + group_index, + group_name); + + status = CCTK_GroupData(group_index, &group_info); + if (status < 0) + CCTK_VWarn(CCTK_WARN_ABORT, __LINE__, __FILE__, CCTK_THORNSTRING, + "Error return %d trying to get info for group \'%s\'", + status, + group_name); + + if (group_info.numvars != nvars) + { + CCTK_VWarn(CCTK_WARN_ABORT, __LINE__, __FILE__, CCTK_THORNSTRING, + "Group \'%s\' has %d variables but %d were expected", + group_name, group_info.numvars, nvars); + } + + int v1 = CCTK_FirstVarIndex(group_name); + + for (int v = 0; v < nvars; v++) + { + ptrs[v] = (CCTK_REAL *) CCTK_VarDataPtrI(cctkGH, 0 /* timelevel */, v1+v); + } +} diff --git a/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.h b/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.h index b7a4239..5974e63 100644 --- a/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.h +++ b/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.h @@ -152,6 +152,8 @@ void GenericFD_LoopOverBoundary(cGH const * restrict cctkGH, Kranc_Calculation c void GenericFD_LoopOverBoundaryWithGhosts(cGH const * restrict cctkGH, Kranc_Calculation calc); void GenericFD_LoopOverInterior(cGH const * restrict cctkGH, Kranc_Calculation calc); +void GenericFD_GroupDataPointers(cGH const * restrict const cctkGH, const char *group_name, + int nvars, CCTK_REAL **ptrs); #ifdef __cplusplus -- cgit v1.2.3