28 "ERROR(yac_point_selection_bnd_circle_new): "
29 "invalid latitude for bounding circle center (%lf) "
30 "(has to be in the range of [-M_PI_2;M_PI_2])",
center_lat);
33 "ERROR(yac_point_selection_bnd_circle_new): "
34 "invalid angle for bounding circle (%lf) "
35 "(has to be in the range of [0;M_PI[)",
inc_angle);
38 xmalloc(1 *
sizeof(*point_select));
57 "ERROR(yac_point_selection_copy): invalid point selection type");
59 point_select_copy = NULL;
70 return point_select_copy;
81 yac_mpi_call(MPI_Pack_size(1, MPI_INT, comm, &int_pack_size), comm);
86 size_t pack_size = int_pack_size;
90 "ERROR(yac_point_selection_get_pack_size): invalid point selection type");
96 MPI_Pack_size(1, MPI_DOUBLE, comm, &dble_pack_size), comm);
97 pack_size += dble_pack_size +
108 void *
buffer,
int buffer_size,
int * position, MPI_Comm comm) {
111 yac_mpi_call(MPI_Pack_size(1, MPI_INT, comm, &int_pack_size), comm);
116 MPI_Pack(&
type, 1, MPI_INT,
buffer, buffer_size, position, comm), comm);
120 "ERROR(yac_point_selection_pack): invalid point selection type");
127 buffer, buffer_size, position, comm), comm);
131 buffer, buffer_size, position, comm), comm);
135 buffer, buffer_size, position, comm), comm);
141 void const *
buffer,
int buffer_size,
int * position, MPI_Comm comm) {
146 buffer, buffer_size, position, &
type, 1, MPI_INT, comm), comm);
152 "ERROR(yac_point_selection_unpack): invalid point selection type");
161 MPI_DOUBLE, comm), comm);
165 MPI_DOUBLE, comm), comm);
169 MPI_DOUBLE, comm), comm);
185 int ret = (type_a > type_b) - (type_a < type_b);
191 "ERROR(yac_point_selection_compare): invalid point selection type");
223 int *
flag,
size_t false_count) {
229 for (
size_t i = 0, j = false_count; i < false_count; ++i) {
233 for (;
flag[j]; ++j);
235 double temp_coord[3];
236 memcpy(temp_coord, array_coord[i],
sizeof(temp_coord));
237 memcpy(array_coord[i], array_coord[j],
sizeof(temp_coord));
238 memcpy(array_coord[j], temp_coord,
sizeof(temp_coord));
239 size_t temp_size_t = array_size_t[i];
240 array_size_t[i] = array_size_t[j];
241 array_size_t[j] = temp_size_t;
251 size_t num_points,
size_t * num_selected_points) {
258 "ERROR(yac_point_selection_apply): invalid point selection type");
260 *num_selected_points = 0;
270 double sin_inc_angle, cos_inc_angle;
273 &sin_inc_angle, &cos_inc_angle);
279 size_t match_count = 0;
282 int point_in_bounding_circle =
284 (
double*)(point_coords[i]), &bnd_circle);
285 match_flag[i] = point_in_bounding_circle;
286 if (point_in_bounding_circle) ++match_count;
291 point_indices, point_coords, match_flag,
num_points - match_count);
294 *num_selected_points = match_count;
309 double * center_lon,
double * center_lat,
double *
inc_angle) {
314 "ERROR(yac_point_selection_bnd_circle_get_config): "
315 "invalid point selection type");
#define YAC_ASSERT(exp, msg)
static void compute_sin_cos(double angle, double *sin_value, double *cos_value)
static int yac_point_in_bounding_circle_vec(double point_vector[3], struct bounding_circle *bnd_circle)
static struct sin_cos_angle sin_cos_angle_new(double sin, double cos)
int yac_point_selection_compare(struct yac_point_selection const *a, struct yac_point_selection const *b)
struct yac_point_selection * yac_point_selection_bnd_circle_new(double center_lon, double center_lat, double inc_angle)
struct yac_point_selection * yac_point_selection_unpack(void const *buffer, int buffer_size, int *position, MPI_Comm comm)
struct yac_point_selection * yac_point_selection_copy(struct yac_point_selection const *point_select)
void yac_point_selection_apply(struct yac_point_selection const *point_select, yac_coordinate_pointer point_coords, size_t *point_indices, size_t num_points, size_t *num_selected_points)
void yac_point_selection_pack(struct yac_point_selection const *point_select, void *buffer, int buffer_size, int *position, MPI_Comm comm)
size_t yac_point_selection_get_pack_size(struct yac_point_selection const *point_select, MPI_Comm comm)
void yac_point_selection_delete(struct yac_point_selection *point_select)
void yac_point_selection_bnd_circle_get_config(struct yac_point_selection const *point_selection, double *center_lon, double *center_lat, double *inc_angle)
enum yac_point_selection_type yac_point_selection_get_type(struct yac_point_selection const *point_select)
static void flag_sort(size_t *array_size_t, yac_coordinate_pointer array_coord, int *flag, size_t false_count)
@ YAC_POINT_SELECTION_TYPE_BND_CIRCLE
@ YAC_POINT_SELECTION_TYPE_EMPTY
struct sin_cos_angle inc_angle
angle between the middle point and the boundary of the spherical cap
union yac_point_selection::@56 data
struct yac_point_selection::@56::@57 bnd_circle
enum yac_point_selection_type type
static void LLtoXYZ(double lon, double lat, double p_out[])
#define YAC_ASSERT_F(exp, format,...)
#define YAC_UNREACHABLE_DEFAULT(msg)
#define yac_mpi_call(call, comm)
double(* yac_coordinate_pointer)[3]