7.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-2021 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  * MUMPS headers
32  *----------------------------------------------------------------------------*/
33 
34 #include <dmumps_c.h>
35 #include <smumps_c.h>
36 
37 /*----------------------------------------------------------------------------
38  * Local headers
39  *----------------------------------------------------------------------------*/
40 
41 #include "cs_base.h"
42 #include "cs_halo_perio.h"
43 #include "cs_matrix.h"
44 #include "cs_param_sles.h"
45 #include "cs_time_plot.h"
46 #include "cs_sles.h"
47 
48 /*----------------------------------------------------------------------------*/
49 
51 
52 /*============================================================================
53  * Macro definitions
54  *============================================================================*/
55 
56 #define CS_SLES_MUMPS_JOB_INIT -1
57 
58 /* Set of macros defined in order to match MUMPS documentation (because of the
59  * difference between C/FORTRAN programming language
60  */
61 #define ICNTL(I) icntl[(I)-1]
62 #define CNTL(I) cntl[(I)-1]
63 #define INFOG(I) infog[(I)-1]
64 #define INFO(I) info[(I)-1]
65 #define RINFOG(I) rinfog[(I)-1]
66 #define RINFO(I) rinfo[(I)-1]
67 
68 /*============================================================================
69  * Type definitions
70  *============================================================================*/
71 
72 /*----------------------------------------------------------------------------*/
86 /*----------------------------------------------------------------------------*/
87 
88 typedef void
90  void *context,
91  DMUMPS_STRUC_C *dmumps,
92  SMUMPS_STRUC_C *smumps);
93 
94 /* MUMPS solver context (opaque) */
95 
96 typedef struct _cs_sles_mumps_t cs_sles_mumps_t;
97 
98 /*============================================================================
99  * Global variables
100  *============================================================================*/
101 
102 /*=============================================================================
103  * User function prototypes
104  *============================================================================*/
105 
106 /*----------------------------------------------------------------------------*/
120 /*----------------------------------------------------------------------------*/
121 
122 void
124  void *context,
125  DMUMPS_STRUC_C *dmumps,
126  SMUMPS_STRUC_C *smumps);
127 
128 /*=============================================================================
129  * Public function prototypes
130  *============================================================================*/
131 
132 /*----------------------------------------------------------------------------*/
158 /*----------------------------------------------------------------------------*/
159 
161 cs_sles_mumps_define(int f_id,
162  const char *name,
163  const cs_param_sles_t *slesp,
164  cs_sles_mumps_setup_hook_t *setup_hook,
165  void *context);
166 
167 /*----------------------------------------------------------------------------*/
178 /*----------------------------------------------------------------------------*/
179 
182  cs_sles_mumps_setup_hook_t *setup_hook,
183  void *context);
184 
185 /*----------------------------------------------------------------------------*/
196 /*----------------------------------------------------------------------------*/
197 
198 void *
199 cs_sles_mumps_copy(const void *context);
200 
201 /*----------------------------------------------------------------------------*/
212 /*----------------------------------------------------------------------------*/
213 
214 void
215 cs_sles_mumps_free(void *context);
216 
217 /*----------------------------------------------------------------------------*/
224 /*----------------------------------------------------------------------------*/
225 
226 void
227 cs_sles_mumps_destroy(void **context);
228 
229 /*----------------------------------------------------------------------------*/
239 /*----------------------------------------------------------------------------*/
240 
241 void
242 cs_sles_mumps_setup(void *context,
243  const char *name,
244  const cs_matrix_t *a,
245  int verbosity);
246 
247 /*----------------------------------------------------------------------------*/
268 /*----------------------------------------------------------------------------*/
269 
271 cs_sles_mumps_solve(void *context,
272  const char *name,
273  const cs_matrix_t *a,
274  int verbosity,
275  double precision,
276  double r_norm,
277  int *n_iter,
278  double *residue,
279  const cs_real_t *rhs,
280  cs_real_t *vx,
281  size_t aux_size,
282  void *aux_vectors);
283 
284 /*----------------------------------------------------------------------------*/
292 /*----------------------------------------------------------------------------*/
293 
294 void
295 cs_sles_mumps_log(const void *context,
296  cs_log_t log_type);
297 
298 /*----------------------------------------------------------------------------*/
299 
301 
302 #endif /* __CS_SLES_MUMPS_H__ */
struct _cs_sles_mumps_t cs_sles_mumps_t
Definition: cs_sles_mumps.h:96
void cs_sles_mumps_log(const void *context, cs_log_t log_type)
Log sparse linear equation solver info.
Definition: cs_sles_mumps.c:2401
#define BEGIN_C_DECLS
Definition: cs_defs.h:510
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:1609
Structure and routines handling the SLES settings stored inside a cs_param_sles_t structure...
void cs_sles_mumps_destroy(void **context)
Destroy MUMPS linear system solver info and context.
Definition: cs_sles_mumps.c:1791
double cs_real_t
Floating-point value.
Definition: cs_defs.h:322
struct _cs_matrix_t cs_matrix_t
Definition: cs_matrix.h:93
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:1819
cs_sles_convergence_state_t
Convergence status indicator.
Definition: cs_sles.h:56
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:1687
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:1645
double precision, save a
Definition: cs_fuel_incl.f90:146
void() cs_sles_mumps_setup_hook_t(const cs_param_sles_t *slesp, void *context, DMUMPS_STRUC_C *dmumps, SMUMPS_STRUC_C *smumps)
Function pointer for user settings of a MUMPS solver. This function is called at the end of the setup...
Definition: cs_sles_mumps.h:89
void cs_sles_mumps_free(void *context)
Free MUMPS linear equation solver setup context.
Definition: cs_sles_mumps.c:1715
void cs_user_sles_mumps_hook(const cs_param_sles_t *slesp, void *context, DMUMPS_STRUC_C *dmumps, SMUMPS_STRUC_C *smumps)
Function pointer for user settings of a MUMPS solver. This function is called at the end of the setup...
Definition: cs_sles_mumps.c:1565
cs_log_t
Definition: cs_log.h:48
#define END_C_DECLS
Definition: cs_defs.h:511
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.
Definition: cs_sles_mumps.c:2166
Structure storing all metadata related to the resolution of a linear system with an iterative solver...
Definition: cs_param_sles.h:62