8.0
general documentation
cs_cdo_system.h File Reference
#include "cs_defs.h"
#include "cs_cdo_assembly.h"
#include "cs_cdo_connect.h"
#include "cs_param_types.h"
#include "cs_matrix.h"
#include "cs_matrix_assembler.h"
#include "cs_range_set.h"
+ Include dependency graph for cs_cdo_system.h:

Go to the source code of this file.

Data Structures

struct  cs_cdo_system_block_info_t
 
struct  cs_cdo_system_dblock_t
 Structure associated to the default type of block. More...
 
struct  cs_cdo_system_sblock_t
 Structure associated to the split type of block. More...
 
struct  cs_cdo_system_ublock_t
 Structure associated to the unassembled type of block. More...
 
struct  cs_cdo_system_xblock_t
 Structure associated to the extended type of block. More...
 
struct  cs_cdo_system_block_t
 
struct  cs_cdo_system_helper_t
 

Enumerations

enum  cs_cdo_system_type_t { CS_CDO_SYSTEM_DEFAULT , CS_CDO_SYSTEM_COUPLED , CS_CDO_SYSTEM_SADDLE_POINT }
 
enum  cs_cdo_system_block_type_t {
  CS_CDO_SYSTEM_BLOCK_DEFAULT , CS_CDO_SYSTEM_BLOCK_SPLIT , CS_CDO_SYSTEM_BLOCK_UNASS , CS_CDO_SYSTEM_BLOCK_EXT ,
  CS_CDO_SYSTEM_N_BLOCK_TYPES
}
 type of block composing a (block) matrix More...
 
enum  cs_cdo_system_matrix_class_t {
  CS_CDO_SYSTEM_MATRIX_NONE , CS_CDO_SYSTEM_MATRIX_CS , CS_CDO_SYSTEM_MATRIX_PETSC , CS_CDO_SYSTEM_MATRIX_HYPRE ,
  CS_CDO_SYSTEM_N_MATRIX_CLASSES
}
 Class of matrices to consider. More...
 

Functions

static cs_cdo_system_matrix_class_t cs_cdo_system_get_matrix_class (cs_param_sles_class_t solver_class)
 Get the best available class of matrix w.r.t. the solver class. More...
 
void cs_cdo_system_init_sharing (cs_mesh_t *mesh, cs_cdo_connect_t *connect)
 Allocate and initialize matrix-related structures according to the type of discretization used for this simulation. More...
 
cs_cdo_system_helper_tcs_cdo_system_helper_create (cs_cdo_system_type_t type, int n_col_blocks, const cs_lnum_t *col_block_sizes, int n_blocks)
 Create a system_helper structure from its set of metadata. n_col_blocks and n_blocks may differ according to the settings. For instance, for a saddle-point system, n_col_blocks >= n_blocks. More...
 
cs_cdo_system_block_tcs_cdo_system_add_dblock (cs_cdo_system_helper_t *sh, int block_id, cs_cdo_system_matrix_class_t matclass, cs_flag_t location, cs_lnum_t n_elements, int stride, bool interlaced, bool unrolled)
 Add an unassembled block definition at position "block_id" in the helper structure Only metadata are set at this stage. More...
 
cs_cdo_system_block_tcs_cdo_system_add_sblock (cs_cdo_system_helper_t *sh, int block_id, cs_cdo_system_matrix_class_t matclass, cs_flag_t location, cs_lnum_t n_elements, int stride)
 Add a split block definition at position "block_id" in the helper structure. Only metadata are set at this stage. More...
 
cs_cdo_system_block_tcs_cdo_system_add_ublock (cs_cdo_system_helper_t *sh, int block_id, const cs_adjacency_t *adjacency, cs_flag_t location, cs_lnum_t n_elements, int stride, bool interlaced)
 Add an unassembled block definition at position "block_id" in the helper structure Only metadata are set at this stage. More...
 
cs_cdo_system_block_tcs_cdo_system_add_xblock (cs_cdo_system_helper_t *sh, int block_id, cs_lnum_t n_dofs)
 Add an external block definition at position "block_id" in the helper structure. Only metadata are set at this stage. More...
 
cs_range_set_tcs_cdo_system_get_range_set (const cs_cdo_system_helper_t *sh, int block_id)
 Retrieve the range set structure associated to the given block_id. More...
 
cs_matrix_tcs_cdo_system_get_matrix (const cs_cdo_system_helper_t *sh, int block_id)
 Retrieve the matrix associated to the given block_id. If the type of block is either CS_CDO_SYSTEM_BLOCK_DEFAULT or CS_CDO_SYSTEM_BLOCK_EXT. In other cases, a NULL pointer is returned. The unassembled block has no matrix and to get a matrix of a split block, one should use cs_cdo_system_get_sub_matrix(sh, block_id, sub_id) More...
 
cs_matrix_tcs_cdo_system_get_sub_matrix (cs_cdo_system_helper_t *sh, int block_id, int sub_id)
 Retrieve the (sub-)matrix associated to a split block with id equal to block_id. sub_id is the id in the list of matrices of size equal to stride*stride. If the type of the block is not CS_CDO_SYSTEM_BLOCK_SPLIT, then a NULL pointer is returned. More...
 
void cs_cdo_system_build_block (cs_cdo_system_helper_t *sh, int block_id)
 Build the associated structures for the given system_helper structure If a member is already allocated, one keeps the member as it is. More...
 
void cs_cdo_system_helper_init_system (cs_cdo_system_helper_t *sh, cs_real_t **p_rhs)
 Allocate and initialize the matrix, rhs and the matrix assembler values. More...
 
void cs_cdo_system_helper_finalize_assembly (cs_cdo_system_helper_t *sh)
 Finalize the assembly after the cellwise building and assembly. More...
 
void cs_cdo_system_helper_reset (cs_cdo_system_helper_t *sh)
 Free matrix and rhs after the solve step. More...
 
void cs_cdo_system_helper_free (cs_cdo_system_helper_t **p_helper)
 Free a cs_cdo_system_helper_t structure. More...
 
void cs_cdo_system_allocate_assembly (void)
 Initialize shared assembly structures from the existing helper structures. More...
 
void cs_cdo_system_destroy_all (void)
 Free all members associated to system helpers. More...
 

Enumeration Type Documentation

◆ cs_cdo_system_block_type_t

type of block composing a (block) matrix

Enumerator
CS_CDO_SYSTEM_BLOCK_DEFAULT 

Simplest block type. One matrix inside a block.

CS_CDO_SYSTEM_BLOCK_SPLIT 

The block is described by several (sub)matrices.

CS_CDO_SYSTEM_BLOCK_UNASS 

The block is unassembled so that there is no matrix and related structures to describe this type of block. For instance, this block can be associated to the pressure block in some strategy for solving sadle-point problems.

CS_CDO_SYSTEM_BLOCK_EXT 

External way to define a block. This block does not rely on the generic function to assemble and build the associated structures. For instance, it corresponds to the full assembly strategy in case of a saddle-point problem.

CS_CDO_SYSTEM_N_BLOCK_TYPES 

◆ cs_cdo_system_matrix_class_t

Class of matrices to consider.

Enumerator
CS_CDO_SYSTEM_MATRIX_NONE 

No matrix is considered (unassembled treatment for instance)

CS_CDO_SYSTEM_MATRIX_CS 

Matrix format specific to code_saturne (native)

CS_CDO_SYSTEM_MATRIX_PETSC 

Matrix format specific to the library PETSC (external)

CS_CDO_SYSTEM_MATRIX_HYPRE 

Matrix format specific to the library HYPRE (external)

CS_CDO_SYSTEM_N_MATRIX_CLASSES 

◆ cs_cdo_system_type_t

Enumerator
CS_CDO_SYSTEM_DEFAULT 
CS_CDO_SYSTEM_COUPLED 

One matrix with one block

CS_CDO_SYSTEM_SADDLE_POINT 

System arising of a system of equations

Function Documentation

◆ cs_cdo_system_add_dblock()

cs_cdo_system_block_t* cs_cdo_system_add_dblock ( cs_cdo_system_helper_t sh,
int  block_id,
cs_cdo_system_matrix_class_t  matclass,
cs_flag_t  location,
cs_lnum_t  n_elements,
int  stride,
bool  interlaced,
bool  unrolled 
)

Add an unassembled block definition at position "block_id" in the helper structure Only metadata are set at this stage.

Parameters
[in,out]shpointer to the system helper to update
[in]block_idid in blocks array in a system helper
[in]matclassclass of the matrix to handle
[in]locationwhere DoFs are defined
[in]n_elementsnumber of elements (support entities for DoFs)
[in]stridenumber of DoFs by element
[in]interlaceduseful if stride > 1; way to store components
[in]unrolleduseful if stride > 1; true=as scalar-valued
Returns
a pointer to the newly allocated structure

◆ cs_cdo_system_add_sblock()

cs_cdo_system_block_t* cs_cdo_system_add_sblock ( cs_cdo_system_helper_t sh,
int  block_id,
cs_cdo_system_matrix_class_t  matclass,
cs_flag_t  location,
cs_lnum_t  n_elements,
int  stride 
)

Add a split block definition at position "block_id" in the helper structure. Only metadata are set at this stage.

Parameters
[in,out]shpointer to the system helper to update
[in]block_idid in blocks array in a system helper
[in]matclassclass of the matrix to handle
[in]locationwhere DoFs are defined
[in]n_elementsnumber of elements (support entities for DoFs)
[in]stridenumber of DoFs by element
Returns
a pointer to the newly allocated structure

◆ cs_cdo_system_add_ublock()

cs_cdo_system_block_t* cs_cdo_system_add_ublock ( cs_cdo_system_helper_t sh,
int  block_id,
const cs_adjacency_t adjacency,
cs_flag_t  location,
cs_lnum_t  n_elements,
int  stride,
bool  interlaced 
)

Add an unassembled block definition at position "block_id" in the helper structure Only metadata are set at this stage.

Parameters
[in,out]shpointer to the system helper to update
[in]block_idid in blocks array in a system helper
[in]adjacencyshared adjacency structure
[in]locationwhere DoFs are defined
[in]n_elementsnumber of elements (support entities for DoFs)
[in]stridenumber of DoFs by element
[in]interlaceduseful if stride > 1; way to store components
Returns
a pointer to the newly allocated structure

◆ cs_cdo_system_add_xblock()

cs_cdo_system_block_t* cs_cdo_system_add_xblock ( cs_cdo_system_helper_t sh,
int  block_id,
cs_lnum_t  n_dofs 
)

Add an external block definition at position "block_id" in the helper structure. Only metadata are set at this stage.

Parameters
[in,out]shpointer to the system helper to update
[in]block_idid in blocks array in a system helper
[in]n_dofsnumber of degrees of freedom
Returns
a pointer to the newly allocated structure

◆ cs_cdo_system_allocate_assembly()

void cs_cdo_system_allocate_assembly ( void  )

Initialize shared assembly structures from the existing helper structures.

◆ cs_cdo_system_build_block()

void cs_cdo_system_build_block ( cs_cdo_system_helper_t sh,
int  block_id 
)

Build the associated structures for the given system_helper structure If a member is already allocated, one keeps the member as it is.

Parameters
[in,out]shpointer to the system_helper structure to update
[in]block_idspecific block to handle or -1 for all blocks

◆ cs_cdo_system_destroy_all()

void cs_cdo_system_destroy_all ( void  )

Free all members associated to system helpers.

◆ cs_cdo_system_get_matrix()

cs_matrix_t* cs_cdo_system_get_matrix ( const cs_cdo_system_helper_t sh,
int  block_id 
)

Retrieve the matrix associated to the given block_id. If the type of block is either CS_CDO_SYSTEM_BLOCK_DEFAULT or CS_CDO_SYSTEM_BLOCK_EXT. In other cases, a NULL pointer is returned. The unassembled block has no matrix and to get a matrix of a split block, one should use cs_cdo_system_get_sub_matrix(sh, block_id, sub_id)

Parameters
[in]shpointer to the system_helper structure to update
[in]block_idid of the block to consider
Returns
a pointer to a cs_matrix_t structure or NULL

◆ cs_cdo_system_get_matrix_class()

static cs_cdo_system_matrix_class_t cs_cdo_system_get_matrix_class ( cs_param_sles_class_t  solver_class)
inlinestatic

Get the best available class of matrix w.r.t. the solver class.

Parameters
[in]solver_classfamily of solver to consider
Returns
the bast class of matrices which is available

◆ cs_cdo_system_get_range_set()

cs_range_set_t* cs_cdo_system_get_range_set ( const cs_cdo_system_helper_t sh,
int  block_id 
)

Retrieve the range set structure associated to the given block_id.

Parameters
[in]shpointer to the system_helper structure to update
[in]block_idid of the block to consider
Returns
a pointer to a range set structure or NULL

◆ cs_cdo_system_get_sub_matrix()

cs_matrix_t* cs_cdo_system_get_sub_matrix ( cs_cdo_system_helper_t sh,
int  block_id,
int  sub_id 
)

Retrieve the (sub-)matrix associated to a split block with id equal to block_id. sub_id is the id in the list of matrices of size equal to stride*stride. If the type of the block is not CS_CDO_SYSTEM_BLOCK_SPLIT, then a NULL pointer is returned.

Parameters
[in,out]shpointer to the system_helper structure to update
[in]block_idid of the block to consider
[in]sub_idid in the slip block
Returns
a pointer to a cs_matrix_t structure or NULL

◆ cs_cdo_system_helper_create()

cs_cdo_system_helper_t* cs_cdo_system_helper_create ( cs_cdo_system_type_t  type,
int  n_col_blocks,
const cs_lnum_t col_block_sizes,
int  n_blocks 
)

Create a system_helper structure from its set of metadata. n_col_blocks and n_blocks may differ according to the settings. For instance, for a saddle-point system, n_col_blocks >= n_blocks.

Parameters
[in]typetype of system to handle
[in]n_col_blocksnumber of blocks in a row
[in]col_block_sizesnumber of DoFs in each block of the row
[in]n_blocksnumber of blocks associated to this system
Returns
the pointer to the new allocated structure

◆ cs_cdo_system_helper_finalize_assembly()

void cs_cdo_system_helper_finalize_assembly ( cs_cdo_system_helper_t sh)

Finalize the assembly after the cellwise building and assembly.

Parameters
[in,out]shpointer to a system helper structure

◆ cs_cdo_system_helper_free()

void cs_cdo_system_helper_free ( cs_cdo_system_helper_t **  p_helper)

Free a cs_cdo_system_helper_t structure.

Parameters
[in,out]p_helperdouble pointer to the structure to free

◆ cs_cdo_system_helper_init_system()

void cs_cdo_system_helper_init_system ( cs_cdo_system_helper_t sh,
cs_real_t **  p_rhs 
)

Allocate and initialize the matrix, rhs and the matrix assembler values.

Parameters
[in,out]shpointer to a system helper structure
[in,out]p_rhsdouble pointer to the RHS array to initialize

Allocate and initialize the matrix, rhs and the matrix assembler values.

Parameters
[in,out]shpointer to a system helper structure
[in,out]p_rhsdouble pointer to the RHS array to initialize

◆ cs_cdo_system_helper_reset()

void cs_cdo_system_helper_reset ( cs_cdo_system_helper_t sh)

Free matrix and rhs after the solve step.

Parameters
[in,out]shpointer to a system helper structure

◆ cs_cdo_system_init_sharing()

void cs_cdo_system_init_sharing ( cs_mesh_t mesh,
cs_cdo_connect_t connect 
)

Allocate and initialize matrix-related structures according to the type of discretization used for this simulation.

Parameters
[in]meshpointer to a cs_mesh_t structure
[in]connectpointer to a cs_cdo_connect_t structure