void exchanger_set_sends(exchanger_t* ex, int_ptr_unordered_map_t* send_map) { int pos = 0, send_proc; int_array_t* send_indices; while (int_ptr_unordered_map_next(send_map, &pos, &send_proc, (void**)&send_indices)) exchanger_set_send(ex, send_proc, send_indices->data, send_indices->size, true); }
void exchanger_set_receives(exchanger_t* ex, int_ptr_unordered_map_t* recv_map) { int pos = 0, recv_proc; int_array_t* recv_indices; while (int_ptr_unordered_map_next(recv_map, &pos, &recv_proc, (void**)&recv_indices)) exchanger_set_receive(ex, recv_proc, recv_indices->data, recv_indices->size, true); }
int str_grid_cell_filler_start(str_grid_cell_filler_t* cell_filler, str_grid_cell_data_t* data) { ASSERT(str_grid_cell_data_grid(data) == cell_filler->grid); // Dream up a new token for ghost fills. int token = 0; while (int_ptr_unordered_map_contains(cell_filler->tokens, token)) ++token; // Map our token to a list of underlying operation tokens.` int_array_t* op_tokens = int_array_new(); int_ptr_unordered_map_insert_with_v_dtor(cell_filler->tokens, token, op_tokens, DTOR(int_array_free)); // Begin the ghost fill operations and gather tokens. int pos = 0, patch_index; ptr_array_t* fillers; while (int_ptr_unordered_map_next(cell_filler->patch_fillers, &pos, &patch_index, (void**)&fillers)) { int i, j, k; get_patch_indices(cell_filler, patch_index, &i, &j, &k); // Go through all the fillers for this patch. for (int l = 0; l < fillers->size; ++l) { str_grid_patch_filler_t* filler = fillers->data[l]; int op_token = str_grid_patch_filler_start(filler, i, j, k, data); ASSERT((op_token >= 0) || (op_token == -1)); if (op_token != -1) // -1 <-> no finish operation. { // We stash both the patch index and the op token. int_array_append(op_tokens, patch_index); int_array_append(op_tokens, op_token); } } } return token; }