changeset 2483:b0b03c7c5f9f

better utilization of buffer for input/output
author claude <claude>
date Thu, 30 Apr 2009 00:54:12 +0000
parents 6472274b5fc0
children 86661ee06d3a
files volume_io/Volumes/input_mnc.c volume_io/Volumes/output_mnc.c
diffstat 2 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/volume_io/Volumes/input_mnc.c
+++ b/volume_io/Volumes/input_mnc.c
@@ -582,7 +582,9 @@
 
     ncopts = NC_VERBOSE | NC_FATAL;
 
-    /* --- decide how many dimensions to read in at a time */
+    /* --- decide how many full dimensions to read in at a time 
+       to max out the read/write buffer and make it like the 
+       chunking dimensions for compression */
 
     file->n_slab_dims = 0;
     slab_size = 1;
@@ -592,7 +594,7 @@
       if( file->to_volume_index[d] != INVALID_AXIS ) {
         if( MI_MAX_VAR_BUFFER_SIZE > file->sizes_in_file[d] * slab_size * unit_size ) {
           slab_size *= file->sizes_in_file[d];
-          ++file->n_slab_dims;  // number of complete dimensions
+          file->n_slab_dims++;  /* integral number of complete dimensions */
         } else {
           slab_size *= MIN( file->sizes_in_file[d],
                             (hsize_t)( MI_MAX_VAR_BUFFER_SIZE / ( slab_size * unit_size ) ) );
--- a/volume_io/Volumes/output_mnc.c
+++ b/volume_io/Volumes/output_mnc.c
@@ -1411,7 +1411,9 @@
         FREE( image_range );
     }
 
-    /*--- determine which contiguous blocks of volume to output */
+    /* --- determine which contiguous blocks of volume to output
+       to max out the read/write buffer and make it like the
+       chunking dimensions for compression (for efficiency) */
 
     file->n_slab_dims = 0;
     slab_size = 1;
@@ -1424,7 +1426,7 @@
       if( to_volume_index[d] != INVALID_AXIS ) {
         if( MI_MAX_VAR_BUFFER_SIZE > volume_count[to_volume_index[d]] * slab_size * unit_size ) {
           count[d] = volume_count[to_volume_index[d]];
-          ++file->n_slab_dims;  // number of complete dimensions
+          file->n_slab_dims++;  /* integral number of complete dimensions */
         } else {
           count[d] = MIN( volume_count[to_volume_index[d]], 
                           (hsize_t)( MI_MAX_VAR_BUFFER_SIZE / ( slab_size * unit_size ) ) );
@@ -1449,7 +1451,7 @@
     increment = FALSE;
     while( !increment ) {
 
-        /*--- set the indices of the file array to write */
+        /*--- set the indices of the file slab to write */
 
         long local_count[MAX_VAR_DIMS];
         for( d = 0; d < file->n_file_dimensions; d++ ) {
@@ -1460,7 +1462,7 @@
         output_slab( file, volume, to_volume_index, file_indices, local_count );
 
         /*--- increment the file index dimensions which correspond
-              to volume dimensions not output */
+              for the next slab to write to output */
 
         increment = TRUE;