#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"
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_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... | |
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_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. 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. 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... | |
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.
[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 |
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. 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.
[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 |