aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhawke <hawke@578cdeb0-5ea1-4b81-8215-5a3b8777ee0b>2005-01-31 17:06:33 +0000
committerhawke <hawke@578cdeb0-5ea1-4b81-8215-5a3b8777ee0b>2005-01-31 17:06:33 +0000
commita5dc8bf62793e6ba4251fa0c369dee0d7d67b2bc (patch)
tree7da4d99588fb10227998ebe82118b6ff041f4f65 /src
parent495a7da9357fa3a487d626de33ec75dccb843100 (diff)
Catch the case where people that didn't read the documentation
properly try to register, e.g., evolved function with MoL before the index arrays have been set up. git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/MoL/trunk@83 578cdeb0-5ea1-4b81-8215-5a3b8777ee0b
Diffstat (limited to 'src')
-rw-r--r--src/ExternalVariables.h3
-rw-r--r--src/Registration.c77
-rw-r--r--src/Startup.c2
3 files changed, 82 insertions, 0 deletions
diff --git a/src/ExternalVariables.h b/src/ExternalVariables.h
index 229c6bb..0c6457b 100644
--- a/src/ExternalVariables.h
+++ b/src/ExternalVariables.h
@@ -61,3 +61,6 @@ extern CCTK_INT MoLNumEvolvedComplexArrayVariables;
extern CCTK_INT MoLNumConstrainedComplexArrayVariables;
extern CCTK_INT MoLNumSandRComplexArrayVariables;
+
+extern CCTK_INT ScheduleStatus;
+
diff --git a/src/Registration.c b/src/Registration.c
index 547455c..41bd70b 100644
--- a/src/Registration.c
+++ b/src/Registration.c
@@ -11,6 +11,7 @@
@@*/
#include "cctk.h"
+#include "cctk_Arguments.h"
#include "cctk_Parameters.h"
#include "ExternalVariables.h"
@@ -31,6 +32,8 @@ CCTK_FILEVERSION(CactusBase_MoL_Registration_c);
***************** Scheduled Routine Prototypes *********************
********************************************************************/
+void MoL_SetScheduleStatus(CCTK_ARGUMENTS);
+
/********************************************************************
********************* Other Routine Prototypes *********************
********************************************************************/
@@ -117,6 +120,32 @@ CCTK_INT MoL_QueryEvolvedRHS(CCTK_INT EvolvedIndex);
********************************************************************/
/*@@
+ @routine MoL_SetScheduleStatus
+ @date Mon Jan 31 16:01:51 2005
+ @author Ian Hawke
+ @desc
+ Set the ScheduleStatus flag. This is to ensure that we can catch
+ calls to the registration routines that happen too early.
+ @enddesc
+ @calls
+ @calledby
+ @history
+
+ @endhistory
+
+@@*/
+
+
+void MoL_SetScheduleStatus(CCTK_ARGUMENTS)
+{
+
+ DECLARE_CCTK_ARGUMENTS;
+
+ ScheduleStatus = 1;
+}
+
+
+ /*@@
@routine MoL_RegisterEvolved
@date Thu May 30 11:36:59 2002
@author Ian Hawke
@@ -139,6 +168,14 @@ CCTK_INT MoL_RegisterEvolved(CCTK_INT EvolvedIndex, CCTK_INT RHSIndex)
retval = 0;
+ if (!ScheduleStatus)
+ {
+ CCTK_WARN(0, "MoL registration routine called too early!\n"
+ "Please ensure that all calls to MoL registration routines "
+ "occur within the \"MoL_Register\" timebin.");
+ retval++;
+ }
+
GroupType = CCTK_GroupTypeFromVarI(EvolvedIndex);
if (GroupType < 0)
{
@@ -249,6 +286,14 @@ CCTK_INT MoL_RegisterConstrained(CCTK_INT ConstrainedIndex)
retval = 0;
+ if (!ScheduleStatus)
+ {
+ CCTK_WARN(0, "MoL registration routine called too early!\n"
+ "Please ensure that all calls to MoL registration routines "
+ "occur within the \"MoL_Register\" timebin.");
+ retval++;
+ }
+
GroupType = CCTK_GroupTypeFromVarI(ConstrainedIndex);
if (GroupType < 0)
{
@@ -351,6 +396,14 @@ CCTK_INT MoL_RegisterSaveAndRestore(CCTK_INT SandRIndex)
retval = 0;
+ if (!ScheduleStatus)
+ {
+ CCTK_WARN(0, "MoL registration routine called too early!\n"
+ "Please ensure that all calls to MoL registration routines "
+ "occur within the \"MoL_Register\" timebin.");
+ retval++;
+ }
+
GroupType = CCTK_GroupTypeFromVarI(SandRIndex);
if (GroupType < 0)
{
@@ -439,6 +492,14 @@ CCTK_INT MoL_RegisterEvolvedGroup(CCTK_INT EvolvedGroupIndex,
retval = 0;
+ if (!ScheduleStatus)
+ {
+ CCTK_WARN(0, "MoL registration routine called too early!\n"
+ "Please ensure that all calls to MoL registration routines "
+ "occur within the \"MoL_Register\" timebin.");
+ retval++;
+ }
+
GroupFirstVar = CCTK_FirstVarIndexI(EvolvedGroupIndex);
if (GroupFirstVar < 0)
{
@@ -530,6 +591,14 @@ CCTK_INT MoL_RegisterConstrainedGroup(CCTK_INT ConstrainedGroupIndex)
retval = 0;
+ if (!ScheduleStatus)
+ {
+ CCTK_WARN(0, "MoL registration routine called too early!\n"
+ "Please ensure that all calls to MoL registration routines "
+ "occur within the \"MoL_Register\" timebin.");
+ retval++;
+ }
+
GroupFirstVar = CCTK_FirstVarIndexI(ConstrainedGroupIndex);
if (GroupFirstVar < 0)
{
@@ -616,6 +685,14 @@ CCTK_INT MoL_RegisterSaveAndRestoreGroup(CCTK_INT SandRGroupIndex)
retval = 0;
+ if (!ScheduleStatus)
+ {
+ CCTK_WARN(0, "MoL registration routine called too early!\n"
+ "Please ensure that all calls to MoL registration routines "
+ "occur within the \"MoL_Register\" timebin.");
+ retval++;
+ }
+
GroupFirstVar = CCTK_FirstVarIndexI(SandRGroupIndex);
if (GroupFirstVar < 0)
{
diff --git a/src/Startup.c b/src/Startup.c
index f49652f..9b15e6b 100644
--- a/src/Startup.c
+++ b/src/Startup.c
@@ -64,6 +64,8 @@ CCTK_INT MoLNumEvolvedComplexArrayVariables = 0;
CCTK_INT MoLNumConstrainedComplexArrayVariables = 0;
CCTK_INT MoLNumSandRComplexArrayVariables = 0;
+CCTK_INT ScheduleStatus = 0;
+
/********************************************************************
********************* Local Data Types ***********************
********************************************************************/