49#ifndef XT_XMAP_INTERSECTION_COMMON_H
50#define XT_XMAP_INTERSECTION_COMMON_H
67 size_t num_pos, const int *restrict pos)
87 size_t i = 0, num_pos_ext = 0;
99 size_t num_pos,
const int *restrict pos,
100 size_t num_pos_ext,
struct Xt_pos_ext *restrict pos_ext)
105 size_t i = 0, temp_num_pos_ext = 0;
109 pos_ext[temp_num_pos_ext]
115 assert(num_pos_ext == temp_num_pos_ext);
121 size_t num_pos_ext,
const struct Xt_pos_ext *restrict pos_ext)
124 for (
size_t i = 0; i < num_pos_ext; ++i) num_pos += (
size_t)(pos_ext[i].size);
129 size_t num_pos_ext,
const struct Xt_pos_ext *restrict pos_ext,
130 size_t num_pos,
int *restrict pos)
136 for (
size_t i = 0; i < num_pos_ext; ++i) {
137 int abssize = abs(pos_ext[i].size);
138 int step =
isign(pos_ext[i].size);
139 for (
int j = 0; j < abssize; ++j)
140 pos[ofs + (
size_t)j] = pos_ext[i].start + j * step;
141 ofs += (size_t)abssize;
143 assert(ofs == num_pos);
148 MPI_Comm comm,
const char *source,
int line)
153 MPI_Comm comm,
const char *source,
int line)
157 static const char fmt[] =
"ERROR: destination intersections do not match "
158 "with destination index list (first missing index %lld "
160 char error_message[
sizeof (fmt)
161 + (
sizeof (
long long) +
sizeof (int)) * CHAR_BIT / 8 * 3];
162 sprintf(error_message, fmt, (
long long)missing_index, missing_pos);
163 Xt_abort(comm, error_message, source, line);
static int isign_mask(int x)
int xt_idxlist_get_index_at_position(Xt_idxlist idxlist, int position, Xt_int *index)
static size_t count_pos(size_t num_pos_ext, const struct Xt_pos_ext *restrict pos_ext)
static struct pos_run get_pos_run_len(size_t num_pos, const int *restrict pos)
static void print_miss_msg(Xt_idxlist dst_idxlist, int missing_pos, MPI_Comm comm, const char *source, int line) __attribute__((noreturn))
static size_t count_pos_ext(size_t num_pos, const int *restrict pos)
static void generate_pos(size_t num_pos_ext, const struct Xt_pos_ext *restrict pos_ext, size_t num_pos, int *restrict pos)
static void generate_pos_ext(size_t num_pos, const int *restrict pos, size_t num_pos_ext, struct Xt_pos_ext *restrict pos_ext)