aboutsummaryrefslogtreecommitdiff
path: root/src/GenericRK.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/GenericRK.c')
-rw-r--r--src/GenericRK.c41
1 files changed, 35 insertions, 6 deletions
diff --git a/src/GenericRK.c b/src/GenericRK.c
index 60648f1..58185ca 100644
--- a/src/GenericRK.c
+++ b/src/GenericRK.c
@@ -73,7 +73,7 @@ void MoL_GenericRKAdd(CCTK_ARGUMENTS)
cGroupDynamicData arraydata;
CCTK_INT groupindex, ierr;
- CCTK_INT arraytotalsize, arraydim;
+ CCTK_INT arraytotalsize, arraydim, singlearraysize;
/* FIXME */
@@ -346,6 +346,28 @@ void MoL_GenericRKAdd(CCTK_ARGUMENTS)
arrayscratchlocation = 0;
+ arraytotalsize = MoL_Max_Evolved_Array_Size;
+ if (MoL_Num_Scratch_Levels)
+ {
+ groupindex = CCTK_GroupIndex("MOL::ARRAYSCRATCHSPACE");
+ ierr = CCTK_GroupDynamicData(cctkGH, groupindex,
+ &arraydata);
+ if (ierr)
+ {
+ CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "The driver does not return group information "
+ "for group '%s' (%d).",
+ CCTK_GroupName(groupindex), ierr);
+ }
+ arraytotalsize = 1;
+ for (arraydim = 0; arraydim < arraydata.dim; arraydim++)
+ {
+ arraytotalsize *= arraydata.lsh[arraydim];
+ }
+ }
+ singlearraysize = arraytotalsize / MoLNumEvolvedArrayVariables;
+
+
for (var = 0; var < MoLNumEvolvedArrayVariables; var++)
{
@@ -387,14 +409,19 @@ void MoL_GenericRKAdd(CCTK_ARGUMENTS)
if (scratchstep)
{
- ScratchVar = &ArrayScratchSpace[scratchindex*
- (MoL_Max_Evolved_Array_Size+1) +
+/* ScratchVar = &ArrayScratchSpace[scratchindex* */
+/* (MoL_Max_Evolved_Array_Size+1) + */
+/* arrayscratchlocation]; */
+ ScratchVar = &ArrayScratchSpace[scratchindex*singlearraysize +
arrayscratchlocation];
#ifdef MOLDEBUG
if (CCTK_EQUALS(verbose,"extreme"))
{
+/* printf("Reading from scratch space, initial address %ld index %d\n", */
+/* ScratchVar, scratchindex*(MoL_Max_Evolved_Array_Size+1) + */
+/* arrayscratchlocation); */
printf("Reading from scratch space, initial address %ld index %d\n",
- ScratchVar, scratchindex*(MoL_Max_Evolved_Array_Size+1) +
+ ScratchVar, scratchindex*singlearraysize +
arrayscratchlocation);
}
#endif
@@ -438,7 +465,8 @@ void MoL_GenericRKAdd(CCTK_ARGUMENTS)
EvolvedArrayVariableIndex[var]);
ScratchVar = &ArrayScratchSpace[(MoL_Intermediate_Steps -
(*MoL_Intermediate_Step)) *
- (MoL_Max_Evolved_Array_Size+1) +
+ singlearraysize +
+/* (MoL_Max_Evolved_Array_Size+1) + */
arrayscratchlocation];
groupindex = CCTK_GroupIndexFromVarI(EvolvedArrayVariableIndex[var]);
ierr = CCTK_GroupDynamicData(cctkGH, groupindex,
@@ -460,7 +488,8 @@ void MoL_GenericRKAdd(CCTK_ARGUMENTS)
printf("Writing to scratch space, initial address %ld, index %d \n",
ScratchVar, (MoL_Intermediate_Steps -
(*MoL_Intermediate_Step)) *
- (MoL_Max_Evolved_Array_Size+1) +
+ singlearraysize +
+/* (MoL_Max_Evolved_Array_Size+1) + */
arrayscratchlocation);
#endif
for (index = 0; index < arraytotalsize; index++)