![]() |
programmer's documentation
|
#include "cs_defs.h"
#include <stdlib.h>
#include <assert.h>
#include <float.h>
#include <limits.h>
#include <string.h>
#include <bft_mem.h>
#include <bft_printf.h>
#include "cs_cdo.h"
#include "cs_blas.h"
#include "cs_math.h"
#include "cs_sort.h"
#include "cs_cdo_toolbox.h"
Functions | |
static cs_data_info_t | _init_dinfo (cs_datatype_t datatype) |
Intialize by default a cs_data_info_t structure according to the datatype. More... | |
static void | _compute_info_double (cs_lnum_t n_elts, const cs_real_t data[], cs_data_info_t *info) |
Compute simple information about an array of data. >> Algorithm from Mark Hoemmen (U.C. Berkeley) More... | |
static void | _compute_info_int32 (cs_lnum_t n_elts, const cs_lnum_t data[], cs_data_info_t *info) |
Compute simple information about an array of data. >> Algorithm from Mark Hoemmen (U.C. Berkeley) More... | |
double | cs_euclidean_norm (int len, const double v[]) |
Compute the euclidean norm 2 of a vector of size len This algorithm tries to reduce round-off error thanks to intermediate sums. More... | |
double | cs_weighted_sum_square (cs_lnum_t n, const double *restrict x, const double *restrict weight) |
Compute the weighted sum of square values of an array. More... | |
void | cs_tmpbuf_alloc (size_t bufsize, cs_tmpbuf_t **p_tb) |
Allocate or reallocate a temporary buffer structure. More... | |
cs_tmpbuf_t * | cs_tmpbuf_free (cs_tmpbuf_t *tb) |
Free a temporary buffer structure. More... | |
cs_data_info_t | cs_analysis_data (cs_lnum_t n_elts, int stride, cs_datatype_t datatype, const void *indata, _Bool do_abs) |
Compute some simple statistics from an array. More... | |
void | cs_data_info_dump (const char *name, FILE *f, cs_lnum_t n_elts, cs_datatype_t datatype, const cs_data_info_t dinfo) |
Dump a cs_data_info_t structure. More... | |
cs_connect_index_t * | cs_index_create (int n) |
Create an index structure of size n. More... | |
cs_connect_index_t * | cs_index_map (int n, int *idx, int *ids) |
Map arrays into an index structure of size n (owner = false) More... | |
void | cs_index_free (cs_connect_index_t **pidx) |
Destroy a cs_connect_index_t structure. More... | |
cs_connect_index_t * | cs_index_compose (int nc, const cs_connect_index_t *a2b, const cs_connect_index_t *b2c) |
From 2 indexes : A -> B and B -> C create a new index A -> C. More... | |
cs_connect_index_t * | cs_index_transpose (int nb, const cs_connect_index_t *a2b) |
From a cs_connect_index_t A -> B create a new index B -> A. More... | |
void | cs_index_sort (cs_connect_index_t *x) |
Sort each sub-list related to an entry in a cs_connect_index_t structure. More... | |
void | cs_index_dump (const char *name, FILE *_f, cs_connect_index_t *x) |
Dump a cs_connect_index_t structure to a file or into the standard output. More... | |
cs_locmat_t * | cs_locmat_create (int n_max_ent) |
Allocate and initialize a cs_locmat_t structure. More... | |
cs_locmat_t * | cs_locmat_free (cs_locmat_t *lm) |
Free a cs_locmat_t structure. More... | |
void | cs_locmat_copy (cs_locmat_t *recv, const cs_locmat_t *send) |
Copy a cs_locmat_t structure into another cs_locmat_t structure which has been already allocated. More... | |
void | cs_locmat_matvec (const cs_locmat_t *loc, const cs_real_t *vec, cs_real_t *matvec) |
Compute a local dense matrix-vector product matvec has been previously allocated. More... | |
void | cs_locmat_add (cs_locmat_t *loc, const cs_locmat_t *add) |
Add two local dense matrices: loc += add. More... | |
void | cs_locmat_mult_add (cs_locmat_t *loc, double alpha, const cs_locmat_t *add) |
Give the result of the following operation: loc = loc + alpha*add. More... | |
void | cs_locmat_add_transpose (cs_locmat_t *loc, cs_locmat_t *tr) |
Define a new matrix by adding a local matrix with its transpose. Keep the transposed matrix for future use. More... | |
void | cs_locmat_dump (int parent_id, const cs_locmat_t *lm) |
Dump a local discrete Hodge operator. More... | |
cs_locdec_t * | cs_locdec_create (int n_max_rows, int n_max_cols) |
Allocate and initialize a cs_locdec_t structure. More... | |
cs_locdec_t * | cs_locdec_free (cs_locdec_t *m) |
Free a cs_locdec_t structure. More... | |
|
static |
Compute simple information about an array of data. >> Algorithm from Mark Hoemmen (U.C. Berkeley)
[in] | n_elts | number of couples in data |
[in] | data | buffer containing input data |
[in,out] | info | pointer to a cs_data_info_t structure |
|
static |
Compute simple information about an array of data. >> Algorithm from Mark Hoemmen (U.C. Berkeley)
[in] | n_elts | number of couples in data |
[in] | data | buffer containing input data |
[in,out] | info | pointer to a cs_data_info_t structure |
|
static |
Intialize by default a cs_data_info_t structure according to the datatype.
[in] | datatype |
cs_data_info_t cs_analysis_data | ( | cs_lnum_t | n_elts, |
int | stride, | ||
cs_datatype_t | datatype, | ||
const void * | indata, | ||
_Bool | do_abs | ||
) |
Compute some simple statistics from an array.
[in] | n_elts | number of couples in data |
[in] | stride | size of a couple of data |
[in] | datatype | datatype |
[in] | indata | buffer containing input data |
[in] | do_abs | analyse the absolute value of indata |
void cs_data_info_dump | ( | const char * | name, |
FILE * | f, | ||
cs_lnum_t | n_elts, | ||
cs_datatype_t | datatype, | ||
const cs_data_info_t | dinfo | ||
) |
Dump a cs_data_info_t structure.
[in] | name | filename if not NULL |
[in] | f | output file if not NULL |
[in] | n_elts | number of couples in data |
[in] | datatype | datatype |
[in] | dinfo | cs_data_info_t structure |
double cs_euclidean_norm | ( | int | len, |
const double | v[] | ||
) |
Compute the euclidean norm 2 of a vector of size len This algorithm tries to reduce round-off error thanks to intermediate sums.
[in] | len | vector dimension |
[in] | v | vector |
cs_connect_index_t* cs_index_compose | ( | int | nc, |
const cs_connect_index_t * | a2b, | ||
const cs_connect_index_t * | b2c | ||
) |
From 2 indexes : A -> B and B -> C create a new index A -> C.
[in] | nc | number of elements in C set |
[in] | a2b | pointer to the index A -> B |
[in] | b2c | pointer to the index B -> C |
cs_connect_index_t* cs_index_create | ( | int | n | ) |
Create an index structure of size n.
[in] | n | number of entries of the indexed list |
void cs_index_dump | ( | const char * | name, |
FILE * | _f, | ||
cs_connect_index_t * | x | ||
) |
Dump a cs_connect_index_t structure to a file or into the standard output.
[in] | name | name of the dump file. Can be set to NULL |
[in] | _f | pointer to a FILE structure. Can be set to NULL. |
[in] | x | pointer to a cs_connect_index_t structure |
void cs_index_free | ( | cs_connect_index_t ** | pidx | ) |
Destroy a cs_connect_index_t structure.
[in] | pidx | pointer of pointer to a cs_connect_index_t structure |
cs_connect_index_t* cs_index_map | ( | int | n, |
int * | idx, | ||
int * | ids | ||
) |
Map arrays into an index structure of size n (owner = false)
[in] | n | number of entries of the indexed list |
[in] | idx | array of size n+1 |
[in] | ids | array of size idx[n] |
void cs_index_sort | ( | cs_connect_index_t * | x | ) |
Sort each sub-list related to an entry in a cs_connect_index_t structure.
Sort each list related to an entry in a cs_connect_index_t structure.
[in] | x | pointer to a cs_connect_index_t structure |
cs_connect_index_t* cs_index_transpose | ( | int | nb, |
const cs_connect_index_t * | a2b | ||
) |
From a cs_connect_index_t A -> B create a new index B -> A.
From a cs_connect_index_t struct. A -> B create a new index B -> A.
[in] | nb | size of the "b" set |
[in] | a2b | pointer to the index A -> B |
cs_locdec_t* cs_locdec_create | ( | int | n_max_rows, |
int | n_max_cols | ||
) |
Allocate and initialize a cs_locdec_t structure.
[in] | n_max_rows | max number of rows |
[in] | n_max_cols | max number of columns |
cs_locdec_t* cs_locdec_free | ( | cs_locdec_t * | m | ) |
Free a cs_locdec_t structure.
[in,out] | m | pointer to a cs_locdec_t structure to free |
void cs_locmat_add | ( | cs_locmat_t * | loc, |
const cs_locmat_t * | add | ||
) |
Add two local dense matrices: loc += add.
[in,out] | loc | local matrix storing the result |
[in] | add | values to add to loc |
void cs_locmat_add_transpose | ( | cs_locmat_t * | loc, |
cs_locmat_t * | tr | ||
) |
Define a new matrix by adding a local matrix with its transpose. Keep the transposed matrix for future use.
[in,out] | loc | local matrix to transpose and add |
[in,out] | tr | transposed of the local matrix |
void cs_locmat_copy | ( | cs_locmat_t * | recv, |
const cs_locmat_t * | send | ||
) |
Copy a cs_locmat_t structure into another cs_locmat_t structure which has been already allocated.
[in,out] | recv | pointer to a cs_locmat_t struct. |
[in] | send | pointer to a cs_locmat_t struct. |
cs_locmat_t* cs_locmat_create | ( | int | n_max_ent | ) |
Allocate and initialize a cs_locmat_t structure.
[in] | n_max_ent | max number of entities |
void cs_locmat_dump | ( | int | parent_id, |
const cs_locmat_t * | lm | ||
) |
Dump a local discrete Hodge operator.
[in] | parent_id | id of the related parent entity |
[in] | lm | pointer to the cs_sla_locmat_t struct. |
cs_locmat_t* cs_locmat_free | ( | cs_locmat_t * | lm | ) |
Free a cs_locmat_t structure.
[in] | lm | pointer to a cs_locmat_t struct. to free |
void cs_locmat_matvec | ( | const cs_locmat_t * | loc, |
const cs_real_t * | vec, | ||
cs_real_t * | matvec | ||
) |
Compute a local dense matrix-vector product matvec has been previously allocated.
[in] | loc | local matrix to use |
[in] | vec | local vector to use |
[in,out] | matvec | result of the local matrix-vector product |
void cs_locmat_mult_add | ( | cs_locmat_t * | loc, |
double | alpha, | ||
const cs_locmat_t * | add | ||
) |
Give the result of the following operation: loc = loc + alpha*add.
[in,out] | loc | local matrix storing the result |
[in] | alpha | multiplicative coefficient |
[in] | add | values to add to loc |
void cs_tmpbuf_alloc | ( | size_t | bufsize, |
cs_tmpbuf_t ** | p_tb | ||
) |
Allocate or reallocate a temporary buffer structure.
[in] | bufsize | reference size |
[in,out] | p_tb | pointer to the temporary structure to allocate |
cs_tmpbuf_t* cs_tmpbuf_free | ( | cs_tmpbuf_t * | tb | ) |
Free a temporary buffer structure.
[in] | tb | pointer to the temporary structure to free |
double cs_weighted_sum_square | ( | cs_lnum_t | n, |
const double *restrict | x, | ||
const double *restrict | weight | ||
) |
Compute the weighted sum of square values of an array.
[in] | n | size of arrays x and weight |
[in] | x | array of floating-point values |
[in] | weight | floating-point values of weights |