#include "base/cs_defs.h"
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "bft/bft_error.h"
#include "base/cs_all_to_all.h"
#include "base/cs_block_dist.h"
#include "base/cs_mem.h"
#include "base/cs_order.h"
#include "base/cs_block_to_part.h"
Functions | |
void | cs_block_to_part_global_to_local (cs_lnum_t n_ents, cs_lnum_t base, cs_lnum_t global_list_size, bool global_list_is_sorted, const cs_gnum_t global_list[], const cs_gnum_t global_number[], cs_lnum_t local_number[]) |
Determine local references from references to global numbers. |
void cs_block_to_part_global_to_local | ( | cs_lnum_t | n_ents, |
cs_lnum_t | base, | ||
cs_lnum_t | global_list_size, | ||
bool | global_list_is_sorted, | ||
const cs_gnum_t | global_list[], | ||
const cs_gnum_t | global_number[], | ||
cs_lnum_t | local_number[] ) |
Determine local references from references to global numbers.
This is based on finding the local id of a given global number using a binary search.
Global numbers use a 1 to n numbering, while local numbers use a 0+base to n-1+base numbering. If an entity's global number does not appear in the global list, base-1 is assigned for that entity's local list.
If list contains duplicate values, any local id having a multiple global number (i.e not necessarily the smallest one) may be assigned to the corresponding local_number[] entry.
[in] | n_ents | number of entities |
[in] | base | base numbering (typically 0 or 1) |
[in] | global_list_size | size of global entity list |
[in] | global_list_is_sorted | true if global entity list is guaranteed to be sorted |
[in] | global_list | global entity list |
[in] | global_number | entity global numbers (size: n_ents) |
[out] | local_number | entity local numbers (size: n_ents) |