OpenFCST: The open-source Fuel Cell Simulation Toolbox
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
application_data.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 //
3 // FCST: Fuel Cell Simulation Toolbox
4 //
5 // Copyright (C) 2006-2009 by Guido Kanschat
6 // Copyright (C) 2006-2015 by Energy Systems Design Laboratory, University of Alberta
7 //
8 // This software is distributed under the MIT license
9 // For more information, see the README file in /doc/LICENSE
10 //
11 // - Class: application_data.h
12 // - Description: This class implements general data of applications
13 // - Developers: Guido Kanschat, Texas A&M University
14 // Valentin N. Zingan, University of Alberta
15 // Marc Secanell, University of Alberta
16 // - Id: $Id$
17 //
18 // ----------------------------------------------------------------------------
19 
20 #ifndef _FUEL_CELL_APPLICATION_CORE_APPLICATION_DATA_H_
21 #define _FUEL_CELL_APPLICATION_CORE_APPLICATION_DATA_H_
22 
23 #include <lac/vector_memory.h>
24 #include <lac/block_vector.h>
25 #include "logging.h"
26 #include <algorithm>
27 #include <fstream>
28 
29 using namespace dealii;
30 
31 namespace FuelCell
32 {
33 namespace ApplicationCore
34 {
35 
39 typedef BlockVector<double> FEVector;
40 
67 {
68 public:
69 
73  ~ApplicationData();
74 
78  void enter_flag(std::string name,
79  const bool& s);
80 
84  void enter(std::string name,
85  const double& s);
86 
90  void enter(std::string name,
91  const FEVector& v);
92 
96  void enter(std::string name,
97  const std::vector<double>& v);
98 
103  void erase_flag(std::string name);
104 
109  void erase_scalar(std::string name);
110 
115  void erase_vector(std::string name);
116 
121  void erase_std_vector(std::string name);
122 
128  bool flag_exists(const std::string& name) const;
129 
134  bool flag(std::string name) const;
135 
144  const double* scalar(std::string name) const;
145 
154  const FEVector* vector(std::string name) const;
155 
164  const std::vector<double>* std_vector(std::string name) const;
165 
169  void log() const;
170 
180  GrowingVectorMemory< Vector<double> > vector_pool;
181 
191  GrowingVectorMemory<FEVector> block_vector_pool;
192 
197  typedef std::map< std::string, bool > flag_map;
198 
203  typedef std::map< std::string, const double* > scalar_map;
204 
209  typedef std::map< std::string, const FEVector* > vector_map;
210 
215  typedef std::map< std::string, const std::vector<double>* > std_vector_map;
216 
222  DeclException2(ExcNotFound,
223  char*,
224  std::string,
225  << "A " << arg1 << " with name " << arg2 << " was not stored in this data object");
226 
227 private:
228 
234 
240 
246 
252 };
253 
254 } // ApplicationCore
255 
256 } // FuelCell
257 
258 #endif
scalar_map named_scalars
A map linking names of data to actual scalars.
Definition: application_data.h:239
GrowingVectorMemory< Vector< double > > vector_pool
VectorMemory object for simple vectors.
Definition: application_data.h:180
Here we handle general data of applications.
Definition: application_data.h:66
vector_map named_vectors
A map linking names of data to actual vectors.
Definition: application_data.h:245
std::map< std::string, const double * > scalar_map
The typedef for the map of scalars.
Definition: application_data.h:203
std_vector_map named_std_vectors
A map linking names of data to actual std vectors.
Definition: application_data.h:251
std::map< std::string, const std::vector< double > * > std_vector_map
The typedef for the map of std vectors.
Definition: application_data.h:215
FCSTLogStream log
Object used to output data to file and, if file attached recorded to a file as well.
DeclException2(VariableShouldExistForEquation, std::string, std::string,<< "The user-defined variable with name \""<< arg1<< "\" should be one of the solution variables for equation with name \""<< arg2<< "\"")
Exception thrown when a particular variable required by the equation class, does not exist in the use...
std::map< std::string, const FEVector * > vector_map
The typedef for the map of vectors.
Definition: application_data.h:209
GrowingVectorMemory< FEVector > block_vector_pool
VectorMemory object for block vectors.
Definition: application_data.h:191
std::map< std::string, bool > flag_map
The typedef for the map of boolean flags.
Definition: application_data.h:197
BlockVector< double > FEVector
The vector class used by applications.
Definition: application_data.h:39
flag_map named_flags
A map linking names of data to actual boolean flags.
Definition: application_data.h:233