My Project
programmer's documentation
Typedefs | Functions
cs_sort_partition.h File Reference
#include "cs_defs.h"
#include <stdio.h>
Include dependency graph for cs_sort_partition.h:

Go to the source code of this file.

Typedefs

typedef void() cs_sort_partition_s_to_elt_t(double s, void *elt, const void *input)
 function pointer for conversion of a double precision value in range [0, 1] to a given element. More...
 
typedef int() cs_sort_partition_compare_t(const void *elt1, const void *elt2, const void *input)
 function pointer for comparison of 2 elements. More...
 

Functions

void cs_sort_partition_dest_rank_id (cs_lnum_t sampling_factor, size_t elt_size, cs_lnum_t n_elts, const void *elts, const cs_lnum_t *weight, const cs_lnum_t order[], int dest_rank_id[], cs_sort_partition_s_to_elt_t s_to_elt, cs_sort_partition_compare_t compare, const void *f_input, MPI_Comm comm)
 Determine to which rank data elements should be sent for parallel sorting or ordering. More...
 

Typedef Documentation

◆ cs_sort_partition_compare_t

typedef int() cs_sort_partition_compare_t(const void *elt1, const void *elt2, const void *input)

function pointer for comparison of 2 elements.

This function is the same type as that used by qsort_r.

Remarks
for simplicity, calling functions assume the input is shared between cs_sort_partition_s_to_elt_t and cs_sort_partition_compare_t functions (as they use both).
Parameters
[in]elt1coordinate between 0 and 1
[in]elt2pointer to optional (untyped) value or structure.
[in]inputpointer to optional (untyped) value or structure.
Returns
< 0 if elt1 < elt2, 0 if elt1 == elt2, > 0 if elt1 > elt2

◆ cs_sort_partition_s_to_elt_t

typedef void() cs_sort_partition_s_to_elt_t(double s, void *elt, const void *input)

function pointer for conversion of a double precision value in range [0, 1] to a given element.

Remarks
for simplicity, calling functions assume the input is shared between cs_sort_partition_s_to_elt_t and cs_sort_partition_compare_t functions (as they use both).
Parameters
[in]scoordinate between 0 and 1
[out]eltpointer to element
[in]inputpointer to optional (untyped) value or structure.

Function Documentation

◆ cs_sort_partition_dest_rank_id()

void cs_sort_partition_dest_rank_id ( cs_lnum_t  sampling_factor,
size_t  elt_size,
cs_lnum_t  n_elts,
const void *  elts,
const cs_lnum_t weight,
const cs_lnum_t  order[],
int  dest_rank_id[],
cs_sort_partition_s_to_elt_t  s_to_elt,
cs_sort_partition_compare_t  compare,
const void *  f_input,
MPI_Comm  comm 
)

Determine to which rank data elements should be sent for parallel sorting or ordering.

Parameters
[in]sampling_factornumber of samples per rank
[in]elt_sizesize associated with each element
[in]n_eltsnumber of elements to be indexed
[in]eltsarray of elements
[in]weightoptional weight of each element, or NULL
[in]orderordering array
[out]dest_rank_iddestination rank id (size: n_elts)
[in]s_to_eltcoordinate to element conversion function
[in]comparecomparison function
[in]f_inputoptional input to s_to_elt and compare, or NULL
[in]commMPI communicator on which we build the global index