programmer's documentation
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
cs_matrix_default.h
Go to the documentation of this file.
1 #ifndef __CS_MATRIX_DEFAULT_H__
2 #define __CS_MATRIX_DEFAULT_H__
3 
4 /*============================================================================
5  * Default Sparse Matrix structure and Tuning.
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2014 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_defs.h"
35 
36 #include "cs_halo.h"
37 #include "cs_matrix.h"
38 #include "cs_numbering.h"
39 #include "cs_halo_perio.h"
40 
41 /*----------------------------------------------------------------------------*/
42 
44 
45 /*============================================================================
46  * Macro definitions
47  *============================================================================*/
48 
49 /*============================================================================
50  * Type definitions
51  *============================================================================*/
52 
53 /*============================================================================
54  * Global variables
55  *============================================================================*/
56 
57 /*=============================================================================
58  * Public function prototypes for Fortran API
59  *============================================================================*/
60 
61 void CS_PROCF(promav, PROMAV)
62 (
63  const cs_int_t *isym, /* <-- Symmetry indicator:
64  1: symmetric; 2: not symmetric */
65  const cs_int_t *ibsize, /* <-- Block size of diagonal element */
66  const cs_int_t *iesize, /* <-- Block size of element ij */
67  const cs_int_t *iinvpe, /* <-- Indicator to cancel increments
68  in rotational periodicty (2) or
69  to exchange them as scalars (1) */
70  const cs_real_t *dam, /* <-- Matrix diagonal */
71  const cs_real_t *xam, /* <-- Matrix extra-diagonal terms */
72  cs_real_t *vx, /* <-- A*vx */
73  cs_real_t *vy /* <-> vy = A*vx */
74  );
75 
76 /*=============================================================================
77  * Public function prototypes
78  *============================================================================*/
79 
80 /*----------------------------------------------------------------------------
81  * Initialize sparse matrix API.
82  *----------------------------------------------------------------------------*/
83 
84 void
86 
87 /*----------------------------------------------------------------------------
88  * Finalize sparse matrix API.
89  *----------------------------------------------------------------------------*/
90 
91 void
92 cs_matrix_finalize(void);
93 
94 /*----------------------------------------------------------------------------
95  * Update sparse matrix API in case of mesh modification.
96  *----------------------------------------------------------------------------*/
97 
98 void
100 
101 /*----------------------------------------------------------------------------
102  * Return default matrix for a given fill type
103  *
104  * parameters:
105  * symmetric <-- Indicates if matrix coefficients are symmetric
106  * diag_block_size <-- Block sizes for diagonal, or NULL
107  * extra_diag_block_size <-- Block sizes for extra diagonal, or NULL
108  *
109  * returns:
110  * pointer to default matrix structure adapted to fill type
111  *----------------------------------------------------------------------------*/
112 
113 cs_matrix_t *
114 cs_matrix_default(bool symmetric,
115  const int *diag_block_size,
116  const int *extra_diag_block_size);
117 
118 /*----------------------------------------------------------------------------
119  * Force matrix variant for a given fill type
120  *
121  * Information from the variant used fo this definition is copied,
122  * so it may be freed after calling this function.
123  *
124  * parameters:
125  * fill type <-- Fill type for which tuning behavior is set
126  * mv <-- Matrix variant to use for this type
127  *----------------------------------------------------------------------------*/
128 
129 void
131  const cs_matrix_variant_t *mv);
132 
133 /*----------------------------------------------------------------------------
134  * Set matrix tuning behavior for a given fill type
135  *
136  * parameters:
137  * fill type <-- Fill type for which tuning behavior is set
138  * tune <-- 1 to activate tuning, 0 to deactivate
139  *----------------------------------------------------------------------------*/
140 
141 void
143  int tune);
144 
145 /*----------------------------------------------------------------------------
146  * Return matrix tuning behavior for a given fill type.
147  *
148  * parameters:
149  * fill type <-- Fill type for which tuning behavior is set
150  *
151  * returns:
152  * 1 if tuning is active, 0 otherwise
153  *----------------------------------------------------------------------------*/
154 
155 int
157 
158 /*----------------------------------------------------------------------------
159  * Set number of matrix computation runs for tuning.
160  *
161  * If this function is not called, defaults are:
162  * - minimum of 10 runs
163  * - minimum of 0.5 seconds of running
164  *
165  * parameters:
166  * n_min_products <-- minimum number of expected SpM.V products for
167  * coefficients assign amortization.
168  * t_measure <-- minimum running time per measure
169  *----------------------------------------------------------------------------*/
170 
171 void
172 cs_matrix_set_tuning_runs(int n_min_products,
173  double t_measure);
174 
175 /*----------------------------------------------------------------------------
176  * Get number of matrix computation runs for tuning.
177  *
178  * parameters:
179  * n_min_products --> minimum number of expected SpM.V products for
180  * coefficients assign amortization.
181  * t_measure --> minimum running time per measure, or NULL
182  *----------------------------------------------------------------------------*/
183 
184 void
185 cs_matrix_get_tuning_runs(int *n_min_products,
186  double *t_measure);
187 
188 /*----------------------------------------------------------------------------*/
189 
191 
192 #endif /* __CS_MATRIX_DEFAULT_H__ */
struct _cs_matrix_variant_t cs_matrix_variant_t
Definition: cs_matrix.h:90
void cs_matrix_get_tuning_runs(int *n_min_products, double *t_measure)
Definition: cs_matrix_default.c:557
#define BEGIN_C_DECLS
Definition: cs_defs.h:405
int cs_int_t
Fortran-compatible integer.
Definition: cs_defs.h:295
struct _cs_matrix_t cs_matrix_t
Definition: cs_matrix.h:86
int cs_matrix_get_tuning(cs_matrix_fill_type_t fill_type)
Definition: cs_matrix_default.c:510
void cs_matrix_initialize(void)
Definition: cs_matrix_default.c:221
void cs_matrix_finalize(void)
Definition: cs_matrix_default.c:341
void promav(const cs_int_t *isym, const cs_int_t *ibsize, const cs_int_t *iesize, const cs_int_t *iinvpe, const cs_real_t *dam, const cs_real_t *xam, cs_real_t *vx, cs_real_t *vy)
Definition: cs_matrix_default.c:144
cs_matrix_t * cs_matrix_default(bool symmetric, const int *diag_block_size, const int *extra_diag_block_size)
Definition: cs_matrix_default.c:413
#define END_C_DECLS
Definition: cs_defs.h:406
double cs_real_t
Definition: cs_defs.h:296
#define CS_PROCF(x, y)
Definition: cs_defs.h:419
void cs_matrix_update_mesh(void)
Definition: cs_matrix_default.c:365
void cs_matrix_set_variant(cs_matrix_fill_type_t fill_type, const cs_matrix_variant_t *mv)
Definition: cs_matrix_default.c:461
void cs_matrix_set_tuning_runs(int n_min_products, double t_measure)
Definition: cs_matrix_default.c:537
void cs_matrix_set_tuning(cs_matrix_fill_type_t fill_type, int tune)
Definition: cs_matrix_default.c:485
cs_matrix_fill_type_t
Definition: cs_matrix.h:66