commit 21cb540d71091f27a04fe9ee56825766b20dbcf9
parent 62354d171c1bc816d00429fe8075fd0b09137461
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Tue, 19 Jul 2022 10:02:55 +0200
Use Star-Mesh getters to retrieve mesh nodes/cells
Diffstat:
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/src/rngrd_mesh.c b/src/rngrd_mesh.c
@@ -153,20 +153,24 @@ static void
get_indices(const unsigned itri, unsigned ids[3], void* ctx)
{
struct smsh_desc* desc = ctx;
+ const uint64_t* indices = NULL;
ASSERT(itri < desc->ncells && desc->dcell == 3);
- ids[0] = (unsigned)desc->cells[itri*3 + 0];
- ids[1] = (unsigned)desc->cells[itri*3 + 1];
- ids[2] = (unsigned)desc->cells[itri*3 + 2];
+ indices = smsh_desc_get_cell(desc, itri);
+ ids[0] = (unsigned)indices[0];
+ ids[1] = (unsigned)indices[1];
+ ids[2] = (unsigned)indices[2];
}
static void
get_position(const unsigned ivert, float pos[3], void* ctx)
{
struct smsh_desc* desc = ctx;
+ const double* position = NULL;
ASSERT(ivert < desc->nnodes && desc->dnode == 3);
- pos[0] = (float)desc->nodes[ivert*3 + 0];
- pos[1] = (float)desc->nodes[ivert*3 + 1];
- pos[2] = (float)desc->nodes[ivert*3 + 2];
+ position = smsh_desc_get_node(desc, ivert);
+ pos[0] = (float)position[0];
+ pos[1] = (float)position[1];
+ pos[2] = (float)position[2];
}
static res_T
@@ -178,7 +182,7 @@ check_smsh_desc(const struct rngrd* ground, const struct smsh_desc* desc)
if(desc->dnode != 3 && desc->dcell != 3) {
log_err(ground,
"The ground mesh must be a 3D triangular mesh "
- "(dimension of the mesh: %u; dimension of vertices: %u)\n",
+ "(dimension of the mesh: %u; dimension of the vertices: %u)\n",
desc->dnode, desc->dcell);
res = RES_BAD_ARG;
goto error;