From 86c3a6fd8b989ba41cea2f4884780379a7816851 Mon Sep 17 00:00:00 2001 From: tradke Date: Wed, 5 Oct 2005 10:08:31 +0000 Subject: The general routine to parse the value of IO*::out_vars parameters now also checks for the option "out_unchunked = 'true|false|yes|no'" which can be used to overwrite the general output mode (as defined by IO::out_unchunked) on a per-variable basis. git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOUtil/trunk@230 b32723a9-ab3a-4a60-88e2-2e5d99d7c17a --- doc/documentation.tex | 3 +++ src/Utils.c | 36 ++++++++++++++++++++++++++++++++++++ src/ioutil_Utils.h | 3 +++ 3 files changed, 42 insertions(+) diff --git a/doc/documentation.tex b/doc/documentation.tex index 090142a..1e890aa 100644 --- a/doc/documentation.tex +++ b/doc/documentation.tex @@ -233,6 +233,9 @@ your particular machine architecture and needs: "no"}) with each chunk containing the data from a single processor, or collected into a single global array before writing ({\tt IO::out\_unchunked = "yes"}). The default is to write the data in chunks. + This can be changed by adding an option string to the group/variable name(s) + in the {\tt out\_vars} parameter with the key {\tt out\_unchunked} and an + associated string value {\tt "yes|no|true|false"}. \item {\tt IO::out\_mode = "np"}\\ Output is written in parallel for groups of processors. Each group diff --git a/src/Utils.c b/src/Utils.c index 38e7e94..d1def3d 100644 --- a/src/Utils.c +++ b/src/Utils.c @@ -828,6 +828,41 @@ static void SetOutputVar (int vindex, const char *optstring, void *arg) Util_TableDeleteKey (table, "out_every"); } + /* check for boolean option 'out_unchunked' */ + if (Util_TableQueryValueInfo (table, &type, &nelems, "out_unchunked") > 0) + { + int unchunked = -1; + if (type == CCTK_VARIABLE_CHAR && + nelems >= sizeof ("no")-1 && nelems <= sizeof ("false")-1) + { + char value[sizeof ("false")]; + Util_TableGetString (table, sizeof (value), value, "out_unchunked"); + if (CCTK_Equals (value, "yes") || CCTK_Equals (value, "true")) + { + unchunked = 1; + } + else if (CCTK_Equals (value, "no") || CCTK_Equals (value, "false")) + { + unchunked = 0; + } + } + if (unchunked >= 0) + { + request->out_unchunked = unchunked; + } + else + { + CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, + "Invalid value for option 'out_unchunked' in option string " + "'%s' in parameter '%s' (must be a boolean)", + optstring, info->parameter_name); + CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, + "Option 'out_unchunked' will be ignored for %s output of " + "variable '%s'", info->method_name, fullname); + } + Util_TableDeleteKey (table, "out_unchunked"); + } + /* check for hyperslab option 'direction' */ if (Util_TableQueryValueInfo (table, &type, &nelems, "direction") > 0) { @@ -1025,6 +1060,7 @@ ioRequest *IOUtil_DefaultIORequest (const cGH *GH, int vindex, request->timelevel = 0; request->check_exist = myGH->recovered; request->out_every = out_every_default; + request->out_unchunked = out_unchunked; request->with_ghostzones = 0; request->refinement_levels = -1; diff --git a/src/ioutil_Utils.h b/src/ioutil_Utils.h index 32341e3..cee81d8 100644 --- a/src/ioutil_Utils.h +++ b/src/ioutil_Utils.h @@ -39,6 +39,9 @@ typedef struct /* flag indicating whether to include ghostzones in the hyperslab mapping */ int with_ghostzones; + /* flag indicating whether to output in chunked or unchunked format */ + int out_unchunked; + /* pointer to allocated buffers */ CCTK_INT *vectors; -- cgit v1.2.3