OpenFCST: The open-source Fuel Cell Simulation Toolbox
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fcst_utilities.h
Go to the documentation of this file.
1 //---------------------------------------------------------------------------
2 //
3 // FCST: Fuel Cell Simulation Toolbox
4 //
5 // Copyright (C) 2013 by Energy Systems Design Laboratory, University of Alberta
6 //
7 // This software is distributed under the MIT License.
8 // For more information, see the README file in /doc/LICENSE
9 //
10 // - Class: fcst_utilities.h
11 // - Description: Namespace carrying a lot of utility functions
12 // - Developers: Madhur Bhaiya, Valentin N. Zingan
13 // - $Id: fcst_utilities.h 1380 2013-08-22 02:05:45Z zingan $
14 //
15 //---------------------------------------------------------------------------
16 
17 #ifndef _FUELCELLSHOP__FCST_UTILITIES_H
18 #define _FUELCELLSHOP__FCST_UTILITIES_H
19 
20 //Include STL and boost libraries
21 #include <cmath>
22 #include <iostream>
23 #include <string>
24 #include <vector>
25 #include <map>
26 #include <cctype>
27 #include <boost/lexical_cast.hpp>
28 #include <fstream>
29 
30 //Include deal.ii classes
31 #include <base/utilities.h>
32 #include <base/exceptions.h>
33 #include <base/parameter_handler.h>
34 
35 
36 using namespace dealii;
37 
38 namespace FcstUtilities
39 {
43  DeclException1 (ExcWrongString,
44  std::string,
45  << "Can't convert the string " << arg1
46  << " to the desired Number type");
47 
57  template <typename NumType>
58  NumType string_to_number(const std::string&);
59 
68  template <typename NumType>
69  std::vector<NumType> string_to_number(const std::vector<std::string>&);
70 
71 
85  template <typename KeyType, typename ValueType>
86  std::map< KeyType, ValueType > string_to_map(const std::vector<std::string>&);
87 
88 
89 
95  template< typename KeyType, typename ValueType >
96  std::map< KeyType, ValueType > string_to_map(const std::string& name);
97 
98 
99 
104  template<>
105  std::map< unsigned int, std::string > string_to_map<>(const std::string& name);
106 
107 
108 
109 
116  template< typename KeyType, typename ValueType >
117  std::map< KeyType, std::vector<ValueType> > split_mapvalue_list(const std::map< KeyType, std::string >&, const char delimiter = ';');
118 
124  void print_parameter_file_XML(ParameterHandler& param);
125 
130  std::string find_fcst_root();
131 
132 
137  void run_python(std::string script_name,std::string arg);
138 
142  template <typename NumType>
143  std::string number_to_string(const NumType &num);
144 
145 
146 } //FcstUtilities
147 #endif //_FUELCELLSHOP__FCST_UTILITIES_H