queso-0.53.0
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
src
core
src
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-2015 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
#include <mpi.h>
27
28
namespace
QUESO {
29
30
RngBase::RngBase
(
int
seed,
int
worldRank)
31
:
32
m_seed (seed),
33
m_worldRank(worldRank)
34
{
35
privateResetSeed
();
36
}
37
38
RngBase::~RngBase
()
39
{
40
}
41
42
int
43
RngBase::seed
()
const
44
{
45
return
m_seed
;
46
}
47
48
void
49
RngBase::resetSeed
(
int
newSeed)
50
{
51
m_seed
= newSeed;
52
privateResetSeed
();
53
return
;
54
}
55
56
void
57
RngBase::privateResetSeed
()
58
{
59
if
(
m_seed
>= 0) {
60
// Do nothing
61
}
62
else
if
(
m_seed
< 0) {
63
m_seed
= (-
m_seed
+
m_worldRank
);
64
}
65
//else {
66
// struct timeval timevalNow;
67
// /*iRC = */gettimeofday(&timevalNow, NULL);
68
// m_seed = (int) timevalNow.tv_usec;
69
//}
70
71
return
;
72
}
73
74
}
// End namespace QUESO
QUESO::RngBase::privateResetSeed
void privateResetSeed()
Reset seed.
Definition:
RngBase.C:57
QUESO::RngBase::seed
int seed() const
Sets the seed.
Definition:
RngBase.C:43
QUESO::RngBase::~RngBase
virtual ~RngBase()
Virtual destructor.
Definition:
RngBase.C:38
QUESO::RngBase::resetSeed
virtual void resetSeed(int newSeed)
Resets the seed with value newSeed.
Definition:
RngBase.C:49
QUESO::RngBase::m_seed
int m_seed
Seed.
Definition:
RngBase.h:82
QUESO::RngBase::m_worldRank
int m_worldRank
Rank of processor.
Definition:
RngBase.h:85
QUESO::RngBase::RngBase
RngBase()
Default Constructor: it should not be used.
Generated on Thu Jun 11 2015 13:52:31 for queso-0.53.0 by
doxygen
1.8.5