aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetIOScalar
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@gmail.com>2013-05-26 15:55:33 -0400
committerErik Schnetter <schnetter@gmail.com>2013-05-26 15:55:33 -0400
commit84e390d73ab7148814b19d4758ff90564c3f1c5d (patch)
tree93cc0c4ef78338a6cf9879016a9a1e6518a237ac /Carpet/CarpetIOScalar
parent9748e3a83336a9ccae73a66481530f8049e8c78d (diff)
CarpetIO*: New parameter CarpetIO*::out_group_separator
out_group_separator chooses the string by which thorn name and group name are separated in file names. The default is "::" for backward compatibility. This parameter only affects output where CarpetIO*::one_file_per_group is set; otherwise, the thorn name does not appear in the file name.
Diffstat (limited to 'Carpet/CarpetIOScalar')
-rw-r--r--Carpet/CarpetIOScalar/param.ccl5
-rw-r--r--Carpet/CarpetIOScalar/src/ioscalar.cc14
-rw-r--r--Carpet/CarpetIOScalar/test/newsep.par32
-rw-r--r--Carpet/CarpetIOScalar/test/newsep/grid.coordinates.scalars.asc8
4 files changed, 55 insertions, 4 deletions
diff --git a/Carpet/CarpetIOScalar/param.ccl b/Carpet/CarpetIOScalar/param.ccl
index dc3ed57e6..a66c73a69 100644
--- a/Carpet/CarpetIOScalar/param.ccl
+++ b/Carpet/CarpetIOScalar/param.ccl
@@ -28,6 +28,11 @@ BOOLEAN all_reductions_in_one_file "Write all requested reductions in one file i
{
} "no"
+STRING out_group_separator "String to separate group from variable name in file name" STEERABLE = ALWAYS
+{
+ "" :: ""
+} "::"
+
CCTK_STRING outScalar_dir "Name of scalar output directory, overrides out_dir" STEERABLE = ALWAYS
diff --git a/Carpet/CarpetIOScalar/src/ioscalar.cc b/Carpet/CarpetIOScalar/src/ioscalar.cc
index cfdf1843b..e9bba4b30 100644
--- a/Carpet/CarpetIOScalar/src/ioscalar.cc
+++ b/Carpet/CarpetIOScalar/src/ioscalar.cc
@@ -719,11 +719,17 @@ namespace CarpetIOScalar {
char* const fullname = CCTK_FullName(vindex);
int const gindex = CCTK_GroupIndexFromVarI(vindex);
- char* const groupname = CCTK_GroupName(gindex);
- for (char* p=groupname; *p; ++p) *p=tolower(*p);
- retval = OutputVarAs (cctkGH, fullname, groupname, out_reductions);
+ char* const groupname_c = CCTK_GroupName(gindex);
+ string groupname(groupname_c);
+ transform
+ (groupname.begin(), groupname.end(), groupname.begin(), ::tolower);
+ string const oldsep ("::");
+ size_t const oldseppos = groupname.find(oldsep);
+ assert (oldseppos != string::npos);
+ groupname.replace(oldseppos, oldsep.size(), out_group_separator);
+ retval =
+ OutputVarAs (cctkGH, fullname, groupname.c_str(), out_reductions);
free (fullname);
- free (groupname);
int const firstvar = CCTK_FirstVarIndexI(gindex);
int const numvars = CCTK_NumVarsInGroupI(gindex);
diff --git a/Carpet/CarpetIOScalar/test/newsep.par b/Carpet/CarpetIOScalar/test/newsep.par
new file mode 100644
index 000000000..cb1cfb495
--- /dev/null
+++ b/Carpet/CarpetIOScalar/test/newsep.par
@@ -0,0 +1,32 @@
+ActiveThorns = "
+ AEILocalInterp
+ Carpet
+ CarpetInterp
+ CarpetIOScalar
+ CarpetLib
+ CarpetReduce
+ CartGrid3D
+ CoordBase
+ IOUtil
+ LoopControl
+ SymBase
+"
+
+IO::out_dir = $parfile
+
+Carpet::global_nx = 7
+Carpet::global_ny = 8
+Carpet::global_nz = 9
+
+Cactus::cctk_itlast = 0
+
+IO::out_every = 1
+IOScalar::one_file_per_group = yes
+IOScalar::out_group_separator = "."
+IOScalar::all_reductions_in_one_file = yes
+
+IOScalar::outScalar_reductions = "average iaverage norm_inf inorm1 inorm2 maximum minimum norm1 norm2"
+
+IOScalar::outScalar_vars = "
+ grid::coordinates
+"
diff --git a/Carpet/CarpetIOScalar/test/newsep/grid.coordinates.scalars.asc b/Carpet/CarpetIOScalar/test/newsep/grid.coordinates.scalars.asc
new file mode 100644
index 000000000..338e4bbcc
--- /dev/null
+++ b/Carpet/CarpetIOScalar/test/newsep/grid.coordinates.scalars.asc
@@ -0,0 +1,8 @@
+# Scalar ASCII output created by CarpetIOScalar
+# created on horizon.tapir.caltech.edu by rhaas on May 10 2012 at 17:21:06-0700
+# parameter filename: "coords4.par"
+#
+# GRID::x (grid::coordinates)
+# 1:iteration 2:time 3:data
+# data columns: 3:x(average) 4:y(average) 5:z(average) 6:r(average) 7:x(iaverage) 8:y(iaverage) 9:z(iaverage) 10:r(iaverage) 11:x(norm_inf) 12:y(norm_inf) 13:z(norm_inf) 14:r(norm_inf) 15:x(inorm1) 16:y(inorm1) 17:z(inorm1) 18:r(inorm1) 19:x(inorm2) 20:y(inorm2) 21:z(inorm2) 22:r(inorm2) 23:x(maximum) 24:y(maximum) 25:z(maximum) 26:r(maximum) 27:x(minimum) 28:y(minimum) 29:z(minimum) 30:r(minimum) 31:x(norm1) 32:y(norm1) 33:z(norm1) 34:r(norm1) 35:x(norm2) 36:y(norm2) 37:z(norm2) 38:r(norm2)
+0 0 -3.62639812358961e-17 1.65211759616839e-18 0 0.488709669281446 -3.62639812358961e-17 1.65211759616839e-18 0 0.488709669281446 0.5 0.5 0.5 0.866025403784439 0.25 0.255102040816327 0.25 0.488709669281446 0.29658550700087 0.294507544686975 0.293150984988964 0.510524393972035 0.5 0.5 0.5 0.866025403784439 -0.5 -0.5 -0.5 0.0714285714285714 0.25 0.255102040816327 0.25 0.488709669281446 0.29658550700087 0.294507544686975 0.293150984988964 0.510524393972035