YetAnotherCoupler 3.1.1
Loading...
Searching...
No Matches
Data Structures | Enumerations | Functions
sphere_part.c File Reference
#include "config.h"
#include <assert.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <stdint.h>
#include <float.h>
#include "sphere_part.h"
#include "geometry.h"
#include "basic_grid.h"
#include "interval_tree.h"
#include "utils_core.h"
#include "ensure_array_size.h"
Include dependency graph for sphere_part.c:

Go to the source code of this file.

Data Structures

union  I_list
 
struct  sphere_part_node
 
struct  bnd_sphere_part_search
 
struct  temp_partition_data
 
struct  point_id_xyz
 
struct  point_id_xyz_angle
 
struct  point_sphere_part_node
 
struct  point_sphere_part_search
 
struct  point_id_xyz_int32
 

Enumerations

enum  { I_list_tree_min_size = 2 }
 
enum  { U_FLAG = 1 , T_FLAG = 2 }
 
enum  yac_node_flags { U_IS_LEAF = 1 , T_IS_LEAF = 2 , I_IS_INTERVAL_TREE = 4 }
 
enum  node_type { I_NODE_FULL = 0 , I_NODE = 1 , U_NODE = 2 , T_NODE = 3 }
 

Functions

static void init_sphere_part_node (struct sphere_part_node *node)
 
static struct sphere_part_nodeget_sphere_part_node ()
 
static void compute_gc_norm_vector (void *coords_data, size_t coords_size, size_t coords_count, double prev_gc_norm_vector[], double gc_norm_vector[])
 
static void swap_partition_data (struct temp_partition_data *a, struct temp_partition_data *b)
 
static size_t swap_node_type (struct temp_partition_data *part_data, size_t i, int node_type, size_t begin, size_t end)
 
static void sort_partition_data (struct temp_partition_data *part_data, size_t I_FULL_size, size_t I_size, size_t U_size, size_t T_size)
 
static void partition_data (size_t *local_cell_ids, struct temp_partition_data *part_data, size_t num_cell_ids, size_t threshold, struct sphere_part_node *parent_node, double prev_gc_norm_vector[])
 
static int compare_point_idx_xyz (void const *a, void const *b)
 
static struct point_sphere_part_nodepartition_point_data (struct point_id_xyz *points, size_t num_points, size_t threshold, double prev_gc_norm_vector[], size_t curr_tree_depth, size_t *max_tree_depth)
 
struct bnd_sphere_part_searchyac_bnd_sphere_part_search_new (struct bounding_circle *circles, size_t num_circles)
 
static int compare_points_int32_coord (const void *a, const void *b)
 
static struct point_id_xyzget_unique_points (size_t *num_points, yac_const_coordinate_pointer coordinates_xyz, yac_int const *ids, int const *mask)
 
struct point_sphere_part_searchyac_point_sphere_part_search_new (size_t num_points, yac_const_coordinate_pointer coordinates_xyz, yac_int const *ids)
 
struct point_sphere_part_searchyac_point_sphere_part_search_mask_new (size_t num_points, yac_const_coordinate_pointer coordinates_xyz, yac_int const *ids, int const *mask)
 
static void search_bnd_circle_I_node (struct sphere_part_node *node, struct bounding_circle bnd_circle, size_t **restrict overlap_cells, size_t *overlap_cells_array_size, size_t *restrict num_overlap_cells, struct overlaps *search_interval_tree_buffer, double prev_gc_norm_vector[])
 
static void search_big_bnd_circle (struct sphere_part_node *node, struct bounding_circle bnd_circle, size_t **restrict overlap_cells, size_t *overlap_cells_array_size, size_t *restrict num_overlap_cells, struct overlaps *search_interval_tree_buffer, double prev_gc_norm_vector[])
 TODO change to iterative implementation and allocate overlap_cells first.
 
static void search_small_bnd_circle (struct sphere_part_node *node, struct bounding_circle bnd_circle, size_t **restrict overlap_cells, size_t *overlap_cells_array_size, size_t *restrict num_overlap_cells, struct overlaps *search_interval_tree_buffer, double prev_gc_norm_vector[])
 
static void search_bnd_circle (struct sphere_part_node *node, struct bounding_circle bnd_circle, size_t **restrict overlap_cells, size_t *overlap_cells_array_size, size_t *restrict num_overlap_cells, struct overlaps *search_interval_tree_buffer, double prev_gc_norm_vector[])
 
static void check_leaf_NN (struct point_id_xyz *points, size_t num_points, double *point_coordinates_xyz, struct sin_cos_angle *best_angle, double(**result_coordinates_xyz)[3], size_t *result_coordinates_xyz_array_size, size_t **local_point_ids, size_t *local_point_ids_array_size, size_t total_num_local_point_ids, size_t *num_local_point_ids)
 
static void point_search_NN (struct bounding_circle *bnd_circle, double(**result_coordinates_xyz)[3], size_t *result_coordinates_xyz_array_size, size_t **local_point_ids, size_t *local_point_ids_array_size, size_t total_num_local_point_ids, size_t *num_local_point_ids, double *dot_stack, struct point_sphere_part_node **node_stack, int *flags, size_t curr_tree_depth)
 
static int point_check_bnd_circle (struct point_sphere_part_node *node, struct bounding_circle bnd_circle)
 
static int leaf_contains_matching_point (struct point_id_xyz *points, size_t num_points, double coordinate_xyz[3], size_t **local_point_ids, size_t *local_point_ids_array_size, double(**result_coordinates_xyz)[3], size_t *result_coordinates_xyz_array_size, size_t total_num_local_point_ids, size_t *num_local_point_ids)
 
void yac_point_sphere_part_search_NN (struct point_sphere_part_search *search, size_t num_points, double(*coordinates_xyz)[3], double *cos_angles, double(**result_coordinates_xyz)[3], size_t *result_coordinates_xyz_array_size, size_t **local_point_ids, size_t *local_point_ids_array_size, size_t *num_local_point_ids)
 
static int compare_point_id_xyz_angle (const void *a, const void *b)
 
static size_t initial_point_bnd_search_NNN (size_t n, struct point_id_xyz *points, size_t num_points, double *point_coordinates_xyz, struct point_id_xyz_angle **results, size_t *results_array_size)
 
static struct sin_cos_angle check_leaf_NNN (size_t n, double *point_coordinates_xyz, struct point_id_xyz *points, size_t num_points, struct point_id_xyz_angle **results, size_t *results_array_size, size_t *num_results, struct sin_cos_angle curr_angle)
 
static void point_search_NNN (size_t n, double *point_coordinates_xyz, struct point_id_xyz_angle **results, size_t *results_array_size, size_t *num_results, double *dot_stack, struct point_sphere_part_node **node_stack, int *flags, size_t curr_tree_depth)
 
void yac_point_sphere_part_search_NNN (struct point_sphere_part_search *search, size_t num_points, double(*coordinates_xyz)[3], size_t n, double **cos_angles, size_t *cos_angles_array_size, double(**result_coordinates_xyz)[3], size_t *result_coordinates_xyz_array_size, size_t **local_point_ids, size_t *local_point_ids_array_size, size_t *num_local_point_ids)
 
int yac_point_sphere_part_search_bnd_circle_contains_points (struct point_sphere_part_search *search, struct bounding_circle circle)
 
static void search_point (struct sphere_part_node *node, double point[], size_t **overlap_cells, size_t *overlap_cells_array_size, size_t *num_overlap_cells, struct overlaps *search_interval_tree_buffer, double prev_gc_norm_vector[])
 
void yac_bnd_sphere_part_search_do_point_search (struct bnd_sphere_part_search *search, yac_coordinate_pointer coordinates_xyz, size_t count, size_t **cells, size_t *num_cells_per_coordinate)
 
void yac_bnd_sphere_part_search_do_bnd_circle_search (struct bnd_sphere_part_search *search, struct bounding_circle *bnd_circles, size_t count, size_t **cells, size_t *num_cells_per_bnd_circle)
 
static void free_sphere_part_tree (struct sphere_part_node tree)
 
static void free_point_sphere_part_tree (struct point_sphere_part_node *tree)
 
void yac_delete_point_sphere_part_search (struct point_sphere_part_search *search)
 
void yac_bnd_sphere_part_search_delete (struct bnd_sphere_part_search *search)
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
I_list_tree_min_size 

make I list into tree when list is larger than this

Definition at line 32 of file sphere_part.c.

◆ anonymous enum

anonymous enum
Enumerator
U_FLAG 
T_FLAG 

Definition at line 36 of file sphere_part.c.

◆ node_type

enum node_type
Enumerator
I_NODE_FULL 
I_NODE 
U_NODE 
T_NODE 

Definition at line 66 of file sphere_part.c.

◆ yac_node_flags

Enumerator
U_IS_LEAF 
T_IS_LEAF 
I_IS_INTERVAL_TREE 

Definition at line 41 of file sphere_part.c.

Function Documentation

◆ check_leaf_NN()

static void check_leaf_NN ( struct point_id_xyz points,
size_t  num_points,
double *  point_coordinates_xyz,
struct sin_cos_angle best_angle,
double(**)  result_coordinates_xyz[3],
size_t *  result_coordinates_xyz_array_size,
size_t **  local_point_ids,
size_t *  local_point_ids_array_size,
size_t  total_num_local_point_ids,
size_t *  num_local_point_ids 
)
inlinestatic

Definition at line 924 of file sphere_part.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_leaf_NNN()

static struct sin_cos_angle check_leaf_NNN ( size_t  n,
double *  point_coordinates_xyz,
struct point_id_xyz points,
size_t  num_points,
struct point_id_xyz_angle **  results,
size_t *  results_array_size,
size_t *  num_results,
struct sin_cos_angle  curr_angle 
)
inlinestatic

Definition at line 1370 of file sphere_part.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ compare_point_id_xyz_angle()

static int compare_point_id_xyz_angle ( const void *  a,
const void *  b 
)
inlinestatic

Definition at line 1313 of file sphere_part.c.

Here is the caller graph for this function:

◆ compare_point_idx_xyz()

static int compare_point_idx_xyz ( void const *  a,
void const *  b 
)
static

Definition at line 443 of file sphere_part.c.

Here is the caller graph for this function:

◆ compare_points_int32_coord()

static int compare_points_int32_coord ( const void *  a,
const void *  b 
)
inlinestatic

Definition at line 570 of file sphere_part.c.

Here is the caller graph for this function:

◆ compute_gc_norm_vector()

static void compute_gc_norm_vector ( void *  coords_data,
size_t  coords_size,
size_t  coords_count,
double  prev_gc_norm_vector[],
double  gc_norm_vector[] 
)
inlinestatic

Definition at line 136 of file sphere_part.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ free_point_sphere_part_tree()

static void free_point_sphere_part_tree ( struct point_sphere_part_node tree)
static

Definition at line 1930 of file sphere_part.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ free_sphere_part_tree()

static void free_sphere_part_tree ( struct sphere_part_node  tree)
static

Definition at line 1913 of file sphere_part.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_sphere_part_node()

static struct sphere_part_node * get_sphere_part_node ( )
static

Definition at line 125 of file sphere_part.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_unique_points()

static struct point_id_xyz * get_unique_points ( size_t *  num_points,
yac_const_coordinate_pointer  coordinates_xyz,
yac_int const *  ids,
int const *  mask 
)
static

Definition at line 586 of file sphere_part.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init_sphere_part_node()

static void init_sphere_part_node ( struct sphere_part_node node)
static

Definition at line 113 of file sphere_part.c.

Here is the caller graph for this function:

◆ initial_point_bnd_search_NNN()

static size_t initial_point_bnd_search_NNN ( size_t  n,
struct point_id_xyz points,
size_t  num_points,
double *  point_coordinates_xyz,
struct point_id_xyz_angle **  results,
size_t *  results_array_size 
)
static

Definition at line 1326 of file sphere_part.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ leaf_contains_matching_point()

static int leaf_contains_matching_point ( struct point_id_xyz points,
size_t  num_points,
double  coordinate_xyz[3],
size_t **  local_point_ids,
size_t *  local_point_ids_array_size,
double(**)  result_coordinates_xyz[3],
size_t *  result_coordinates_xyz_array_size,
size_t  total_num_local_point_ids,
size_t *  num_local_point_ids 
)
inlinestatic

Definition at line 1150 of file sphere_part.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ partition_data()

static void partition_data ( size_t *  local_cell_ids,
struct temp_partition_data part_data,
size_t  num_cell_ids,
size_t  threshold,
struct sphere_part_node parent_node,
double  prev_gc_norm_vector[] 
)
static

Definition at line 244 of file sphere_part.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ partition_point_data()

static struct point_sphere_part_node * partition_point_data ( struct point_id_xyz points,
size_t  num_points,
size_t  threshold,
double  prev_gc_norm_vector[],
size_t  curr_tree_depth,
size_t *  max_tree_depth 
)
static

Definition at line 448 of file sphere_part.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ point_check_bnd_circle()

static int point_check_bnd_circle ( struct point_sphere_part_node node,
struct bounding_circle  bnd_circle 
)
static

Definition at line 1098 of file sphere_part.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ point_search_NN()

static void point_search_NN ( struct bounding_circle bnd_circle,
double(**)  result_coordinates_xyz[3],
size_t *  result_coordinates_xyz_array_size,
size_t **  local_point_ids,
size_t *  local_point_ids_array_size,
size_t  total_num_local_point_ids,
size_t *  num_local_point_ids,
double *  dot_stack,
struct point_sphere_part_node **  node_stack,
int *  flags,
size_t  curr_tree_depth 
)
static

Definition at line 997 of file sphere_part.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ point_search_NNN()

static void point_search_NNN ( size_t  n,
double *  point_coordinates_xyz,
struct point_id_xyz_angle **  results,
size_t *  results_array_size,
size_t *  num_results,
double *  dot_stack,
struct point_sphere_part_node **  node_stack,
int *  flags,
size_t  curr_tree_depth 
)
static

Definition at line 1436 of file sphere_part.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ search_big_bnd_circle()

static void search_big_bnd_circle ( struct sphere_part_node node,
struct bounding_circle  bnd_circle,
size_t **restrict  overlap_cells,
size_t *  overlap_cells_array_size,
size_t *restrict  num_overlap_cells,
struct overlaps search_interval_tree_buffer,
double  prev_gc_norm_vector[] 
)
static

TODO change to iterative implementation and allocate overlap_cells first.

Definition at line 790 of file sphere_part.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ search_bnd_circle()

static void search_bnd_circle ( struct sphere_part_node node,
struct bounding_circle  bnd_circle,
size_t **restrict  overlap_cells,
size_t *  overlap_cells_array_size,
size_t *restrict  num_overlap_cells,
struct overlaps search_interval_tree_buffer,
double  prev_gc_norm_vector[] 
)
static

Definition at line 905 of file sphere_part.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ search_bnd_circle_I_node()

static void search_bnd_circle_I_node ( struct sphere_part_node node,
struct bounding_circle  bnd_circle,
size_t **restrict  overlap_cells,
size_t *  overlap_cells_array_size,
size_t *restrict  num_overlap_cells,
struct overlaps search_interval_tree_buffer,
double  prev_gc_norm_vector[] 
)
static

Definition at line 712 of file sphere_part.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ search_point()

static void search_point ( struct sphere_part_node node,
double  point[],
size_t **  overlap_cells,
size_t *  overlap_cells_array_size,
size_t *  num_overlap_cells,
struct overlaps search_interval_tree_buffer,
double  prev_gc_norm_vector[] 
)
static

Definition at line 1721 of file sphere_part.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ search_small_bnd_circle()

static void search_small_bnd_circle ( struct sphere_part_node node,
struct bounding_circle  bnd_circle,
size_t **restrict  overlap_cells,
size_t *  overlap_cells_array_size,
size_t *restrict  num_overlap_cells,
struct overlaps search_interval_tree_buffer,
double  prev_gc_norm_vector[] 
)
static

Definition at line 829 of file sphere_part.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sort_partition_data()

static void sort_partition_data ( struct temp_partition_data part_data,
size_t  I_FULL_size,
size_t  I_size,
size_t  U_size,
size_t  T_size 
)
static

Definition at line 198 of file sphere_part.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ swap_node_type()

static size_t swap_node_type ( struct temp_partition_data part_data,
size_t  i,
int  node_type,
size_t  begin,
size_t  end 
)
static

Definition at line 184 of file sphere_part.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ swap_partition_data()

static void swap_partition_data ( struct temp_partition_data a,
struct temp_partition_data b 
)
static

Definition at line 177 of file sphere_part.c.

Here is the caller graph for this function:

◆ yac_bnd_sphere_part_search_delete()

void yac_bnd_sphere_part_search_delete ( struct bnd_sphere_part_search search)
Examples
test_bnd_sphere_part.c.

Definition at line 1953 of file sphere_part.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ yac_bnd_sphere_part_search_do_bnd_circle_search()

void yac_bnd_sphere_part_search_do_bnd_circle_search ( struct bnd_sphere_part_search search,
struct bounding_circle bnd_circles,
size_t  count,
size_t **  cells,
size_t *  num_cells_per_bnd_circle 
)
Examples
test_bnd_sphere_part.c.

Definition at line 1869 of file sphere_part.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ yac_bnd_sphere_part_search_do_point_search()

void yac_bnd_sphere_part_search_do_point_search ( struct bnd_sphere_part_search search,
yac_coordinate_pointer  coordinates_xyz,
size_t  count,
size_t **  cells,
size_t *  num_cells_per_coordinate 
)
Examples
test_bnd_sphere_part.c.

Definition at line 1823 of file sphere_part.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ yac_bnd_sphere_part_search_new()

struct bnd_sphere_part_search * yac_bnd_sphere_part_search_new ( struct bounding_circle circles,
size_t  num_circles 
)
Examples
test_bnd_sphere_part.c.

Definition at line 543 of file sphere_part.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ yac_delete_point_sphere_part_search()

void yac_delete_point_sphere_part_search ( struct point_sphere_part_search search)
Examples
test_point_sphere_part.c.

Definition at line 1943 of file sphere_part.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ yac_point_sphere_part_search_bnd_circle_contains_points()

int yac_point_sphere_part_search_bnd_circle_contains_points ( struct point_sphere_part_search search,
struct bounding_circle  circle 
)

This routine returns true if the provided point_sphere_part_search contains a point that is within the provided bounding circle.

Examples
test_point_sphere_part.c.

Definition at line 1713 of file sphere_part.c.

Here is the call graph for this function:

◆ yac_point_sphere_part_search_mask_new()

struct point_sphere_part_search * yac_point_sphere_part_search_mask_new ( size_t  num_points,
yac_const_coordinate_pointer  coordinates_xyz,
yac_int const *  ids,
int const *  mask 
)

Definition at line 685 of file sphere_part.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ yac_point_sphere_part_search_new()

struct point_sphere_part_search * yac_point_sphere_part_search_new ( size_t  num_points,
yac_const_coordinate_pointer  coordinates_xyz,
yac_int const *  ids 
)
Examples
test_point_sphere_part.c.

Definition at line 659 of file sphere_part.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ yac_point_sphere_part_search_NN()

void yac_point_sphere_part_search_NN ( struct point_sphere_part_search search,
size_t  num_points,
double(*)  coordinates_xyz[3],
double *  cos_angles,
double(**)  result_coordinates_xyz[3],
size_t *  result_coordinates_xyz_array_size,
size_t **  local_point_ids,
size_t *  local_point_ids_array_size,
size_t *  num_local_point_ids 
)

This routine does a nearest neighbour search between the points provided to this routine and the matching yac_point_sphere_part_search_new call.

Examples
test_point_sphere_part.c.

Definition at line 1180 of file sphere_part.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ yac_point_sphere_part_search_NNN()

void yac_point_sphere_part_search_NNN ( struct point_sphere_part_search search,
size_t  num_points,
double(*)  coordinates_xyz[3],
size_t  n,
double **  cos_angles,
size_t *  cos_angles_array_size,
double(**)  result_coordinates_xyz[3],
size_t *  result_coordinates_xyz_array_size,
size_t **  local_point_ids,
size_t *  local_point_ids_array_size,
size_t *  num_local_point_ids 
)

This routine does a n nearest neighbour search between the points provided to this routine and the matching yac_point_sphere_part_search_new call.

Examples
test_point_sphere_part.c.

Definition at line 1533 of file sphere_part.c.

Here is the call graph for this function:
Here is the caller graph for this function: