summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>2000-04-18 13:28:09 +0000
committergoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>2000-04-18 13:28:09 +0000
commitf3df548d78b6f84a2c4ede1c7f38320a42b7b97d (patch)
treed086c01bb0b8e547e22f9f0d5be1e63633d735a0 /src
parent7e11e7778b2a9b8dd299a7bbbadb0000c074f408 (diff)
Stuff for cactus -x[n].
Cosmetic changes. Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@1576 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src')
-rw-r--r--src/comm/CactusDefaultComm.c77
-rw-r--r--src/include/cctk_ParamCheck.h41
-rw-r--r--src/main/CommandLine.c106
3 files changed, 209 insertions, 15 deletions
diff --git a/src/comm/CactusDefaultComm.c b/src/comm/CactusDefaultComm.c
index d52ac18d..3778609e 100644
--- a/src/comm/CactusDefaultComm.c
+++ b/src/comm/CactusDefaultComm.c
@@ -19,6 +19,8 @@
#include "cctk_GHExtensions.h"
#include "cctki_GHExtensions.h"
+#include "cctk_ParamCheck.h"
+
#ifdef MPI
#include "mpi.h"
#endif
@@ -27,10 +29,19 @@ static char *rcsid = "$Header$";
CCTK_FILEVERSION(comm_CactusDefaultComm_c)
+/********************************************************************
+ ********************* Global Data *****************************
+ ********************************************************************/
+
+/* FIXME: This should be in a header somewhere */
#ifdef MPI
extern char MPI_Active;
#endif
+/********************************************************************
+ ********************* Local Definitions **********************
+ ********************************************************************/
+
#ifdef MPI
#define CACTUS_MPI_ERROR(xf) do {int errcode; \
if((errcode = xf) != MPI_SUCCESS) \
@@ -46,6 +57,10 @@ extern char MPI_Active;
} while (0)
#endif
+/********************************************************************
+ ********************* External Routines **********************
+ ********************************************************************/
+
/*@@
@routine CactusDefaultSetupGH
@@ -200,14 +215,21 @@ int CactusDefaultMyProc(cGH *GH)
{
int myproc;
-#ifdef MPI
- if(MPI_Active)
+ if(CCTK_ParamChecking())
{
- CACTUS_MPI_ERROR(MPI_Comm_rank(MPI_COMM_WORLD, &myproc));
+ myproc = 0;
}
+ else
+ {
+#ifdef MPI
+ if(MPI_Active)
+ {
+ CACTUS_MPI_ERROR(MPI_Comm_rank(MPI_COMM_WORLD, &myproc));
+ }
#else
- myproc = 0;
+ myproc = 0;
#endif
+ }
return myproc;
}
@@ -231,18 +253,39 @@ int CactusDefaultnProcs(cGH *GH)
{
int nprocs;
-#ifdef MPI
- if(MPI_Active)
+ if(CCTK_ParamChecking())
{
- CACTUS_MPI_ERROR(MPI_Comm_size(MPI_COMM_WORLD, &nprocs));
+ nprocs = CCTK_ParamCheckNProcs();
}
+ else
+ {
+#ifdef MPI
+ if(MPI_Active)
+ {
+ CACTUS_MPI_ERROR(MPI_Comm_size(MPI_COMM_WORLD, &nprocs));
+ }
#else
- nprocs = 1;
+ nprocs = 1;
#endif
-
+ }
+
return nprocs;
}
+ /*@@
+ @routine CactusDefaultExit
+ @date Tue Apr 18 15:21:15 2000
+ @author Gerd Lanfermann
+ @desc
+ The default for when people call CCTK_Exit.
+ @enddesc
+ @calls
+ @calledby
+ @history
+
+ @endhistory
+
+@@*/
int CactusDefaultExit(int retval, cGH *GH)
{
#ifdef MPI
@@ -254,7 +297,21 @@ int CactusDefaultExit(int retval, cGH *GH)
exit(retval);
}
+ /*@@
+ @routine CactusDefaultBarrier
+ @date Tue Apr 18 15:21:42 2000
+ @author Tom Goodale
+ @desc
+ The default for when people call CCTK_Barrier
+ @enddesc
+ @calls
+ @calledby
+ @history
+
+ @endhistory
+
+@@*/
int CactusDefaultBarrier(cGH *GH)
{
- return(0);
+ return 0;
}
diff --git a/src/include/cctk_ParamCheck.h b/src/include/cctk_ParamCheck.h
new file mode 100644
index 00000000..73f3bca8
--- /dev/null
+++ b/src/include/cctk_ParamCheck.h
@@ -0,0 +1,41 @@
+ /*@@
+ @header cctk_ParamCheck.h
+ @date Tue Apr 18 14:39:15 2000
+ @author Tom Goodale
+ @desc
+ Stuff for when in Parameter checking mode.
+ @enddesc
+ @version $Header$
+ @@*/
+
+#ifndef _CCTK_PARAMCHECK_H_
+#define _CCTK_PARAMCHECK_H_ 1
+
+/* These are just here for speed at the mo. Don't modify
+ * directly outside the flesh.
+ */
+
+extern int cctki_paramchecking;
+extern int cctki_paramcheck_nprocs;
+
+/* Define these as macros for the moment, but give them an
+ * interface like a function so they can can be chenged
+ * to functions later if necessary.
+ */
+
+#define CCTK_ParamCheckNProcs() cctki_paramcheck_nprocs
+#define CCTK_ParamChecking() cctki_paramchecking
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _CCTK_PARAMCHECK_H_ */
+
diff --git a/src/main/CommandLine.c b/src/main/CommandLine.c
index 529558bd..36480d16 100644
--- a/src/main/CommandLine.c
+++ b/src/main/CommandLine.c
@@ -23,6 +23,8 @@
#include "cctk_ActiveThorns.h"
#include "cctki_WarnLevel.h"
+#include "cctk_ParamCheck.h"
+
#define NEED_PARAMETER_SCOPE_STRINGS
#define NEED_PARAMETER_TYPE_STRINGS
@@ -32,18 +34,41 @@ static char *rcsid = "$Header$";
CCTK_FILEVERSION(main_CommandLine_c)
-/*Prototypes for some functions */
+
+/********************************************************************
+ ********************* Local Routine Prototypes *********************
+ ********************************************************************/
+
+static void CommandLinePrintParameter(const cParamData *properties);
+
+/********************************************************************
+ ********************* Other Routine Prototypes *********************
+ ********************************************************************/
+
+/* FIXME: these should be put in a header somewhere */
char *compileTime(void);
char *compileDate(void);
char *CCTK_FullVersion(void);
int CCTK_CommandLine(char ***outargv);
-static void CommandLinePrintParameter(const cParamData *properties);
+/********************************************************************
+ ********************* Local Data *****************************
+ ********************************************************************/
+
+static int redirectsubs = 0;
+static int paramchecking = 0;
-static int redirectsubs;
+/********************************************************************
+ ********************* Global Data *****************************
+ ********************************************************************/
-/* The functions used to deal with each option. */
+int cctki_paramchecking;
+int cctki_paramcheck_nprocs;
+
+/********************************************************************
+ ********************* External Routines **********************
+ ********************************************************************/
/*@@
@routine CCTK_CommandLineTestThorncompiled
@@ -79,6 +104,20 @@ void CCTKi_CommandLineTestThornCompiled(const char *optarg)
}
+ /*@@
+ @routine CCTKi_CommandLineDescribeAllParameters
+ @date Tue Apr 18 15:00:12 2000
+ @author Tom Goodale
+ @desc
+ Describe all the parameters
+ @enddesc
+ @calls
+ @calledby
+ @history
+
+ @endhistory
+
+@@*/
void CCTKi_CommandLineDescribeAllParameters(const char *optarg)
{
int first;
@@ -126,6 +165,20 @@ void CCTKi_CommandLineDescribeAllParameters(const char *optarg)
CCTK_Exit(0,NULL);
}
+ /*@@
+ @routine CCTKi_CommandLineDescribeParameter
+ @date Tue Apr 18 15:00:33 2000
+ @author Tom Goodale
+ @desc
+ Describe a particular parameter.
+ @enddesc
+ @calls
+ @calledby
+ @history
+
+ @endhistory
+
+@@*/
void CCTKi_CommandLineDescribeParameter(const char *optarg)
{
char *thorn;
@@ -158,6 +211,20 @@ void CCTKi_CommandLineDescribeParameter(const char *optarg)
CCTK_Exit(0,NULL);
}
+ /*@@
+ @routine CCTKi_CommandLineTestParameters
+ @date Tue Apr 18 15:00:45 2000
+ @author Tom Goodale
+ @desc
+
+ @enddesc
+ @calls
+ @calledby
+ @history
+
+ @endhistory
+
+@@*/
void CCTKi_CommandLineTestParameters(const char *optarg)
{
int nprocs;
@@ -171,6 +238,10 @@ void CCTKi_CommandLineTestParameters(const char *optarg)
nprocs = atoi(optarg);
}
+ paramchecking = 1;
+
+ cctki_paramchecking = 1;
+ cctki_paramcheck_nprocs = nprocs;
}
/*@@
@@ -243,6 +314,20 @@ void CCTKi_CommandLineRedirectStdout(void)
}
+ /*@@
+ @routine CCTKi_CommandLineListThorns
+ @date Tue Apr 18 15:05:00 2000
+ @author Tom Goodale
+ @desc
+ List the thorns which are compiled in.
+ @enddesc
+ @calls
+ @calledby
+ @history
+
+ @endhistory
+
+@@*/
void CCTKi_CommandLineListThorns(void)
{
printf ("\n---------------Compiled Thorns-------------\n");
@@ -368,7 +453,13 @@ void CCTKi_CommandLineFinished(void)
{
int myproc;
- /* Redirect output from sub-processors ... */
+ /* Are we in a paramcheck run ? */
+ if(! paramchecking)
+ {
+ cctki_paramchecking = 0;
+ }
+
+ /* Redirect output from sub-processors ... */
if ((myproc = CCTK_MyProc(NULL)) != 0)
{
@@ -394,8 +485,13 @@ void CCTKi_CommandLineFinished(void)
freopen(fname,"w",stdout);
}
+
+
}
+/********************************************************************
+ ********************* Local Routines *************************
+ ********************************************************************/
/*@@
@routine CommandLinePrintParameter