#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"
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_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. More... | |
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 a default block definition at position "block_id" in the helper structure Only metadata are set at this stage. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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) More... | |
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. 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... | |
type of block composing a (block) matrix
Class of matrices to consider.
enum cs_cdo_system_type_t |
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 a default block definition at position "block_id" in the helper structure Only metadata are set at this stage.
[in,out] | sh | pointer to the system helper to update |
[in] | block_id | id in blocks array in a system helper |
[in] | matclass | class of the matrix to handle |
[in] | location | where DoFs are defined |
[in] | n_elements | number of elements (support entities for DoFs) |
[in] | stride | number of DoFs by element |
[in] | interlaced | useful if stride > 1; way to store components |
[in] | unrolled | useful if stride > 1; true=as scalar-valued |
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.
[in,out] | sh | pointer to the system helper to update |
[in] | block_id | id in blocks array in a system helper |
[in] | matclass | class of the matrix to handle |
[in] | location | where DoFs are defined |
[in] | n_elements | number of elements (support entities for DoFs) |
[in] | stride | number of DoFs by element |
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.
[in,out] | sh | pointer to the system helper to update |
[in] | block_id | id in blocks array in a system helper |
[in] | adjacency | shared adjacency structure |
[in] | location | where DoFs are defined |
[in] | n_elements | number of elements (support entities for DoFs) |
[in] | stride | number of DoFs by element |
[in] | interlaced | useful if stride > 1; way to store components |
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.
[in,out] | sh | pointer to the system helper to update |
[in] | block_id | id in blocks array in a system helper |
[in] | n_dofs | number of degrees of freedom |
void cs_cdo_system_allocate_assembly | ( | void | ) |
Initialize shared assembly structures from the existing helper structures.
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.
[in,out] | sh | pointer to the system_helper structure to update |
[in] | block_id | specific block to handle or -1 for all blocks |
void cs_cdo_system_destroy_all | ( | void | ) |
Free all members associated to system helpers.
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)
[in] | sh | pointer to the system_helper structure to update |
[in] | block_id | id of the block to consider |
|
inlinestatic |
Get the best available class of matrix w.r.t. the solver class.
[in] | solver_class | family of solver to consider |
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.
[in] | sh | pointer to the system_helper structure to update |
[in] | block_id | id of the block to consider |
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.
[in,out] | sh | pointer to the system_helper structure to update |
[in] | block_id | id of the block to consider |
[in] | sub_id | id in the slip block |
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.
[in] | type | type of system to handle |
[in] | n_col_blocks | number of blocks in a row |
[in] | col_block_sizes | number of DoFs in each block of the row |
[in] | n_blocks | number of blocks associated to this system |
void cs_cdo_system_helper_finalize_assembly | ( | cs_cdo_system_helper_t * | sh | ) |
Finalize the assembly after the cellwise building and assembly.
[in,out] | sh | pointer to a system helper structure |
void cs_cdo_system_helper_free | ( | cs_cdo_system_helper_t ** | p_helper | ) |
Free a cs_cdo_system_helper_t structure.
[in,out] | p_helper | double pointer to the structure to free |
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.
[in,out] | sh | pointer to a system helper structure |
[in,out] | p_rhs | double pointer to the RHS array to initialize |
Allocate and initialize the matrix, rhs and the matrix assembler values.
[in,out] | sh | pointer to a system helper structure |
[in,out] | p_rhs | double pointer to the RHS array to initialize |
void cs_cdo_system_helper_reset | ( | cs_cdo_system_helper_t * | sh | ) |
Free matrix and rhs after the solve step.
[in,out] | sh | pointer to a system helper structure |
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.
[in] | mesh | pointer to a cs_mesh_t structure |
[in] | connect | pointer to a cs_cdo_connect_t structure |