7.3
general documentation
cs_array.h
Go to the documentation of this file.
1 #ifndef __CS_ARRAY_H__
2 #define __CS_ARRAY_H__
3 
4 /*============================================================================
5  * Array handling utilities.
6  *============================================================================*/
7 
8 /*
9  This file is part of code_saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2022 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  * Standard C library headers
32  *----------------------------------------------------------------------------*/
33 
34 #include <string.h>
35 
36 /*----------------------------------------------------------------------------
37  * Local headers
38  *----------------------------------------------------------------------------*/
39 
40 #include "cs_defs.h"
41 
42 /*----------------------------------------------------------------------------*/
43 
45 
46 /*=============================================================================
47  * Macro definitions
48  *============================================================================*/
49 
50 #define CS_ARRAY_NO_SUBLIST -1
51 #define CS_ARRAY_IN_SUBLIST 0
52 #define CS_ARRAY_OUT_SUBLIST 1
53 #define CS_ARRAY_INOUT_SUBLIST 2
54 
55 /*============================================================================
56  * Type definitions
57  *============================================================================*/
58 
59 /*============================================================================
60  * Global variables
61  *============================================================================*/
62 
63 /*=============================================================================
64  * Public inline function prototypes
65  *============================================================================*/
66 
67 /*=============================================================================
68  * Public function prototypes
69  *============================================================================*/
70 
71 /*----------------------------------------------------------------------------*/
94 /*----------------------------------------------------------------------------*/
95 
96 void
98  int stride,
99  const cs_lnum_t elt_ids[],
100  int mode,
101  const cs_real_t ref[],
102  cs_real_t dest[]);
103 
104 /*----------------------------------------------------------------------------*/
113 /*----------------------------------------------------------------------------*/
114 
115 void
117  cs_lnum_t dim,
118  const cs_real_t src[],
119  cs_real_t dest[restrict]);
120 
121 /*----------------------------------------------------------------------------*/
129 /*----------------------------------------------------------------------------*/
130 
131 void
133  cs_real_t ref_val,
134  cs_real_t a[]);
135 
136 /*----------------------------------------------------------------------------*/
147 /*----------------------------------------------------------------------------*/
148 
149 void
151  const cs_lnum_t elt_ids[],
152  cs_real_t ref_val,
153  cs_real_t a[]);
154 
155 /*----------------------------------------------------------------------------*/
163 /*----------------------------------------------------------------------------*/
164 
165 void
167  const cs_real_t ref_val[3],
168  cs_real_t *a);
169 
170 /*----------------------------------------------------------------------------*/
181 /*----------------------------------------------------------------------------*/
182 
183 void
185  const cs_lnum_t elt_ids[],
186  const cs_real_t ref_val[3],
187  cs_real_t a[]);
188 
189 /*----------------------------------------------------------------------------*/
198 /*----------------------------------------------------------------------------*/
199 
200 void
202  const cs_real_t ref_val[6],
203  cs_real_t *a);
204 
205 /*----------------------------------------------------------------------------*/
217 /*----------------------------------------------------------------------------*/
218 
219 void
221  const cs_lnum_t elt_ids[],
222  const cs_real_t ref_val[6],
223  cs_real_t *a);
224 
225 /*----------------------------------------------------------------------------*/
234 /*----------------------------------------------------------------------------*/
235 
236 void
238  const cs_real_t ref_tens[3][3],
239  cs_real_t *a);
240 
241 /*----------------------------------------------------------------------------*/
252 /*----------------------------------------------------------------------------*/
253 
254 void
256  const cs_lnum_t elt_ids[],
257  const cs_real_t ref_tens[3][3],
258  cs_real_t *a);
259 
260 /*----------------------------------------------------------------------------*/
267 /*----------------------------------------------------------------------------*/
268 
269 void
271  cs_real_t a[]);
272 
273 /*----------------------------------------------------------------------------*/
282 /*----------------------------------------------------------------------------*/
283 
284 void
286  cs_lnum_t dim,
287  cs_real_t v,
288  cs_real_t a[]);
289 
290 /*----------------------------------------------------------------------------*/
291 
293 
294 #endif /* __CS_ARRAY_H__ */
void cs_array_real_set_scalar(cs_lnum_t n_elts, cs_real_t ref_val, cs_real_t a[])
Assign a constant scalar value to an array.
Definition: cs_array.c:239
#define restrict
Definition: cs_defs.h:142
void cs_array_real_copy(cs_lnum_t n_elts, cs_lnum_t dim, const cs_real_t src[], cs_real_t dest[restrict])
Copy real values from an array to another of the same dimensions.
Definition: cs_array.c:216
void cs_array_real_set_symm_tensor_on_subset(cs_lnum_t n_elts, const cs_lnum_t elt_ids[], const cs_real_t ref_val[6], cs_real_t *a)
Assign a constant vector of size 6 (optimized way to define a symmetric tensor) to an interlaced arra...
Definition: cs_array.c:378
#define BEGIN_C_DECLS
Definition: cs_defs.h:512
void cs_array_real_set_scalar_on_subset(cs_lnum_t n_elts, const cs_lnum_t elt_ids[], cs_real_t ref_val, cs_real_t a[])
Assign a constant scalar value to an array on a selected subset of elements. If elt_ids = NULL...
Definition: cs_array.c:262
double cs_real_t
Floating-point value.
Definition: cs_defs.h:322
double precision, dimension(:,:,:), allocatable v
Definition: atimbr.f90:114
void cs_array_real_set_vector(cs_lnum_t n_elts, const cs_real_t ref_val[3], cs_real_t *a)
Assign a constant vector to an array of stride 3 which is interlaced.
Definition: cs_array.c:290
void cs_array_set_value_real(cs_lnum_t n_elts, cs_lnum_t dim, cs_real_t v, cs_real_t a[])
Assign a constant value to an array (deprecated function).
Definition: cs_array.c:503
double precision, save a
Definition: cs_fuel_incl.f90:148
void cs_array_real_fill_zero(cs_lnum_t size, cs_real_t a[])
Assign zero to all elements of an array.
Definition: cs_array.c:479
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:316
void cs_array_real_set_vector_on_subset(cs_lnum_t n_elts, const cs_lnum_t elt_ids[], const cs_real_t ref_val[3], cs_real_t a[])
Assign a constant vector to an interlaced array (of stride 3) on a selected subset of elements...
Definition: cs_array.c:315
#define END_C_DECLS
Definition: cs_defs.h:513
void cs_array_real_set_tensor_on_subset(cs_lnum_t n_elts, const cs_lnum_t elt_ids[], const cs_real_t ref_tens[3][3], cs_real_t *a)
Assign a constant 3x3 tensor to an interlaced array (of stride 9) on a subset of elements. If elt_ids = NULL, then one recovers the function cs_array_real_set_tensor.
Definition: cs_array.c:445
void cs_array_real_set_symm_tensor(cs_lnum_t n_elts, const cs_real_t ref_val[6], cs_real_t *a)
Assign a constant vector of size 6 (optimized way to define a symmetric tensor) to an array (of strid...
Definition: cs_array.c:346
void cs_array_real_set_tensor(cs_lnum_t n_elts, const cs_real_t ref_tens[3][3], cs_real_t *a)
Assign a constant 3x3 tensor to an array (of stride 9) which is interlaced.
Definition: cs_array.c:410
void cs_array_real_copy_sublist(cs_lnum_t n_elts, int stride, const cs_lnum_t elt_ids[], int mode, const cs_real_t ref[], cs_real_t dest[])
Copy an array ("ref") into another array ("dest") on possibly only a part of the array(s). Array with stride > 1 are assumed to be interlaced. The sublist of element on which working is defined by "elt_ids" (of size "n_elts"). The way to apply the sublist is set with the parameter "mode" as follows:
Definition: cs_array.c:100