queso-0.52.0
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 
31  :
32  m_seed (0),
33  m_worldRank(UQ_UNAVAILABLE_RANK)
34 {
37  "RngBase::constructor(), default",
38  "should not be used by user");
39 }
40 
41 RngBase::RngBase(int seed, int worldRank)
42  :
43  m_seed (seed),
44  m_worldRank(worldRank)
45 {
47 }
48 
50 {
51 }
52 
53 int
55 {
56  return m_seed;
57 }
58 
59 void
60 RngBase::resetSeed(int newSeed)
61 {
62  m_seed = newSeed;
64  return;
65 }
66 
67 void
69 {
70  if (m_seed >= 0) {
71  // Do nothing
72  }
73  else if (m_seed < 0) {
75  }
76  //else {
77  // struct timeval timevalNow;
78  // /*iRC = */gettimeofday(&timevalNow, NULL);
79  // m_seed = (int) timevalNow.tv_usec;
80  //}
81 
82  return;
83 }
84 
85 } // End namespace QUESO
const int UQ_UNAVAILABLE_RANK
Definition: Defines.h:74
int m_seed
Seed.
Definition: RngBase.h:85
virtual ~RngBase()
Virtual destructor.
Definition: RngBase.C:49
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
Definition: Defines.h:223
int seed() const
Sets the seed.
Definition: RngBase.C:54
int m_worldRank
Rank of processor.
Definition: RngBase.h:88
void privateResetSeed()
Reset seed.
Definition: RngBase.C:68
RngBase()
Default Constructor: it should not be used.
Definition: RngBase.C:30
virtual void resetSeed(int newSeed)
Resets the seed with value newSeed.
Definition: RngBase.C:60

Generated on Thu Apr 23 2015 19:30:54 for queso-0.52.0 by  doxygen 1.8.5