8.1
general documentation
cs_sles_hypre.h File Reference
#include "cs_base.h"
#include "cs_matrix.h"
#include "cs_sles.h"
+ Include dependency graph for cs_sles_hypre.h:

Go to the source code of this file.

Typedefs

typedef void() cs_sles_hypre_setup_hook_t(int verbosity, void *context, void *solver)
 Function pointer for settings of a HYPRE solver setup. More...
 
typedef struct _cs_sles_hypre_t cs_sles_hypre_t
 

Enumerations

enum  cs_sles_hypre_type_t {
  CS_SLES_HYPRE_BOOMERAMG , CS_SLES_HYPRE_HYBRID , CS_SLES_HYPRE_ILU , CS_SLES_HYPRE_BICGSTAB ,
  CS_SLES_HYPRE_GMRES , CS_SLES_HYPRE_FLEXGMRES , CS_SLES_HYPRE_LGMRES , CS_SLES_HYPRE_PCG ,
  CS_SLES_HYPRE_EUCLID , CS_SLES_HYPRE_PARASAILS , CS_SLES_HYPRE_NONE
}
 

Functions

cs_sles_hypre_tcs_sles_hypre_define (int f_id, const char *name, cs_sles_hypre_type_t solver_type, cs_sles_hypre_type_t precond_type, cs_sles_hypre_setup_hook_t *setup_hook, void *context)
 Define and associate a HYPRE linear system solver for a given field or equation name. More...
 
cs_sles_hypre_tcs_sles_hypre_create (cs_sles_hypre_type_t solver_type, cs_sles_hypre_type_t precond_type, cs_sles_hypre_setup_hook_t *setup_hook, void *context)
 Create HYPRE linear system solver info and context. More...
 
void cs_sles_hypre_destroy (void **context)
 Destroy iterative sparse linear system solver info and context. More...
 
void * cs_sles_hypre_copy (const void *context)
 Create HYPRE sparse linear system solver info and context based on existing info and context. More...
 
void cs_sles_hypre_setup (void *context, const char *name, const cs_matrix_t *a, int verbosity)
 Setup iterative sparse linear equation solver. More...
 
cs_sles_convergence_state_t cs_sles_hypre_solve (void *context, const char *name, const cs_matrix_t *a, int verbosity, double precision, double r_norm, int *n_iter, double *residual, const cs_real_t *rhs, cs_real_t *vx, size_t aux_size, void *aux_vectors)
 Call HYPRE linear equation solver. More...
 
void cs_sles_hypre_free (void *context)
 Free HYPRE linear equation solver setup context. More...
 
bool cs_sles_hypre_error_post_and_abort (cs_sles_t *sles, cs_sles_convergence_state_t state, const cs_matrix_t *a, const cs_real_t *rhs, cs_real_t *vx)
 Error handler for HYPRE solver. More...
 
void cs_sles_hypre_log (const void *context, cs_log_t log_type)
 Log sparse linear equation solver info. More...
 
void cs_sles_hypre_set_n_max_iter (cs_sles_hypre_t *context, int n_max_iter)
 Set the max. number of iterations associated to the given HYPRE contrext. More...
 
void cs_sles_hypre_set_host_device (cs_sles_hypre_t *context, int use_device)
 Define whether the solver should run on the host or accelerated device. More...
 
int cs_sles_hypre_get_host_device (const cs_sles_hypre_t *context)
 Query whether the solver should run on the host or accelerated device. More...
 
void cs_sles_hypre_library_info (cs_log_t log_type)
 Print information on hypre library. More...
 

Typedef Documentation

◆ cs_sles_hypre_setup_hook_t

cs_sles_hypre_setup_hook_t

Function pointer for settings of a HYPRE solver setup.

This function is called during the setup stage for a HYPRE solver.

When first called, the solver argument is NULL, and must be created using HYPRE functions.

Note: if the context pointer is non-NULL, it must point to valid data when the selection function is called so that value or structure should not be temporary (i.e. local);

Parameters
[in]verbosityverbosity level
[in,out]contextpointer to optional (untyped) value or structure
[in,out]solverhandle to HYPRE solver (to be cast as HYPRE_Solver)

◆ cs_sles_hypre_t

typedef struct _cs_sles_hypre_t cs_sles_hypre_t

Enumeration Type Documentation

◆ cs_sles_hypre_type_t

Enumerator
CS_SLES_HYPRE_BOOMERAMG 

BoomerAMG (algebraic multigrid)

CS_SLES_HYPRE_HYBRID 

Hybrid solver

CS_SLES_HYPRE_ILU 

hypre-ILU (incomplete LU)

CS_SLES_HYPRE_BICGSTAB 

BiCGSTAB

CS_SLES_HYPRE_GMRES 

GMRES

CS_SLES_HYPRE_FLEXGMRES 

Flexible GMRES

CS_SLES_HYPRE_LGMRES 

LGMRES

CS_SLES_HYPRE_PCG 

Preconditioned Congugate Gradient

CS_SLES_HYPRE_EUCLID 

hypre-ILU (incomplete LU)

CS_SLES_HYPRE_PARASAILS 

ParaSails (sparse approximate inverse))

CS_SLES_HYPRE_NONE 

No solver or preconditioner

Function Documentation

◆ cs_sles_hypre_copy()

void* cs_sles_hypre_copy ( const void *  context)

Create HYPRE sparse linear system solver info and context based on existing info and context.

Parameters
[in]contextpointer to reference info and context (actual type: cs_sles_hypre_t *)
Returns
pointer to newly created solver info object. (actual type: cs_sles_hypre_t *)

◆ cs_sles_hypre_create()

cs_sles_hypre_t* cs_sles_hypre_create ( cs_sles_hypre_type_t  solver_type,
cs_sles_hypre_type_t  precond_type,
cs_sles_hypre_setup_hook_t setup_hook,
void *  context 
)

Create HYPRE linear system solver info and context.

In case of rotational periodicity for a block (non-scalar) matrix, the matrix type will be forced to MATSHELL ("shell") regardless of the option used.

Parameters
[in]solver_typeHYPRE solver type
[in]precond_typeHYPRE preconditioner type
[in]setup_hookpointer to optional setup epilogue function
[in]contextpointer to optional (untyped) value or structure for setup_hook, or NULL
Returns
pointer to newly created linear system object.

◆ cs_sles_hypre_define()

cs_sles_hypre_t* cs_sles_hypre_define ( int  f_id,
const char *  name,
cs_sles_hypre_type_t  solver_type,
cs_sles_hypre_type_t  precond_type,
cs_sles_hypre_setup_hook_t setup_hook,
void *  context 
)

Define and associate a HYPRE linear system solver for a given field or equation name.

If this system did not previously exist, it is added to the list of "known" systems. Otherwise, its definition is replaced by the one defined here.

This is a utility function: if finer control is needed, see cs_sles_define and cs_sles_petsc_create.

The associated solver required that the matrix passed to it is a HYPRE matrix (see cs_matrix_set_type_hypre).

Note that this function returns a pointer directly to the iterative solver management structure. This may be used to set further options. If needed, cs_sles_find may be used to obtain a pointer to the matching cs_sles_t container.

Parameters
[in]f_idassociated field id, or < 0
[in]nameassociated name if f_id < 0, or NULL
[in]solver_typeHYPRE solver type
[in]precond_typeHYPRE preconditioner type
[in]setup_hookpointer to optional setup epilogue function
[in,out]contextpointer to optional (untyped) value or structure for setup_hook, or NULL
Returns
pointer to newly created iterative solver info object.

◆ cs_sles_hypre_destroy()

void cs_sles_hypre_destroy ( void **  context)

Destroy iterative sparse linear system solver info and context.

Parameters
[in,out]contextpointer to iterative solver info and context (actual type: cs_sles_hypre_t **)

◆ cs_sles_hypre_error_post_and_abort()

bool cs_sles_hypre_error_post_and_abort ( cs_sles_t sles,
cs_sles_convergence_state_t  state,
const cs_matrix_t a,
const cs_real_t rhs,
cs_real_t vx 
)

Error handler for HYPRE solver.

In case of divergence or breakdown, this error handler outputs an error message It does nothing in case the maximum iteration count is reached.

Parameters
[in,out]slespointer to solver object
[in]stateconvergence state
[in]amatrix
[in]rhsright hand side
[in,out]vxsystem solution
Returns
false (do not attempt new solve)

◆ cs_sles_hypre_free()

void cs_sles_hypre_free ( void *  context)

Free HYPRE linear equation solver setup context.

This function frees resolution-related data, such as buffers and preconditioning but does not free the whole context, as info used for logging (especially performance data) is maintained.

Parameters
[in,out]contextpointer to iterative solver info and context (actual type: cs_sles_hypre_t *)

◆ cs_sles_hypre_get_host_device()

int cs_sles_hypre_get_host_device ( const cs_sles_hypre_t context)

Query whether the solver should run on the host or accelerated device.

Parameters
[in,out]contextpointer to HYPRE linear solver info
Returns
0 for host, 1 for device (GPU)

◆ cs_sles_hypre_library_info()

void cs_sles_hypre_library_info ( cs_log_t  log_type)

Print information on hypre library.

Parameters
[in]log_typelog type

◆ cs_sles_hypre_log()

void cs_sles_hypre_log ( const void *  context,
cs_log_t  log_type 
)

Log sparse linear equation solver info.

Parameters
[in]contextpointer to iterative solver info and context (actual type: cs_sles_hypre_t *)
[in]log_typelog type

◆ cs_sles_hypre_set_host_device()

void cs_sles_hypre_set_host_device ( cs_sles_hypre_t context,
int  use_device 
)

Define whether the solver should run on the host or accelerated device.

If no device is available, this setting is ignored.

Parameters
[in,out]contextpointer to HYPRE linear solver info
[in]use_device0 for host, 1 for device (GPU)

◆ cs_sles_hypre_set_n_max_iter()

void cs_sles_hypre_set_n_max_iter ( cs_sles_hypre_t context,
int  n_max_iter 
)

Set the max. number of iterations associated to the given HYPRE contrext.

Parameters
[in,out]contextpointer to HYPRE linear solver info
[in]n_max_itermax. number of iterations

◆ cs_sles_hypre_setup()

void cs_sles_hypre_setup ( void *  context,
const char *  name,
const cs_matrix_t a,
int  verbosity 
)

Setup iterative sparse linear equation solver.

Parameters
[in,out]contextpointer to iterative solver info and context (actual type: cs_sles_hypre_t *)
[in]namepointer to system name
[in]aassociated matrix
[in]verbosityassociated verbosity

◆ cs_sles_hypre_solve()

cs_sles_convergence_state_t cs_sles_hypre_solve ( void *  context,
const char *  name,
const cs_matrix_t a,
int  verbosity,
double  precision,
double  r_norm,
int *  n_iter,
double *  residual,
const cs_real_t rhs,
cs_real_t vx,
size_t  aux_size,
void *  aux_vectors 
)

Call HYPRE linear equation solver.

Parameters
[in,out]contextpointer to iterative solver info and context (actual type: cs_sles_hypre_t *)
[in]namepointer to system name
[in]amatrix
[in]verbosityassociated verbosity
[in]precisionsolver precision
[in]r_normresidual normalization
[out]n_iternumber of "equivalent" iterations
[out]residualresidual
[in]rhsright hand side
[in,out]vxsystem solution
[in]aux_sizenumber of elements in aux_vectors (in bytes)
aux_vectorsoptional working area (internal allocation if NULL)
Returns
convergence state