aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/GHExtension.c70
1 files changed, 38 insertions, 32 deletions
diff --git a/src/GHExtension.c b/src/GHExtension.c
index 15468ab..0e4c037 100644
--- a/src/GHExtension.c
+++ b/src/GHExtension.c
@@ -97,12 +97,13 @@ int IOUtil_InitGH (cGH *GH)
if (CCTK_CreateDirectory (0755,checkpoint_dir) < 0)
{
CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
- "Problem creating checkpoint directory '%s'", checkpoint_dir);
+ "Problem creating checkpoint directory '%s'",
+ checkpoint_dir);
}
}
}
- if (CCTK_Equals (out3D_mode, "proc"))
+ if (CCTK_Equals (out3D_mode, "proc"))
{
myGH->ioproc = CCTK_MyProc (GH);
myGH->nioprocs = CCTK_nProcs (GH);
@@ -113,8 +114,9 @@ int IOUtil_InitGH (cGH *GH)
if (out3D_procs > CCTK_nProcs (GH))
{
myGH->ioproc_every = CCTK_nProcs (GH);
- printf ("Reducing ioproc_every to %d\n", myGH->ioproc_every);
- }
+ CCTK_VInfo (CCTK_THORNSTRING, "Reducing 'IO::ioproc_every' to %d",
+ myGH->ioproc_every);
+ }
else
{
myGH->ioproc_every = out3D_procs;
@@ -130,10 +132,10 @@ int IOUtil_InitGH (cGH *GH)
myGH->ioproc = 0;
myGH->nioprocs = 1;
myGH->ioproc_every = CCTK_nProcs (GH);
- }
- else
+ }
+ else
{
- printf ("I don't understand out3D_mode setting. Using onefile.\n");
+ CCTK_INFO ("I don't understand 'IO::out3D_mode' setting. Using 'onefile'.");
myGH->ioproc = 0;
myGH->nioprocs = 1;
myGH->ioproc_every = CCTK_nProcs (GH);
@@ -146,10 +148,10 @@ int IOUtil_InitGH (cGH *GH)
{
myGH->unchunked = 1;
}
- else
+ else
{
- printf ("Unchunked output not currently supported for multiple\n");
- printf ("output files. Output will be chunked.\n");
+ CCTK_INFO ("Unchunked output not currently supported for multiple "
+ "output files. Output will be chunked.");
myGH->unchunked = 0;
}
}
@@ -241,7 +243,8 @@ void IOUtil_ParseVarsForOutput (const char *var_list, char do_output [])
splitstring = (char *) var_list;
- while(Util_SplitString(&before,&after,splitstring," ")==0) {
+ while (Util_SplitString(&before, &after, splitstring, " ") == 0)
+ {
#ifdef DEBUG_IO
printf(" String is -%s-\n",splitstring);
@@ -272,11 +275,8 @@ void IOUtil_ParseVarsForOutput (const char *var_list, char do_output [])
groupnum = CCTK_GroupIndex(before);
if (groupnum < 0)
{
- char *msg;
- msg = (char *)malloc((100+strlen(before))*sizeof(char));
- sprintf(msg,"Ignoring <%s> in IO string (invalid token)",before);
- CCTK_WARN(2,msg);
- free(msg);
+ CCTK_VWarn(2, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Ignoring '%s' in IO string (invalid token)", before);
}
else
{
@@ -288,9 +288,9 @@ void IOUtil_ParseVarsForOutput (const char *var_list, char do_output [])
}
}
else
- {
+ {
do_output[varnum] = 1;
- }
+ }
}
}
if(before)
@@ -307,33 +307,41 @@ void IOUtil_ParseVarsForOutput (const char *var_list, char do_output [])
}
- if (strlen(splitstring)>0) {
+ if (strlen(splitstring)>0)
+ {
/* Special cases */
- if (CCTK_Equals(splitstring,"all")) {
+ if (CCTK_Equals(splitstring,"all"))
+ {
int ilab;
for (ilab=0;ilab<CCTK_NumVars();ilab++)
do_output[ilab]=1;
- } else {
+ }
+ else
+ {
varnum = CCTK_VarIndex(splitstring);
- if (varnum < 0) {
+ if (varnum < 0)
+ {
groupnum = CCTK_GroupIndex(splitstring);
- if (groupnum < 0) {
- char *msg;
- msg = (char *)malloc((100+strlen(splitstring))*sizeof(char));
- sprintf(msg,"Ignoring %s in IO string (invalid token)",splitstring);
- CCTK_WARN(2,msg);
- free(msg);
- } else {
+ if (groupnum < 0)
+ {
+ CCTK_VWarn(2, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Ignoring '%s' in IO string (invalid token)", splitstring);
+ }
+ else
+ {
/* We have a group so now need all the variables in the group */
first = CCTK_FirstVarIndexI(groupnum);
last = first+CCTK_NumVarsInGroupI(groupnum)-1;
for (index=first;index<=last;index++)
do_output[index] = 1;
}
- } else
+ }
+ else
+ {
do_output[varnum] = 1;
+ }
}
}
@@ -552,5 +560,3 @@ void IOUtil_PrintTimings (const char *description,
"No timing output available.");
}
}
-
-