diff options
Diffstat (limited to 'src/Startup.c')
-rw-r--r-- | src/Startup.c | 144 |
1 files changed, 75 insertions, 69 deletions
diff --git a/src/Startup.c b/src/Startup.c index 7101634..3ac52ea 100644 --- a/src/Startup.c +++ b/src/Startup.c @@ -123,7 +123,6 @@ static void *IOBasic_SetupGH (tFleshConfig *config, int conv_level, cGH *GH) int i; iobasicGH *myGH; const char *my_out_dir; - char dirname[1000]; DECLARE_CCTK_PARAMETERS @@ -134,85 +133,92 @@ static void *IOBasic_SetupGH (tFleshConfig *config, int conv_level, cGH *GH) /* allocate the GH extension and its components */ myGH = malloc (sizeof (iobasicGH)); - if (myGH) + if (! myGH) { - /* Register the IOBasic routines as output methods */ - i = CCTK_RegisterIOMethod ("Scalar"); - CCTK_RegisterIOMethodOutputGH (i, IOBasic_ScalarOutputGH); - CCTK_RegisterIOMethodOutputVarAs (i, IOBasic_OutputVarAs); - CCTK_RegisterIOMethodTimeToOutput (i, IOBasic_TimeForScalarOutput); - CCTK_RegisterIOMethodTriggerOutput (i, IOBasic_TriggerScalarOutput); - - i = CCTK_RegisterIOMethod ("Info"); - CCTK_RegisterIOMethodOutputGH (i, IOBasic_InfoOutputGH); - CCTK_RegisterIOMethodTimeToOutput (i, IOBasic_TimeForInfoOutput); - CCTK_RegisterIOMethodTriggerOutput (i, IOBasic_TriggerInfoOutput); - - if (! CCTK_Equals (verbose, "none")) - { - CCTK_INFO ("I/O Method 'Scalar' registered"); - CCTK_INFO ("Scalar: Output of scalar quantities (grid scalars, " - "reductions) to ASCII files"); - CCTK_INFO ("I/O Method 'Info' registered"); - CCTK_INFO ("Info: Output of scalar quantities (grid scalars, " - "reductions) to screen"); - } + return (NULL); + } - i = CCTK_NumVars (); + /* Register the IOBasic routines as output methods */ + i = CCTK_RegisterIOMethod ("Scalar"); + CCTK_RegisterIOMethodOutputGH (i, IOBasic_ScalarOutputGH); + CCTK_RegisterIOMethodOutputVarAs (i, IOBasic_OutputVarAs); + CCTK_RegisterIOMethodTimeToOutput (i, IOBasic_TimeForScalarOutput); + CCTK_RegisterIOMethodTriggerOutput (i, IOBasic_TriggerScalarOutput); - myGH->info_reductions = calloc (2 * i, sizeof (iobasic_reductionlist_t)); - myGH->scalar_reductions = myGH->info_reductions + i; - myGH->outInfo_last = malloc (2 * i * sizeof (int)); - myGH->outScalar_last = myGH->outInfo_last + i; + i = CCTK_RegisterIOMethod ("Info"); + CCTK_RegisterIOMethodOutputGH (i, IOBasic_InfoOutputGH); + CCTK_RegisterIOMethodTimeToOutput (i, IOBasic_TimeForInfoOutput); + CCTK_RegisterIOMethodTriggerOutput (i, IOBasic_TriggerInfoOutput); - /* initialize counters for how often to do output with a value different - to the current parameter values - this forces info output about periodic output */ - myGH->outInfo_every = outInfo_every >= 0 ? outInfo_every : out_every; - myGH->outScalar_every = outScalar_every >= 0 ? outScalar_every : out_every; - myGH->outInfo_dt = outInfo_dt >= 0 ? outInfo_dt : out_dt; - myGH->outScalar_dt = outScalar_dt >= 0 ? outScalar_dt : out_dt; + i = CCTK_NumVars (); - memset (myGH->outInfo_last, -1, 2 * i * sizeof (int)); + myGH->info_reductions = calloc (2 * i, sizeof (iobasic_reductionlist_t)); + myGH->scalar_reductions = myGH->info_reductions + i; + myGH->outInfo_last = malloc (2 * i * sizeof (int)); + myGH->outScalar_last = myGH->outInfo_last + i; - myGH->filenameListScalar = NULL; + /* initialize counters for how often to do output with a value different + to the current parameter values + this forces info output about periodic output */ + myGH->outInfo_every = outInfo_every >= 0 ? outInfo_every : out_every; + myGH->outScalar_every = outScalar_every >= 0 ? outScalar_every : out_every; + myGH->outInfo_dt = outInfo_dt >= 0 ? outInfo_dt : out_dt; + myGH->outScalar_dt = outScalar_dt >= 0 ? outScalar_dt : out_dt; - /* get the name of IOBasic's output directory */ - my_out_dir = out_dir; - if (*my_out_dir == 0) - { - my_out_dir = io_out_dir; - } + memset (myGH->outInfo_last, -1, 2 * i * sizeof (int)); - /* skip the directory pathname if output goes into current directory */ - if (strcmp (my_out_dir, ".")) - { - i = strlen (my_out_dir); - myGH->out_dir = malloc (i + 2); - strcpy (myGH->out_dir, my_out_dir); - myGH->out_dir[i] = '/'; - myGH->out_dir[i+1] = 0; - } - else + myGH->filenameListScalar = NULL; + + myGH->stop_on_parse_errors = strict_io_parameter_check; + if (! CCTK_Equals (verbose, "none")) + { + CCTK_INFO ("I/O Method 'Scalar' registered: output of scalar quantities " + "(grid scalars, reductions) to ASCII files"); + } + IOBasic_CheckSteerableInfoParameters (myGH); + if (! CCTK_Equals (verbose, "none")) + { + CCTK_INFO ("I/O Method 'Info' registered: output of scalar quantities " + "(grid scalars, reductions) to screen"); + } + IOBasic_CheckSteerableInfoParameters (myGH); + myGH->stop_on_parse_errors = 0; + + /* get the name of IOBasic's output directory */ + my_out_dir = out_dir; + if (*my_out_dir == 0) + { + my_out_dir = io_out_dir; + } + + /* skip the directory pathname if output goes into current directory */ + if (strcmp (my_out_dir, ".")) + { + i = strlen (my_out_dir); + myGH->out_dir = malloc (i + 2); + strcpy (myGH->out_dir, my_out_dir); + myGH->out_dir[i] = '/'; + myGH->out_dir[i+1] = 0; + } + else + { + myGH->out_dir = strdup (""); + } + + /* create the output dir */ + if (*myGH->out_dir && CCTK_MyProc (GH) == 0) + { + i = IOUtil_CreateDirectory (GH, myGH->out_dir, 0, 0); + if (i < 0) { - myGH->out_dir = strdup (""); + CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, + "IOBasic_SetupGH: Couldn't create Scalar output directory " + "'%s'", myGH->out_dir); } - - /* create the output dir */ - if (*myGH->out_dir && CCTK_MyProc (GH) == 0) + else if (i >= 0 && CCTK_Equals (verbose, "full")) { - i = IOUtil_CreateDirectory (GH, myGH->out_dir, 0, 0); - if (i < 0) - { - CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, - "IOBasic_SetupGH: Couldn't create Scalar output directory " - "'%s'", myGH->out_dir); - } - else if (i >= 0 && CCTK_Equals (verbose, "full")) - { - CCTK_VInfo (CCTK_THORNSTRING, "Scalar: Output to directory '%s'", - myGH->out_dir); - } + CCTK_VInfo (CCTK_THORNSTRING, "Scalar: Output to directory '%s'", + myGH->out_dir); } } |