commit 50b66a33792008632fbb542ab89b5a1bda5ae125
parent b95159c064306498d5bf725a78e7f0dbfc37acdc
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Mon, 2 Nov 2020 13:55:12 +0100
Fix the wrong type of the Ka
Use simple precision rather than double precision
Diffstat:
4 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/src/atrck.c b/src/atrck.c
@@ -217,7 +217,7 @@ load_stream(struct atrck* atrck, FILE* stream, const char* stream_name)
}
/* Compute the length in bytes of the ka to map for each quadrature point */
- map_len = ALIGN_SIZE(atrck->nnodes * sizeof(double), atrck->pagesize);
+ map_len = ALIGN_SIZE(atrck->nnodes * sizeof(float), atrck->pagesize);
/* Compute the offset toward the 1st list of ka */
offset = (off_t)ALIGN_SIZE((uint64_t)ftell(stream), atrck->pagesize);
diff --git a/src/atrck.h b/src/atrck.h
@@ -48,7 +48,7 @@ struct atrck_band {
static const struct atrck_band ATRCK_BAND_NULL;
struct atrck_quad_pt {
- double* ka_list; /* Per node ka */
+ float* ka_list; /* Per node ka */
double abscissa; /* m^-1 */
double weight;
};
diff --git a/src/atrck_c.h b/src/atrck_c.h
@@ -23,7 +23,7 @@
struct mem_allocator;
struct quad_pt {
- double* ka_list; /* Per node ka */
+ float* ka_list; /* Per node ka */
size_t map_len;
double abscissa;
double weight;
diff --git a/src/test_atrck_load.c b/src/test_atrck_load.c
@@ -70,7 +70,7 @@ check_atrck_load
CHK(qpt.weight == weight);
FOR_EACH(inode, 0, nnodes) {
- const double ka = (double)(iband*1000 + iqpt*100 + inode);
+ const float ka = (float)(iband*1000 + iqpt*100 + inode);
CHK(qpt.ka_list[inode] == ka);
}
}
@@ -83,8 +83,8 @@ test_load(struct atrck* atrck)
FILE* fp = NULL;
const char* filename = "test_file.atrck";
const uint64_t pagesize = 16384;
- const uint64_t nbands = 3;
- const uint64_t nnodes = 100;
+ const uint64_t nbands = 11;
+ const uint64_t nnodes = 1000;
uint64_t iband;
const char byte = 0;
@@ -129,7 +129,7 @@ test_load(struct atrck* atrck)
CHK(fseek(fp, (long)ALIGN_SIZE((size_t)ftell(fp), pagesize), SEEK_SET)==0);
FOR_EACH(inode, 0, nnodes) {
- const double ka = (double)(iband*1000 + iqpt*100 + inode);
+ const float ka = (float)(iband*1000 + iqpt*100 + inode);
CHK(fwrite(&ka, sizeof(ka), 1, fp) == 1);
}
}
@@ -138,7 +138,6 @@ test_load(struct atrck* atrck)
/* Padding. Write one char to position the EOF indicator */
CHK(fseek(fp, (long)ALIGN_SIZE((size_t)ftell(fp), pagesize)-1, SEEK_SET) == 0);
CHK(fwrite(&byte, sizeof(byte), 1, fp) == 1);
-
rewind(fp);
CHK(atrck_load_stream(NULL, fp, filename) == RES_BAD_ARG);