Skip to content

Commit

Permalink
made unique_rank a preprocessor variable
Browse files Browse the repository at this point in the history
  • Loading branch information
scemama committed Mar 24, 2023
1 parent 7955bc1 commit db655ce
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/templates_front/templator_front.org
Original file line number Diff line number Diff line change
Expand Up @@ -3327,19 +3327,20 @@ trexio_read_$group_dset$(trexio_t* const file,

/* To be set by generator : number of unique dimensions
(e.g. 1 for ERI in AO basis because only ao_num is present in the list of dimensions) */
const uint32_t unique_rank = $group_dset_unique_rank$;
#define unique_rank $group_dset_unique_rank$
int64_t unique_dims[$group_dset_unique_rank$];

// Below part is populated by the generator when unique_rank > 1
rc = trexio_read_$group_dset_unique_dim$_64(file, &unique_dims[$dim_id$]); if (rc != TREXIO_SUCCESS) return rc;

/* 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) {
for (uint32_t i = 1; i < unique_rank; i++) {
if (unique_dims[i] > max_dim) max_dim = unique_dims[i];
}
#if (unique_rank != 1)
for (uint32_t i = 1; i < unique_rank; i++) {
if (unique_dims[i] > max_dim) max_dim = unique_dims[i];
}
#endif
#undef unique_rank

// introduce a new variable which will be modified with the number of integrals being read if EOF is encountered
int64_t eof_read_size = 0L;
Expand Down Expand Up @@ -3459,19 +3460,20 @@ trexio_write_$group_dset$(trexio_t* const file,

/* To be set by generator : number of unique dimensions
(e.g. 1 for ERI in AO basis because only ao_num is present in the list of dimensions) */
const uint32_t unique_rank = $group_dset_unique_rank$;
#define unique_rank $group_dset_unique_rank$
int64_t unique_dims[$group_dset_unique_rank$];

// Below part is populated by the generator when unique_rank > 1
rc = trexio_read_$group_dset_unique_dim$_64(file, &unique_dims[$dim_id$]); if (rc != TREXIO_SUCCESS) return rc;

/* 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) {
for (uint32_t i = 1; i < unique_rank; i++) {
if (unique_dims[i] > max_dim) max_dim = unique_dims[i];
}
#if (unique_rank != 1)
for (uint32_t i = 1; i < unique_rank; i++) {
if (unique_dims[i] > max_dim) max_dim = unique_dims[i];
}
#endif
#undef unique_rank

// shift indices to be zero-based if Fortran API is used
if (file->one_based) {
Expand Down

0 comments on commit db655ce

Please sign in to comment.