8.0
general documentation
cs_cdo_system.c File Reference
#include "cs_defs.h"
#include <assert.h>
#include "bft_error.h"
#include "bft_mem.h"
#include "cs_array.h"
#include "cs_flag.h"
#include "cs_matrix_priv.h"
#include "cs_cdo_system.h"
+ Include dependency graph for cs_cdo_system.c:

Functions

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...
 
void cs_cdo_system_helper_free (cs_cdo_system_helper_t **p_helper)
 Free a cs_cdo_system_helper_t structure. 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. If p_rhs is NULL then one allocates the rhs inside this function. The ownership is transfered to this structure in that case. 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_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...
 

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_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. If p_rhs is NULL then one allocates the rhs inside this function. The ownership is transfered to this structure in that case.

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