aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhawke <hawke@578cdeb0-5ea1-4b81-8215-5a3b8777ee0b>2005-05-04 13:03:05 +0000
committerhawke <hawke@578cdeb0-5ea1-4b81-8215-5a3b8777ee0b>2005-05-04 13:03:05 +0000
commit4cd986841fb0640801ba497f7d0b52a7f302a264 (patch)
tree6d9a8dd457b97e80992dfd523ef3e6bae068c66d /src
parent6ed5fcf53fce538e6098c50101bd39e291bf7b16 (diff)
Check that a constrained GF may have more than one timelevel before
complaining that it doesn't when copying data (if a constrained GF only has one timelevel then such a copy is unnecessary). Fixes PR/1921. git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/MoL/trunk@89 578cdeb0-5ea1-4b81-8215-5a3b8777ee0b
Diffstat (limited to 'src')
-rw-r--r--src/InitialCopy.c72
1 files changed, 49 insertions, 23 deletions
diff --git a/src/InitialCopy.c b/src/InitialCopy.c
index 37d3cff..df09980 100644
--- a/src/InitialCopy.c
+++ b/src/InitialCopy.c
@@ -336,7 +336,7 @@ void MoL_InitialCopy(CCTK_ARGUMENTS)
{
StorageOn = CCTK_QueryGroupStorageI(cctkGH,
- CCTK_GroupIndexFromVarI(ConstrainedVariableIndex[var]));
+ CCTK_GroupIndexFromVarI(ConstrainedVariableIndex[var]));
if (StorageOn < 0)
{
@@ -350,19 +350,32 @@ void MoL_InitialCopy(CCTK_ARGUMENTS)
CCTK_WARN(0, "The grid function does not have storage assigned.");
}
- PreviousVar = (CCTK_REAL*)CCTK_VarDataPtrI(cctkGH, 1,
- ConstrainedVariableIndex[var]);
- CurrentVar = (CCTK_REAL*)CCTK_VarDataPtrI(cctkGH, 0,
- ConstrainedVariableIndex[var]);
+ /*
+ Check that there is more than one timelevel.
+ If not, copying is unnecessary.
+ */
- if (PreviousVar && CurrentVar)
- {
- memcpy(CurrentVar, PreviousVar, totalsize * sizeof(CCTK_REAL));
- }
- else
+ StorageOn = CCTK_ActiveTimeLevelsVI(cctkGH,
+ ConstrainedVariableIndex[var]);
+
+ if (StorageOn > 1)
{
- CCTK_VWarn(0,__LINE__,__FILE__,"MoL","Null pointer for variable %s",
- CCTK_VarName(ConstrainedVariableIndex[var]));
+
+ PreviousVar = (CCTK_REAL*)CCTK_VarDataPtrI(cctkGH, 1,
+ ConstrainedVariableIndex[var]);
+ CurrentVar = (CCTK_REAL*)CCTK_VarDataPtrI(cctkGH, 0,
+ ConstrainedVariableIndex[var]);
+
+ if (PreviousVar && CurrentVar)
+ {
+ memcpy(CurrentVar, PreviousVar, totalsize * sizeof(CCTK_REAL));
+ }
+ else
+ {
+ CCTK_VWarn(0,__LINE__,__FILE__,"MoL","Null pointer for variable %s",
+ CCTK_VarName(ConstrainedVariableIndex[var]));
+ }
+
}
}
@@ -389,19 +402,32 @@ void MoL_InitialCopy(CCTK_ARGUMENTS)
CCTK_WARN(0, "The grid function does not have storage assigned.");
}
- PreviousComplexVar = (CCTK_COMPLEX*)CCTK_VarDataPtrI(cctkGH, 1,
- ConstrainedComplexVariableIndex[var]);
- CurrentComplexVar = (CCTK_COMPLEX*)CCTK_VarDataPtrI(cctkGH, 0,
- ConstrainedComplexVariableIndex[var]);
+ /*
+ Check that there is more than one timelevel.
+ If not, copying is unnecessary.
+ */
- if (PreviousComplexVar && CurrentComplexVar)
- {
- memcpy(CurrentComplexVar, PreviousComplexVar, totalsize * sizeof(CCTK_COMPLEX));
- }
- else
+ StorageOn = CCTK_ActiveTimeLevelsVI(cctkGH,
+ ConstrainedVariableIndex[var]);
+
+ if (StorageOn > 1)
{
- CCTK_VWarn(0,__LINE__,__FILE__,"MoL","Null pointer for variable %s",
- CCTK_VarName(ConstrainedComplexVariableIndex[var]));
+
+ PreviousComplexVar = (CCTK_COMPLEX*)CCTK_VarDataPtrI(cctkGH, 1,
+ ConstrainedComplexVariableIndex[var]);
+ CurrentComplexVar = (CCTK_COMPLEX*)CCTK_VarDataPtrI(cctkGH, 0,
+ ConstrainedComplexVariableIndex[var]);
+
+ if (PreviousComplexVar && CurrentComplexVar)
+ {
+ memcpy(CurrentComplexVar, PreviousComplexVar, totalsize * sizeof(CCTK_COMPLEX));
+ }
+ else
+ {
+ CCTK_VWarn(0,__LINE__,__FILE__,"MoL","Null pointer for variable %s",
+ CCTK_VarName(ConstrainedComplexVariableIndex[var]));
+ }
+
}
}