From d1ada666c67f416bbdc56a4d60937d862e1f5472 Mon Sep 17 00:00:00 2001 From: q-posev Date: Thu, 25 May 2023 18:20:00 +0200 Subject: [PATCH] Fix bug in trexio_flush [Python API] --- src/templates_front/templator_front.org | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/templates_front/templator_front.org b/src/templates_front/templator_front.org index c3f692f..dacd19a 100644 --- a/src/templates_front/templator_front.org +++ b/src/templates_front/templator_front.org @@ -853,6 +853,14 @@ class File: return self.state + + def flush(self): + """Flush the data on disk.""" + rc = pytr.trexio_flush(self.pytrexio_s) + if rc != TREXIO_SUCCESS: + raise Error(rc) + + def inquire(self): """Inquire whether a TREXIO file exists.""" self.exists = _inquire(self.filename) @@ -1506,7 +1514,7 @@ def flush(trexio_file): Parameter is a ~trexio_file~ object that has been created by a call to ~open~ function. """ - rc = pytr.trexio_flush(trexio_file) + rc = pytr.trexio_flush(trexio_file.pytrexio_s) if rc != TREXIO_SUCCESS: raise Error(rc) #+end_src @@ -2139,7 +2147,7 @@ trexio_read_$group_num$_64 (trexio_t* const file, $group_num_dtype_double$* cons if (trexio_has_$group_num$(file) != TREXIO_SUCCESS) return TREXIO_ATTR_MISSING; trexio_exit_code rc = TREXIO_GROUP_READ_ERROR; - + switch (file->back_end) { case TREXIO_TEXT: @@ -3370,7 +3378,7 @@ trexio_read_$group_dset$(trexio_t* const file, /* Find the maximal value along all dimensions to define the compression technique in the back end */ int64_t max_dim = unique_dims[0]; -#if (unique_rank != 1) +#if (unique_rank != 1) for (uint32_t i = 1; i < unique_rank; i++) { if (unique_dims[i] > max_dim) max_dim = unique_dims[i]; } @@ -3503,7 +3511,7 @@ trexio_write_$group_dset$(trexio_t* const file, /* Find the maximal value along all dimensions to define the compression technique in the back end */ int64_t max_dim = unique_dims[0]; -#if (unique_rank != 1) +#if (unique_rank != 1) for (uint32_t i = 1; i < unique_rank; i++) { if (unique_dims[i] > max_dim) max_dim = unique_dims[i]; }