queso-0.57.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Vector.h
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 #ifndef UQ_VECTOR_H
26 #define UQ_VECTOR_H
27 
28 #include <queso/Environment.h>
29 #include <queso/Map.h>
30 #include <iostream>
31 #include <queso/Defines.h>
32 
33 namespace QUESO {
34 
47 class Vector
48 {
49 public:
50 
52 
53  Vector(const BaseEnvironment& env, const Map& map);
55 
57  virtual ~Vector();
59 
61 
62  const BaseEnvironment& env () const;
63  const Map& map () const;
64  unsigned int numOfProcsForStorage() const;
66 
68 
69  virtual unsigned int sizeLocal () const = 0;
71 
73  virtual unsigned int sizeGlobal () const = 0;
75 
77 
78  virtual void cwSet (double value) = 0;
80 
82  virtual void cwSetGaussian (double mean, double stdDev) = 0;
83 
85  virtual void cwInvert () = 0;
87 
88 
90 
91  virtual void sort () = 0;
93 
95  virtual void print (std::ostream& os) const = 0;
96 
98  void setPrintHorizontally(bool value) const; // Yes, 'const'
99 
101  bool getPrintHorizontally() const;
102 
104  void setPrintScientific (bool value) const; // Yes, 'const'
105 
107  bool getPrintScientific () const;
108 
110 
111 protected:
112 
114  virtual void base_copy (const Vector& src);
115 
118 
119 #ifdef QUESO_CLASSES_INSTANTIATE_NEW_MAPS
120 
122  const Map m_map;
123 #else
124 
126  const Map& m_map;
127 #endif
128 
130  mutable bool m_printHorizontally;
131 
133  mutable bool m_printScientific;
134 
135 private:
137  Vector();
138 };
139 
140 } // End namespace QUESO
141 
142 #endif // UQ_VECTOR_H
void setPrintScientific(bool value) const
Determines whether vector should be printed in Scientific Notation.
Definition: Vector.C:88
A class for partitioning vectors and matrices.
Definition: Map.h:49
This (virtual) class sets up the environment underlying the use of the QUESO library by an executable...
Definition: Environment.h:198
bool getPrintHorizontally() const
Checks if vector is printed horizontally.
Definition: Vector.C:82
virtual void sort()=0
Sort the elements.
bool m_printHorizontally
Flag for either or not print this matrix horizontally.
Definition: Vector.h:130
const BaseEnvironment & m_env
Environment variable.
Definition: Vector.h:117
virtual void base_copy(const Vector &src)
Copies base data from vector src to this vector.
Definition: Vector.C:101
bool m_printScientific
Flag for either or not print this matrix in scientific notation.
Definition: Vector.h:133
virtual unsigned int sizeGlobal() const =0
Returns the global size of the vector.
virtual void cwInvert()=0
Component-wise invert the values of the vector.
virtual void print(std::ostream &os) const =0
Print this vector.
virtual void cwSet(double value)=0
Component-wise set the values of the vector to value.
unsigned int numOfProcsForStorage() const
Definition: Vector.C:68
const Map m_map
Mapping variable.
Definition: Vector.h:122
Class for vector operations (virtual).
Definition: Vector.h:47
bool getPrintScientific() const
Checks if the vector should be printed in Scientific Notation.
Definition: Vector.C:95
const BaseEnvironment & env() const
Definition: Vector.C:54
virtual ~Vector()
Virtual Destructor.
Definition: Vector.C:48
void setPrintHorizontally(bool value) const
Determines whether vector should be printed horizontally.
Definition: Vector.C:75
const Map & map() const
Definition: Vector.C:61
Vector()
Default Constructor.
virtual void cwSetGaussian(double mean, double stdDev)=0
Component-wise set the values of the vector to a random number from a Gaussian distribution.
const Map & m_map
Mapping variable.
Definition: Vector.h:126
virtual unsigned int sizeLocal() const =0
Returns the local size of the vector.

Generated on Tue Jun 5 2018 19:48:54 for queso-0.57.1 by  doxygen 1.8.5