aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetIOASCII
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@cct.lsu.edu>2006-06-18 20:01:00 +0000
committerErik Schnetter <schnetter@cct.lsu.edu>2006-06-18 20:01:00 +0000
commit162979c6322c71093aa2ada4a84c2af2037ea2fb (patch)
tree8e4ee95ef27a58da68867526bc79a0d02754f4a6 /Carpet/CarpetIOASCII
parent5dc579f15d0a7c745507d217df42431ddc8d322a (diff)
CarpetIOASCII: Correct handling of the last output iteration
When CarpetIOASCII::one_file_per_group=yes, store the last output iteration per group instead of per variable. darcs-hash:20060618200108-dae7b-85af2a059fab5d8756f0385cf6029b428a22d441.gz
Diffstat (limited to 'Carpet/CarpetIOASCII')
-rw-r--r--Carpet/CarpetIOASCII/src/ioascii.cc18
1 files changed, 15 insertions, 3 deletions
diff --git a/Carpet/CarpetIOASCII/src/ioascii.cc b/Carpet/CarpetIOASCII/src/ioascii.cc
index fb008e8f8..2c5398aa5 100644
--- a/Carpet/CarpetIOASCII/src/ioascii.cc
+++ b/Carpet/CarpetIOASCII/src/ioascii.cc
@@ -409,17 +409,23 @@ namespace CarpetIOASCII {
typedef std::map<string, vector<vector<vector<int> > > > filelist;
static filelist created_files;
string basefilename (my_out_dir);
+ basefilename.append ("/");
basefilename.append (alias);
filelist::iterator thisfile = created_files.find (basefilename);
bool is_new_file = thisfile == created_files.end();
if (is_new_file) {
- int const numvars = CCTK_NumVars ();
+ int numelems;
+ if (one_file_per_group) {
+ numelems = CCTK_NumGroups ();
+ } else {
+ numelems = CCTK_NumVars ();
+ }
vector<vector<vector<int> > > last_outputs; // [ml][rl][var]
last_outputs.resize (mglevels);
for (int ml = 0; ml < mglevels; ++ml) {
last_outputs[ml].resize (maxreflevels);
for (int rl = 0; rl < maxreflevels; ++rl) {
- last_outputs[ml][rl].resize (numvars, cctk_iteration - 1);
+ last_outputs[ml][rl].resize (numelems, cctk_iteration - 1);
}
}
thisfile = created_files.insert (thisfile,
@@ -430,7 +436,13 @@ namespace CarpetIOASCII {
is_new_file &= IO_TruncateOutputFiles (cctkGH);
// check if this variable has been output already during this iteration
- int& last_output = thisfile->second.at(mglevel).at(reflevel).at(vindex);
+ int elem;
+ if (one_file_per_group) {
+ elem = CCTK_GroupIndexFromVarI (vindex);
+ } else {
+ elem = vindex;
+ }
+ int& last_output = thisfile->second.at(mglevel).at(reflevel).at(elem);
if (last_output == cctk_iteration) {
// Has already been output during this iteration
char* varname = CCTK_FullName (vindex);