aboutsummaryrefslogtreecommitdiff
path: root/src/GenericRK.c
diff options
context:
space:
mode:
authorhawke <hawke@578cdeb0-5ea1-4b81-8215-5a3b8777ee0b>2006-08-01 12:57:45 +0000
committerhawke <hawke@578cdeb0-5ea1-4b81-8215-5a3b8777ee0b>2006-08-01 12:57:45 +0000
commit1db9e820e488272d13b6331d4f81aa9c2d637fbc (patch)
tree502778f424980849482fc46ad3a8b2454a5c3bf4 /src/GenericRK.c
parent5b12759aff89d3e5854999776b169112e8510111 (diff)
Modification for evolving array variables; change to local
arrays. This gets around the problems with the driver allocating the scratch space differently on multiprocessors from the individual arrays. git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/MoL/trunk@116 578cdeb0-5ea1-4b81-8215-5a3b8777ee0b
Diffstat (limited to 'src/GenericRK.c')
-rw-r--r--src/GenericRK.c118
1 files changed, 34 insertions, 84 deletions
diff --git a/src/GenericRK.c b/src/GenericRK.c
index 58185ca..f9622c7 100644
--- a/src/GenericRK.c
+++ b/src/GenericRK.c
@@ -15,6 +15,8 @@
#include "cctk_Arguments.h"
#include "cctk_Parameters.h"
+#include <stdio.h>
+
#include "ExternalVariables.h"
static const char *rcsid = "$Header$";
@@ -73,7 +75,7 @@ void MoL_GenericRKAdd(CCTK_ARGUMENTS)
cGroupDynamicData arraydata;
CCTK_INT groupindex, ierr;
- CCTK_INT arraytotalsize, arraydim, singlearraysize;
+ CCTK_INT arraytotalsize, arraydim;
/* FIXME */
@@ -344,29 +346,14 @@ void MoL_GenericRKAdd(CCTK_ARGUMENTS)
/* Real arrays */
+/* #define MOLDEBUGARRAYS 1 */
+
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;
-
+#ifdef MOLDEBUGARRAYS
+ CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Array sizes are %d %d %d\n", MoL_Max_Evolved_Array_Size, arraytotalsize, singlearraysize);
+#endif
for (var = 0; var < MoLNumEvolvedArrayVariables; var++)
{
@@ -375,22 +362,8 @@ void MoL_GenericRKAdd(CCTK_ARGUMENTS)
EvolvedArrayVariableIndex[var]);
RHSVar = (CCTK_REAL const *)CCTK_VarDataPtrI(cctkGH, 0,
RHSArrayVariableIndex[var]);
-
- groupindex = CCTK_GroupIndexFromVarI(EvolvedArrayVariableIndex[var]);
- 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'.",
- CCTK_GroupName(groupindex));
- }
- arraytotalsize = 1;
- for (arraydim = 0; arraydim < arraydata.dim; arraydim++)
- {
- arraytotalsize *= arraydata.lsh[arraydim];
- }
+
+ arraytotalsize = ArrayScratchSizes[var];
for (index = 0; index < arraytotalsize; index++)
{
@@ -409,22 +382,8 @@ void MoL_GenericRKAdd(CCTK_ARGUMENTS)
if (scratchstep)
{
-/* ScratchVar = &ArrayScratchSpace[scratchindex* */
-/* (MoL_Max_Evolved_Array_Size+1) + */
-/* arrayscratchlocation]; */
- ScratchVar = &ArrayScratchSpace[scratchindex*singlearraysize +
+ ScratchVar = &ArrayScratchSpace[scratchindex*CurrentArrayScratchSize +
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*singlearraysize +
- arrayscratchlocation);
- }
-#endif
}
else
{
@@ -437,13 +396,14 @@ void MoL_GenericRKAdd(CCTK_ARGUMENTS)
for (index = 0; index < arraytotalsize; index++)
{
UpdateVar[index] += alpha * ScratchVar[index];
-#ifdef MOLDEBUG
+#ifdef MOLDEBUGARRAYS
if (CCTK_EQUALS(verbose,"extreme"))
{
- printf("Variable: %d. Index: %d. step: %d. "
- "alpha: %f. Scratch: %f. q: %f.\n",
- var, index, (*MoL_Intermediate_Step),
- alpha, ScratchVar[index], UpdateVar[index]);
+ CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Variable: %d. Index: %d. step: %d. "
+ "alpha: %f. Scratch: %f. q: %f.\n",
+ var, index, (*MoL_Intermediate_Step),
+ alpha, ScratchVar[index], UpdateVar[index]);
}
#endif
}
@@ -465,41 +425,31 @@ void MoL_GenericRKAdd(CCTK_ARGUMENTS)
EvolvedArrayVariableIndex[var]);
ScratchVar = &ArrayScratchSpace[(MoL_Intermediate_Steps -
(*MoL_Intermediate_Step)) *
- singlearraysize +
+ CurrentArrayScratchSize +
+/* singlearraysize + */
/* (MoL_Max_Evolved_Array_Size+1) + */
arrayscratchlocation];
- groupindex = CCTK_GroupIndexFromVarI(EvolvedArrayVariableIndex[var]);
- 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'.",
- CCTK_GroupName(groupindex));
- }
- arraytotalsize = 1;
- for (arraydim = 0; arraydim < arraydata.dim; arraydim++)
- {
- arraytotalsize *= arraydata.lsh[arraydim];
- }
-#ifdef MOLDEBUG
- printf("Writing to scratch space, initial address %ld, index %d \n",
- ScratchVar, (MoL_Intermediate_Steps -
- (*MoL_Intermediate_Step)) *
- singlearraysize +
-/* (MoL_Max_Evolved_Array_Size+1) + */
- arrayscratchlocation);
+ arraytotalsize = ArrayScratchSizes[var];
+
+
+#ifdef MOLDEBUGARRAYS
+ CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Writing to scratch space, initial address %ld, index %d \n",
+ ScratchVar, (MoL_Intermediate_Steps -
+ (*MoL_Intermediate_Step)) *
+ CurrentArrayScratchSize +
+ arrayscratchlocation);
#endif
for (index = 0; index < arraytotalsize; index++)
{
ScratchVar[index] = UpdateVar[index];
-#ifdef MOLDEBUG
+#ifdef MOLDEBUGARRAYS
if (CCTK_EQUALS(verbose,"extreme"))
{
- printf("Variable: %d. Index: %d. step: %d. Scratch: %f.\n",
- var, index, (*MoL_Intermediate_Step), ScratchVar[index]);
+ CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Variable: %d. Index: %d. step: %d. Scratch: %f.\n",
+ var, index, (*MoL_Intermediate_Step), ScratchVar[index]);
}
#endif
}