aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortradke <tradke@94b1c47f-dcfd-45ef-a468-0854c0e9e350>2004-06-10 16:40:47 +0000
committertradke <tradke@94b1c47f-dcfd-45ef-a468-0854c0e9e350>2004-06-10 16:40:47 +0000
commit98bc87067e54f21301d12619588c271488edd412 (patch)
treec83c4b2f18fc6af73e7529fb20ac67a524d114d0
parentf5ed6c2e28e17995f9a69ee24a33ee81ddc44065 (diff)
Implement downsampling for IOASCII output.
Set IO::out_downsample_[xyz] to change to default of no downsampling. git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOASCII/trunk@182 94b1c47f-dcfd-45ef-a468-0854c0e9e350
-rw-r--r--src/Write1D.c9
-rw-r--r--src/Write2D.c8
-rw-r--r--src/Write3D.c8
3 files changed, 20 insertions, 5 deletions
diff --git a/src/Write1D.c b/src/Write1D.c
index 8ab3057..d40cb79 100644
--- a/src/Write1D.c
+++ b/src/Write1D.c
@@ -142,6 +142,7 @@ int IOASCII_Write1D (const cGH *GH, int vindex, const char *alias)
FILE *file[8];
CCTK_REAL offset;
CCTK_REAL coord_lower[3];
+ CCTK_INT downsample[3];
CCTK_INT *origin, *direction;
CCTK_INT hsize, extent;
CCTK_INT vindices[2];
@@ -263,6 +264,12 @@ int IOASCII_Write1D (const cGH *GH, int vindex, const char *alias)
direction = origin + gdata.dim;
extent_int = malloc ((gdata.dim + 1) * sizeof (int));
+ /* set downsampling vector from I/O parameters */
+ downsample[0] = out_downsample_x;
+ downsample[1] = out_downsample_y;
+ downsample[2] = out_downsample_z;
+ downsample[3] = 1;
+
/* get the variable's extents, compute the extent for 3D-diagonals as the
minimum of grid points in each direction */
CCTK_GroupgshVI (GH, gdata.dim, extent_int, vindex);
@@ -330,7 +337,7 @@ int IOASCII_Write1D (const cGH *GH, int vindex, const char *alias)
mapping = Hyperslab_GlobalMappingByIndex (GH, vindex, 1,
direction, origin, &extent,
- NULL, /* downsample */
+ &downsample[dir],
-1, /* table handle */
NULL /* conversion fn */,
&hsize);
diff --git a/src/Write2D.c b/src/Write2D.c
index 4c7db4d..5ddb038 100644
--- a/src/Write2D.c
+++ b/src/Write2D.c
@@ -142,7 +142,8 @@ int IOASCII_Write2D (const cGH *GH, int vindex, const char *alias)
char *fullname, *groupname;
int extent_int[3];
CCTK_REAL offset[2];
- CCTK_INT vindices[3], origin[3], extent[2], direction[6], hsize[2];
+ CCTK_INT vindices[3], origin[3], extent[2], direction[6], downsample[2],
+ hsize[2];
void *hdata[3];
FILE **fileset;
DECLARE_CCTK_PARAMETERS
@@ -248,14 +249,17 @@ int IOASCII_Write2D (const cGH *GH, int vindex, const char *alias)
if (dir == 0)
{
dir_i = 0; dir_j = 1; /* xy */
+ downsample[0] = out_downsample_x; downsample[1] = out_downsample_y;
}
else if (dir == 1)
{
dir_i = 0; dir_j = 2; /* xz */
+ downsample[0] = out_downsample_x; downsample[1] = out_downsample_z;
}
else
{
dir_i = 1; dir_j = 2; /* yz */
+ downsample[0] = out_downsample_y; downsample[1] = out_downsample_z;
}
/* set the extent vector */
@@ -275,7 +279,7 @@ int IOASCII_Write2D (const cGH *GH, int vindex, const char *alias)
mapping = Hyperslab_GlobalMappingByIndex (GH, vindex, 2,
direction, origin, extent,
- NULL, /* downsample */
+ downsample,
-1, /* table handle */
NULL /* conversion fn */,
hsize);
diff --git a/src/Write3D.c b/src/Write3D.c
index 56fb233..4a6bab7 100644
--- a/src/Write3D.c
+++ b/src/Write3D.c
@@ -137,7 +137,7 @@ int IOASCII_Write3D (const cGH *GH, int vindex, const char *alias)
int extent_int[3];
CCTK_REAL offset[3];
int mapping;
- CCTK_INT vindices[4], extent[3], hsize[3];
+ CCTK_INT vindices[4], extent[3], downsample[3], hsize[3];
const CCTK_INT origin[] = {0, 0, 0},
direction[] = {1, 0, 0, 0, 1, 0, 0, 0, 1};
DECLARE_CCTK_PARAMETERS
@@ -227,10 +227,14 @@ int IOASCII_Write3D (const cGH *GH, int vindex, const char *alias)
extent[i] = extent_int[i];
}
+ downsample[0] = out_downsample_x;
+ downsample[1] = out_downsample_y;
+ downsample[2] = out_downsample_z;
+
/* get the hyperslab mapping */
mapping = Hyperslab_GlobalMappingByIndex (GH, vindex, 3,
direction, origin, extent,
- NULL, /* downsample */
+ downsample,
-1, /* table handle */
NULL /* conversion fn */,
hsize);