aboutsummaryrefslogtreecommitdiff
path: root/src/ChangeType.c
diff options
context:
space:
mode:
authoryye00 <yye00@578cdeb0-5ea1-4b81-8215-5a3b8777ee0b>2004-10-05 13:38:08 +0000
committeryye00 <yye00@578cdeb0-5ea1-4b81-8215-5a3b8777ee0b>2004-10-05 13:38:08 +0000
commit72fa6a23c921eaf0c6e572c57cfe8a0425866300 (patch)
tree92480cc53fcfbb6a7c9706d7cb3bdc8158680e0f /src/ChangeType.c
parentfb30868c8bf1234fa22900f2940751efde306679 (diff)
committing the patch sent by Ian Hawke to ChangeType.c
git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/MoL/trunk@75 578cdeb0-5ea1-4b81-8215-5a3b8777ee0b
Diffstat (limited to 'src/ChangeType.c')
-rw-r--r--src/ChangeType.c70
1 files changed, 70 insertions, 0 deletions
diff --git a/src/ChangeType.c b/src/ChangeType.c
index 6f3d272..28d2fd4 100644
--- a/src/ChangeType.c
+++ b/src/ChangeType.c
@@ -11,6 +11,7 @@
@@*/
#include "cctk.h"
+#include "cctk_Parameters.h"
#include "ExternalVariables.h"
@@ -75,6 +76,8 @@ CCTK_INT MoL_ChangeToNone(CCTK_INT RemoveIndex);
CCTK_INT MoL_ChangeToEvolved(CCTK_INT EvolvedIndex, CCTK_INT RHSIndex)
{
+ DECLARE_CCTK_PARAMETERS;
+
CCTK_INT index, usedindex;
CCTK_INT vartype; /* See the defines at the top of file */
CCTK_INT timelevs;
@@ -140,6 +143,19 @@ CCTK_INT MoL_ChangeToEvolved(CCTK_INT EvolvedIndex, CCTK_INT RHSIndex)
"index %i to evolved (RHS GF).", RHSIndex);
CCTK_WARN(0, "The index passed does not correspond to a GF.");
}
+
+ if (!(MoLNumEvolvedVariables < MoL_Num_Evolved_Vars))
+ {
+ CCTK_VWarn(1,__LINE__,__FILE__,"MoL",
+ "Warning whilst trying to change variable "
+ "index %i (%s) to save and restore.",
+ EvolvedIndex, CCTK_VarName(EvolvedIndex));
+ CCTK_WARN(0, "When changing type there are more variables "
+ "than the accumulator parameter "
+ "MoL_Num_Evolved_Vars allows. Check that "
+ "you are accumulating onto this parameter correctly");
+ }
+
EvolvedVariableIndex[MoLNumEvolvedVariables] = EvolvedIndex;
RHSVariableIndex[MoLNumEvolvedVariables] = RHSIndex;
MoLNumEvolvedVariables++;
@@ -168,6 +184,19 @@ CCTK_INT MoL_ChangeToEvolved(CCTK_INT EvolvedIndex, CCTK_INT RHSIndex)
"index %i to evolved type from constrained.", RHSIndex);
CCTK_WARN(0, "The RHS index passed does not correspond to a GF.");
}
+
+ if (!(MoLNumEvolvedVariables < MoL_Num_Evolved_Vars))
+ {
+ CCTK_VWarn(1,__LINE__,__FILE__,"MoL",
+ "Warning whilst trying to change variable "
+ "index %i (%s) to save and restore.",
+ EvolvedIndex, CCTK_VarName(EvolvedIndex));
+ CCTK_WARN(0, "When changing type there are more variables "
+ "than the accumulator parameter "
+ "MoL_Num_Evolved_Vars allows. Check that "
+ "you are accumulating onto this parameter correctly");
+ }
+
for (index = usedindex; index < MoLNumConstrainedVariables - 1;
index++)
{
@@ -196,6 +225,19 @@ CCTK_INT MoL_ChangeToEvolved(CCTK_INT EvolvedIndex, CCTK_INT RHSIndex)
"restore.", RHSIndex);
CCTK_WARN(0, "The RHS index passed does not correspond to a GF.");
}
+
+ if (!(MoLNumEvolvedVariables < MoL_Num_Evolved_Vars))
+ {
+ CCTK_VWarn(1,__LINE__,__FILE__,"MoL",
+ "Warning whilst trying to change variable "
+ "index %i (%s) to save and restore.",
+ EvolvedIndex, CCTK_VarName(EvolvedIndex));
+ CCTK_WARN(0, "When changing type there are more variables "
+ "than the accumulator parameter "
+ "MoL_Num_Evolved_Vars allows. Check that "
+ "you are accumulating onto this parameter correctly");
+ }
+
for (index = usedindex; index < MoLNumSandRVariables - 1; index++)
{
SandRVariableIndex[index] = SandRVariableIndex[index+1];
@@ -243,6 +285,8 @@ CCTK_INT MoL_ChangeToEvolved(CCTK_INT EvolvedIndex, CCTK_INT RHSIndex)
CCTK_INT MoL_ChangeToConstrained(CCTK_INT ConstrainedIndex)
{
+ DECLARE_CCTK_PARAMETERS;
+
CCTK_INT index, usedindex;
CCTK_INT vartype; /* See the defines at the top of file */
CCTK_INT timelevs;
@@ -265,6 +309,18 @@ CCTK_INT MoL_ChangeToConstrained(CCTK_INT ConstrainedIndex)
"index %i to evolved.", ConstrainedIndex);
CCTK_WARN(0, "The index passed only has a single timelevel.");
}
+
+ if (!(MoLNumConstrainedVariables < MoL_Num_Constrained_Vars))
+ {
+ CCTK_VWarn(1,__LINE__,__FILE__,"MoL",
+ "Warning whilst trying to change variable "
+ "index %i (%s) to save and restore.",
+ ConstrainedIndex, CCTK_VarName(ConstrainedIndex));
+ CCTK_WARN(0, "When changing type there are more variables "
+ "than the accumulator parameter "
+ "MoL_Num_Constrained_Vars allows. Check that "
+ "you are accumulating onto this parameter correctly");
+ }
for (index = 0; (index < MoLNumEvolvedVariables)&&(!vartype); index++)
{
@@ -373,6 +429,8 @@ CCTK_INT MoL_ChangeToConstrained(CCTK_INT ConstrainedIndex)
CCTK_INT MoL_ChangeToSaveAndRestore(CCTK_INT SandRIndex)
{
+ DECLARE_CCTK_PARAMETERS;
+
CCTK_INT index, usedindex;
CCTK_INT vartype; /* See the defines at the top of file */
CCTK_INT timelevs;
@@ -388,6 +446,18 @@ CCTK_INT MoL_ChangeToSaveAndRestore(CCTK_INT SandRIndex)
"index %i to save and restore.", SandRIndex);
CCTK_WARN(0, "The index passed does not correspond to a GF.");
}
+
+ if (!(MoLNumSandRVariables < MoL_Num_SaveAndRestore_Vars))
+ {
+ CCTK_VWarn(1,__LINE__,__FILE__,"MoL",
+ "Warning whilst trying to change variable "
+ "index %i (%s) to save and restore.",
+ SandRIndex, CCTK_VarName(SandRIndex));
+ CCTK_WARN(0, "When changing type there are more variables "
+ "than the accumulator parameter "
+ "MoL_Num_SaveAndRestore_Vars allows. Check that "
+ "you are accumulating onto this parameter correctly");
+ }
for (index = 0; (index < MoLNumEvolvedVariables)&&(!vartype); index++)
{