diff options
author | swhite <swhite@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2006-05-11 13:55:51 +0000 |
---|---|---|
committer | swhite <swhite@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2006-05-11 13:55:51 +0000 |
commit | 28bf70daab10b8a1926aad64c9cc08e4f17ee028 (patch) | |
tree | fb526c9f3c9c4063dfa34511b42dd49f170ad668 /src | |
parent | cbdbf5e58ea01a80e3d355099aad1f2117d47863 (diff) |
Applying Erik's patch from 6.10.05
New command line option to stop after printing the schedule
git-svn-id: http://svn.cactuscode.org/flesh/trunk@4293 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src')
-rw-r--r-- | src/include/CommandLine.h | 1 | ||||
-rw-r--r-- | src/main/CommandLine.c | 24 | ||||
-rw-r--r-- | src/main/ProcessCommandLine.c | 4 | ||||
-rw-r--r-- | src/main/flesh.cc | 39 |
4 files changed, 53 insertions, 15 deletions
diff --git a/src/include/CommandLine.h b/src/include/CommandLine.h index bce6e7a9..408e2562 100644 --- a/src/include/CommandLine.h +++ b/src/include/CommandLine.h @@ -23,6 +23,7 @@ void CCTKi_CommandLineWarningLevel(const char *argument); void CCTKi_CommandLineErrorLevel(const char *argument); void CCTKi_CommandLineParameterLevel(const char *argument); void CCTKi_CommandLineRedirect(const char *argument); +void CCTKi_CommandLinePrintSchedule(void); void CCTKi_CommandLineListThorns(void); void CCTKi_CommandLineVersion(void); void CCTKi_CommandLineHelp(void); diff --git a/src/main/CommandLine.c b/src/main/CommandLine.c index 5897800a..93984ab6 100644 --- a/src/main/CommandLine.c +++ b/src/main/CommandLine.c @@ -56,13 +56,15 @@ static int paramchecking = 0; int cctki_paramchecking; int cctki_paramcheck_nprocs; +int cctki_onlyprintschedule = 0; /******************************************************************** ********************* Defines ********************** ********************************************************************/ -#define CACTUS_COMMANDLINE_OPTIONS \ - "[-h] [-O] [-o paramname] [-L n] [-W n] [-E n] [-r[o|e|oe|eo]] [-T] " \ - "[-t name] [-parameter-level <level>] [-v] <parameter_file_name>" +#define CACTUS_COMMANDLINE_OPTIONS \ + "[-h] [-O] [-o paramname] [-L n] [-W n] [-E n] [-r[o|e|oe|eo]] " \ + "[-S] [-T] [-t name] [-parameter-level <level>] [-v] " \ + "<parameter_file_name>" /******************************************************************** @@ -456,6 +458,21 @@ void CCTKi_CommandLineRedirect (const char *argument) /*@@ + @routine CCTKi_CommandLinePrintSchedule + @date 2005-06-10 + @author Erik Schnetter + @desc + Set a flag that makes the run abort after printing the + schedule tree. + @enddesc +@@*/ +void CCTKi_CommandLinePrintSchedule (void) +{ + cctki_onlyprintschedule = 1; +} + + + /*@@ @routine CCTKi_CommandLineListThorns @date Tue Apr 18 15:05:00 2000 @author Tom Goodale @@ -535,6 +552,7 @@ void CCTKi_CommandLineHelp (void) "-E, -error-level <n> : Sets the error level to n.\n" "-r, -redirect [o|e|oe|eo] : Redirects standard output and/or standard\n" " error to files.\n" + "-S, -print-schedule : Print the schedule tree, then exit.\n" "-T, -list-thorns : Lists the compiled-in thorns.\n" "-t, -test-thorn-compiled <name> : Tests for the presence of thorn <name>.\n" " -parameter-level <level> : Sets the amount of parameter checking, \n" diff --git a/src/main/ProcessCommandLine.c b/src/main/ProcessCommandLine.c index 8b14f652..97b7a40c 100644 --- a/src/main/ProcessCommandLine.c +++ b/src/main/ProcessCommandLine.c @@ -122,6 +122,7 @@ int CCTKi_ProcessCommandLine(int *inargc, char ***inargv, tFleshConfig *ConfigDa {"error-level", required_argument, NULL, 'E'}, {"parameter-level", required_argument, NULL, 256}, {"redirect", optional_argument, NULL, 'r'}, + {"print-schedule", no_argument, NULL, 'S'}, {"list-thorns", no_argument, NULL, 'T'}, {"test-thorn-compiled", required_argument, NULL, 't'}, {"version", no_argument, NULL, 'v'}, @@ -129,7 +130,7 @@ int CCTKi_ProcessCommandLine(int *inargc, char ***inargv, tFleshConfig *ConfigDa {0, 0, 0, 0} }; - c = getopt_long_only (argc, argv, "hO::o:x::L:W:E:r::Tt:vi", + c = getopt_long_only (argc, argv, "hO::o:x::L:W:E:r::STt:vi", long_options, &option_index); if (c == -1) break; @@ -147,6 +148,7 @@ int CCTKi_ProcessCommandLine(int *inargc, char ***inargv, tFleshConfig *ConfigDa case 'E': CCTKi_CommandLineErrorLevel(optarg); break; case 256: CCTKi_CommandLineParameterLevel(optarg); break; case 'r': CCTKi_CommandLineRedirect(optarg); break; + case 'S': CCTKi_CommandLinePrintSchedule(); break; case 'T': CCTKi_CommandLineListThorns(); break; case 'v': CCTKi_CommandLineVersion(); break; case 'i': ignore = 1; break; diff --git a/src/main/flesh.cc b/src/main/flesh.cc index 27c6cc09..6e839e3a 100644 --- a/src/main/flesh.cc +++ b/src/main/flesh.cc @@ -16,6 +16,7 @@ static const char *rcsid = "$Header$"; CCTK_FILEVERSION(main_flesh_cc); +extern "C" int cctki_onlyprintschedule; /*@@ @routine main @date Fri Sep 18 14:17:37 1998 @@ -56,25 +57,41 @@ int main(int argc, char **argv) { tFleshConfig ConfigData; + + /* Initialise any cactus specific stuff. */ CCTKi_InitialiseCactus(&argc, &argv, &ConfigData); - /* This is a (c-linkage) routine which has been registered by a thorn. + /* Abort if only the schedule tree should be printed. */ - CCTK_Initialise(&ConfigData); + if (cctki_onlyprintschedule) + { + printf ("--------------------------------------------------------------------------------\n"); + printf ("Stopping now because the option '-S' was given.\n"); + printf ("--------------------------------------------------------------------------------\n"); + printf ("Done.\n"); + } + else + { - /* This is a (c-linkage) routine which has been registered by a thorn. - */ - CCTK_Evolve(&ConfigData); + /* This is a (c-linkage) routine which has been registered by a thorn. + */ + CCTK_Initialise(&ConfigData); - /* This is a (c-linkage) routine which has been registered by a thorn. - */ - CCTK_Shutdown(&ConfigData); + /* This is a (c-linkage) routine which has been registered by a thorn. + */ + CCTK_Evolve(&ConfigData); - /* Shut down any cactus specific stuff. - */ - CCTKi_ShutdownCactus(&ConfigData); + /* This is a (c-linkage) routine which has been registered by a thorn. + */ + CCTK_Shutdown(&ConfigData); + + /* Shut down any cactus specific stuff. + */ + CCTKi_ShutdownCactus(&ConfigData); + + } return 0; } |