Skip to content

Commit

Permalink
Feature transfer_search: follow type conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
cburstedde committed Jul 18, 2024
1 parent 6aee7a4 commit 61c28d8
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/p4est_communication.c
Original file line number Diff line number Diff line change
Expand Up @@ -1713,6 +1713,7 @@ compute_send_buffers (p4est_transfer_internal_t *internal,
p4est_points_context_t *c = internal->c;
p4est_transfer_meta_t *resp = internal->resp;
p4est_transfer_meta_t *own = internal->own;
p4est_locidx_t il;
const size_t point_size = c->points->elem_size;

/* Initialise last_procs to -1 to signify no points have been added to send
Expand All @@ -1734,7 +1735,7 @@ compute_send_buffers (p4est_transfer_internal_t *internal,

/* set up search objects for partition search */
search_objects = sc_array_new_count (sizeof (p4est_locidx_t), c->num_respon);
for (p4est_locidx_t il = 0; il < c->num_respon; ++il) {
for (il = 0; il < c->num_respon; ++il) {
*(p4est_locidx_t *) sc_array_index (search_objects, il) = il;
}

Expand Down Expand Up @@ -1763,7 +1764,7 @@ compute_send_buffers (p4est_transfer_internal_t *internal,

/* save points that do not intersect any process domain, if configured to */
if (internal->save_unowned) {
for (p4est_locidx_t il = 0; il < c->num_respon; ++il) {
for (il = 0; il < c->num_respon; ++il) {
if (internal->last_procs[il] == -1) {
/* add point to unowned points buffer*/
memcpy (sc_array_push (internal->unowned_points),
Expand Down Expand Up @@ -2123,7 +2124,8 @@ p4est_transfer_search_internal (p4est_transfer_internal_t *internal)
if (!errsend) {
/* total number of messages this process will send */
/* conversion is safe as we don't expect 2*num_procs to overflow int */
num_send_reqs = own.receivers->elem_count + resp.receivers->elem_count;
num_send_reqs =
(int) (own.receivers->elem_count + resp.receivers->elem_count);

/* initialise request array for outgoing messages */
send_req = P4EST_ALLOC (sc_MPI_Request, num_send_reqs);
Expand Down Expand Up @@ -2213,16 +2215,16 @@ p4est_transfer_search_internal (p4est_transfer_internal_t *internal)
sc_array_destroy_null (&c->points);

/* update count of points we are responsible for */
c->num_respon = resp.num_incoming + num_unowned;
c->num_respon = (p4est_locidx_t) (resp.num_incoming + num_unowned);

/* update count of *unowned* points we are responsible for */
c->num_unowned = num_unowned;
c->num_unowned = (p4est_locidx_t) num_unowned;

/* allocate memory for incoming points */
c->points = sc_array_new_count (point_size, num_incoming);

/* total number of messages received */
num_recv_reqs = own.senders->elem_count + resp.senders->elem_count;
num_recv_reqs = (int) (own.senders->elem_count + resp.senders->elem_count);

/* initialise request array for incoming messages */
recv_req = P4EST_ALLOC (sc_MPI_Request, num_recv_reqs);
Expand Down

0 comments on commit 61c28d8

Please sign in to comment.