8.0
general documentation
cs_sles_mumps.c File Reference

Set of functions to handle the interface with the MUMPS library to solve sparse linear system with a direct approach. More...

#include "cs_defs.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <float.h>
#include <math.h>
#include <dmumps_c.h>
#include <smumps_c.h>
#include "bft_mem.h"
#include "bft_error.h"
#include "bft_printf.h"
#include "cs_array.h"
#include "cs_base.h"
#include "cs_log.h"
#include "cs_fp_exception.h"
#include "cs_halo.h"
#include "cs_matrix.h"
#include "cs_matrix_default.h"
#include "cs_parall.h"
#include "cs_timer.h"
#include "cs_sles.h"
#include "cs_sles_mumps.h"
+ Include dependency graph for cs_sles_mumps.c:

Functions

void cs_user_sles_mumps_hook (const cs_param_sles_t *slesp, void *context, void *pmumps)
 Function pointer for advanced user settings of a MUMPS solver. This function is called two times during the setup stage. More...
 
cs_sles_mumps_tcs_sles_mumps_define (int f_id, const char *name, const cs_param_sles_t *slesp, cs_sles_mumps_setup_hook_t *setup_hook, void *context)
 Define and associate a MUMPS linear system solver for a given field or equation name. More...
 
cs_sles_pc_tcs_sles_mumps_pc_create (const cs_param_sles_t *slesp)
 Create a preconditioner structure relying on MUMPS solver. More...
 
cs_sles_mumps_tcs_sles_mumps_create (const cs_param_sles_t *slesp, cs_sles_mumps_setup_hook_t *setup_hook, void *context)
 Create MUMPS linear system solver info and context. More...
 
void * cs_sles_mumps_copy (const void *context)
 Create MUMPS linear system solver info and context based on existing info and context. More...
 
void cs_sles_mumps_free (void *context)
 Free MUMPS linear equation solver setup context. More...
 
void cs_sles_mumps_destroy (void **context)
 Destroy MUMPS linear system solver info and context. More...
 
void cs_sles_mumps_setup (void *context, const char *name, const cs_matrix_t *a, int verbosity)
 Setup MUMPS linear equation solver. More...
 
cs_sles_convergence_state_t cs_sles_mumps_solve (void *context, const char *name, const cs_matrix_t *a, int verbosity, double precision, double r_norm, int *n_iter, double *residue, const cs_real_t *rhs, cs_real_t *vx, size_t aux_size, void *aux_vectors)
 Call MUMPS linear equation solver. More...
 
void cs_sles_mumps_log (const void *context, cs_log_t log_type)
 Log sparse linear equation solver info. More...
 
void cs_sles_mumps_library_info (cs_log_t log_type)
 Print information on MUMPS library. More...
 

Detailed Description

Set of functions to handle the interface with the MUMPS library to solve sparse linear system with a direct approach.

Function Documentation

◆ cs_sles_mumps_copy()

void* cs_sles_mumps_copy ( const void *  context)

Create MUMPS linear system solver info and context based on existing info and context.

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

◆ cs_sles_mumps_create()

cs_sles_mumps_t* cs_sles_mumps_create ( const cs_param_sles_t slesp,
cs_sles_mumps_setup_hook_t setup_hook,
void *  context 
)

Create MUMPS linear system solver info and context.

Parameters
[in]slesppointer to a cs_param_sles_t structure
[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 associated linear system object.

◆ cs_sles_mumps_define()

cs_sles_mumps_t* cs_sles_mumps_define ( int  f_id,
const char *  name,
const cs_param_sles_t slesp,
cs_sles_mumps_setup_hook_t setup_hook,
void *  context 
)

Define and associate a MUMPS 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_mumps_create.

Note that this function returns a pointer directly to the sparse direct 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]slesppointer to a cs_param_sles_t structure
[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 sparse direct solver info object.

◆ cs_sles_mumps_destroy()

void cs_sles_mumps_destroy ( void **  context)

Destroy MUMPS linear system solver info and context.

Parameters
[in,out]contextpointer to sparse direct solver info and context (actual type: cs_sles_mumps_t **)

◆ cs_sles_mumps_free()

void cs_sles_mumps_free ( void *  context)

Free MUMPS 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 sparse direct solver info and context (actual type: cs_sles_mumps_t *)

◆ cs_sles_mumps_library_info()

void cs_sles_mumps_library_info ( cs_log_t  log_type)

Print information on MUMPS library.

Parameters
[in]log_typelog type

◆ cs_sles_mumps_log()

void cs_sles_mumps_log ( const void *  context,
cs_log_t  log_type 
)

Log sparse linear equation solver info.

Parameters
[in]contextpointer to sparse direct solver info and context (actual type: cs_sles_mumps_t *)
[in]log_typelog type

◆ cs_sles_mumps_pc_create()

cs_sles_pc_t* cs_sles_mumps_pc_create ( const cs_param_sles_t slesp)

Create a preconditioner structure relying on MUMPS solver.

Parameters
[in]slesppointer to a cs_param_sles_t structure
Returns
pointer to newly created preconditioner object.

◆ cs_sles_mumps_setup()

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

Setup MUMPS linear equation solver.

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

◆ cs_sles_mumps_solve()

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

Call MUMPS linear equation solver.

Parameters
[in,out]contextpointer to sparse direct solver info and context (actual type: cs_sles_mumps_t *)
[in]namepointer to system name
[in]amatrix
[in]verbosityassociated verbosity
[in]precisionsolver precision
[in]r_normresidue normalization
[out]n_iternumber of "equivalent" iterations
[out]residueresidue
[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

◆ cs_user_sles_mumps_hook()

void cs_user_sles_mumps_hook ( const cs_param_sles_t slesp,
void *  context,
void *  pmumps 
)

Function pointer for advanced user settings of a MUMPS solver. This function is called two times during the setup stage.

  1. Before the analysis step
  2. Before the factorization step

One can recover the MUMPS step through the "job" member. MUMPS_JOB_ANALYSIS or MUMPS_JOB_FACTORIZATION

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

Parameters
[in]slesppointer to the related cs_param_sles_t structure
[in,out]contextpointer to optional (untyped) value or structure
[in,out]pmumpspointer to DMUMPS_STRUC_C or SMUMPS_STRUC_C struct.