queso-0.57.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
AsciiTable.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_ASCII_TABLE_H
26 #define UQ_ASCII_TABLE_H
27 
28 #include <queso/Environment.h>
29 #include <queso/DistArray.h>
30 #include <queso/Map.h>
31 #include <queso/Miscellaneous.h>
32 
33 namespace QUESO {
34 
35 class GslVector;
36 class GslMatrix;
37 
44 template<class V = GslVector, class M = GslMatrix>
46 {
47 public:
49 
50 
53  AsciiTable(const BaseEnvironment& env,
54  unsigned int numRows,
55  unsigned int numExtraCols,
56  const std::vector<bool>* extraColIsString,
57  const std::string& fileName);
59  ~AsciiTable();
61 
63 
64  unsigned int numRows () const;
66 
68  unsigned int numCols () const;
69 
71  const DistArray<std::string>& stringColumn(unsigned int j) const;
72 
74  const V& doubleColumn(unsigned int j) const;
76 
78 
79  void print (std::ostream& os) const;
82 private:
83  Map* newMap(); // See template specialization
84 
86  unsigned int m_numRows;
87  unsigned int m_numCols;
88  std::vector<bool> m_colIsString;
89  std::string m_fileName;
90 
91  const Map* m_map;
92  std::vector<DistArray<std::string>*> m_stringColumns;
93  std::vector<V*> m_doubleColumns;
94 
95  void readColumnsFromFile();
96 };
97 
98 } // End namespace QUESO
99 
100 #endif // UQ_ASCII_TABLE_H
AsciiTable(const BaseEnvironment &env, unsigned int numRows, unsigned int numExtraCols, const std::vector< bool > *extraColIsString, const std::string &fileName)
Default constructor.
Definition: AsciiTable.C:32
const Map * m_map
Definition: AsciiTable.h:91
A class for partitioning vectors and matrices.
Definition: Map.h:49
std::vector< V * > m_doubleColumns
Definition: AsciiTable.h:93
This (virtual) class sets up the environment underlying the use of the QUESO library by an executable...
Definition: Environment.h:198
unsigned int m_numCols
Definition: AsciiTable.h:87
std::string m_fileName
Definition: AsciiTable.h:89
~AsciiTable()
Destructor.
Definition: AsciiTable.C:77
unsigned int numCols() const
Returns the number of columns in the table.
Definition: AsciiTable.C:243
Class for reading ASCII values from a table in a file.
Definition: AsciiTable.h:45
std::vector< DistArray< std::string > * > m_stringColumns
Definition: AsciiTable.h:92
const V & doubleColumn(unsigned int j) const
Returns the value (double) stored in column j.
Definition: AsciiTable.C:261
void readColumnsFromFile()
Definition: AsciiTable.C:90
void print(std::ostream &os) const
Prints the table.
Definition: AsciiTable.C:273
std::vector< bool > m_colIsString
Definition: AsciiTable.h:88
const BaseEnvironment & m_env
Definition: AsciiTable.h:85
const DistArray< std::string > & stringColumn(unsigned int j) const
Returns the string stored in column j.
Definition: AsciiTable.C:250
unsigned int m_numRows
Definition: AsciiTable.h:86
unsigned int numRows() const
Returns the number of rows in the table.
Definition: AsciiTable.C:236

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