9.2
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-2026 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 "base/cs_defs.h"
39
40/*=============================================================================
41 * Macro definitions
42 *============================================================================*/
43
44/*============================================================================
45 * Type definitions
46 *============================================================================*/
47
48/*=============================================================================
49 * Global variables
50 *============================================================================*/
51
52/*=============================================================================
53 * Public function prototypes
54 *============================================================================*/
55
56/*----------------------------------------------------------------------------*/
65/*----------------------------------------------------------------------------*/
66
67void
68cs_random_seed(int seed);
69
70/*----------------------------------------------------------------------------*/
81/*----------------------------------------------------------------------------*/
82
83void
85 cs_real_t a[]);
86
87/*----------------------------------------------------------------------------*/
96/*----------------------------------------------------------------------------*/
97
98void
100 cs_real_t x[]);
101
102/*----------------------------------------------------------------------------*/
112/*----------------------------------------------------------------------------*/
113
114void
117 int p[]);
118
119/*----------------------------------------------------------------------------*/
125/*----------------------------------------------------------------------------*/
126
127void
128cs_random_save(cs_real_t save_block[1634]);
129
130/*----------------------------------------------------------------------------*/
136/*----------------------------------------------------------------------------*/
137
138void
139cs_random_restore(cs_real_t save_block[1634]);
140
141/*----------------------------------------------------------------------------*/
142
143#endif /* CS_RANDOM_H */
double cs_real_t
Floating-point value.
Definition: cs_defs.h:332
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:325
@ p
Definition: cs_field_pointer.h:63
@ mu
Definition: cs_field_pointer.h:102
void cs_random_save(cs_real_t save_block[1634])
Save static variables used by random number generator.
Definition: cs_random.cpp:533
void cs_random_normal(cs_lnum_t n, cs_real_t x[])
Normal distribution random number generator.
Definition: cs_random.cpp:403
void cs_random_poisson(cs_lnum_t n, cs_real_t mu, int p[])
Poisson distribution random number generator.
Definition: cs_random.cpp:459
void cs_random_seed(int seed)
Initialize random number generator.
Definition: cs_random.cpp:188
void cs_random_uniform(cs_lnum_t n, cs_real_t a[])
Uniform distribution random number generator.
Definition: cs_random.cpp:238
void cs_random_restore(cs_real_t save_block[1634])
Restore static variables used by random number generator.
Definition: cs_random.cpp:565