Skip to content

Commit 79c415b

Browse files
committed
add fix_end, end offset of last fix-sized variable
1 parent cca757d commit 79c415b

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

src/drivers/ncmpio/ncmpio_NC.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,6 @@ struct NC {
391391
int chunk; /* chunk size for reading header, one chunk at a time */
392392
MPI_Offset v_align; /* alignment of the beginning of fixed-size variables */
393393
MPI_Offset r_align; /* file alignment for record variable section */
394-
MPI_Offset env_v_align; /* v_align set in environment variable */
395-
MPI_Offset env_r_align; /* r_align set in environment variable */
396394
MPI_Offset info_v_align;/* v_align set in MPI Info object */
397395
MPI_Offset info_r_align;/* r_align set in MPI Info object */
398396
MPI_Offset h_minfree; /* pad at the end of the header section */
@@ -406,6 +404,7 @@ struct NC {
406404
the size of file header extent. */
407405
MPI_Offset begin_rec; /* file offset of the first 'record' */
408406

407+
MPI_Offset fix_end; /* end offset of last fix-sized variable */
409408
MPI_Offset recsize; /* length of 'record': sum of single record sizes
410409
of all the record variables */
411410
MPI_Offset numrecs; /* no. 'records' allocated */

src/drivers/ncmpio/ncmpio_header_get.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
static int
3535
compute_var_shape(NC *ncp)
3636
{
37-
int i, err;
37+
int i, err, last_fix;
3838
NC_var *first_var = NULL; /* first "non-record" var */
3939
NC_var *first_rec = NULL; /* first "record" var */
4040

@@ -44,6 +44,7 @@ compute_var_shape(NC *ncp)
4444
ncp->begin_rec = ncp->xsz;
4545
ncp->recsize = 0;
4646

47+
last_fix = -1;
4748
for (i=0; i<ncp->vars.ndefined; i++) {
4849
/* ncp->vars.value[i]->len will be recomputed from dimensions in
4950
* ncmpio_NC_var_shape64() */
@@ -62,8 +63,14 @@ compute_var_shape(NC *ncp)
6263
*/
6364
ncp->begin_rec = ncp->vars.value[i]->begin
6465
+ ncp->vars.value[i]->len;
66+
last_fix = i;
6567
}
6668
}
69+
if (last_fix >= 0)
70+
ncp->fix_end = ncp->vars.value[last_fix]->begin
71+
+ ncp->vars.value[last_fix]->len;
72+
else
73+
ncp->fix_end = ncp->begin_var;
6774

6875
if (first_rec != NULL) {
6976
if (ncp->begin_rec > first_rec->begin)

0 commit comments

Comments
 (0)