1 #ifndef __CS_ITER_ALGO_H__
2 #define __CS_ITER_ALGO_H__
586 int n_last_inner_iter);
662 const char *algo_name,
cs_real_t() cs_cdo_blas_square_norm_t(const cs_real_t *array)
Generic function pointer for computing a square norm. Parallel synchronization is performed.
Definition: cs_cdo_blas.h:79
cs_real_t() cs_cdo_blas_dotprod_t(const cs_real_t *a, const cs_real_t *b)
Generic function pointer for computing a dot product. Parallel synchronization is performed.
Definition: cs_cdo_blas.h:64
#define BEGIN_C_DECLS
Definition: cs_defs.h:514
double cs_real_t
Floating-point value.
Definition: cs_defs.h:319
#define END_C_DECLS
Definition: cs_defs.h:515
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:313
unsigned short int cs_flag_t
Definition: cs_defs.h:321
cs_iter_algo_t * cs_iter_algo_create(cs_iter_algo_type_t type)
Create and initialize by default a new cs_iter_algo_t structure.
Definition: cs_iter_algo.c:404
void cs_iter_algo_reset(cs_iter_algo_t *algo)
Reset a cs_iter_algo_t structure.
Definition: cs_iter_algo.c:546
void cs_iter_algo_check_warning(const char *func_name, const char *eq_name, const char *algo_name, cs_iter_algo_t *algo)
Check if something wrong happens during the iterative process after one new iteration.
Definition: cs_iter_algo.c:1472
void cs_iter_algo_set_tolerance(cs_iter_algo_t *algo, double tol)
Set the final tolerance used to check the convergence of the algorithm This tolerance should take int...
Definition: cs_iter_algo.c:643
void cs_iter_algo_log_cvg(cs_iter_algo_t *algo, const char *label)
Log the convergence of the iterative algorithm.
Definition: cs_iter_algo.c:1387
void cs_iter_algo_release_anderson_arrays(cs_iter_algo_aac_t *c)
Reset a cs_iter_algo_t structure.
Definition: cs_iter_algo.c:574
cs_iter_algo_param_aac_t cs_iter_algo_get_anderson_param(cs_iter_algo_t *algo)
Retrieve the set of parameters for an Anderson algorithm.
Definition: cs_iter_algo.c:960
void cs_iter_algo_set_initial_residual(cs_iter_algo_t *algo, double value)
Set the initial residual used to detect a divergence.
Definition: cs_iter_algo.c:673
cs_sles_convergence_state_t cs_iter_algo_get_cvg_status(const cs_iter_algo_t *algo)
Retrieve the last convergence state.
Definition: cs_iter_algo.c:898
cs_iter_algo_type_bit_t
Definition: cs_iter_algo.h:64
@ CS_ITER_ALGO_DEFAULT
Definition: cs_iter_algo.h:66
@ CS_ITER_ALGO_ANDERSON
Definition: cs_iter_algo.h:67
@ CS_ITER_ALGO_TWO_LEVEL
Definition: cs_iter_algo.h:68
cs_sles_convergence_state_t cs_iter_algo_update_cvg_tol_auto(cs_iter_algo_t *algo)
Update the convergence status and the number of iterations. The tolerance threshold is automatically ...
Definition: cs_iter_algo.c:1366
void cs_iter_algo_set_cvg_status(cs_iter_algo_t *algo, cs_sles_convergence_state_t cvg_status)
Set the convergence status of the given structure.
Definition: cs_iter_algo.c:734
int cs_iter_algo_get_n_iter(const cs_iter_algo_t *algo)
Retrieve the current number of iterations done.
Definition: cs_iter_algo.c:798
void cs_iter_algo_set_verbosity(cs_iter_algo_t *algo, int verbosity)
Define the verbosity of the given iterative algorithm.
Definition: cs_iter_algo.c:599
void cs_iter_algo_update_inner_iters(cs_iter_algo_t *algo, int n_last_inner_iter)
Update the counting of inner iterations in two-level algorithms.
Definition: cs_iter_algo.c:1208
cs_iter_algo_t * cs_iter_algo_create_with_settings(cs_iter_algo_type_t type, int verbosity, cs_param_sles_cvg_t cvg_param)
Create a new cs_iter_algo_t structure with the given settings.
Definition: cs_iter_algo.c:483
void cs_iter_algo_update_residual(cs_iter_algo_t *algo, double res)
Update the value of the residual and its associated members.
Definition: cs_iter_algo.c:1244
void cs_iter_algo_set_normalization(cs_iter_algo_t *algo, double value)
Set the normalization to apply when checking the convergence of the algorithm.
Definition: cs_iter_algo.c:704
void cs_iter_algo_free(cs_iter_algo_t **p_algo)
Free a cs_iter_algo_t structure.
Definition: cs_iter_algo.c:507
void cs_iter_algo_update_anderson(cs_iter_algo_t *algo, cs_real_t *cur_iterate, const cs_real_t *pre_iterate, cs_cdo_blas_dotprod_t *dotprod, cs_cdo_blas_square_norm_t *sqnorm)
Apply one more iteration of the Anderson acceleration.
Definition: cs_iter_algo.c:987
double cs_iter_algo_get_normalization(const cs_iter_algo_t *algo)
Get the normalization to apply when computing the tolerance threshold.
Definition: cs_iter_algo.c:928
double cs_iter_algo_get_residual(const cs_iter_algo_t *algo)
Retrieve the last computed residual.
Definition: cs_iter_algo.c:866
void cs_iter_algo_set_cvg_param(cs_iter_algo_t *algo, cs_param_sles_cvg_t cvg_param)
Define the criteria related the convergence of the given iterative algorithm.
Definition: cs_iter_algo.c:620
void cs_iter_algo_set_anderson_param(cs_iter_algo_t *algo, cs_iter_algo_param_aac_t aac_param, cs_lnum_t n_elts)
Create a new cs_iter_algo_aac_t structure for Anderson acceleration.
Definition: cs_iter_algo.c:765
cs_sles_convergence_state_t cs_iter_algo_update_cvg_tol_given(cs_iter_algo_t *algo, double tol)
Update the convergence status and the number of iterations. The tolerance threshold is given so that ...
Definition: cs_iter_algo.c:1291
cs_flag_t cs_iter_algo_type_t
Definition: cs_iter_algo.h:72
int cs_iter_algo_get_n_inner_iter(const cs_iter_algo_t *algo)
Retrieve the cumulated number of inner iterations done.
Definition: cs_iter_algo.c:830
Structure and routines handling the SLES settings stored inside a cs_param_sles_t structure.
cs_param_dotprod_type_t
Definition: cs_param_types.h:1040
cs_sles_convergence_state_t
Definition: cs_sles.h:56
char * label
Definition: keywords.h:58
Context structure for the algorithm called Anderson acceleration.
Definition: cs_iter_algo.h:172
int n_inner_iter
Definition: cs_iter_algo.h:225
cs_real_t * gold
Definition: cs_iter_algo.h:265
double prev_res
Definition: cs_iter_algo.h:220
double tol
Definition: cs_iter_algo.h:218
double res0
Definition: cs_iter_algo.h:222
cs_real_t * dg
Definition: cs_iter_algo.h:266
cs_iter_algo_param_aac_t param
Definition: cs_iter_algo.h:179
cs_real_t * fold
Definition: cs_iter_algo.h:263
cs_real_t * Q
Definition: cs_iter_algo.h:268
cs_lnum_t n_elts
Definition: cs_iter_algo.h:260
cs_sles_convergence_state_t cvg_status
Definition: cs_iter_algo.h:216
cs_real_t * gamma
Definition: cs_iter_algo.h:271
int n_dir
Definition: cs_iter_algo.h:261
double res
Definition: cs_iter_algo.h:221
cs_real_t * df
Definition: cs_iter_algo.h:264
int last_inner_iter
Definition: cs_iter_algo.h:226
cs_sdm_t * R
Definition: cs_iter_algo.h:269
double normalization
Definition: cs_iter_algo.h:217
int n_algo_iter
Definition: cs_iter_algo.h:224
Definition: cs_iter_algo.h:77
int n_inner_iter
Definition: cs_iter_algo.h:123
double prev_res
Definition: cs_iter_algo.h:118
double tol
Definition: cs_iter_algo.h:116
double res0
Definition: cs_iter_algo.h:120
cs_sles_convergence_state_t cvg_status
Definition: cs_iter_algo.h:114
double res
Definition: cs_iter_algo.h:119
int last_inner_iter
Definition: cs_iter_algo.h:124
double normalization
Definition: cs_iter_algo.h:115
int n_algo_iter
Definition: cs_iter_algo.h:122
Structure storing all the parameters to drive the algorithm called Anderson acceleration.
Definition: cs_iter_algo.h:137
cs_param_dotprod_type_t dp_type
Definition: cs_iter_algo.h:162
int n_max_dir
Definition: cs_iter_algo.h:158
double max_cond
Definition: cs_iter_algo.h:160
int starting_iter
Definition: cs_iter_algo.h:159
double beta
Definition: cs_iter_algo.h:161
Structure to handle the convergence of an iterative algorithm.
Definition: cs_iter_algo.h:289
cs_param_sles_cvg_t cvg_param
Definition: cs_iter_algo.h:308
void * context
Definition: cs_iter_algo.h:311
cs_iter_algo_type_t type
Definition: cs_iter_algo.h:307
int verbosity
Definition: cs_iter_algo.h:309
Set of parameters to check the convergence (or the divergence) of an iterative process (tolerances or...
Definition: cs_param_sles.h:61