Skip to content

Commit

Permalink
Merge pull request #360 from hannesbrandt/feature-debug-consistency
Browse files Browse the repository at this point in the history
debug consistency: fix unused-but-set-variable warning
  • Loading branch information
scottaiton authored Dec 18, 2024
2 parents 22a6138 + d243af1 commit aa8bf24
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 41 deletions.
48 changes: 24 additions & 24 deletions src/fclaw2d_convenience.c
Original file line number Diff line number Diff line change
Expand Up @@ -522,8 +522,8 @@ fclaw2d_domain_adapt (fclaw2d_domain_t * domain)
p4est_wrap_t *wrap = (p4est_wrap_t *) domain->pp;

FCLAW_ASSERT (domain->pp_owned);
P4EST_ASSERT (!domain->just_adapted);
P4EST_ASSERT (!domain->just_partitioned);
FCLAW_ASSERT (!domain->just_adapted);
FCLAW_ASSERT (!domain->just_partitioned);

/* propagate desired refinement level to neighbors */
if (domain->p.smooth_refine)
Expand Down Expand Up @@ -578,7 +578,7 @@ fclaw2d_domain_adapt (fclaw2d_domain_t * domain)
nblockno,
npatchno
[0]);
P4EST_ASSERT (npatch->level == level);
FCLAW_ASSERT (npatch->level == level);
if (npatch->level >= domain->p.smooth_level)
/* Match target level only if we are in a level that
should be refined */
Expand All @@ -592,7 +592,7 @@ fclaw2d_domain_adapt (fclaw2d_domain_t * domain)
nblockno,
npatchno
[0]);
P4EST_ASSERT (npatch->level == level - 1);
FCLAW_ASSERT (npatch->level == level - 1);
if (npatch->level >= domain->p.smooth_level)
max_tlevel =
SC_MAX (max_tlevel, npatch->target_level);
Expand All @@ -607,7 +607,7 @@ fclaw2d_domain_adapt (fclaw2d_domain_t * domain)
nblockno,
npatchno
[k]);
P4EST_ASSERT (npatch->level == level + 1);
FCLAW_ASSERT (npatch->level == level + 1);
if (npatch->level >= domain->p.smooth_level)
max_tlevel =
SC_MAX (max_tlevel, npatch->target_level);
Expand Down Expand Up @@ -1054,7 +1054,7 @@ search_point_fn (p4est_t * p4est, p4est_topidx_t which_tree,
}
if (now != earlier)
{
P4EST_ASSERT (earlier == -1 || now < earlier);
FCLAW_ASSERT (earlier == -1 || now < earlier);
*(int *) sc_array_index_int (sd->results, ip) = now;
}

Expand Down Expand Up @@ -1383,9 +1383,9 @@ overlap_consumer_add (overlap_consumer_comm_t * c, void *point, int rank)
overlap_buf_t *sb;
overlap_ind_t *qi;

P4EST_ASSERT (c != NULL);
P4EST_ASSERT (c->send_buffer != NULL && c->query_indices != NULL);
P4EST_ASSERT (0 <= rank && rank < c->domain->mpisize);
FCLAW_ASSERT (c != NULL);
FCLAW_ASSERT (c->send_buffer != NULL && c->query_indices != NULL);
FCLAW_ASSERT (0 <= rank && rank < c->domain->mpisize);
overlap_point_t *op = (overlap_point_t *) point;
FCLAW_ASSERT (op != NULL && op->point != NULL);
op->rank = rank; /* mark, that we added this point to the process buffer */
Expand All @@ -1398,10 +1398,10 @@ overlap_consumer_add (overlap_consumer_comm_t * c, void *point, int rank)
{
sb = (overlap_buf_t *) sc_array_index (c->send_buffer, bcount - 1);
qi = (overlap_ind_t *) sc_array_index (c->query_indices, bcount - 1);
P4EST_ASSERT (sb->rank == qi->rank);
P4EST_ASSERT (sb->rank <= rank);
P4EST_ASSERT (sb->ops.elem_count == qi->oqs.elem_count);
P4EST_ASSERT (sb->ops.elem_count > 0);
FCLAW_ASSERT (sb->rank == qi->rank);
FCLAW_ASSERT (sb->rank <= rank);
FCLAW_ASSERT (sb->ops.elem_count == qi->oqs.elem_count);
FCLAW_ASSERT (sb->ops.elem_count > 0);
}
if (bcount == 0 || sb->rank < rank)
{
Expand Down Expand Up @@ -1682,13 +1682,13 @@ producer_interpolate (overlap_producer_comm_t * p)
(sc_MPI_Request *) p->recv_reqs->array,
&received, prod_indices, sc_MPI_STATUSES_IGNORE);
SC_CHECK_MPI (mpiret);
P4EST_ASSERT (received != sc_MPI_UNDEFINED);
P4EST_ASSERT (received > 0);
FCLAW_ASSERT (received != sc_MPI_UNDEFINED);
FCLAW_ASSERT (received > 0);

for (i = 0; i < received; ++i)
{
/* compute the prodata for the points sent by process prod_indices[i] */
P4EST_ASSERT (0 <= prod_indices[i]
FCLAW_ASSERT (0 <= prod_indices[i]
&& prod_indices[i] < num_senders);
rb = (overlap_buf_t *) sc_array_index_int (p->recv_buffer,
prod_indices[i]);
Expand Down Expand Up @@ -1725,7 +1725,7 @@ consumer_update_from_buffer (overlap_consumer_comm_t * c, sc_array_t * buffer,
int i;

/* obtain the array of points we want to update the query points with */
P4EST_ASSERT (0 <= bi && bi < (int) buffer->elem_count);
FCLAW_ASSERT (0 <= bi && bi < (int) buffer->elem_count);
rb = (overlap_buf_t *) sc_array_index_int (buffer, bi);
qi = (overlap_ind_t *) sc_array_index_int (c->query_indices, bi);

Expand Down Expand Up @@ -1759,8 +1759,8 @@ consumer_update_query_points (overlap_consumer_comm_t * c)
(sc_MPI_Request *) c->recv_reqs->array,
&received, cons_indices, sc_MPI_STATUSES_IGNORE);
SC_CHECK_MPI (mpiret);
P4EST_ASSERT (received != sc_MPI_UNDEFINED);
P4EST_ASSERT (received > 0);
FCLAW_ASSERT (received != sc_MPI_UNDEFINED);
FCLAW_ASSERT (received > 0);

for (i = 0; i < received; ++i)
{
Expand Down Expand Up @@ -1827,15 +1827,15 @@ consumer_free_communication_data (overlap_consumer_comm_t * c)
rb = (overlap_buf_t *) sc_array_index (c->recv_buffer, bz);
SC_ASSERT (sb->rank == rb->rank);
#ifdef FCLAW_ENABLE_DEBUG
SC_ASSERT (prev_rank < sb->rank);
FCLAW_ASSERT (prev_rank < sb->rank);
prev_rank = sb->rank;
if (bz == (size_t) c->iconrank)
{
P4EST_ASSERT (rb->ops.elem_count == 0);
FCLAW_ASSERT (rb->ops.elem_count == 0);
}
else
{
P4EST_ASSERT (rb->ops.elem_count == sb->ops.elem_count);
FCLAW_ASSERT (rb->ops.elem_count == sb->ops.elem_count);
}
#endif
FCLAW_ASSERT (sb->ops.elem_count > 0);
Expand Down Expand Up @@ -1876,11 +1876,11 @@ producer_free_communication_data (overlap_producer_comm_t * p)
#ifdef FCLAW_ENABLE_DEBUG
if (i == p->iprorank)
{
P4EST_ASSERT (rb->ops.elem_count == 0);
FCLAW_ASSERT (rb->ops.elem_count == 0);
}
else
{
P4EST_ASSERT (rb->ops.elem_count > 0);
FCLAW_ASSERT (rb->ops.elem_count > 0);
}
#endif
sc_array_reset (&rb->ops);
Expand Down
8 changes: 4 additions & 4 deletions src/fclaw2d_p4est.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ static unsigned fclaw2d_p4est_magic;
static int
fclaw2d_p4est_map_query (fclaw2d_map_context_t * cont, int query_identifier)
{
P4EST_ASSERT (cont->magic == FCLAW2D_P4EST_MAGIC);
FCLAW_ASSERT (cont->magic == FCLAW2D_P4EST_MAGIC);

switch (query_identifier)
{
Expand All @@ -61,7 +61,7 @@ fclaw2d_p4est_map_c2m (fclaw2d_map_context_t * cont, int blockno,
double cx, double cy,
double *mx, double *my, double *mz)
{
P4EST_ASSERT (cont->magic == FCLAW2D_P4EST_MAGIC);
FCLAW_ASSERT (cont->magic == FCLAW2D_P4EST_MAGIC);

p4est_connectivity_t *conn = (p4est_connectivity_t *) cont->user_data;
double xyzp[3];
Expand All @@ -80,7 +80,7 @@ fclaw2d_p4est_map_new (const p4est_connectivity_t * conn)
{
fclaw2d_map_context_t *cont;

P4EST_ASSERT (conn->vertices != NULL);
FCLAW_ASSERT (conn->vertices != NULL);

cont = P4EST_ALLOC_ZERO (fclaw2d_map_context_t, 1);
cont->magic = FCLAW2D_P4EST_MAGIC;
Expand All @@ -94,6 +94,6 @@ fclaw2d_p4est_map_new (const p4est_connectivity_t * conn)
void
fclaw2d_p4est_map_destroy (fclaw2d_map_context_t * cont)
{
P4EST_ASSERT (cont->magic == FCLAW2D_P4EST_MAGIC);
FCLAW_ASSERT (cont->magic == FCLAW2D_P4EST_MAGIC);
P4EST_FREE (cont);
}
18 changes: 9 additions & 9 deletions src/forestclaw2d.c
Original file line number Diff line number Diff line change
Expand Up @@ -548,15 +548,15 @@ fclaw2d_patch_face_swap (int *faceno, int *rfaceno)
const int iface = *faceno;
const int orientation = *rfaceno / P4EST_FACES;

P4EST_ASSERT (0 <= *faceno && *faceno < P4EST_FACES);
P4EST_ASSERT (0 <= *rfaceno && *rfaceno < P4EST_HALF * P4EST_FACES);
P4EST_ASSERT (0 <= orientation && orientation < P4EST_HALF);
FCLAW_ASSERT (0 <= *faceno && *faceno < P4EST_FACES);
FCLAW_ASSERT (0 <= *rfaceno && *rfaceno < P4EST_HALF * P4EST_FACES);
FCLAW_ASSERT (0 <= orientation && orientation < P4EST_HALF);

*faceno = *rfaceno % P4EST_FACES;
*rfaceno = iface + P4EST_FACES * orientation;

P4EST_ASSERT (0 <= *faceno && *faceno < P4EST_FACES);
P4EST_ASSERT (0 <= *rfaceno && *rfaceno < P4EST_HALF * P4EST_FACES);
FCLAW_ASSERT (0 <= *faceno && *faceno < P4EST_FACES);
FCLAW_ASSERT (0 <= *rfaceno && *rfaceno < P4EST_HALF * P4EST_FACES);
}

void
Expand Down Expand Up @@ -1835,7 +1835,7 @@ fclaw2d_domain_iterate_pack (fclaw2d_domain_t * domain, size_t data_size,
/* find range of receiving processes */
first_receiver =
p4est_bsearch_partition (old_gfq[mpirank], new_gfq, mpisize);
P4EST_ASSERT (0 <= first_receiver && first_receiver < mpisize);
FCLAW_ASSERT (0 <= first_receiver && first_receiver < mpisize);
last_receiver =
p4est_bsearch_partition (old_gfq[mpirank + 1] - 1,
&new_gfq[first_receiver],
Expand Down Expand Up @@ -1904,7 +1904,7 @@ fclaw2d_domain_iterate_pack (fclaw2d_domain_t * domain, size_t data_size,
block = domain->blocks + blockno;
}
patchno = i - block->num_patches_before;
P4EST_ASSERT (0 <= patchno && patchno < block->num_patches);
FCLAW_ASSERT (0 <= patchno && patchno < block->num_patches);
}

/* do not pack patch if source size is 0 */
Expand Down Expand Up @@ -2096,7 +2096,7 @@ fclaw2d_domain_iterate_unpack (fclaw2d_domain_t * domain,
block = domain->blocks + blockno;
}
patchno = i - block->num_patches_before;
P4EST_ASSERT (0 <= patchno && patchno < block->num_patches);
FCLAW_ASSERT (0 <= patchno && patchno < block->num_patches);

/* update dest data index accordingly */
if (!skip_local && !skip_refined)
Expand Down Expand Up @@ -2140,7 +2140,7 @@ fclaw2d_domain_iterate_unpack (fclaw2d_domain_t * domain,
void
fclaw2d_domain_partition_free (fclaw2d_domain_partition_t * p)
{
P4EST_ASSERT (!p->inside_async);
FCLAW_ASSERT (!p->inside_async);
sc_array_destroy (p->src_data);
sc_array_destroy (p->dest_data);
if (p->src_sizes != NULL)
Expand Down
8 changes: 4 additions & 4 deletions src/patches/clawpatch/fclaw_clawpatch_output_vtk.c
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ fclaw2d_vtk_write_field (fclaw_global_t * glob, fclaw2d_vtk_state_t * s,
int max_num_writes, local_num_writes;
int mpiret;
MPI_Offset mpipos;
#ifdef P4EST_ENABLE_DEBUG
#ifdef FCLAW_ENABLE_DEBUG
MPI_Offset mpinew;
#endif
MPI_Status mpistatus;
Expand Down Expand Up @@ -618,13 +618,13 @@ fclaw2d_vtk_write_field (fclaw_global_t * glob, fclaw2d_vtk_state_t * s,
s->num_buffered_patches = 0;

#ifdef P4EST_ENABLE_MPIIO
#ifdef P4EST_ENABLE_DEBUG
#ifdef FCLAW_ENABLE_DEBUG
mpiret = MPI_File_get_position (s->mpifile, &mpinew);
SC_CHECK_MPI (mpiret);
P4EST_ASSERT (mpinew - mpipos ==
FCLAW_ASSERT (mpinew - mpipos ==
(domain->mpirank == 0 ? s->ndsize : 0) +
domain->local_num_patches * psize_field);
P4EST_ASSERT (domain->mpirank < domain->mpisize - 1 ||
FCLAW_ASSERT (domain->mpirank < domain->mpisize - 1 ||
mpinew - s->mpibegin ==
offset_field + s->ndsize +
psize_field * domain->global_num_patches);
Expand Down

0 comments on commit aa8bf24

Please sign in to comment.