programmer's documentation
cs_array_reduce.h
Go to the documentation of this file.
1 #ifndef __CS_ARRAY_REDUCE_H__
2 #define __CS_ARRAY_REDUCE_H__
3 
4 /*============================================================================
5  * Common array reduction operations.
6  *============================================================================*/
7 
8 /*
9  This file is part of the Code_Saturne Kernel, element of the
10  Code_Saturne CFD tool.
11 
12  Copyright (C) 1998-2015 EDF S.A., France
13 
14  contact: saturne-support@edf.fr
15 
16  The Code_Saturne Kernel is free software; you can redistribute it
17  and/or modify it under the terms of the GNU General Public License
18  as published by the Free Software Foundation; either version 2 of
19  the License, or (at your option) any later version.
20 
21  The Code_Saturne Kernel is distributed in the hope that it will be
22  useful, but WITHOUT ANY WARRANTY; without even the implied warranty
23  of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24  GNU General Public License for more details.
25 
26  You should have received a copy of the GNU General Public License
27  along with the Code_Saturne Kernel; if not, write to the
28  Free Software Foundation, Inc.,
29  51 Franklin St, Fifth Floor,
30  Boston, MA 02110-1301 USA
31 */
32 
33 /*----------------------------------------------------------------------------*/
34 
35 #if defined(HAVE_MPI)
36 #include <mpi.h>
37 #endif
38 
39 /*----------------------------------------------------------------------------
40  * Local headers
41  *----------------------------------------------------------------------------*/
42 
43 #include "cs_defs.h"
44 #include "cs_mesh.h"
45 
46 /*----------------------------------------------------------------------------*/
47 
49 
50 /*=============================================================================
51  * Macro definitions
52  *============================================================================*/
53 
54 /*============================================================================
55  * Type definitions
56  *============================================================================*/
57 
58 /*=============================================================================
59  * Public function prototypes
60  *============================================================================*/
61 
62 /*----------------------------------------------------------------------------
63  * Compute sums of an n-dimensional cs_real_t array's components.
64  *
65  * The maximum allowed dimension is 9 (allowing for a rank-2 tensor).
66  * The array is interleaved.
67  *
68  * For arrays of dimension 3, the statistics relative to the norm
69  * are also computed, and added at the end of the statistics arrays
70  * (which must be size dim+1).
71  *
72  * The algorithm here is similar to that used for BLAS, but computes several
73  * quantities simultaneously for better cache behavior.
74  *
75  * Note that for locations with elements shared across ranks
76  * (such as interior faces and vertices), sums may be incorrect as
77  * contributions from multiple ranks may be counted several times.
78  *
79  * parameters:
80  * n_elts <-- number of local elements
81  * v_elt_list <-- optional list of parent elements on which values
82  * are defined, or NULL
83  * dim <-- local array dimension (max: 9)
84  * v <-- pointer to array values
85  * vsum --> resulting sum array (size: dim, or 4 if dim = 3)
86  *----------------------------------------------------------------------------*/
87 
88 void
90  int dim,
91  const cs_lnum_t *v_elt_list,
92  const cs_real_t v[],
93  double vsum[]);
94 
95 /*----------------------------------------------------------------------------
96  * Compute simple local stats (minima, maxima, sum) of an
97  * n-dimensional cs_real_t array's components.
98  *
99  * The maximum allowed dimension is 9 (allowing for a rank-2 tensor).
100  * The array is interleaved.
101  *
102  * For arrays of dimension 3, the statistics relative to the norm
103  * are also computed, and added at the end of the statistics arrays
104  * (which must be size dim+1).
105  *
106  * The algorithm here is similar to that used for BLAS, but computes several
107  * quantities simultaneously for better cache behavior.
108  *
109  * Note that for locations with elements shared across ranks
110  * (such as interior faces and vertices), sums may be incorrect as
111  * contributions from multiple ranks may be counted several times.
112  *
113  * parameters:
114  * n_elts <-- number of local elements
115  * dim <-- local array dimension (max: 9)
116  * v_elt_list <-- optional list of parent elements on which values
117  * are defined, or NULL
118  * v <-- pointer to array values
119  * vmin --> resulting min array (size: dim, or 4 if dim = 3)
120  * vmax --> resulting max array (size: dim, or 4 if dim = 3)
121  * vsum --> resulting sum array (size: dim, or 4 if dim = 3)
122  *----------------------------------------------------------------------------*/
123 
124 void
126  int dim,
127  const cs_lnum_t *v_elt_list,
128  const cs_real_t v[],
129  double vmin[],
130  double vmax[],
131  double vsum[]);
132 
133 /*----------------------------------------------------------------------------*/
164 /*----------------------------------------------------------------------------*/
165 
166 void
168  int dim,
169  const cs_lnum_t *v_elt_list,
170  const cs_lnum_t *w_elt_list,
171  const cs_real_t v[],
172  const cs_real_t w[],
173  double vmin[],
174  double vmax[],
175  double vsum[],
176  double wsum[]);
177 
178 /*----------------------------------------------------------------------------*/
179 
181 
182 #endif /* __CS_ARRAY_REDUCE_H__ */
#define BEGIN_C_DECLS
Definition: cs_defs.h:429
void cs_array_reduce_simple_stats_l_w(cs_lnum_t n_elts, int dim, const cs_lnum_t *v_elt_list, const cs_lnum_t *w_elt_list, const cs_real_t v[], const cs_real_t w[], double vmin[], double vmax[], double vsum[], double wsum[])
Compute simple local stats (minima, maxima, sum, weighted sum) of an n-dimensional cs_real_t array's ...
Definition: cs_array_reduce.c:1818
void cs_array_reduce_simple_stats_l(cs_lnum_t n_elts, int dim, const cs_lnum_t *v_elt_list, const cs_real_t v[], double vmin[], double vmax[], double vsum[])
Compute simple local stats (minima, maxima, sum) of an n-dimensional cs_real_t array's components...
Definition: cs_array_reduce.c:1751
double precision, dimension(:,:,:), allocatable v
Definition: atimbr.f90:114
double precision, save vmax
maximum volumetric concentration reached
Definition: lagran.f90:984
void cs_array_reduce_sum_l(cs_lnum_t n_elts, int dim, const cs_lnum_t *v_elt_list, const cs_real_t v[], double vsum[])
Compute sums of an n-dimensional cs_real_t array's components.
Definition: cs_array_reduce.c:1689
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:292
#define END_C_DECLS
Definition: cs_defs.h:430
double cs_real_t
Definition: cs_defs.h:296