8.3
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-2024 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
71void
72cs_random_seed(int seed);
73
74/*----------------------------------------------------------------------------*/
85/*----------------------------------------------------------------------------*/
86
87void
89 cs_real_t a[]);
90
91/*----------------------------------------------------------------------------*/
100/*----------------------------------------------------------------------------*/
101
102void
104 cs_real_t x[]);
105
106/*----------------------------------------------------------------------------*/
116/*----------------------------------------------------------------------------*/
117
118void
121 int p[]);
122
123/*----------------------------------------------------------------------------*/
129/*----------------------------------------------------------------------------*/
130
131void
132cs_random_save(cs_real_t save_block[1634]);
133
134/*----------------------------------------------------------------------------*/
140/*----------------------------------------------------------------------------*/
141
142void
143cs_random_restore(cs_real_t save_block[1634]);
144
145/*----------------------------------------------------------------------------*/
146
148
149#endif /* __CS_RANDOM_H__ */
#define BEGIN_C_DECLS
Definition: cs_defs.h:542
double cs_real_t
Floating-point value.
Definition: cs_defs.h:342
#define END_C_DECLS
Definition: cs_defs.h:543
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:335
@ p
Definition: cs_field_pointer.h:67
@ mu
Definition: cs_field_pointer.h:105
void cs_random_save(cs_real_t save_block[1634])
Save static variables used by random number generator.
Definition: cs_random.cpp:537
void cs_random_normal(cs_lnum_t n, cs_real_t x[])
Normal distribution random number generator.
Definition: cs_random.cpp:407
void cs_random_poisson(cs_lnum_t n, cs_real_t mu, int p[])
Poisson distribution random number generator.
Definition: cs_random.cpp:463
void cs_random_seed(int seed)
Initialize random number generator.
Definition: cs_random.cpp:192
void cs_random_uniform(cs_lnum_t n, cs_real_t a[])
Uniform distribution random number generator.
Definition: cs_random.cpp:242
void cs_random_restore(cs_real_t save_block[1634])
Restore static variables used by random number generator.
Definition: cs_random.cpp:569