#include "cs_defs.h"
#include <array>
#include <assert.h>
#include <float.h>
#include <limits.h>
#include <math.h>
#include <string.h>
#include <bft_mem.h>
#include "cs_array.h"
#include "cs_array_reduce.h"
#include "cs_log.h"
#include "cs_order.h"
#include "cs_parall.h"
#include "cs_param_cdo.h"
#include "cs_prototypes.h"
#include "cs_cdo_quantities.h"
Functions | |
long long | cs_cdo_quantities_get_time_perfo (void) |
Retrieve the time elapsed to build the cs_cdo_quantities_t structure. More... | |
void | cs_cdo_quantities_set (cs_flag_t option_flag) |
Set which quantities have to be computed. Additionnal quantities are added to cs_cdo_quantities_flag (static variable) More... | |
void | cs_cdo_quantities_set_algo_ccenter (cs_cdo_quantities_cell_center_algo_t algo) |
Set the type of algorithm to use for computing the cell center. More... | |
cs_cdo_quantities_t * | cs_cdo_quantities_build (const cs_mesh_t *m, const cs_mesh_quantities_t *mq, const cs_cdo_connect_t *topo) |
Build a cs_cdo_quantities_t structure. Some quantities are shared with the cs_mesh_quantities_t structure and other are not built according to the given flags in cs_cdo_quantities_flag. More... | |
cs_cdo_quantities_t * | cs_cdo_quantities_free (cs_cdo_quantities_t *cdoq) |
Destroy a cs_cdo_quantities_t structure. More... | |
void | cs_cdo_quantities_log_summary (const cs_cdo_quantities_t *cdoq) |
Summarize generic information about the cdo mesh quantities. More... | |
void | cs_cdo_quantities_dump (const cs_cdo_quantities_t *cdoq) |
Dump a cs_cdo_quantities_t structure (for debuggingpurpose) More... | |
const cs_real_t * | cs_cdo_quantities_get_pvol_fc (const cs_cdo_quantities_t *cdoq, const cs_adjacency_t *c2f) |
Retrieve the portion of volume surrounding each face of a cell. This volume corresponds to a pyramid with base f and apex x_f. If this quantity does not exist, then one computes it and stores it inside the cdoq structures. The computed quantity is scanned with the c2f adjacency structure. More... | |
void | cs_cdo_quantities_compute_pvol_fc (const cs_cdo_quantities_t *cdoq, const cs_adjacency_t *c2f, cs_real_t **p_pvol_fc) |
Compute the portion of volume surrounding each face of a cell. This volume corresponds to a pyramid with base f and apex x_f The computed quantity is scanned with the c2f adjacency. More... | |
const cs_real_t * | cs_cdo_quantities_get_pvol_ec (const cs_cdo_quantities_t *cdoq, const cs_adjacency_t *c2e) |
Retrieve the portion of volume surrounding each edge of a cell. This volume corresponds to an octahedron with a vertical axis defined by the edge. If this quantity does not exist, then one computes it and stores it inside the cdoq structures. The computed quantity is scanned with the c2e adjacency structure. More... | |
void | cs_cdo_quantities_compute_pvol_ec (const cs_cdo_quantities_t *cdoq, const cs_adjacency_t *c2e, cs_real_t **p_pvol_ec) |
Compute the portion of volume surrounding each edge of a cell. The computed quantity is scanned with the c2e adjacency structure. More... | |
const cs_real_t * | cs_cdo_quantities_get_dual_volumes (cs_cdo_quantities_t *cdoq, const cs_cdo_connect_t *connect) |
Compute or retrieve the dual volume surrounding each vertex. The parallel operation (sum reduction) is performed inside this function so that the full dual volume (i.e. taking into account all ranks) is computed. The sum of all the portions of dual cell associated to a vertex in each cell is taken into account. More... | |
void | cs_cdo_quantities_compute_dual_volumes (const cs_cdo_quantities_t *cdoq, const cs_cdo_connect_t *connect, cs_real_t **p_dual_vol) |
Compute the dual volume surrounding each vertex. The parallel operation (sum reduction) is performed inside this function so that the full dual volume (i.e. taking into account all ranks) is computed. The sum of all the portions of dual cell associated to a vertex in each cell is taken into account. More... | |
void | cs_cdo_quantities_compute_i_tef (const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq, cs_lnum_t f_id, cs_real_t tef[]) |
Compute the area of the triangles with basis each edge of the face and apex the face center. Case of interior faces. Storage in agreement with the if2v adjacency structure. More... | |
void | cs_cdo_quantities_compute_b_tef (const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq, cs_lnum_t bf_id, cs_real_t tef[]) |
Compute the area of the triangles with basis each edge of the face and apex the face center. Case of boundary faces. Storage in agreement with the bf2v adjacency structure. More... | |
void | cs_cdo_quantities_compute_i_wvf (const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq, cs_lnum_t f_id, cs_real_t wvf[]) |
Compute the weight related to each vertex of a face. This weight ensures a 2nd order approximation if the face center is the face barycenter. Case of interior faces. More... | |
void | cs_cdo_quantities_compute_b_wvf (const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq, cs_lnum_t bf_id, cs_real_t wvf[]) |
Compute the weight related to each vertex of a face. This weight ensures a 2nd order approximation if the face center is the face barycenter. Case of boundary faces. More... | |
cs_quant_t | cs_quant_set_face (cs_lnum_t f_id, const cs_cdo_quantities_t *cdoq) |
Define a cs_quant_t structure for a primal face (interior or border) More... | |
cs_nvec3_t | cs_quant_set_face_nvec (cs_lnum_t f_id, const cs_cdo_quantities_t *cdoq) |
Retrieve the face surface and its unit normal vector for a primal face (interior or border) More... | |
cs_quant_t | cs_quant_get_edge_center (cs_lnum_t e_id, const cs_cdo_connect_t *topo, const cs_cdo_quantities_t *cdoq) |
Retrieve the edge center for a primal edge (interior or border) More... | |
cs_nvec3_t | cs_quant_set_edge_nvec (cs_lnum_t e_id, const cs_cdo_quantities_t *cdoq) |
Get the normalized vector associated to a primal edge. More... | |
cs_nvec3_t | cs_quant_set_dedge_nvec (cs_lnum_t shift, const cs_cdo_quantities_t *cdoq) |
Get the two normalized vector associated to a dual edge. More... | |
void | cs_quant_dump (FILE *f, cs_lnum_t num, const cs_quant_t q) |
Dump a cs_quant_t structure. More... | |
Variables | |
static long long | cs_cdo_quantities_time = 0 |
cs_flag_t | cs_cdo_quantities_flag = 0 |
cs_cdo_quantities_cell_center_algo_t | cs_cdo_cell_center_algo = CS_CDO_QUANTITIES_BARYC_CENTER |
cs_cdo_quantities_t * cs_cdo_quantities_build | ( | const cs_mesh_t * | m, |
const cs_mesh_quantities_t * | mq, | ||
const cs_cdo_connect_t * | topo | ||
) |
Build a cs_cdo_quantities_t structure. Some quantities are shared with the cs_mesh_quantities_t structure and other are not built according to the given flags in cs_cdo_quantities_flag.
[in] | m | pointer to a cs_mesh_t structure |
[in] | mq | pointer to a cs_mesh_quantities_t structure |
[in] | topo | pointer to a cs_cdo_connect_t structure |
void cs_cdo_quantities_compute_b_tef | ( | const cs_cdo_connect_t * | connect, |
const cs_cdo_quantities_t * | cdoq, | ||
cs_lnum_t | bf_id, | ||
cs_real_t | tef[] | ||
) |
Compute the area of the triangles with basis each edge of the face and apex the face center. Case of boundary faces. Storage in agreement with the bf2v adjacency structure.
[in] | connect | pointer to a cs_cdo_connect_t structure |
[in] | cdoq | pointer to a cs_cdo_quantities_t structure |
[in] | bf_id | border face id |
[in,out] | tef | quantities to compute (pre-allocated) |
void cs_cdo_quantities_compute_b_wvf | ( | const cs_cdo_connect_t * | connect, |
const cs_cdo_quantities_t * | cdoq, | ||
cs_lnum_t | bf_id, | ||
cs_real_t | wvf[] | ||
) |
Compute the weight related to each vertex of a face. This weight ensures a 2nd order approximation if the face center is the face barycenter. Case of boundary faces.
[in] | connect | pointer to a cs_cdo_connect_t structure |
[in] | cdoq | pointer to a cs_cdo_quantities_t structure |
[in] | bf_id | border face id |
[in,out] | wvf | quantities to compute (pre-allocated) |
void cs_cdo_quantities_compute_dual_volumes | ( | const cs_cdo_quantities_t * | cdoq, |
const cs_cdo_connect_t * | connect, | ||
cs_real_t ** | p_dual_vol | ||
) |
Compute the dual volume surrounding each vertex. The parallel operation (sum reduction) is performed inside this function so that the full dual volume (i.e. taking into account all ranks) is computed. The sum of all the portions of dual cell associated to a vertex in each cell is taken into account.
[in] | cdoq | additional quantities for CDO schemes |
[in] | connect | additional connectivities for CDO schemes |
[in,out] | p_dual_vol | double pointer to the dual volumes related to each vertex. Allocated if nullptr. |
void cs_cdo_quantities_compute_i_tef | ( | const cs_cdo_connect_t * | connect, |
const cs_cdo_quantities_t * | cdoq, | ||
cs_lnum_t | f_id, | ||
cs_real_t | tef[] | ||
) |
Compute the area of the triangles with basis each edge of the face and apex the face center. Case of interior faces. Storage in agreement with the if2v adjacency structure.
Compute the area of the triangles with basis each edge of the face and apex the face center. Case of interior faces. Storage in agreement with the bf2v adjacency structure.
[in] | connect | pointer to a cs_cdo_connect_t structure |
[in] | cdoq | pointer to a cs_cdo_quantities_t structure |
[in] | f_id | interior face id |
[in,out] | tef | quantities to compute (pre-allocated) |
void cs_cdo_quantities_compute_i_wvf | ( | const cs_cdo_connect_t * | connect, |
const cs_cdo_quantities_t * | cdoq, | ||
cs_lnum_t | f_id, | ||
cs_real_t | wvf[] | ||
) |
Compute the weight related to each vertex of a face. This weight ensures a 2nd order approximation if the face center is the face barycenter. Case of interior faces.
[in] | connect | pointer to a cs_cdo_connect_t structure |
[in] | cdoq | pointer to a cs_cdo_quantities_t structure |
[in] | f_id | interior face id |
[in,out] | wvf | quantities to compute (pre-allocated) |
void cs_cdo_quantities_compute_pvol_ec | ( | const cs_cdo_quantities_t * | cdoq, |
const cs_adjacency_t * | c2e, | ||
cs_real_t ** | p_pvol_ec | ||
) |
Compute the portion of volume surrounding each edge of a cell. The computed quantity is scanned with the c2e adjacency structure.
[in] | cdoq | pointer to cs_cdo_quantities_t structure |
[in] | c2e | pointer to the cell --> edges connectivity |
[in,out] | p_pvol_ec | double pointer to the edge volume in each cell If not allocated before calling this function, one allocates the array storing the volumes |
void cs_cdo_quantities_compute_pvol_fc | ( | const cs_cdo_quantities_t * | cdoq, |
const cs_adjacency_t * | c2f, | ||
cs_real_t ** | p_pvol_fc | ||
) |
Compute the portion of volume surrounding each face of a cell. This volume corresponds to a pyramid with base f and apex x_f The computed quantity is scanned with the c2f adjacency.
Compute the portion of volume surrounding each face of a cell. This volume corresponds to a pyramid with base f and apex x_f The computed quantity is scanned with the c2f adjacency structure.
[in] | cdoq | pointer to cs_cdo_quantities_t structure |
[in] | c2f | pointer to the cell --> faces connectivity |
[in,out] | p_pvol_fc | double pointer to the face volume in each cell If not allocated before calling this function, one allocates the array storing the volumes |
void cs_cdo_quantities_dump | ( | const cs_cdo_quantities_t * | cdoq | ) |
Dump a cs_cdo_quantities_t structure (for debuggingpurpose)
[in] | cdoq | pointer to cs_cdo_quantities_t structure |
cs_cdo_quantities_t * cs_cdo_quantities_free | ( | cs_cdo_quantities_t * | cdoq | ) |
Destroy a cs_cdo_quantities_t structure.
[in] | cdoq | pointer to structure to free |
const cs_real_t * cs_cdo_quantities_get_dual_volumes | ( | cs_cdo_quantities_t * | cdoq, |
const cs_cdo_connect_t * | connect | ||
) |
Compute or retrieve the dual volume surrounding each vertex. The parallel operation (sum reduction) is performed inside this function so that the full dual volume (i.e. taking into account all ranks) is computed. The sum of all the portions of dual cell associated to a vertex in each cell is taken into account.
[in,out] | cdoq | additional quantities for CDO schemes |
[in] | connect | additional connectivities for CDO schemes |
const cs_real_t * cs_cdo_quantities_get_pvol_ec | ( | const cs_cdo_quantities_t * | cdoq, |
const cs_adjacency_t * | c2e | ||
) |
Retrieve the portion of volume surrounding each edge of a cell. This volume corresponds to an octahedron with a vertical axis defined by the edge. If this quantity does not exist, then one computes it and stores it inside the cdoq structures. The computed quantity is scanned with the c2e adjacency structure.
[in] | cdoq | pointer to cs_cdo_quantities_t structure |
[in] | c2e | pointer to the cell --> edges connectivity |
const cs_real_t * cs_cdo_quantities_get_pvol_fc | ( | const cs_cdo_quantities_t * | cdoq, |
const cs_adjacency_t * | c2f | ||
) |
Retrieve the portion of volume surrounding each face of a cell. This volume corresponds to a pyramid with base f and apex x_f. If this quantity does not exist, then one computes it and stores it inside the cdoq structures. The computed quantity is scanned with the c2f adjacency structure.
Retrieve the portion of volume surrounding each face of a cell. This volume corresponds to a pyramid with base f and apex x_f The computed quantity is scanned with the c2f adjacency structure.
[in] | cdoq | pointer to cs_cdo_quantities_t structure |
[in] | c2f | pointer to the cell --> faces connectivity |
long long cs_cdo_quantities_get_time_perfo | ( | void | ) |
Retrieve the time elapsed to build the cs_cdo_quantities_t structure.
void cs_cdo_quantities_log_summary | ( | const cs_cdo_quantities_t * | cdoq | ) |
Summarize generic information about the cdo mesh quantities.
[in] | cdoq | pointer to cs_cdo_quantities_t structure |
void cs_cdo_quantities_set | ( | cs_flag_t | option_flag | ) |
Set which quantities have to be computed. Additionnal quantities are added to cs_cdo_quantities_flag (static variable)
[in] | option_flag | flag to set geometrical quantities to compute |
void cs_cdo_quantities_set_algo_ccenter | ( | cs_cdo_quantities_cell_center_algo_t | algo | ) |
Set the type of algorithm to use for computing the cell center.
[in] | algo | type of algorithm |
void cs_quant_dump | ( | FILE * | f, |
cs_lnum_t | num, | ||
const cs_quant_t | q | ||
) |
Dump a cs_quant_t structure.
[in] | f | FILE struct (stdout if nullptr) |
[in] | num | entity number related to this quantity struct. |
[in] | q | cs_quant_t structure to dump |
cs_quant_t cs_quant_get_edge_center | ( | cs_lnum_t | e_id, |
const cs_cdo_connect_t * | topo, | ||
const cs_cdo_quantities_t * | cdoq | ||
) |
Retrieve the edge center for a primal edge (interior or border)
[in] | e_id | id related to the edfe |
[in] | topo | pointer to a cs_cdo_connect_t structure |
[in] | cdoq | pointer to a cs_cdo_quantities_t structure |
cs_nvec3_t cs_quant_set_dedge_nvec | ( | cs_lnum_t | shift, |
const cs_cdo_quantities_t * | cdoq | ||
) |
Get the two normalized vector associated to a dual edge.
[in] | shift | position in c2f_idx |
[in] | cdoq | pointer to a cs_cdo_quantities_t structure |
cs_nvec3_t cs_quant_set_edge_nvec | ( | cs_lnum_t | e_id, |
const cs_cdo_quantities_t * | cdoq | ||
) |
Get the normalized vector associated to a primal edge.
[in] | e_id | id related to an edge |
[in] | cdoq | pointer to a cs_cdo_quantities_t structure |
cs_quant_t cs_quant_set_face | ( | cs_lnum_t | f_id, |
const cs_cdo_quantities_t * | cdoq | ||
) |
Define a cs_quant_t structure for a primal face (interior or border)
[in] | f_id | id related to the face (f_id > n_i_face -> border face) |
[in] | cdoq | pointer to a cs_cdo_quantities_t structure |
cs_nvec3_t cs_quant_set_face_nvec | ( | cs_lnum_t | f_id, |
const cs_cdo_quantities_t * | cdoq | ||
) |
Retrieve the face surface and its unit normal vector for a primal face (interior or border)
[in] | f_id | id related to the face (f_id > n_i_face -> border face) |
[in] | cdoq | pointer to a cs_cdo_quantities_t structure |
cs_cdo_quantities_cell_center_algo_t cs_cdo_cell_center_algo = CS_CDO_QUANTITIES_BARYC_CENTER |
cs_flag_t cs_cdo_quantities_flag = 0 |
|
static |