diff options
author | schnetter <schnetter@94b1c47f-dcfd-45ef-a468-0854c0e9e350> | 2004-01-16 13:57:45 +0000 |
---|---|---|
committer | schnetter <schnetter@94b1c47f-dcfd-45ef-a468-0854c0e9e350> | 2004-01-16 13:57:45 +0000 |
commit | 27de9af3380fae70b2485a842ca88e4512cc3ef5 (patch) | |
tree | 42b870a7c48e7fd39e2f3517ea497a48f4ba1df7 | |
parent | 4aaf8c3cd053be460491b27dba7a4d2ce1cb4f57 (diff) |
Fix wrong order of coordinate or gridpoint indices in 2D ASCII output,
but keep the normal of the surface pointing upwards, so that gnuplot
colours it correctly.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOASCII/trunk@156 94b1c47f-dcfd-45ef-a468-0854c0e9e350
-rw-r--r-- | src/Write2D.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/Write2D.c b/src/Write2D.c index ee1f1bb..cf3fe35 100644 --- a/src/Write2D.c +++ b/src/Write2D.c @@ -35,33 +35,38 @@ CCTK_FILEVERSION(CactusBase_IOASCII_Write2D_c) int _i, _j; \ const cctk_type *_hdata = hdata[0]; \ const CCTK_REAL *_coord[2]; \ - \ + const int _dic = hsize[0]; \ + const int _did = hsize[0] * (is_complex ? 2 : 1); \ \ \ _coord[0] = (const CCTK_REAL *) hdata[1]; \ _coord[1] = (const CCTK_REAL *) hdata[2]; \ - for (_j = 0; _j < hsize[1]; _j++) \ + for (_i = 0; _i < hsize[0]; _i++) \ { \ - for (_i = 0; _i < hsize[0]; _i++) \ + for (_j = 0; _j < hsize[1]; _j++) \ { \ if (_coord[0]) \ { \ - fprintf (file, fmt, (double) *_coord[1]++, \ - (double) *_coord[0]++, (c_type) *_hdata++); \ + fprintf (file, fmt, (double) _coord[0][_i+_dic*_j], \ + (double) _coord[1][_i+_dic*_j], \ + (c_type) _hdata[_i+_did*_j]); \ } \ else \ { \ - fprintf (file, fmt, _j, _i, (c_type) *_hdata++); \ + fprintf (file, fmt, _i, _j, (c_type) _hdata[_i+_did*_j]); \ } \ \ if (is_complex) \ { \ - fprintf (file, format[2], (c_type) *_hdata++); \ + fprintf (file, format[2], (c_type) _hdata[_i+1+_did*_j]); \ } \ fputc ('\n', file); \ } \ fputc ('\n', file); \ } \ + _coord[0] += _dic*_j; \ + _coord[1] += _dic*_j; \ + _hdata += _did*_j; \ } |