7.0
general documentation
cs_order.c File Reference
#include "cs_defs.h"
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include "bft_mem.h"
#include "bft_printf.h"
#include "cs_order.h"
+ Include dependency graph for cs_order.c:

Functions

int cs_order_gnum_test (const cs_lnum_t list[], const cs_gnum_t number[], size_t nb_ent)
 Test if an array of global numbers is ordered. More...
 
cs_lnum_tcs_order_gnum (const cs_lnum_t list[], const cs_gnum_t number[], size_t nb_ent)
 Return an ordering table associated with an array of global numbers. More...
 
cs_lnum_tcs_order_gnum_s (const cs_lnum_t list[], const cs_gnum_t number[], size_t stride, size_t nb_ent)
 Return a lexicographical ordering table associated with a strided array of global numbers. More...
 
cs_lnum_tcs_order_gnum_i (const cs_lnum_t list[], const cs_gnum_t number[], const cs_lnum_t index[], size_t nb_ent)
 Return a lexicographical ordering table associated with an indexed array of global numbers. More...
 
void cs_order_gnum_allocated (const cs_lnum_t list[], const cs_gnum_t number[], cs_lnum_t order[], size_t nb_ent)
 Compute an ordering table associated with an array of global numbers. More...
 
void cs_order_gnum_allocated_s (const cs_lnum_t list[], const cs_gnum_t number[], size_t stride, cs_lnum_t order[], const size_t nb_ent)
 Compute a lexicographical ordering table associated with an array of strided global numbers. More...
 
void cs_order_gnum_allocated_i (const cs_lnum_t list[], const cs_gnum_t number[], const cs_lnum_t index[], cs_lnum_t order[], size_t nb_ent)
 Compute a lexicographical ordering table associated with an indexed array of global numbers. More...
 
void cs_order_lnum_allocated (const cs_lnum_t list[], const cs_lnum_t number[], cs_lnum_t order[], size_t nb_ent)
 Compute an ordering table associated with an array of local numbers. More...
 
void cs_order_lnum_allocated_s (const cs_lnum_t list[], const cs_lnum_t number[], size_t stride, cs_lnum_t order[], const size_t nb_ent)
 Compute a lexicographical ordering table associated with an array of strided local numbers. More...
 
void cs_order_real_allocated (const cs_lnum_t list[], const cs_real_t val[], cs_lnum_t order[], size_t nb_ent)
 Compute an ordering table associated with an array of local values. More...
 
cs_lnum_tcs_order_renumbering (const cs_lnum_t order[], size_t nb_ent)
 Build local renumbering array based on ordering of entities. More...
 
void cs_order_reorder_data (cs_lnum_t n_elts, size_t elt_size, const cs_lnum_t order[], void *data)
 Reorder data based on ordering array. More...
 
void cs_order_single_gnum (size_t n_ent, const cs_gnum_t base, const cs_gnum_t number[], size_t *n_single, cs_gnum_t *single[])
 Build a sorted array containing a single occurence of each global number in a given array. More...
 

Function Documentation

◆ cs_order_gnum()

cs_lnum_t* cs_order_gnum ( const cs_lnum_t  list[],
const cs_gnum_t  number[],
size_t  nb_ent 
)

Return an ordering table associated with an array of global numbers.

Parameters
[in]listoptional list (1 to n numbering) of selected entities (or NULL if all nb_ent are selected). This list may contain element numbers in any order
[in]numberarray of all entity numbers (number of entity i given by number[i] or number[list[i] - 1]) if list exists (if NULL, a default 1 to n numbering is considered)
[in]nb_entnumber of entities considered
Returns
pointer to list of nb_ent entities (0 to n-1 numbering) ordered by increasing associated number. The calling code is responsible for freeing this array when it is not needed anymore.

◆ cs_order_gnum_allocated()

void cs_order_gnum_allocated ( const cs_lnum_t  list[],
const cs_gnum_t  number[],
cs_lnum_t  order[],
size_t  nb_ent 
)

Compute an ordering table associated with an array of global numbers.

Parameters
[in]listoptional list (1 to n numbering) of selected entities (or NULL if all nb_ent are selected). This list may contain element numbers in any order
[in]numberarray of all entity numbers (number of entity i given by number[i] or number[list[i] - 1]) if list exists (if NULL, a default 1 to n numbering is considered)
[out]orderpointer to pre-allocated ordering table
[in]nb_entnumber of entities considered

◆ cs_order_gnum_allocated_i()

void cs_order_gnum_allocated_i ( const cs_lnum_t  list[],
const cs_gnum_t  number[],
const cs_lnum_t  index[],
cs_lnum_t  order[],
size_t  nb_ent 
)

Compute a lexicographical ordering table associated with an indexed array of global numbers.

Parameters
[in]listoptional list (1 to n numbering) of selected entities (or NULL if all nb_ent are selected). This list may contain element numbers in any order
[in]numberarray of all entity numbers (numbers of entity i start at index[i] or _index[i] (reduced index) if list exists). If list = NULL, a default 1 to n numbering is considered)
[in]indexnumber of values to compare for each entity (from 0)
[out]orderpointer to pre-allocated ordering table
[in]nb_entnumber of entities considered

◆ cs_order_gnum_allocated_s()

void cs_order_gnum_allocated_s ( const cs_lnum_t  list[],
const cs_gnum_t  number[],
size_t  stride,
cs_lnum_t  order[],
const size_t  nb_ent 
)

Compute a lexicographical ordering table associated with an array of strided global numbers.

Parameters
[in]listoptional list (1 to n numbering) of selected entities (or NULL if all nb_ent are selected). This list may contain element numbers in any order
[in]numberarray of all entity numbers (numbers of entity i start at number[i*stride] or number[(list[i] - 1)*stride]) if list exists (if NULL, a default 1 to n numbering is considered)
[in]stridestride of number array (number of values to compare)
[out]orderpointer to pre-allocated ordering table
[in]nb_entnumber of entities considered

◆ cs_order_gnum_i()

cs_lnum_t* cs_order_gnum_i ( const cs_lnum_t  list[],
const cs_gnum_t  number[],
const cs_lnum_t  index[],
size_t  nb_ent 
)

Return a lexicographical ordering table associated with an indexed array of global numbers.

Parameters
[in]listoptional list (1 to n numbering) of selected entities (or NULL if all nb_ent are selected). This list may contain element numbers in any order
[in]numberarray of all entity numbers (numbers of entity i start at index[i] or _index[i] (reduced index) if list exists). If list = NULL, a default 1 to n numbering is considered)
[in]indexnumber of values to compare for each entity
[in]nb_entnumber of entities considered
Returns
pointer to list of nb_ent entities (0 to n-1 numbering) ordered by increasing associated number. The calling code is responsible for freeing this array when it is not needed anymore.

◆ cs_order_gnum_s()

cs_lnum_t* cs_order_gnum_s ( const cs_lnum_t  list[],
const cs_gnum_t  number[],
size_t  stride,
size_t  nb_ent 
)

Return a lexicographical ordering table associated with a strided array of global numbers.

Parameters
[in]listoptional list (1 to n numbering) of selected entities (or NULL if all nb_ent are selected). This list may contain element numbers in any order
[in]numberarray of all entity numbers (number of entity i given by number[i] or number[list[i] - 1]) if list exists (if NULL, a default 1 to n numbering is considered)
[in]stridestride of number array (number of values to compare)
[in]nb_entnumber of entities considered
Returns
pointer to list of nb_ent entities (0 to n-1 numbering) ordered by increasing associated number. The calling code is responsible for freeing this array when it is not needed anymore.

◆ cs_order_gnum_test()

int cs_order_gnum_test ( const cs_lnum_t  list[],
const cs_gnum_t  number[],
size_t  nb_ent 
)

Test if an array of global numbers is ordered.

Parameters
[in]listoptional list (1 to n numbering) of selected entities (or NULL if all nb_ent are selected). This list may contain element numbers in any order
[in]numberarray of all entity numbers (number of entity i given by number[i] or number[list[i] - 1]) if list exists (if NULL, a default 1 to n numbering is considered)
[in]nb_entnumber of entities considered
Returns
1 if ordered, 0 otherwise.

◆ cs_order_lnum_allocated()

void cs_order_lnum_allocated ( const cs_lnum_t  list[],
const cs_lnum_t  number[],
cs_lnum_t  order[],
size_t  nb_ent 
)

Compute an ordering table associated with an array of local numbers.

Parameters
[in]listoptional list (1 to n numbering) of selected entities (or NULL if all nb_ent are selected). This list may contain element numbers in any order
[in]numberarray of all entity numbers (number of entity i given by number[i] or number[list[i] - 1]) if list exists (if NULL, a default 1 to n numbering is considered)
[out]orderpointer to pre-allocated ordering table
[in]nb_entnumber of entities considered

◆ cs_order_lnum_allocated_s()

void cs_order_lnum_allocated_s ( const cs_lnum_t  list[],
const cs_lnum_t  number[],
size_t  stride,
cs_lnum_t  order[],
const size_t  nb_ent 
)

Compute a lexicographical ordering table associated with an array of strided local numbers.

Parameters
[in]listoptional list (1 to n numbering) of selected entities (or NULL if all nb_ent are selected). This list may contain element numbers in any order
[in]numberarray of all entity numbers (numbers of entity i start at number[i*stride] or number[(list[i] - 1)*stride]) if list exists (if NULL, a default 1 to n numbering is considered)
[in]stridestride of number array (number of values to compare)
[out]orderpointer to pre-allocated ordering table
[in]nb_entnumber of entities considered

◆ cs_order_real_allocated()

void cs_order_real_allocated ( const cs_lnum_t  list[],
const cs_real_t  val[],
cs_lnum_t  order[],
size_t  nb_ent 
)

Compute an ordering table associated with an array of local values.

Parameters
[in]listoptional list (1 to n numbering) of selected entities (or NULL if all nb_ent are selected). This list may contain element numbers in any order
[in]valarray of all entity values (value of entity i given by value[i] or value[list[i] - 1]) if list exists
[out]orderpointer to pre-allocated ordering table
[in]nb_entnumber of entities considered

◆ cs_order_renumbering()

cs_lnum_t* cs_order_renumbering ( const cs_lnum_t  order[],
size_t  nb_ent 
)

Build local renumbering array based on ordering of entities.

Parameters
[in]order0 to n-1 ordering of entities by increasing attribute
[in]nb_entnumber of entities considered
Returns
pointer to renumbering array (0 to n-1 numbering) indicating the new index of renumbered entities; The calling code is responsible for freeing this array when it is not needed anymore.

◆ cs_order_reorder_data()

void cs_order_reorder_data ( cs_lnum_t  n_elts,
size_t  elt_size,
const cs_lnum_t  order[],
void *  data 
)

Reorder data based on ordering array.

Parameters
[in]n_eltsnumber of elements
[in]elt_sizeelement size
[in]orderreordering array
[in,out]datadata
Returns
new size of data

◆ cs_order_single_gnum()

void cs_order_single_gnum ( size_t  n_ent,
const cs_gnum_t  base,
const cs_gnum_t  number[],
size_t *  n_single,
cs_gnum_t single[] 
)

Build a sorted array containing a single occurence of each global number in a given array.

Global numbers under a given "base" value are extruded.

The caller is responsible for freeing the returned array.

Parameters
[in]n_entsize of input array
[in]basebase id; numbers lower than this are dropped
[in]numberarray containing of all referenced entity numbers
[out]n_singlearray number of single occurences >= base
[out]singlesorted array of unique numbers >= base