queso-0.52.0
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-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 #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 
41 template <class V, class M>
43 {
44 public:
46 
47 
50  AsciiTable(const BaseEnvironment& env,
51  unsigned int numRows,
52  unsigned int numExtraCols,
53  const std::vector<bool>* extraColIsString,
54  const std::string& fileName);
56  ~AsciiTable();
58 
60 
61  unsigned int numRows () const;
63 
65  unsigned int numCols () const;
66 
68  const DistArray<std::string>& stringColumn(unsigned int j) const;
69 
71  const V& doubleColumn(unsigned int j) const;
73 
75 
76  void print (std::ostream& os) const;
79 private:
80  Map* newMap(); // See template specialization
81 
83  unsigned int m_numRows;
84  unsigned int m_numCols;
85  std::vector<bool> m_colIsString;
86  std::string m_fileName;
87 
88  const Map* m_map;
89  std::vector<DistArray<std::string>*> m_stringColumns;
90  std::vector<V*> m_doubleColumns;
91 
92  void readColumnsFromFile();
93 };
94 
95 } // End namespace QUESO
96 
97 #endif // UQ_ASCII_TABLE_H
std::vector< bool > m_colIsString
Definition: AsciiTable.h:85
const DistArray< std::string > & stringColumn(unsigned int j) const
Returns the string stored in column j.
Definition: AsciiTable.C:282
void print(std::ostream &os) const
Prints the table.
Definition: AsciiTable.C:317
unsigned int numRows() const
Returns the number of rows in the table.
Definition: AsciiTable.C:268
This (virtual) class sets up the environment underlying the use of the QUESO library by an executable...
Definition: Environment.h:187
A class for partitioning vectors and matrices.
Definition: Map.h:49
unsigned int m_numCols
Definition: AsciiTable.h:84
const BaseEnvironment & m_env
Definition: AsciiTable.h:82
const Map * m_map
Definition: AsciiTable.h:88
std::vector< DistArray< std::string > * > m_stringColumns
Definition: AsciiTable.h:89
const V & doubleColumn(unsigned int j) const
Returns the value (double) stored in column j.
Definition: AsciiTable.C:299
std::string m_fileName
Definition: AsciiTable.h:86
~AsciiTable()
Destructor.
Definition: AsciiTable.C:76
AsciiTable(const BaseEnvironment &env, unsigned int numRows, unsigned int numExtraCols, const std::vector< bool > *extraColIsString, const std::string &fileName)
Default constructor.
Definition: AsciiTable.C:31
unsigned int m_numRows
Definition: AsciiTable.h:83
Class for reading ASCII values from a table in a file.
Definition: AsciiTable.h:42
std::vector< V * > m_doubleColumns
Definition: AsciiTable.h:90
unsigned int numCols() const
Returns the number of columns in the table.
Definition: AsciiTable.C:275
void readColumnsFromFile()
Definition: AsciiTable.C:89

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