aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortradke <tradke@b32723a9-ab3a-4a60-88e2-2e5d99d7c17a>2009-04-21 00:35:29 +0000
committertradke <tradke@b32723a9-ab3a-4a60-88e2-2e5d99d7c17a>2009-04-21 00:35:29 +0000
commit4505ff65b06407757e1c547a91e83226f7b4c1b2 (patch)
tree21c19f41ebfbd6db9e453939bbf8457b85836822
parentb2325387b5498d65b911399fac7563ccd7b3ed9d (diff)
extend IOUtil_ParseVarsForOutput() to parse an options string for a list of
reductions (to be used in scalar output methods) This applies patch http://www.cactuscode.org/old/pipermail/patches/2009-April/000259.html. git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOUtil/trunk@269 b32723a9-ab3a-4a60-88e2-2e5d99d7c17a
-rw-r--r--src/Utils.c26
-rw-r--r--src/ioutil_Utils.h3
2 files changed, 29 insertions, 0 deletions
diff --git a/src/Utils.c b/src/Utils.c
index dfb3a8c..23ebba8 100644
--- a/src/Utils.c
+++ b/src/Utils.c
@@ -151,6 +151,7 @@ void IOUtil_ParseVarsForOutput (const cGH *GH, const char *method_name,
@@*/
void IOUtil_FreeIORequest (ioRequest **request)
{
+ free ((*request)->reductions);
free ((*request)->vectors);
free (*request);
*request = NULL;
@@ -1031,6 +1032,30 @@ static void SetOutputVar (int vindex, const char *optstring, void *arg)
Util_TableDeleteKey (table, "compression_level");
}
+ /* check for option 'reductions' */
+ if (Util_TableQueryValueInfo (table, &type, &nelems,
+ "reductions") > 0)
+ {
+ request->reductions = NULL;
+ if (type == CCTK_VARIABLE_CHAR && nelems >= 0)
+ {
+ request->reductions = malloc (nelems + 1);
+ Util_TableGetString (table, nelems + 1, request->reductions,
+ "reductions");
+ }
+ else
+ {
+ CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Invalid value for option 'reductions' in option "
+ "string '%s' in parameter '%s' (must be a string)",
+ optstring, info->parameter_name);
+ CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Option 'reductions' will be ignored for %s output "
+ "of variable '%s'", info->method_name, fullname);
+ }
+ Util_TableDeleteKey (table, "compression_level");
+ }
+
/* warn about unrecognized options */
iterator = Util_TableItCreate (table);
for (iterator = Util_TableItCreate (table);
@@ -1097,6 +1122,7 @@ ioRequest *IOUtil_DefaultIORequest (const cGH *GH, int vindex,
request->check_exist = myGH->recovered;
request->out_every = out_every_default;
request->out_unchunked = out_unchunked;
+ request->reductions = NULL;
request->with_ghostzones = 0;
request->refinement_levels = -1;
request->compression_level = -1;
diff --git a/src/ioutil_Utils.h b/src/ioutil_Utils.h
index 655ee7d..3840e65 100644
--- a/src/ioutil_Utils.h
+++ b/src/ioutil_Utils.h
@@ -57,6 +57,9 @@ typedef struct
/* bitmask for refinement levels to output */
CCTK_INT refinement_levels;
+ /* list of reductions to output */
+ char *reductions;
+
} ioRequest;