queso-0.53.0
OneDGrid.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/OneDGrid.h>
26 
27 namespace QUESO {
28 
29 template<class T>
31  const BaseEnvironment& env,
32  const char* prefix)
33  :
34  m_env (env),
35  m_prefix((std::string)(prefix)+"grid")
36 {
37  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) {
38  *m_env.subDisplayFile() << "Entering BaseOneDGrid<T>::constructor()"
39  << ": prefix = " << m_prefix
40  << std::endl;
41  }
42 
43  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) {
44  *m_env.subDisplayFile() << "Leaving BaseOneDGrid<T>::constructor()"
45  << ": prefix = " << m_prefix
46  << std::endl;
47  }
48 }
49 
50 template<class T>
52 {
53 }
54 
55 template <class T>
56 void
57 BaseOneDGrid<T>::print(std::ostream& os) const
58 {
59  // Print values *of* grid points
60  os << m_prefix << "_sub" << m_env.subIdString() << " = zeros(" << this->size()
61  << "," << 1
62  << ");"
63  << std::endl;
64  os << m_prefix << "_sub" << m_env.subIdString() << " = [";
65  for (unsigned int j = 0; j < this->size(); ++j) {
66  os << (*this)[j] << " ";
67  }
68  os << "];"
69  << std::endl;
70 
71  return;
72 }
73 
74 } // End namespace QUESO
75 
76 template class QUESO::BaseOneDGrid<double>;
unsigned int displayVerbosity() const
Definition: Environment.C:396
std::string m_prefix
Definition: OneDGrid.h:83
BaseOneDGrid(const BaseEnvironment &env, const char *prefix)
Default constructor.
Definition: OneDGrid.C:30
virtual ~BaseOneDGrid()
Virtual destructor.
Definition: OneDGrid.C:51
const BaseEnvironment & m_env
Definition: OneDGrid.h:82
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:274
This (virtual) class sets up the environment underlying the use of the QUESO library by an executable...
Definition: Environment.h:193
void print(std::ostream &ofsvar) const
Prints the values of the grid points.
Definition: OneDGrid.C:57
Base class for accommodating one-dimensional grids.
Definition: OneDGrid.h:46

Generated on Thu Jun 11 2015 13:52:32 for queso-0.53.0 by  doxygen 1.8.5