Skip to content

Commit

Permalink
test_coordinates: hash coordinate tuple
Browse files Browse the repository at this point in the history
  • Loading branch information
cburstedde committed Jan 30, 2025
1 parent 4f3ead2 commit 40c64c8
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/test_coordinates2.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,26 @@ test_node_coordinates (const p4est_quadrant_t *r,
1);
}

static void
test_hash (sc_hash_t *hash,
p4est_topidx_t tt, const p4est_qcoord_t coords[])
{
int retval;
void **found;
p4est_qcoord_t hc[P4EST_DIM + 1];

hc[0] = (p4est_qcoord_t) tt;
hc[1] = coords[0];
hc[2] = coords[1];
#ifdef P4_TO_P8
hc[3] = coords[2];
#endif
retval = sc_hash_insert_unique (hash, hc, &found);
if (retval) {
/* new object: count it */
}
}

static void
test_connectivity (sc_MPI_Comm mpicomm, p4est_connectivity_t *conn)
{
Expand Down Expand Up @@ -128,6 +148,7 @@ test_connectivity (sc_MPI_Comm mpicomm, p4est_connectivity_t *conn)
SC_CHECK_ABORT (nt == tt, "Mysterious volume tree");
SC_CHECK_ABORT (!p4est_coordinates_compare (coords, coords_out),
"Mysterious volume coordinates");
test_hash (chash, nt, coords_out);

for (face = 0; face < P4EST_FACES; ++face) {
/* verify face midpoints */
Expand Down

0 comments on commit 40c64c8

Please sign in to comment.