programmer's documentation
Functions | Variables
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_cdo_scheme_geometry.h"
#include "cs_math.h"
#include "cs_sort.h"
#include "cs_timer_stats.h"
#include "cs_hodge.h"
Include dependency graph for cs_hodge.c:

Functions

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 _compute_cost_quant (const int n_ent, const double invcvol, const cs_real_33_t ptymat, const cs_real_3_t *pq, const cs_real_3_t *dq, double *alpha, double *kappa, cs_locmat_t *hloc)
 Compute quantities used for defining the entries of the discrete Hodge for COST algo. Initialize the local discrete Hodge op. with the consistency part. More...
 
static void _cellwise_build_with_cost (const cs_cell_mesh_t *cm, cs_hodge_builder_t *hb)
 Build a local discrete Hodge operator using the generic COST algo. and cellwise view of the mesh COST means COnsistency + STabilization. More...
 
static void _build_using_cost (int cid, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, cs_hodge_builder_t *hb)
 Build a local discrete Hodge operator using the generic COST algo. More...
 
static void _build_stiffness_using_cost (const cs_cell_mesh_t *cm, cs_hodge_builder_t *hb, cs_locmat_t *sloc)
 Build a local stiffness matrix using the generic COST algo. More...
 
static void _cellwise_build_with_wbs (const cs_cell_mesh_t *cm, cs_hodge_builder_t *hb)
 Build a local discrete Hodge operator using the generic WBS algo. and cellwise view of the mesh WBS means Whitney Barycentric Subdivision. More...
 
static void _cellwise_build_with_hvc (const cs_cell_mesh_t *cm, cs_hodge_builder_t *hb)
 Build a local discrete Hodge V+C operator using the WBS algorithm and a cellwise view of the mesh WBS means Whitney Barycentric Subdivision. More...
 
static void _build_stiffness_using_voronoi (const cs_cell_mesh_t *cm, cs_hodge_builder_t *hb, cs_locmat_t *sloc)
 Build a local stiffness matrix using the Voronoi algorithm. More...
 
static void _cellwise_build_with_voronoi (const cs_cell_mesh_t *cm, cs_hodge_builder_t *hb)
 Build a local discrete Hodge op. using the Voronoi algo. More...
 
static void _build_using_voronoi (cs_lnum_t c_id, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, cs_hodge_builder_t *hb)
 Build a local discrete Hodge op. using the Voronoi algo. More...
 
void cs_hodge_set_timer_stats (int level)
 Initialize cs_timer_stats_t structure for monitoring purpose. More...
 
cs_hodge_builder_tcs_hodge_builder_init (const cs_cdo_connect_t *connect, cs_param_hodge_t h_info)
 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...
 
bool cs_hodge_builder_get_setting_flag (cs_hodge_builder_t *hb)
 Get the flag indicating the status of the property. More...
 
void cs_hodge_builder_unset (cs_hodge_builder_t *hb)
 Set the flag indicating the status of the property to false. More...
 
void cs_hodge_builder_set_val (cs_hodge_builder_t *hb, cs_real_t ptyval)
 Set the value of the property attached to a hodge builder. More...
 
void cs_hodge_builder_set_tensor (cs_hodge_builder_t *hb, const cs_real_33_t ptymat)
 Set the value of the property attached to a hodge builder. More...
 
void cs_hodge_build_local_stiffness (const cs_cell_mesh_t *cm, cs_hodge_builder_t *hb, cs_locmat_t *sloc)
 Build a local stiffness matrix from a local discrete Hodge H and the local discrete gradient and divergence S = Gloc^t * H * Gloc. More...
 
cs_locmat_tcs_hodge_build_cellwise (const cs_cell_mesh_t *cm, cs_hodge_builder_t *hb)
 Build a local discrete Hodge using a cell-wise view of the mesh. More...
 
cs_locmat_tcs_hodge_build_local (int c_id, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, cs_hodge_builder_t *hb)
 Build a local discrete Hodge. More...
 
cs_sla_matrix_tcs_hodge_compute (const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_property_t *pty, const cs_param_hodge_t h_info)
 Build the full matrix related to a discrete Hodge operator. More...
 

Variables

static const double cs_hodge_wbs_const = 1/60.
 
static const double cs_hodge_vc_coef = 3./20
 

Detailed Description

Build discrete Hodge operators.

Function Documentation

§ _build_stiffness_using_cost()

static void _build_stiffness_using_cost ( const cs_cell_mesh_t cm,
cs_hodge_builder_t hb,
cs_locmat_t sloc 
)
static

Build a local stiffness matrix using the generic COST algo.

Parameters
[in]cmpointer to a cs_cell_mesh_t structure
[in,out]hbpointer to a cs_hodge_builder_t struct.
[in,out]slocpointer to a local matrix structure

§ _build_stiffness_using_voronoi()

static void _build_stiffness_using_voronoi ( const cs_cell_mesh_t cm,
cs_hodge_builder_t hb,
cs_locmat_t sloc 
)
static

Build a local stiffness matrix using the Voronoi algorithm.

Parameters
[in]cmpointer to a cs_cell_mesh_t structure
[in,out]hbpointer to a cs_hodge_builder_t struct.
[in,out]slocpointer to a local matrix structure

§ _build_using_cost()

static void _build_using_cost ( int  cid,
const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant,
cs_hodge_builder_t hb 
)
static

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,out]hbpointer to a cs_hodge_builder_t struct.

§ _build_using_voronoi()

static void _build_using_voronoi ( cs_lnum_t  c_id,
const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant,
cs_hodge_builder_t hb 
)
static

Build a local discrete Hodge op. using the Voronoi algo.

Parameters
[in]c_idcell id
[in]connectpointer to a cs_cdo_connect_t struct.
[in]quantpointer to a cs_cdo_quantities_t struct.
[in,out]hbpointer to a cs_hodge_builder_t struct.

§ _cellwise_build_with_cost()

static void _cellwise_build_with_cost ( const cs_cell_mesh_t cm,
cs_hodge_builder_t hb 
)
static

Build a local discrete Hodge operator using the generic COST algo. and cellwise view of the mesh COST means COnsistency + STabilization.

Parameters
[in]cmpointer to a cs_cell_mesh_t structure
[in,out]hbpointer to a cs_hodge_builder_t structure

§ _cellwise_build_with_hvc()

static void _cellwise_build_with_hvc ( const cs_cell_mesh_t cm,
cs_hodge_builder_t hb 
)
static

Build a local discrete Hodge V+C operator using the WBS algorithm and a cellwise view of the mesh WBS means Whitney Barycentric Subdivision.

Parameters
[in]cmpointer to a cs_cell_mesh_t structure
[in,out]hbpointer to a cs_hodge_builder_t structure

§ _cellwise_build_with_voronoi()

static void _cellwise_build_with_voronoi ( const cs_cell_mesh_t cm,
cs_hodge_builder_t hb 
)
static

Build a local discrete Hodge op. using the Voronoi algo.

Parameters
[in]cmpointer to a cs_cell_mesh_t structure
[in,out]hbpointer to a cs_hodge_builder_t struct.

§ _cellwise_build_with_wbs()

static void _cellwise_build_with_wbs ( const cs_cell_mesh_t cm,
cs_hodge_builder_t hb 
)
static

Build a local discrete Hodge operator using the generic WBS algo. and cellwise view of the mesh WBS means Whitney Barycentric Subdivision.

Parameters
[in]cmpointer to a cs_cell_mesh_t structure
[in,out]hbpointer to a cs_hodge_builder_t structure

§ _compute_cost_quant()

static void _compute_cost_quant ( const int  n_ent,
const double  invcvol,
const cs_real_33_t  ptymat,
const cs_real_3_t pq,
const cs_real_3_t dq,
double *  alpha,
double *  kappa,
cs_locmat_t hloc 
)
static

Compute quantities used for defining the entries of the discrete Hodge for COST algo. Initialize the local discrete Hodge op. with the consistency part.

Parameters
[in]n_entnumber of local entities
[in]invcvol1/|c|
[in]ptymatvalues 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]alphageometrical quantity
[in,out]kappageometrical quantity
[in,out]hlocpointer to a cs_locmat_t struct.

§ _init_hodge_edge()

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

§ _init_hodge_face()

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

§ _init_hodge_vertex()

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

§ cs_hodge_build_cellwise()

cs_locmat_t* cs_hodge_build_cellwise ( const cs_cell_mesh_t cm,
cs_hodge_builder_t hb 
)

Build a local discrete Hodge using a cell-wise view of the mesh.

Parameters
[in]cmpointer to a cs_cell_mesh_t structure
[in,out]hbpointer to a cs_hodge_builder_t structure
Returns
a pointer to a cs_locmat_t struct. (local dense matrix)

§ cs_hodge_build_local()

cs_locmat_t* cs_hodge_build_local ( int  c_id,
const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant,
cs_hodge_builder_t hb 
)

Build a local discrete Hodge.

Parameters
[in]c_idcell id
[in]connectpointer to a cs_cdo_connect_t struct.
[in]quantpointer to a cs_cdo_quantities_t struct.
[in,out]hbpointer to a cs_hodge_builder_t struct.
Returns
a pointer to a cs_locmat_t struct. (local dense matrix)

§ cs_hodge_build_local_stiffness()

void cs_hodge_build_local_stiffness ( const cs_cell_mesh_t cm,
cs_hodge_builder_t hb,
cs_locmat_t sloc 
)

Build a local stiffness matrix from a local discrete Hodge H and the local discrete gradient and divergence S = Gloc^t * H * Gloc.

Parameters
[in]cmpointer to a cs_cell_mesh_t struct.
[in,out]hbpointer to a cs_hodge_builder_t struct.
[in,out]slocpointer to a local stiffness matrix struct.

§ cs_hodge_builder_free()

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_get_setting_flag()

bool cs_hodge_builder_get_setting_flag ( cs_hodge_builder_t hb)

Get the flag indicating the status of the property.

Parameters
[in,out]hbpointer to a cs_hodge_builder_t structure
Returns
true or flase

§ cs_hodge_builder_init()

cs_hodge_builder_t* cs_hodge_builder_init ( const cs_cdo_connect_t connect,
cs_param_hodge_t  h_info 
)

Allocate and initialize a cs_hodge_builder_t structure.

Parameters
[in]connectpointer to a cs_cdo_connect_t struct.
[in]h_infoalgorithm used to build the discrete Hodge op.
Returns
a new allocated cs_hodge_builder_t structure

§ cs_hodge_builder_set_tensor()

void cs_hodge_builder_set_tensor ( cs_hodge_builder_t hb,
const cs_real_33_t  ptymat 
)

Set the value of the property attached to a hodge builder.

Parameters
[in,out]hbpointer to a cs_hodge_builder_t structure
[in]ptymatvalues of the tensor related to a property

§ cs_hodge_builder_set_val()

void cs_hodge_builder_set_val ( cs_hodge_builder_t hb,
cs_real_t  ptyval 
)

Set the value of the property attached to a hodge builder.

Parameters
[in,out]hbpointer to a cs_hodge_builder_t structure
[in]ptyvalvalue of the property

§ cs_hodge_builder_unset()

void cs_hodge_builder_unset ( cs_hodge_builder_t hb)

Set the flag indicating the status of the property to false.

Parameters
[in,out]hbpointer to a cs_hodge_builder_t structure

§ cs_hodge_compute()

cs_sla_matrix_t* cs_hodge_compute ( const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant,
const cs_property_t *  pty,
const cs_param_hodge_t  h_info 
)

Build the full matrix related to a discrete Hodge operator.

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

§ cs_hodge_set_timer_stats()

void cs_hodge_set_timer_stats ( int  level)

Initialize cs_timer_stats_t structure for monitoring purpose.

Parameters
[in]levellevel of details requested

Variable Documentation

§ cs_hodge_vc_coef

const double cs_hodge_vc_coef = 3./20
static

§ cs_hodge_wbs_const

const double cs_hodge_wbs_const = 1/60.
static

(end ignore by Doxygen)