![]() |
programmer's documentation
|
#include <stdio.h>
Go to the source code of this file.
Data Structures | |
struct | cs_tmpbuf_t |
struct | cs_locmat_t |
struct | cs_connect_index_t |
union | cs_data_t |
struct | cs_data_info_t |
Enumerations | |
enum | cs_toolbox_type_sum_t { CS_TOOLBOX_SUM, CS_TOOLBOX_WSUM, CS_TOOLBOX_SUMABS, CS_TOOLBOX_WSUMABS, CS_TOOLBOX_SUM2, CS_TOOLBOX_WSUM2, CS_TOOLBOX_N_SUM_TYPES } |
Functions | |
double | _dp3 (const cs_real_3_t u, const cs_real_3_t v) |
Compute a dot product for vector of dimension 3. More... | |
double | _n3 (const cs_real_3_t v) |
Compute the euclidean norm of a vector of dimension 3. More... | |
double | _length3 (const cs_real_3_t xa, const cs_real_3_t xb) |
Compute the length (euclidien norm) between two points xa and xb in a cartesian coordinate system of dimension 3. More... | |
void | _lenunit3 (const cs_real_3_t xa, const cs_real_3_t xb, cs_real_t *len, cs_real_3_t *unit) |
Compute the length (euclidien norm) between two points xa and xb in a cartesian coordinate system of dimension 3. More... | |
void | _cp3 (const cs_real_3_t u, const cs_real_3_t v, cs_real_3_t *w) |
Compute the cross product of a vector of dimension 3. More... | |
void | _mv3 (const cs_real_t m[3][3], const cs_real_t v[3], cs_real_t mv[3]) |
Compute the 3x3 matrice by vector product. More... | |
cs_real_t | _detmat33 (const cs_real_t m[3][3]) |
Compute the determinant of a 3x3 matrix. More... | |
void | _invmat33 (const cs_real_t in[3][3], cs_real_t inv[3][3]) |
Inverse a 3x3 matrix. More... | |
void | cs_toolbox_init (cs_lnum_t ref_size) |
Allocate and initialize a private structure for this file used for reducing round-off errors during summation. More... | |
void | cs_toolbox_finalize (void) |
Free a private structure for this file used for reducing round-off errors during summation. More... | |
void | cs_eigen_mat33 (const cs_real_t m[3][3], cs_real_t *eig_ratio, cs_real_t *eig_max) |
Compute the eigenvalues of a 3x3 matrix which is symmetric and real -> Oliver K. Smith "eigenvalues of a symmetric 3x3 matrix", Communication of the ACM (April 1961) -> Wikipedia article entitled "Eigenvalue algorithm". More... | |
double | cs_surftri (const cs_real_3_t xv, const cs_real_3_t xe, const cs_real_3_t xf) |
Compute the area of the convex_hull generated by 3 points. This corresponds to the computation of the surface of a triangle. More... | |
double | cs_voltet (const cs_real_3_t xv, const cs_real_3_t xe, const cs_real_3_t xf, const cs_real_3_t xc) |
Compute the volume of the convex_hull generated by 4 points. This is equivalent to the computation of the volume of a tetrahedron. More... | |
void | cs_daxpy (int size, double alpha, const cs_real_t x[], cs_real_t beta, const cs_real_t y[], cs_real_t *p_z[], bool reset) |
Compute alpha*x + beta*y = p_z. More... | |
double | cs_dp (int size, const double v[], const double w[]) |
Compute the dot product of two vectors of dimension "size" This algorithm tries to reduce round-off error thanks to intermediate sums. 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_sum (cs_lnum_t size, const double v[], const double w[], cs_toolbox_type_sum_t op) |
Compute by default the sum of the elements of an array of double Additional operation are also possible: square, abs This algorithm tries to reduce round-off errors thanks to intermediate sums. 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 struct. A -> B create a new index B -> A. More... | |
void | cs_index_sort (cs_connect_index_t *x) |
Sort each 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_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... | |
|
inline |
Compute the cross product of a vector of dimension 3.
[in] | u | first vector |
[in] | v | second vector |
[out] | w | result of u x v |
Compute the determinant of a 3x3 matrix.
[in] | m | 3x3 matrix |
[in] | m | matrix |
|
inline |
Compute a dot product for vector of dimension 3.
[in] | u | first vector |
[in] | v | second vector |
Inverse a 3x3 matrix.
[in] | in | matrix to inverse |
[out] | inv | inversed matrix |
|
inline |
Compute the length (euclidien norm) between two points xa and xb in a cartesian coordinate system of dimension 3.
[in] | xa | first coordinate |
[in] | xb | second coordinate |
|
inline |
Compute the length (euclidien norm) between two points xa and xb in a cartesian coordinate system of dimension 3.
[in] | xa | coordinate of the first extremity |
[in] | xb | coordinate of the second extremity |
[out] | len | pointer to the length of the vector va -> vb |
[out] | unit | unitary vector anlong va -> vb |
Compute the 3x3 matrice by vector product.
[in] | m | a 3x3 matrix |
[in] | v | a vector |
[in,out] | mv | pointer to the vector resulting of the matrix-vector op. |
|
inline |
Compute the euclidean norm of a vector of dimension 3.
[in] | v |
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 |
void cs_daxpy | ( | int | size, |
double | alpha, | ||
const cs_real_t | x[], | ||
cs_real_t | beta, | ||
const cs_real_t | y[], | ||
cs_real_t * | p_z[], | ||
bool | reset | ||
) |
Compute alpha*x + beta*y = p_z.
[in] | size | vector dimension |
[in] | alpha | coefficient for x vector |
[in] | x | first vector |
[in] | beta | coefficient for y vector |
[in] | y | second vector |
[in,out] | p_z | resulting vector (allocated if NULL) |
[in] | reset | reset z vector before computation |
double cs_dp | ( | int | size, |
const double | v[], | ||
const double | w[] | ||
) |
Compute the dot product of two vectors of dimension "size" This algorithm tries to reduce round-off error thanks to intermediate sums.
[in] | size | vector dimension |
[in] | v | first vector |
[in] | w | second vector |
Compute the eigenvalues of a 3x3 matrix which is symmetric and real -> Oliver K. Smith "eigenvalues of a symmetric 3x3 matrix", Communication of the ACM (April 1961) -> Wikipedia article entitled "Eigenvalue algorithm".
[in] | m | 3x3 matrix |
[out] | eig_ratio | max/min |
[out] | eig_max | max. eigenvalue |
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 list related to an entry in a cs_connect_index_t structure.
[in] | x | pointer to 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 struct. A -> B create a new index B -> A.
[in] | nb | size of the "b" set |
[in] | a2b | pointer to the index A -> B |
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 |
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 |
double cs_sum | ( | cs_lnum_t | size, |
const double | v[], | ||
const double | w[], | ||
cs_toolbox_type_sum_t | op | ||
) |
Compute by default the sum of the elements of an array of double Additional operation are also possible: square, abs This algorithm tries to reduce round-off errors thanks to intermediate sums.
[in] | size | array dimension |
[in] | v | values |
[in] | w | weights (possibly NULL) |
[in] | op | operation to do when doing the sum |
double cs_surftri | ( | const cs_real_3_t | xv, |
const cs_real_3_t | xe, | ||
const cs_real_3_t | xf | ||
) |
Compute the area of the convex_hull generated by 3 points. This corresponds to the computation of the surface of a triangle.
[in] | xv | |
[in] | xe | |
[in] | xf |
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 |
void cs_toolbox_finalize | ( | void | ) |
Free a private structure for this file used for reducing round-off errors during summation.
void cs_toolbox_init | ( | cs_lnum_t | ref_size | ) |
Allocate and initialize a private structure for this file used for reducing round-off errors during summation.
[in] | ref_size | reference array dimension |
double cs_voltet | ( | const cs_real_3_t | xv, |
const cs_real_3_t | xe, | ||
const cs_real_3_t | xf, | ||
const cs_real_3_t | xc | ||
) |
Compute the volume of the convex_hull generated by 4 points. This is equivalent to the computation of the volume of a tetrahedron.
[in] | xv | |
[in] | xe | |
[in] | xf | |
[in] | xc |