- changed status to open
- removed comment
Incorrect header info for 2d CarpetIOASCII when "compact_format=yes"
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.
Keyword:
Comments (5)
-
-
- removed comment
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.
-
- removed comment
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. The attached patch was also updated and now produces the desired output with the simpler code Erik suggested.
-
- changed status to open
- removed comment
This patch looks good; please apply. Please add a test case as well.
-
- changed status to resolved
- removed 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.
- Log in to comment