7.0
general documentation
cs_random.h
Go to the documentation of this file.
1 #ifndef __CS_RANDOM_H__
2 #define __CS_RANDOM_H__
3 
4 /*============================================================================
5  * Random number generation.
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 #if defined(HAVE_MPI)
31 #include <mpi.h>
32 #endif
33 
34 /*----------------------------------------------------------------------------
35  * Local headers
36  *----------------------------------------------------------------------------*/
37 
38 #include "cs_defs.h"
39 
40 /*----------------------------------------------------------------------------*/
41 
43 
44 /*=============================================================================
45  * Macro definitions
46  *============================================================================*/
47 
48 /*============================================================================
49  * Type definitions
50  *============================================================================*/
51 
52 /*=============================================================================
53  * Global variables
54  *============================================================================*/
55 
56 /*=============================================================================
57  * Public function prototypes
58  *============================================================================*/
59 
60 /*----------------------------------------------------------------------------*/
69 /*----------------------------------------------------------------------------*/
70 
71 void
72 cs_random_seed(int seed);
73 
74 /*----------------------------------------------------------------------------*/
85 /*----------------------------------------------------------------------------*/
86 
87 void
89  cs_real_t a[]);
90 
91 /*----------------------------------------------------------------------------*/
100 /*----------------------------------------------------------------------------*/
101 
102 void
104  cs_real_t x[]);
105 
106 /*----------------------------------------------------------------------------*/
116 /*----------------------------------------------------------------------------*/
117 
118 void
120  cs_real_t mu,
121  int p[]);
122 
123 /*----------------------------------------------------------------------------*/
129 /*----------------------------------------------------------------------------*/
130 
131 void
132 cs_random_save(cs_real_t save_block[1634]);
133 
134 /*----------------------------------------------------------------------------*/
140 /*----------------------------------------------------------------------------*/
141 
142 void
143 cs_random_restore(cs_real_t save_block[1634]);
144 
145 /*----------------------------------------------------------------------------*/
146 
148 
149 #endif /* __CS_RANDOM_H__ */
void cs_random_save(cs_real_t save_block[1634])
Save static variables used by random number generator.
Definition: cs_random.c:537
#define BEGIN_C_DECLS
Definition: cs_defs.h:495
Definition: cs_field_pointer.h:67
double cs_real_t
Floating-point value.
Definition: cs_defs.h:307
void cs_random_seed(int seed)
Initialize random number generator.
Definition: cs_random.c:192
void cs_random_restore(cs_real_t save_block[1634])
Restore static variables used by random number generator.
Definition: cs_random.c:569
void cs_random_poisson(cs_lnum_t n, cs_real_t mu, int p[])
Poisson distribution random number generator.
Definition: cs_random.c:463
double precision, save a
Definition: cs_fuel_incl.f90:146
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:301
void cs_random_uniform(cs_lnum_t n, cs_real_t a[])
Uniform distribution random number generator.
Definition: cs_random.c:242
#define END_C_DECLS
Definition: cs_defs.h:496
Definition: cs_field_pointer.h:109
void cs_random_normal(cs_lnum_t n, cs_real_t x[])
Normal distribution random number generator.
Definition: cs_random.c:407