queso-0.57.1
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Pages
RngBase.C
Go to the documentation of this file.
1
//-----------------------------------------------------------------------bl-
2
//--------------------------------------------------------------------------
3
//
4
// QUESO - a library to support the Quantification of Uncertainty
5
// for Estimation, Simulation and Optimization
6
//
7
// Copyright (C) 2008-2017 The PECOS Development Team
8
//
9
// This library is free software; you can redistribute it and/or
10
// modify it under the terms of the Version 2.1 GNU Lesser General
11
// Public License as published by the Free Software Foundation.
12
//
13
// This library is distributed in the hope that it will be useful,
14
// but WITHOUT ANY WARRANTY; without even the implied warranty of
15
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
// Lesser General Public License for more details.
17
//
18
// You should have received a copy of the GNU Lesser General Public
19
// License along with this library; if not, write to the Free Software
20
// Foundation, Inc. 51 Franklin Street, Fifth Floor,
21
// Boston, MA 02110-1301 USA
22
//
23
//-----------------------------------------------------------------------el-
24
25
#include <queso/RngBase.h>
26
27
namespace
QUESO {
28
29
RngBase::RngBase
(
int
seed,
int
worldRank)
30
:
31
m_seed (seed),
32
m_worldRank(worldRank)
33
{
34
privateResetSeed
();
35
}
36
37
RngBase::~RngBase
()
38
{
39
}
40
41
int
42
RngBase::seed
()
const
43
{
44
return
m_seed
;
45
}
46
47
void
48
RngBase::resetSeed
(
int
newSeed)
49
{
50
m_seed
= newSeed;
51
privateResetSeed
();
52
return
;
53
}
54
55
void
56
RngBase::privateResetSeed
()
57
{
58
if
(
m_seed
>= 0) {
59
// Do nothing
60
}
61
else
if
(
m_seed
< 0) {
62
m_seed
= (-
m_seed
+
m_worldRank
);
63
}
64
//else {
65
// struct timeval timevalNow;
66
// /*iRC = */gettimeofday(&timevalNow, NULL);
67
// m_seed = (int) timevalNow.tv_usec;
68
//}
69
70
return
;
71
}
72
73
}
// End namespace QUESO
QUESO::RngBase::seed
int seed() const
Sets the seed.
Definition:
RngBase.C:42
QUESO::RngBase::resetSeed
virtual void resetSeed(int newSeed)
Resets the seed with value newSeed.
Definition:
RngBase.C:48
QUESO::RngBase::m_seed
int m_seed
Seed.
Definition:
RngBase.h:82
QUESO::RngBase::privateResetSeed
void privateResetSeed()
Reset seed.
Definition:
RngBase.C:56
QUESO::RngBase::m_worldRank
int m_worldRank
Rank of processor.
Definition:
RngBase.h:85
QUESO::RngBase::~RngBase
virtual ~RngBase()
Virtual destructor.
Definition:
RngBase.C:37
QUESO::RngBase::RngBase
RngBase()
Default Constructor: it should not be used.
Generated on Tue Jun 5 2018 19:48:55 for queso-0.57.1 by
doxygen
1.8.5