programmer's documentation
cs_matrix.h
Go to the documentation of this file.
1 #ifndef __CS_MATRIX_H__
2 #define __CS_MATRIX_H__
3 
4 /*============================================================================
5  * Sparse Matrix Representation and Operations
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2016 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_numbering.h"
38 #include "cs_halo_perio.h"
39 
40 /*----------------------------------------------------------------------------*/
41 
43 
44 /*============================================================================
45  * Macro definitions
46  *============================================================================*/
47 
48 /*============================================================================
49  * Type definitions
50  *============================================================================*/
51 
52 /* Matrix structure representation types */
53 
54 typedef enum {
55 
56  CS_MATRIX_NATIVE, /* Native matrix format */
57  CS_MATRIX_CSR, /* Compressed Sparse Row storage format */
58  CS_MATRIX_CSR_SYM, /* Compressed Symmetric Sparse Row storage format */
59  CS_MATRIX_MSR, /* Modified Compressed Sparse Row storage format */
60  CS_MATRIX_N_TYPES /* Number of known matrix types */
61 
63 
64 /* Matrix fill types (for tuning) */
65 
66 typedef enum {
67 
68  CS_MATRIX_SCALAR, /* Simple calar matrix */
69  CS_MATRIX_SCALAR_SYM, /* Simple scalar symmetric matrix */
70  CS_MATRIX_33_BLOCK_D, /* Matrix with 3x3 diagonal blocks
71  (and 3.I extradiagonal blocks) */
72  CS_MATRIX_33_BLOCK_D_SYM, /* Symmetric matrix with 3x3 diagonal blocks
73  (and 3.I extradiagonal blocks) */
74  CS_MATRIX_33_BLOCK, /* Matrix with 3x3 blocks
75  (diagonal and extra-diagonal) */
76  CS_MATRIX_N_FILL_TYPES /* Number of possible matrix fill types */
77 
79 
80 /* Structure associated with opaque matrix structure object */
81 
82 typedef struct _cs_matrix_structure_t cs_matrix_structure_t;
83 
84 /* Structure associated with opaque matrix object */
85 
86 typedef struct _cs_matrix_t cs_matrix_t;
87 
88 /* Structure associated with opaque matrix tuning results object */
89 
90 typedef struct _cs_matrix_variant_t cs_matrix_variant_t;
91 
92 /*============================================================================
93  * Global variables
94  *============================================================================*/
95 
96 /* Short names for matrix types */
97 
98 extern const char *cs_matrix_type_name[];
99 
100 /* Full names for matrix types */
101 
102 extern const char *cs_matrix_type_fullname[];
103 
104 /* Fill type names for matrices */
105 
106 extern const char *cs_matrix_fill_type_name[];
107 
108 /*=============================================================================
109  * Public function prototypes
110  *============================================================================*/
111 
112 /*----------------------------------------------------------------------------
113  * Create a matrix Structure.
114  *
115  * Note that the structure created maps to the given existing
116  * cell global number, face -> cell connectivity arrays, and cell halo
117  * structure, so it must be destroyed before they are freed
118  * (usually along with the code's main face -> cell structure).
119  *
120  * Note that the resulting matrix structure will contain either a full or
121  * an empty main diagonal, and that the extra-diagonal structure is always
122  * symmetric (though the coefficients my not be, and we may choose a
123  * matrix format that does not exploit ths symmetry). If the face_cell
124  * connectivity argument is NULL, the matrix will be purely diagonal.
125  *
126  * parameters:
127  * type <-- Type of matrix considered
128  * have_diag <-- Indicates if the diagonal structure contains nonzeroes
129  * n_cells <-- Local number of cells
130  * n_cells_ext <-- Local number of cells + ghost cells sharing a face
131  * n_faces <-- Local number of internal faces
132  * cell_num <-- Optional global cell numbers (1 to n), or NULL
133  * face_cell <-- Face -> cells connectivity
134  * halo <-- Halo structure associated with cells, or NULL
135  * numbering <-- vectorization or thread-related numbering info, or NULL
136  *
137  * returns:
138  * pointer to created matrix structure;
139  *----------------------------------------------------------------------------*/
140 
143  bool have_diag,
144  cs_lnum_t n_cells,
145  cs_lnum_t n_cells_ext,
146  cs_lnum_t n_faces,
147  const cs_gnum_t *cell_num,
148  const cs_lnum_2_t *face_cell,
149  const cs_halo_t *halo,
150  const cs_numbering_t *numbering);
151 
152 /*----------------------------------------------------------------------------
153  * Create a matrix container using a given variant.
154  *
155  * If the matrix variant is incompatible with the structure, it is ignored,
156  * and defaults for that structure are used instead.
157  *
158  * parameters:
159  * ms <-- Associated matrix structure
160  * mv <-- Associated matrix variant
161  *
162  * returns:
163  * pointer to created matrix structure;
164  *----------------------------------------------------------------------------*/
165 
166 cs_matrix_t *
168  const cs_matrix_variant_t *mv);
169 
170 /*----------------------------------------------------------------------------
171  * Destroy a matrix structure.
172  *
173  * parameters:
174  * ms <-> Pointer to matrix structure pointer
175  *----------------------------------------------------------------------------*/
176 
177 void
179 
180 /*----------------------------------------------------------------------------
181  * Create a matrix container using a given structure.
182  *
183  * Note that the matrix container maps to the assigned structure,
184  * so it must be destroyed before that structure.
185  *
186  * parameters:
187  * ms <-- Associated matrix structure
188  *
189  * returns:
190  * pointer to created matrix structure;
191  *----------------------------------------------------------------------------*/
192 
193 cs_matrix_t *
195 
196 /*----------------------------------------------------------------------------
197  * Destroy a matrix structure.
198  *
199  * parameters:
200  * matrix <-> Pointer to matrix structure pointer
201  *----------------------------------------------------------------------------*/
202 
203 void
205 
206 /*----------------------------------------------------------------------------
207  * Return number of columns in matrix.
208  *
209  * parameters:
210  * matrix --> Pointer to matrix structure
211  *----------------------------------------------------------------------------*/
212 
213 cs_lnum_t
215 
216 /*----------------------------------------------------------------------------
217  * Return number of rows in matrix.
218  *
219  * parameters:
220  * matrix --> Pointer to matrix structure
221  *----------------------------------------------------------------------------*/
222 
223 cs_lnum_t
225 
226 /*----------------------------------------------------------------------------
227  * Return matrix diagonal block sizes.
228  *
229  * Block sizes are defined by a array of 4 values:
230  * 0: useful block size, 1: vector block extents,
231  * 2: matrix line extents, 3: matrix line*column extents
232  *
233  * parameters:
234  * matrix <-- Pointer to matrix structure
235  *
236  * returns:
237  * pointer to block sizes
238  *----------------------------------------------------------------------------*/
239 
240 const int *
242 
243 /*----------------------------------------------------------------------------
244  * Return matrix extra-diagonal block sizes.
245  *
246  * Block sizes are defined by a array of 4 values:
247  * 0: useful block size, 1: vector block extents,
248  * 2: matrix line extents, 3: matrix line*column extents
249  *
250  * parameters:
251  * matrix <-- Pointer to matrix structure
252  *
253  * returns:
254  * pointer to block sizes
255  *----------------------------------------------------------------------------*/
256 
257 const int *
259 
260 /*----------------------------------------------------------------------------
261  * Return pointer to matrix halo structure.
262  *
263  * parameters:
264  * matrix <-- Pointer to matrix structure
265  *
266  * returns:
267  * pointer to halo strucuture
268  *----------------------------------------------------------------------------*/
269 
270 const cs_halo_t *
272 
273 /*----------------------------------------------------------------------------
274  * Get matrix fill type, depending on block sizes.
275  *
276  * Block sizes are defined by an optional array of 4 values:
277  * 0: useful block size, 1: vector block extents,
278  * 2: matrix line extents, 3: matrix line*column extents
279  *
280  * parameters:
281  * symmetric <-- Indicates if matrix coefficients are symmetric
282  * diag_block_size <-- Block sizes for diagonal, or NULL
283  * extra_diag_block_size <-- Block sizes for extra diagonal, or NULL
284  *
285  * returns:
286  * matrix fill type
287  *----------------------------------------------------------------------------*/
288 
290 cs_matrix_get_fill_type(bool symmetric,
291  const int *diag_block_size,
292  const int *extra_diag_block_size);
293 
294 /*----------------------------------------------------------------------------
295  * Set matrix coefficients, sharing arrays with the caller when possible.
296  *
297  * With shared arrays, the matrix becomes unusable if the arrays passed as
298  * arguments are not be modified (its coefficients should be unset first
299  * to mark this).
300  *
301  * Depending on current options and initialization, values will be copied
302  * or simply mapped.
303  *
304  * Block sizes are defined by an optional array of 4 values:
305  * 0: useful block size, 1: vector block extents,
306  * 2: matrix line extents, 3: matrix line*column extents
307  *
308  * parameters:
309  * matrix <-> Pointer to matrix structure
310  * symmetric <-- Indicates if matrix coefficients are symmetric
311  * diag_block_size <-- Block sizes for diagonal, or NULL
312  * extra_diag_block_size <-- Block sizes for extra diagonal, or NULL
313  * da <-- Diagonal values (NULL if zero)
314  * xa <-- Extradiagonal values (NULL if zero)
315  *----------------------------------------------------------------------------*/
316 
317 void
319  bool symmetric,
320  const int *diag_block_size,
321  const int *extra_diag_block_size,
322  const cs_real_t *da,
323  const cs_real_t *xa);
324 
325 /*----------------------------------------------------------------------------
326  * Set matrix coefficients, copying values to private arrays.
327  *
328  * With private arrays, the matrix becomes independant from the
329  * arrays passed as arguments.
330  *
331  * Block sizes are defined by an optional array of 4 values:
332  * 0: useful block size, 1: vector block extents,
333  * 2: matrix line extents, 3: matrix line*column extents
334  *
335  * parameters:
336  * matrix <-> Pointer to matrix structure
337  * symmetric <-- Indicates if matrix coefficients are symmetric
338  * diag_block_size <-- Block sizes for diagonal, or NULL
339  * extra_diag_block_size <-- Block sizes for extra diagonal, or NULL
340  * da <-- Diagonal values (NULL if zero)
341  * xa <-- Extradiagonal values (NULL if zero)
342  *----------------------------------------------------------------------------*/
343 
344 void
346  bool symmetric,
347  const int *diag_block_size,
348  const int *extra_diag_block_size,
349  const cs_real_t *da,
350  const cs_real_t *xa);
351 
352 /*----------------------------------------------------------------------------
353  * Release shared matrix coefficients.
354  *
355  * Pointers to mapped coefficients are set to NULL, while
356  * coefficient copies owned by the matrix are not modified.
357  *
358  * This simply ensures the matrix does not maintain pointers
359  * to nonexistant data.
360  *
361  * parameters:
362  * matrix <-> Pointer to matrix structure
363  *----------------------------------------------------------------------------*/
364 
365 void
367 
368 /*----------------------------------------------------------------------------
369  * Copy matrix diagonal values.
370  *
371  * In case of matrixes with block diagonal coefficients, only the true
372  * diagonal values are copied.
373  *
374  * parameters:
375  * matrix --> Pointer to matrix structure
376  * da --> Diagonal (pre-allocated, size: n_cells)
377  *----------------------------------------------------------------------------*/
378 
379 void
381  cs_real_t *restrict da);
382 
383 /*----------------------------------------------------------------------------
384  * Query matrix coefficients symmetry
385  *
386  * parameters:
387  * matrix <-- Pointer to matrix structure
388  *
389  * returns:
390  * true if coefficients are symmetric, false otherwise
391  *----------------------------------------------------------------------------*/
392 
393 bool
395 
396 /*----------------------------------------------------------------------------
397  * Get matrix diagonal values.
398  *
399  * In case of matrixes with block diagonal coefficients, a pointer to
400  * the complete block diagonal is returned.
401  *
402  * parameters:
403  * matrix --> Pointer to matrix structure
404  *
405  * returns:
406  * pointer to matrix diagonal array
407  *----------------------------------------------------------------------------*/
408 
409 const cs_real_t *
411 
412 /*----------------------------------------------------------------------------
413  * Get pointer to matrix extra-diagonal values in "native" format
414  *
415  * This function currently only functions if the matrix is in "native"
416  * format or the coefficients were mapped from native coefficients using
417  * cs_matrix_set_coefficients(), in which case the pointer returned is
418  * the same as the one passed to that function.
419  *
420  * parameters:
421  * matrix --> Pointer to matrix structure
422  *
423  * returns:
424  * pointer to matrix diagonal array
425  *----------------------------------------------------------------------------*/
426 
427 const cs_real_t *
429 
430 /*----------------------------------------------------------------------------
431  * Get arrays describing a matrix in MSR format.
432  *
433  * This function only works for an MSR matrix (i.e. there is
434  * no automatic conversion from another matrix type).
435  *
436  * Matrix block sizes can be obtained by cs_matrix_get_diag_block_size()
437  * and cs_matrix_get_extra_diag_block_size().
438  *
439  * parameters:
440  * matrix <-- Pointer to matrix structure
441  * row_index --> MSR row index
442  * col_id --> MSR column id
443  * d_val --> diagonal values
444  * x_val --> extra-diagonal values
445  *----------------------------------------------------------------------------*/
446 
447 void
449  const cs_lnum_t **row_index,
450  const cs_lnum_t **col_id,
451  const cs_real_t **d_val,
452  const cs_real_t **x_val);
453 
454 /*----------------------------------------------------------------------------
455  * Matrix.vector product y = A.x
456  *
457  * This function includes a halo update of x prior to multiplication by A.
458  *
459  * parameters:
460  * rotation_mode --> Halo update option for rotational periodicity
461  * matrix --> Pointer to matrix structure
462  * x <-> Multipliying vector values (ghost values updated)
463  * y --> Resulting vector
464  *----------------------------------------------------------------------------*/
465 
466 void
468  const cs_matrix_t *matrix,
469  cs_real_t *restrict x,
470  cs_real_t *restrict y);
471 
472 /*----------------------------------------------------------------------------
473  * Matrix.vector product y = A.x with no prior halo update of x.
474  *
475  * This function does not include a halo update of x prior to multiplication
476  * by A, so it should be called only when the halo of x is known to already
477  * be up to date (in which case we avoid the performance penalty of a
478  * redundant update by using this variant of the matrix.vector product).
479  *
480  * parameters:
481  * matrix --> Pointer to matrix structure
482  * x --> Multipliying vector values
483  * y --> Resulting vector
484  *----------------------------------------------------------------------------*/
485 
486 void
488  const cs_real_t *x,
489  cs_real_t *restrict y);
490 
491 /*----------------------------------------------------------------------------
492  * Matrix.vector product y = (A-D).x
493  *
494  * This function includes a halo update of x prior to multiplication by A.
495  *
496  * parameters:
497  * rotation_mode <-- Halo update option for rotational periodicity
498  * matrix <-- Pointer to matrix structure
499  * x <-> Multipliying vector values (ghost values updated)
500  * y --> Resulting vector
501  *----------------------------------------------------------------------------*/
502 
503 void
505  const cs_matrix_t *matrix,
506  cs_real_t *restrict x,
507  cs_real_t *restrict y);
508 
509 /*----------------------------------------------------------------------------
510  * Build list of variants for tuning or testing.
511  *
512  * parameters:
513  * n_fill_types <-- number of fill types tuned for
514  * fill_types <-- array of fill types tuned for
515  * type_filter <-- true for matrix types tuned for, false for others
516  * numbering <-- vectorization or thread-related numbering info,
517  * or NULL
518  * n_variants --> number of variants
519  * m_variant --> array of matrix variants
520  *----------------------------------------------------------------------------*/
521 
522 void
523 cs_matrix_variant_build_list(int n_fill_types,
524  cs_matrix_fill_type_t fill_types[],
525  bool type_filter[],
526  const cs_numbering_t *numbering,
527  int *n_variants,
528  cs_matrix_variant_t **m_variant);
529 
530 /*----------------------------------------------------------------------------
531  * Build matrix variant
532  *
533  * The variant will initially use default matrix-vector functions,
534  * which can be later modified using cs_matrix_variant_set_func().
535  *
536  * parameters:
537  * type <-- Type of matrix considered
538  * numbering <-- vectorization or thread-related numbering info,
539  * or NULL
540  *----------------------------------------------------------------------------*/
541 
544  const cs_numbering_t *numbering);
545 
546 /*----------------------------------------------------------------------------
547  * Destroy a matrix variant structure.
548  *
549  * parameters:
550  * mv <-> Pointer to matrix variant pointer
551  *----------------------------------------------------------------------------*/
552 
553 void
555 
556 /*----------------------------------------------------------------------------
557  * Select the sparse matrix-vector product function to be used by a
558  * matrix variant for a given fill type.
559  *
560  * Currently, possible variant functions are:
561  *
562  * CS_MATRIX_NATIVE (all fill types)
563  * standard
564  * 3_3_diag (for CS_MATRIX_33_BLOCK_D or CS_MATRIX_33_BLOCK_D_SYM)
565  * bull (for CS_MATRIX_SCALAR or CS_MATRIX_SCALAR_SYM)
566  * omp (for OpenMP with compatible numbering)
567  * vector (For vector machine with compatible numbering)
568  *
569  * CS_MATRIX_CSR (for CS_MATRIX_SCALAR or CS_MATRIX_SCALAR_SYM)
570  * standard
571  * prefetch
572  * mkl (with MKL)
573  *
574  * CS_MATRIX_CSR_SYM (for CS_MATRIX_SCALAR_SYM)
575  * standard
576  * mkl (with MKL)
577  *
578  * CS_MATRIX_MSR (all fill types except CS_MATRIX_33_BLOCK)
579  * standard
580  * prefetch
581  * mkl (with MKL, for CS_MATRIX_SCALAR or CS_MATRIX_SCALAR_SYM)
582  *
583  * parameters:
584  * mv <-> Pointer to matrix variant
585  * numbering <-- mesh numbering info, or NULL
586  * fill type <-- matrix fill type to merge from
587  * ed_flag <-- 0: with diagonal only, 1 exclude only; 2; both
588  * func_name <-- function type name
589  *----------------------------------------------------------------------------*/
590 
591 void
593  const cs_numbering_t *numbering,
594  cs_matrix_fill_type_t fill_type,
595  int ed_flag,
596  const char *func_name);
597 
598 /*----------------------------------------------------------------------------
599  * Merge a functions to a matrix variant from another variant sharing
600  * the same structure.
601  *
602  * Functions from the structure to merge for the selected fill type are
603  * assigned to the main variant.
604  *
605  * This can be useful when tuning has been done separately for different fill
606  * types, and the resulting selected structure is identical.
607  *
608  * parameters:
609  * mv <-> Pointer to matrix variant
610  * mv_merge <-- Pointer to matrix variant to merge
611  * fill type <-- matrix fill type to merge from
612  *----------------------------------------------------------------------------*/
613 
614 void
616  const cs_matrix_variant_t *mv_merge,
617  cs_matrix_fill_type_t fill_type);
618 
619 /*----------------------------------------------------------------------------
620  * Get the type associated with a matrix variant.
621  *
622  * parameters:
623  * mv <-- Pointer to matrix variant structure
624  *----------------------------------------------------------------------------*/
625 
628 
629 /*----------------------------------------------------------------------------
630  * Test local matrix.vector product operations.
631  *
632  * parameters:
633  * n_cells <-- number of local cells
634  * n_cells_ext <-- number of cells including ghost cells (array size)
635  * n_faces <-- local number of internal faces
636  * cell_num <-- Optional global cell numbers (1 to n), or NULL
637  * face_cell <-- face -> cells connectivity
638  * halo <-- cell halo structure
639  * numbering <-- vectorization or thread-related numbering info, or NULL
640  *----------------------------------------------------------------------------*/
641 
642 void
644  cs_lnum_t n_cells_ext,
645  cs_lnum_t n_faces,
646  const cs_gnum_t *cell_num,
647  const cs_lnum_2_t *face_cell,
648  const cs_halo_t *halo,
649  const cs_numbering_t *numbering);
650 
651 /*----------------------------------------------------------------------------*/
652 
654 
655 #endif /* __CS_MATRIX_H__ */
const int * cs_matrix_get_diag_block_size(const cs_matrix_t *matrix)
Definition: cs_matrix.c:4688
bool cs_matrix_is_symmetric(const cs_matrix_t *matrix)
Definition: cs_matrix.c:5010
unsigned long cs_gnum_t
global mesh entity number
Definition: cs_defs.h:280
#define restrict
Definition: cs_defs.h:122
void cs_matrix_get_msr_arrays(const cs_matrix_t *matrix, const cs_lnum_t **row_index, const cs_lnum_t **col_id, const cs_real_t **d_val, const cs_real_t **x_val)
Definition: cs_matrix.c:5186
const cs_halo_t * cs_matrix_get_halo(const cs_matrix_t *matrix)
Definition: cs_matrix.c:4732
void cs_matrix_vector_multiply(cs_halo_rotation_t rotation_mode, const cs_matrix_t *matrix, cs_real_t *restrict x, cs_real_t *restrict y)
Definition: cs_matrix.c:5222
void cs_matrix_variant_build_list(int n_fill_types, cs_matrix_fill_type_t fill_types[], bool type_filter[], const cs_numbering_t *numbering, int *n_variants, cs_matrix_variant_t **m_variant)
Definition: cs_matrix.c:5365
cs_halo_rotation_t
Definition: cs_halo.h:59
void cs_matrix_copy_coefficients(cs_matrix_t *matrix, bool symmetric, const int *diag_block_size, const int *extra_diag_block_size, const cs_real_t *da, const cs_real_t *xa)
Definition: cs_matrix.c:4890
const int * cs_matrix_get_extra_diag_block_size(const cs_matrix_t *matrix)
Definition: cs_matrix.c:4712
Definition: cs_matrix.h:72
cs_matrix_t * cs_matrix_create(const cs_matrix_structure_t *ms)
Definition: cs_matrix.c:4434
struct _cs_matrix_variant_t cs_matrix_variant_t
Definition: cs_matrix.h:90
#define BEGIN_C_DECLS
Definition: cs_defs.h:419
void cs_matrix_release_coefficients(cs_matrix_t *matrix)
Definition: cs_matrix.c:4956
Definition: cs_matrix.h:76
Definition: cs_halo.h:70
void cs_matrix_structure_destroy(cs_matrix_structure_t **ms)
Definition: cs_matrix.c:4377
void cs_matrix_copy_diagonal(const cs_matrix_t *matrix, cs_real_t *restrict da)
Definition: cs_matrix.c:4986
void cs_matrix_variant_test(cs_lnum_t n_cells, cs_lnum_t n_cells_ext, cs_lnum_t n_faces, const cs_gnum_t *cell_num, const cs_lnum_2_t *face_cell, const cs_halo_t *halo, const cs_numbering_t *numbering)
Definition: cs_matrix.c:5758
const char * cs_matrix_type_fullname[]
const char * cs_matrix_fill_type_name[]
struct _cs_matrix_t cs_matrix_t
Definition: cs_matrix.h:86
void cs_matrix_variant_merge(cs_matrix_variant_t *mv, const cs_matrix_variant_t *mv_merge, cs_matrix_fill_type_t fill_type)
Definition: cs_matrix.c:5713
cs_matrix_fill_type_t cs_matrix_get_fill_type(bool symmetric, const int *diag_block_size, const int *extra_diag_block_size)
Definition: cs_matrix.c:4758
const char * cs_matrix_type_name[]
Definition: cs_matrix.h:70
Definition: cs_matrix.h:60
cs_matrix_type_t
Definition: cs_matrix.h:54
void matrix(const cs_int_t *const iconvp, const cs_int_t *const idiffp, const cs_int_t *const ndircp, const cs_int_t *const isym, const cs_real_t *const thetap, const cs_int_t *const imucpp, const cs_real_t coefbp[], const cs_real_t cofbfp[], const cs_real_t rovsdt[], const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_t i_visc[], const cs_real_t b_visc[], const cs_real_t xcpp[], cs_real_t da[], cs_real_t xa[])
Definition: cs_matrix_building.c:111
void cs_matrix_set_coefficients(cs_matrix_t *matrix, bool symmetric, const int *diag_block_size, const int *extra_diag_block_size, const cs_real_t *da, const cs_real_t *xa)
Definition: cs_matrix.c:4814
Definition: cs_matrix.h:68
Definition: cs_matrix.h:58
int cs_lnum_2_t[2]
vector of 2 local mesh-entity ids
Definition: cs_defs.h:301
cs_matrix_variant_t * cs_matrix_variant_create(cs_matrix_type_t type, const cs_numbering_t *numbering)
Definition: cs_matrix.c:5322
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:292
cs_lnum_t cs_matrix_get_n_columns(const cs_matrix_t *matrix)
Definition: cs_matrix.c:4649
cs_matrix_structure_t * cs_matrix_structure_create(cs_matrix_type_t type, bool have_diag, cs_lnum_t n_cells, cs_lnum_t n_cells_ext, cs_lnum_t n_faces, const cs_gnum_t *cell_num, const cs_lnum_2_t *face_cell, const cs_halo_t *halo, const cs_numbering_t *numbering)
Definition: cs_matrix.c:4301
void cs_matrix_destroy(cs_matrix_t **matrix)
Definition: cs_matrix.c:4594
#define END_C_DECLS
Definition: cs_defs.h:420
void cs_matrix_variant_destroy(cs_matrix_variant_t **mv)
Definition: cs_matrix.c:5625
double cs_real_t
Definition: cs_defs.h:296
Definition: cs_matrix.h:74
void cs_matrix_exdiag_vector_multiply(cs_halo_rotation_t rotation_mode, const cs_matrix_t *matrix, cs_real_t *restrict x, cs_real_t *restrict y)
Definition: cs_matrix.c:5287
const cs_real_t * cs_matrix_get_extra_diagonal(const cs_matrix_t *matrix)
Definition: cs_matrix.c:5135
Definition: cs_matrix.h:59
cs_matrix_t * cs_matrix_create_by_variant(const cs_matrix_structure_t *ms, const cs_matrix_variant_t *mv)
Definition: cs_matrix.c:4565
Definition: cs_matrix.h:57
cs_lnum_t cs_matrix_get_n_rows(const cs_matrix_t *matrix)
Definition: cs_matrix.c:4665
void cs_matrix_variant_set_func(cs_matrix_variant_t *mv, const cs_numbering_t *numbering, cs_matrix_fill_type_t fill_type, int ed_flag, const char *func_name)
Definition: cs_matrix.c:5667
const cs_real_t * cs_matrix_get_diagonal(const cs_matrix_t *matrix)
Definition: cs_matrix.c:5039
Definition: cs_matrix.h:56
Definition: cs_matrix.h:69
cs_matrix_type_t cs_matrix_variant_type(const cs_matrix_variant_t *mv)
Definition: cs_matrix.c:5736
void cs_matrix_vector_multiply_nosync(const cs_matrix_t *matrix, const cs_real_t *x, cs_real_t *restrict y)
Definition: cs_matrix.c:5259
Definition: cs_numbering.h:78
struct _cs_matrix_structure_t cs_matrix_structure_t
Definition: cs_matrix.h:82
cs_matrix_fill_type_t
Definition: cs_matrix.h:66