8.1
general documentation
cs_sles_mumps.h
Go to the documentation of this file.
1 #ifndef __CS_SLES_MUMPS_H__
2 #define __CS_SLES_MUMPS_H__
3 
4 /*============================================================================
5  * Sparse Linear Equation Solvers using MUMPS (a sparse direct solver library)
6  *============================================================================*/
7 
8 /*
9  This file is part of code_saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2023 EDF S.A.
12 
13  This program is free software; you can redistribute it and/or modify it under
14  the terms of the GNU General Public License as published by the Free Software
15  Foundation; either version 2 of the License, or (at your option) any later
16  version.
17 
18  This program is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21  details.
22 
23  You should have received a copy of the GNU General Public License along with
24  this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
25  Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 */
27 
28 /*----------------------------------------------------------------------------*/
29 
30 /*----------------------------------------------------------------------------
31  * Local headers
32  *----------------------------------------------------------------------------*/
33 
34 #include "cs_base.h"
35 #include "cs_halo_perio.h"
36 #include "cs_matrix.h"
37 #include "cs_param_sles.h"
38 #include "cs_time_plot.h"
39 #include "cs_sles.h"
40 #include "cs_sles_pc.h"
41 
42 /*----------------------------------------------------------------------------*/
43 
45 
46 /*============================================================================
47  * Macro definitions
48  *============================================================================*/
49 
50 /* Set of macros defined in order to match MUMPS documentation (because of the
51  * difference between C/FORTRAN programming language)
52  */
53 
54 #define ICNTL(I) icntl[(I)-1]
55 #define CNTL(I) cntl[(I)-1]
56 #define INFOG(I) infog[(I)-1]
57 #define INFO(I) info[(I)-1]
58 #define RINFOG(I) rinfog[(I)-1]
59 #define RINFO(I) rinfo[(I)-1]
60 #define KEEP(I) keep[(I)-1]
61 
62 /*============================================================================
63  * Type definitions
64  *============================================================================*/
65 
66 /*----------------------------------------------------------------------------*/
79 /*----------------------------------------------------------------------------*/
80 
81 typedef void
83  void *context,
84  void *mumps);
85 
86 /* MUMPS solver context (opaque) */
87 
88 typedef struct _cs_sles_mumps_t cs_sles_mumps_t;
89 
90 /*============================================================================
91  * Global variables
92  *============================================================================*/
93 
94 /*=============================================================================
95  * User function prototypes
96  *============================================================================*/
97 
98 /*----------------------------------------------------------------------------*/
116 /*----------------------------------------------------------------------------*/
117 
118 void
120  void *context,
121  void *pmumps);
122 
123 /*=============================================================================
124  * Public function prototypes
125  *============================================================================*/
126 
127 /*----------------------------------------------------------------------------*/
153 /*----------------------------------------------------------------------------*/
154 
156 cs_sles_mumps_define(int f_id,
157  const char *name,
158  const cs_param_sles_t *slesp,
159  cs_sles_mumps_setup_hook_t *setup_hook,
160  void *context);
161 
162 /*----------------------------------------------------------------------------*/
170 /*----------------------------------------------------------------------------*/
171 
172 cs_sles_pc_t *
174 
175 /*----------------------------------------------------------------------------*/
186 /*----------------------------------------------------------------------------*/
187 
190  cs_sles_mumps_setup_hook_t *setup_hook,
191  void *context);
192 
193 /*----------------------------------------------------------------------------*/
204 /*----------------------------------------------------------------------------*/
205 
206 void *
207 cs_sles_mumps_copy(const void *context);
208 
209 /*----------------------------------------------------------------------------*/
220 /*----------------------------------------------------------------------------*/
221 
222 void
223 cs_sles_mumps_free(void *context);
224 
225 /*----------------------------------------------------------------------------*/
232 /*----------------------------------------------------------------------------*/
233 
234 void
235 cs_sles_mumps_destroy(void **context);
236 
237 /*----------------------------------------------------------------------------*/
247 /*----------------------------------------------------------------------------*/
248 
249 void
250 cs_sles_mumps_setup(void *context,
251  const char *name,
252  const cs_matrix_t *a,
253  int verbosity);
254 
255 /*----------------------------------------------------------------------------*/
276 /*----------------------------------------------------------------------------*/
277 
279 cs_sles_mumps_solve(void *context,
280  const char *name,
281  const cs_matrix_t *a,
282  int verbosity,
283  double precision,
284  double r_norm,
285  int *n_iter,
286  double *residual,
287  const cs_real_t *rhs,
288  cs_real_t *vx,
289  size_t aux_size,
290  void *aux_vectors);
291 
292 /*----------------------------------------------------------------------------*/
300 /*----------------------------------------------------------------------------*/
301 
302 void
303 cs_sles_mumps_log(const void *context,
304  cs_log_t log_type);
305 
306 /*----------------------------------------------------------------------------*/
312 /*----------------------------------------------------------------------------*/
313 
314 void
316 
317 /*----------------------------------------------------------------------------*/
318 
320 
321 #endif /* __CS_SLES_MUMPS_H__ */
#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
cs_log_t
Definition: cs_log.h:48
struct _cs_matrix_t cs_matrix_t
Definition: cs_matrix.h:110
Structure and routines handling the SLES settings stored inside a cs_param_sles_t structure.
cs_sles_convergence_state_t
Definition: cs_sles.h:56
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 *residual, const cs_real_t *rhs, cs_real_t *vx, size_t aux_size, void *aux_vectors)
Call MUMPS linear equation solver.
Definition: cs_sles_mumps.c:2912
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.
Definition: cs_sles_mumps.c:2275
void cs_sles_mumps_free(void *context)
Free MUMPS linear equation solver setup context.
Definition: cs_sles_mumps.c:2422
void() cs_sles_mumps_setup_hook_t(const cs_param_sles_t *slesp, void *context, void *mumps)
Function pointer for user settings of a MUMPS solver. This function is called at the end of the setup...
Definition: cs_sles_mumps.h:82
cs_sles_pc_t * cs_sles_mumps_pc_create(const cs_param_sles_t *slesp)
Create a preconditioner structure relying on MUMPS solver.
Definition: cs_sles_mumps.c:2308
void cs_sles_mumps_library_info(cs_log_t log_type)
Print information on MUMPS library.
Definition: cs_sles_mumps.c:3231
void cs_sles_mumps_setup(void *context, const char *name, const cs_matrix_t *a, int verbosity)
Setup MUMPS linear equation solver.
Definition: cs_sles_mumps.c:2532
void cs_sles_mumps_destroy(void **context)
Destroy MUMPS linear system solver info and context.
Definition: cs_sles_mumps.c:2503
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 duri...
Definition: cs_sles_mumps.c:2233
void * cs_sles_mumps_copy(const void *context)
Create MUMPS linear system solver info and context based on existing info and context.
Definition: cs_sles_mumps.c:2394
struct _cs_sles_mumps_t cs_sles_mumps_t
Definition: cs_sles_mumps.h:88
void cs_sles_mumps_log(const void *context, cs_log_t log_type)
Log sparse linear equation solver info.
Definition: cs_sles_mumps.c:3145
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.
Definition: cs_sles_mumps.c:2347
struct _cs_sles_pc_t cs_sles_pc_t
Definition: cs_sles_pc.h:66
Structure storing all metadata related to the resolution of a linear system with an iterative solver.
Definition: cs_param_sles.h:213