aboutsummaryrefslogtreecommitdiff
path: root/src/InitialCopy.c
diff options
context:
space:
mode:
authorhawke <hawke@578cdeb0-5ea1-4b81-8215-5a3b8777ee0b>2006-07-28 09:46:54 +0000
committerhawke <hawke@578cdeb0-5ea1-4b81-8215-5a3b8777ee0b>2006-07-28 09:46:54 +0000
commit5b12759aff89d3e5854999776b169112e8510111 (patch)
tree7f2936e183a00ae4ceab05e35b25d9416e38e3b8 /src/InitialCopy.c
parentec098f5dadd15c70908dcbd07b484f04f926ebea (diff)
Fix for evolving arrays on multi-processors with the generic RK
method. This fix should use minimal memory, and works even when there is no storage for the array on the local processor. git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/MoL/trunk@115 578cdeb0-5ea1-4b81-8215-5a3b8777ee0b
Diffstat (limited to 'src/InitialCopy.c')
-rw-r--r--src/InitialCopy.c50
1 files changed, 28 insertions, 22 deletions
diff --git a/src/InitialCopy.c b/src/InitialCopy.c
index f326ead..2b63697 100644
--- a/src/InitialCopy.c
+++ b/src/InitialCopy.c
@@ -167,18 +167,21 @@ void MoL_InitialCopy(CCTK_ARGUMENTS)
arraytotalsize *= arraydata.lsh[arraydim];
}
- if (PreviousVar && CurrentVar)
- {
- memcpy(CurrentVar, PreviousVar, arraytotalsize * sizeof(CCTK_REAL));
- }
- else
- {
- printf("The pointers are %p (prev) and %p (curr)\n.",
- PreviousVar, CurrentVar);
- CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,"Null pointer for variable %s",
- CCTK_VarName(EvolvedArrayVariableIndex[var]));
+ if (arraytotalsize)
+ {
+ if (PreviousVar && CurrentVar)
+ {
+ memcpy(CurrentVar, PreviousVar, arraytotalsize * sizeof(CCTK_REAL));
+ }
+ else
+ {
+ printf("The pointers are %p (prev) and %p (curr)\n.",
+ PreviousVar, CurrentVar);
+ CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,"Null pointer for variable %s",
+ CCTK_VarName(EvolvedArrayVariableIndex[var]));
+ }
}
-
+
}
/* FIXME */
@@ -543,21 +546,24 @@ void MoL_InitRHS(CCTK_ARGUMENTS)
arraytotalsize *= arraydata.lsh[arraydim];
}
- if (RHSVar)
+ if (arraytotalsize)
{
- for (index = 0; index < arraytotalsize; index++)
+ if (RHSVar)
{
- RHSVar[index] = 0;
+ for (index = 0; index < arraytotalsize; index++)
+ {
+ RHSVar[index] = 0;
+ }
+ }
+ else
+ {
+ printf("The pointer is %p (rhs)\n.",
+ RHSVar);
+ CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,"Null pointer for variable %s",
+ CCTK_VarName(RHSArrayVariableIndex[var]));
}
}
- else
- {
- printf("The pointer is %p (rhs)\n.",
- RHSVar);
- CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,"Null pointer for variable %s",
- CCTK_VarName(RHSArrayVariableIndex[var]));
- }
-
+
}
/* FIXME */