programmer's documentation
Functions
cs_hodge.c File Reference

Build discrete Hodge operators. More...

#include "cs_defs.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <float.h>
#include <limits.h>
#include <assert.h>
#include <bft_mem.h>
#include <bft_printf.h>
#include "cs_mesh.h"
#include "cs_mesh_quantities.h"
#include "cs_sort.h"
#include "cs_hodge.h"
Include dependency graph for cs_hodge.c:

Functions

static void _compute_builder (const cs_real_33_t matval, const cs_qvect_t *pq, const cs_qvect_t *dq, cs_hodge_builder_t *hb)
 Compute quantities used for defining the entries of the discrete Hodge for COST algo. and edge/face quantities. More...
 
static void _prepare_local_hodge_cost (int cid, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_param_hodge_t h_info, cs_toolbox_locmat_t *hloc, cs_hodge_builder_t *hb)
 Prepare the construction of the local hodge related to cell cid in the case of the COST algo. More...
 
static cs_sla_matrix_t_init_hodge_vertex (const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant)
 Allocate and initialize by default the matrix related to a discrete Hodge op. based on vertices Note: values are filled in a second step. More...
 
static cs_sla_matrix_t_init_hodge_edge (const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant)
 Allocate and initialize by default the matrix related to a discrete Hodge op. based on edges Note: values are filled in a second step. More...
 
static cs_sla_matrix_t_init_hodge_face (const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant)
 Allocate and initialize by default the matrix related to a discrete Hodge op. based on faces Note: values are filled in a second step. More...
 
static void _assemble_local_hodge (const cs_toolbox_locmat_t *hloc, cs_sla_matrix_t *h_mat)
 Assemble a local discrete Hodge operator. More...
 
cs_sla_matrix_tcs_hodge_init_matrix (const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_param_hodge_type_t type)
 Allocate and initialize by default the matrix related to a discrete Hodge operator. More...
 
cs_hodge_builder_tcs_hodge_builder_init (int n_max_ent)
 Allocate and initialize a cs_hodge_builder_t structure. More...
 
cs_hodge_builder_tcs_hodge_builder_free (cs_hodge_builder_t *hb)
 Free a cs_hodge_builder_t structure. More...
 
void cs_hodge_cost_build_local (int cid, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_param_hodge_t h_info, cs_toolbox_locmat_t *hl, cs_hodge_builder_t *hb)
 Build a local discrete Hodge operator using the generic COST algo. More...
 
cs_sla_matrix_tcs_hodge_cost_build (const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_param_hodge_t h_info)
 Build a discrete Hodge operator using a generic reconstruction algorithm: Reconstruction with Consistent and Coercive part stabilized by Beta (COST) A call to cs_hodge_builder_init() should have been done before. More...
 
cs_sla_matrix_tcs_hodge_voronoi_build (const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_param_hodge_t h_info)
 H is an operator from primal edges to dual faces. It mimics a Hodge operator from primal mesh to dual mesh. Use voronoi algorithm. More...
 

Detailed Description

Build discrete Hodge operators.

Function Documentation

static void _assemble_local_hodge ( const cs_toolbox_locmat_t hloc,
cs_sla_matrix_t h_mat 
)
static

Assemble a local discrete Hodge operator.

Parameters
[in]hlocpointer to a cs_toolbox_locmat_t struct.
[in,out]h_matpointer to a cs_sla_matrix_t
static void _compute_builder ( const cs_real_33_t  matval,
const cs_qvect_t pq,
const cs_qvect_t dq,
cs_hodge_builder_t hb 
)
static

Compute quantities used for defining the entries of the discrete Hodge for COST algo. and edge/face quantities.

(end ignore by Doxygen)

Parameters
[in]matvalvalues of the tensor related to the material pty
[in]pqpointer to the first set of quantities
[in]dqpointer to the second set of quantities
[in,out]hbpointer to a _hodge_builder_t struct.
static cs_sla_matrix_t* _init_hodge_edge ( const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant 
)
static

Allocate and initialize by default the matrix related to a discrete Hodge op. based on edges Note: values are filled in a second step.

Parameters
[in]connectpointer to a cs_cdo_connect_t structure
[in]quantpointer to a cs_cdo_quantities_t structure
Returns
a pointer to a cs_sla_matrix_t structure
static cs_sla_matrix_t* _init_hodge_face ( const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant 
)
static

Allocate and initialize by default the matrix related to a discrete Hodge op. based on faces Note: values are filled in a second step.

Parameters
[in]connectpointer to a cs_cdo_connect_t structure
[in]quantpointer to a cs_cdo_quantities_t structure
Returns
a pointer to a cs_sla_matrix_t structure
static cs_sla_matrix_t* _init_hodge_vertex ( const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant 
)
static

Allocate and initialize by default the matrix related to a discrete Hodge op. based on vertices Note: values are filled in a second step.

Parameters
[in]connectpointer to a cs_cdo_connect_t structure
[in]quantpointer to a cs_cdo_quantities_t structure
Returns
a pointer to a cs_sla_matrix_t structure
static void _prepare_local_hodge_cost ( int  cid,
const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant,
const cs_param_hodge_t  h_info,
cs_toolbox_locmat_t hloc,
cs_hodge_builder_t hb 
)
static

Prepare the construction of the local hodge related to cell cid in the case of the COST algo.

Parameters
[in]cidcell id
[in]connectpointer to a cs_cdo_connect_t struct.
[in]quantpointer to a cs_cdo_quantities_t struct.
[in]h_infopointer to a cs_param_hodge_t struct.
[in,out]hlocpointer to a cs_toolbox_locmat_t struct. to fill
[in,out]hbpointer to a cs_hodge_builder_t struct. to fill
cs_hodge_builder_t* cs_hodge_builder_free ( cs_hodge_builder_t hb)

Free a cs_hodge_builder_t structure.

Parameters
[in]hbpointer to the cs_hodge_builder_t struct. to free
Returns
a NULL pointer
cs_hodge_builder_t* cs_hodge_builder_init ( int  n_max_ent)

Allocate and initialize a cs_hodge_builder_t structure.

Parameters
[in]n_max_entmax number of entities by primal cell
Returns
a new allocated cs_hodge_builder_t structure
cs_sla_matrix_t* cs_hodge_cost_build ( const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant,
const cs_param_hodge_t  h_info 
)

Build a discrete Hodge operator using a generic reconstruction algorithm: Reconstruction with Consistent and Coercive part stabilized by Beta (COST) A call to cs_hodge_builder_init() should have been done before.

Parameters
[in]connectpointer to a cs_cdo_connect_t struct.
[in]quantpointer to a cs_cdo_quantities_t struct.
[in]h_infopointer to a cs_param_hodge_t struct.
Returns
a pointer to a cs_sla_matrix_t structure
void cs_hodge_cost_build_local ( int  cid,
const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant,
const cs_param_hodge_t  h_info,
cs_toolbox_locmat_t hl,
cs_hodge_builder_t hb 
)

Build a local discrete Hodge operator using the generic COST algo.

Parameters
[in]cidcell id
[in]connectpointer to a cs_cdo_connect_t struct.
[in]quantpointer to a cs_cdo_quantities_t struct.
[in]h_infopointer to a cs_param_hodge_t struct.
[in,out]hlocpointer to a cs_toolbox_locmat_t struct.
[in,out]hbpointer to a cs_hodge_builder_t struct.
cs_sla_matrix_t* cs_hodge_init_matrix ( const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant,
const cs_param_hodge_type_t  type 
)

Allocate and initialize by default the matrix related to a discrete Hodge operator.

Parameters
[in]connectpointer to a cs_cdo_connect_t structure
[in]quantpointer to a cs_cdo_quantities_t structure
[in]typetype of the discrete Hodge op. to initiliaze
Returns
a pointer to a cs_sla_matrix_t structure
cs_sla_matrix_t* cs_hodge_voronoi_build ( const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant,
const cs_param_hodge_t  h_info 
)

H is an operator from primal edges to dual faces. It mimics a Hodge operator from primal mesh to dual mesh. Use voronoi algorithm.

Parameters
[in]connectpointer to a cs_cdo_connect_t struct.
[in]quantpointer to a cs_cdo_quantities_t struct.
[in]h_infopointer to a cs_param_hodge_t struct.
Returns
a pointer to a cs_sla_matrix_t structure