8.1
general documentation
cs_cdo_quantities.h File Reference
#include "cs_base.h"
#include "cs_cdo_connect.h"
#include "cs_flag.h"
#include "cs_math.h"
#include "cs_mesh.h"
#include "cs_mesh_quantities.h"
+ Include dependency graph for cs_cdo_quantities.h:

Go to the source code of this file.

Data Structures

struct  cs_quant_info_t
 
struct  cs_quant_t
 
struct  cs_cdo_quantities_t
 

Enumerations

enum  cs_cdo_quantities_cell_center_algo_t { CS_CDO_QUANTITIES_MEANV_CENTER , CS_CDO_QUANTITIES_BARYC_CENTER , CS_CDO_QUANTITIES_SATURNE_CENTER }
 Type of algorithm used to compute the cell centers. More...
 
enum  cs_cdo_quantities_bit_t {
  CS_CDO_QUANTITIES_EB_SCHEME = 1<<0 , CS_CDO_QUANTITIES_FB_SCHEME = 1<<1 , CS_CDO_QUANTITIES_HHO_SCHEME = 1<<2 , CS_CDO_QUANTITIES_VB_SCHEME = 1<<3 ,
  CS_CDO_QUANTITIES_VCB_SCHEME = 1<<4 , CS_CDO_QUANTITIES_CB_SCHEME = 1<<5
}
 Bit values for setting which quantities to compute. More...
 

Functions

static double cs_compute_area_from_quant (const cs_quant_t qa, const cs_real_t *xb)
 Compute the area of the triangle of base given by q (related to a segment) with apex located at xa. More...
 
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_tcs_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_tcs_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_tcs_cdo_quantities_get_pvol_fc (cs_cdo_quantities_t *cdoq, const cs_adjacency_t *c2f)
 Compute or 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. More...
 
void cs_cdo_quantities_compute_pvol_fc (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 structure. More...
 
const cs_real_tcs_cdo_quantities_get_pvol_ec (cs_cdo_quantities_t *cdoq, const cs_adjacency_t *c2e)
 Compute or 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_tcs_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 bf2v 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...
 
static const cs_real_tcs_quant_get_face_vector_area (cs_lnum_t f_id, const cs_cdo_quantities_t *cdoq)
 Retrieve the face vector which the face_area * face_normal for a primal face (interior or border) More...
 
static const cs_real_tcs_quant_get_face_center (cs_lnum_t f_id, const cs_cdo_quantities_t *cdoq)
 Retrieve the face center for a primal face (interior or border) More...
 
static cs_real_t cs_quant_get_face_surf (cs_lnum_t f_id, const cs_cdo_quantities_t *cdoq)
 Retrieve the face surface for a primal face (interior or border) 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_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...
 

Enumeration Type Documentation

◆ cs_cdo_quantities_bit_t

Bit values for setting which quantities to compute.

Enumerator
CS_CDO_QUANTITIES_EB_SCHEME 

Geometrical quantities related to edge-based schemes

CS_CDO_QUANTITIES_FB_SCHEME 

Geometrical quantities related to face-based schemes

CS_CDO_QUANTITIES_HHO_SCHEME 

Geometrical quantities related to HHO schemes

CS_CDO_QUANTITIES_VB_SCHEME 

Geometrical quantities related to vertex-based schemes

CS_CDO_QUANTITIES_VCB_SCHEME 

Geometrical quantities related to vertex+cell-based schemes

CS_CDO_QUANTITIES_CB_SCHEME 

Geometrical quantities related to cell-based schemes

◆ cs_cdo_quantities_cell_center_algo_t

Type of algorithm used to compute the cell centers.

Enumerator
CS_CDO_QUANTITIES_MEANV_CENTER 

Center is computed as the mean of cell vertices

CS_CDO_QUANTITIES_BARYC_CENTER 

Center is computed as the real cell barycenter (default choice)

CS_CDO_QUANTITIES_SATURNE_CENTER 

Center is the one defined in cs_mesh_quantities_t (i.e. the one used in the legacy Finite Volume scheme).

Function Documentation

◆ cs_cdo_quantities_build()

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.

Parameters
[in]mpointer to a cs_mesh_t structure
[in]mqpointer to a cs_mesh_quantities_t structure
[in]topopointer to a cs_cdo_connect_t structure
Returns
a new allocated pointer to a cs_cdo_quantities_t structure

◆ cs_cdo_quantities_compute_b_tef()

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.

Parameters
[in]connectpointer to a cs_cdo_connect_t structure
[in]cdoqpointer to a cs_cdo_quantities_t structure
[in]bf_idborder face id
[in,out]tefquantities to compute (pre-allocated)

◆ cs_cdo_quantities_compute_b_wvf()

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.

Parameters
[in]connectpointer to a cs_cdo_connect_t structure
[in]cdoqpointer to a cs_cdo_quantities_t structure
[in]bf_idborder face id
[in,out]wvfquantities to compute (pre-allocated)

◆ cs_cdo_quantities_compute_dual_volumes()

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.

Parameters
[in]cdoqadditional quantities for CDO schemes
[in]connectadditional connectivities for CDO schemes
[in,out]p_dual_voldouble pointer to the dual volumes related to each vertex. Allocated if NULL.

◆ cs_cdo_quantities_compute_i_tef()

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 bf2v adjacency structure.

Parameters
[in]connectpointer to a cs_cdo_connect_t structure
[in]cdoqpointer to a cs_cdo_quantities_t structure
[in]f_idinterior face id
[in,out]tefquantities to compute (pre-allocated)

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.

Parameters
[in]connectpointer to a cs_cdo_connect_t structure
[in]cdoqpointer to a cs_cdo_quantities_t structure
[in]f_idinterior face id
[in,out]tefquantities to compute (pre-allocated)

◆ cs_cdo_quantities_compute_i_wvf()

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.

Parameters
[in]connectpointer to a cs_cdo_connect_t structure
[in]cdoqpointer to a cs_cdo_quantities_t structure
[in]f_idinterior face id
[in,out]wvfquantities to compute (pre-allocated)

◆ cs_cdo_quantities_compute_pvol_ec()

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.

Parameters
[in]cdoqpointer to cs_cdo_quantities_t structure
[in]c2epointer to the cell --> edges connectivity
[in,out]p_pvol_ecdouble pointer to the edge volume in each cell If not allocated before calling this function, one allocates the array storing the volumes

◆ cs_cdo_quantities_compute_pvol_fc()

void cs_cdo_quantities_compute_pvol_fc ( 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 structure.

Parameters
[in,out]cdoqpointer to cs_cdo_quantities_t structure
[in]c2fpointer to the cell --> faces connectivity
[in,out]p_pvol_fcdouble pointer to the face volume in each cell If not allocated before calling this function, one allocates the array storing the volumes

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.

Parameters
[in,out]cdoqpointer to cs_cdo_quantities_t structure
[in]c2fpointer to the cell --> faces connectivity
[in,out]p_pvol_fcdouble pointer to the face volume in each cell If not allocated before calling this function, one allocates the array storing the volumes

◆ cs_cdo_quantities_dump()

void cs_cdo_quantities_dump ( const cs_cdo_quantities_t cdoq)

Dump a cs_cdo_quantities_t structure (for debuggingpurpose)

Parameters
[in]cdoqpointer to cs_cdo_quantities_t structure

◆ cs_cdo_quantities_free()

cs_cdo_quantities_t* cs_cdo_quantities_free ( cs_cdo_quantities_t cdoq)

Destroy a cs_cdo_quantities_t structure.

Parameters
[in]cdoqpointer to structure to free
Returns
a NULL pointer

◆ cs_cdo_quantities_get_dual_volumes()

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.

Parameters
[in,out]cdoqadditional quantities for CDO schemes
[in]connectadditional connectivities for CDO schemes
Returns
the dual volume associated to each vertex

◆ cs_cdo_quantities_get_pvol_ec()

const cs_real_t* cs_cdo_quantities_get_pvol_ec ( cs_cdo_quantities_t cdoq,
const cs_adjacency_t c2e 
)

Compute or 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.

Parameters
[in,out]cdoqpointer to cs_cdo_quantities_t structure
[in]c2epointer to the cell --> edges connectivity
Returns
the volume associated to each edge in each cell

◆ cs_cdo_quantities_get_pvol_fc()

const cs_real_t* cs_cdo_quantities_get_pvol_fc ( cs_cdo_quantities_t cdoq,
const cs_adjacency_t c2f 
)

Compute or 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.

Parameters
[in,out]cdoqpointer to cs_cdo_quantities_t structure
[in]c2fpointer to the cell --> faces connectivity
Returns
the volume associated to each face in each cell

Compute or 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.

Parameters
[in,out]cdoqpointer to cs_cdo_quantities_t structure
[in]c2fpointer to the cell --> faces connectivity
Returns
the volume associated to each face in each cell

◆ cs_cdo_quantities_get_time_perfo()

long long cs_cdo_quantities_get_time_perfo ( void  )

Retrieve the time elapsed to build the cs_cdo_quantities_t structure.

Returns
the value of the time elapsed in ns

◆ cs_cdo_quantities_log_summary()

void cs_cdo_quantities_log_summary ( const cs_cdo_quantities_t cdoq)

Summarize generic information about the cdo mesh quantities.

Parameters
[in]cdoqpointer to cs_cdo_quantities_t structure

◆ cs_cdo_quantities_set()

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)

Parameters
[in]option_flagflag to set geometrical quantities to compute

◆ cs_cdo_quantities_set_algo_ccenter()

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.

Parameters
[in]algotype of algorithm

◆ cs_compute_area_from_quant()

static double cs_compute_area_from_quant ( const cs_quant_t  qa,
const cs_real_t xb 
)
inlinestatic

Compute the area of the triangle of base given by q (related to a segment) with apex located at xa.

Parameters
[in]qapointer to a cs_quant_t structure related to a segment
[in]xbcoordinates of the apex to consider
Returns
the value the area of the triangle

◆ cs_quant_dump()

void cs_quant_dump ( FILE *  f,
cs_lnum_t  num,
const cs_quant_t  q 
)

Dump a cs_quant_t structure.

Parameters
[in]fFILE struct (stdout if NULL)
[in]numentity number related to this quantity struct.
[in]qcs_quant_t structure to dump

◆ cs_quant_get_face_center()

static const cs_real_t* cs_quant_get_face_center ( cs_lnum_t  f_id,
const cs_cdo_quantities_t cdoq 
)
inlinestatic

Retrieve the face center for a primal face (interior or border)

Parameters
[in]f_idid related to the face (f_id > n_i_face -> border face)
[in]cdoqpointer to a cs_cdo_quantities_t structure
Returns
a pointer to the face center coordinates

◆ cs_quant_get_face_surf()

static cs_real_t cs_quant_get_face_surf ( cs_lnum_t  f_id,
const cs_cdo_quantities_t cdoq 
)
inlinestatic

Retrieve the face surface for a primal face (interior or border)

Parameters
[in]f_idid related to the face (f_id > n_i_face -> border face)
[in]cdoqpointer to a cs_cdo_quantities_t structure
Returns
the value of the face surface

◆ cs_quant_get_face_vector_area()

static const cs_real_t* cs_quant_get_face_vector_area ( cs_lnum_t  f_id,
const cs_cdo_quantities_t cdoq 
)
inlinestatic

Retrieve the face vector which the face_area * face_normal for a primal face (interior or border)

Parameters
[in]f_idid related to the face (f_id > n_i_face -> border face)
[in]cdoqpointer to a cs_cdo_quantities_t structure
Returns
a pointer to the face vector

◆ cs_quant_set_dedge_nvec()

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.

Parameters
[in]shiftposition in c2f_idx
[in]cdoqpointer to a cs_cdo_quantities_t structure
Returns
a pointer to the dual edge normalized vector

◆ cs_quant_set_edge_nvec()

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.

Parameters
[in]e_idid related to an edge
[in]cdoqpointer to a cs_cdo_quantities_t structure
Returns
a pointer to the edge normalized vector

◆ cs_quant_set_face()

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)

Parameters
[in]f_idid related to the face (f_id > n_i_face -> border face)
[in]cdoqpointer to a cs_cdo_quantities_t structure
Returns
a initialize structure

◆ cs_quant_set_face_nvec()

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)

Parameters
[in]f_idid related to the face (f_id > n_i_face -> border face)
[in]cdoqpointer to a cs_cdo_quantities_t structure
Returns
a pointer to the face normalized vector