#1118: Incorrect header info for 2d CarpetIOASCII when "compact_format=yes" ----------------------------------------+----------------------------------- Reporter: reisswig@… | Owner: eschnett Type: defect | Status: new Priority: minor | Milestone: Component: Carpet | Version: Keywords: | ----------------------------------------+----------------------------------- I am outputting a 2d array using 2d CarpetIOASCII output. I use CarpetIOASCII::compact_format = yes. The header incorrectly reports that the data starts in column 7. The data really starts in column 5. The header reports that there are x and y coordinates present, which is not the case for 2d arrays, which then presumedly leads to the incorrect column counting.
#1118: Incorrect header info for 2d CarpetIOASCII when "compact_format=yes" -----------------------------------------+---------------------------------- Reporter: reisswig@… | Owner: eschnett Type: defect | Status: review Priority: minor | Milestone: Component: Carpet | Version: Resolution: | Keywords: -----------------------------------------+---------------------------------- Changes (by rhaas):
* status: new => review
#1118: Incorrect header info for 2d CarpetIOASCII when "compact_format=yes" -----------------------------------------+---------------------------------- Reporter: reisswig@… | Owner: eschnett Type: defect | Status: review Priority: minor | Milestone: Component: Carpet | Version: Resolution: | Keywords: -----------------------------------------+----------------------------------
Comment (by eschnett):
Can you try this patch instead? {{{ diff --git a/Carpet/CarpetIOASCII/src/ioascii.cc b/Carpet/CarpetIOASCII/src/ioas index 0a966d5..74557e5 100644 --- a/Carpet/CarpetIOASCII/src/ioascii.cc +++ b/Carpet/CarpetIOASCII/src/ioascii.cc @@ -1377,7 +1377,7 @@ namespace CarpetIOASCII { } } os << "\t" << col++ << ":time"; - if (not compact_format) { + if (not compact_format or grouptype == CCTK_GF) { for (int d=0; d<dim; ++d) { os << (d==0 ? "\t" : " ") << col++ << ":" << coords[d]; } }}}
It is simpler, and uses the same logic while outputting headers as when outputting the coordinates.
The check dim vs. groupdim is not necessary since CCTK_GF always have dim dimensions.
#1118: Incorrect header info for 2d CarpetIOASCII when "compact_format=yes" -----------------------------------------+---------------------------------- Reporter: reisswig@… | Owner: eschnett Type: defect | Status: review Priority: minor | Milestone: Component: Carpet | Version: Resolution: | Keywords: -----------------------------------------+----------------------------------
Comment (by rhaas):
I always liked simpler logic. In particular in IOASCII.cc where the nested if statements are becoming a nuisance. I ended up removing the "else" clasue after the if in line 1377 (ie. the on Erik modified). Otherwise the code finds (for compact_format=yes but grouptype == CCTK_ARRAY) that it will enter the else clause and output coordinates after all. I also attach the (modifed InterpToArray) test file that I had used for the tests.
#1118: Incorrect header info for 2d CarpetIOASCII when "compact_format=yes" -----------------------------------------+---------------------------------- Reporter: reisswig@… | Owner: eschnett Type: defect | Status: reviewed_ok Priority: minor | Milestone: Component: Carpet | Version: Resolution: | Keywords: -----------------------------------------+---------------------------------- Changes (by eschnett):
* status: review => reviewed_ok
Comment:
This patch looks good; please apply. Please add a test case as well.
#1118: Incorrect header info for 2d CarpetIOASCII when "compact_format=yes" -----------------------------------------+---------------------------------- Reporter: reisswig@… | Owner: eschnett Type: defect | Status: closed Priority: minor | Milestone: Component: Carpet | Version: Resolution: fixed | Keywords: -----------------------------------------+---------------------------------- Changes (by rhaas):
* status: reviewed_ok => closed * resolution: => fixed
Comment:
The tests in CarpetIOASCII already test this I think. The only problem is that the test system ignores the comments that make up the header (as well as normally tests not including headers since IO::out_fileinfo = "none"). Applied as hash ab044d454ede8dccb94235d8a5c36369cc6c61d3 "CarpetIOASCII: do not output coordinate column labels for grid arrays in" of Carpet.
trac@lists.einsteintoolkit.org