Canoe
Comprehensive Atmosphere N' Ocean Engine
index_map.hpp
Go to the documentation of this file.
1 #ifndef SRC_INDEX_MAP_HPP_
2 #define SRC_INDEX_MAP_HPP_
3 
4 // C/C++
5 #include <map>
6 #include <string>
7 
8 class ParameterInput;
9 
10 class IndexMap {
11  protected:
13  IndexMap() {}
14 
15  public:
16  ~IndexMap();
17 
18  static IndexMap const* GetInstance();
19 
20  static IndexMap const* InitFromAthenaInput(ParameterInput* pin);
21 
22  static void Destroy();
23 
24  bool HasVapor(std::string const& name) const {
25  return vapor_index_map_.find(name) != vapor_index_map_.end();
26  }
27 
28  size_t GetVaporId(std::string const& name) const {
29  return vapor_index_map_.at(name);
30  }
31 
32  std::string GetVaporName(size_t i) const;
33 
34  bool HasCloud(std::string const& name) const {
35  return cloud_index_map_.find(name) != cloud_index_map_.end();
36  }
37 
38  size_t GetCloudId(std::string const& name) const {
39  return cloud_index_map_.at(name);
40  }
41 
42  std::string GetCloudName(size_t i) const;
43 
44  bool HasChemistry(std::string const& name) const {
45  return chemistry_index_map_.find(name) != chemistry_index_map_.end();
46  }
47 
48  size_t GetChemistryId(std::string const& name) const {
49  return chemistry_index_map_.at(name);
50  }
51 
52  bool HasTracer(std::string const& name) const {
53  return tracer_index_map_.find(name) != tracer_index_map_.end();
54  }
55 
56  size_t GetTracerId(std::string const& name) const {
57  return tracer_index_map_.at(name);
58  }
59 
60  std::string GetTracerName(size_t i) const;
61 
62  size_t GetSpeciesId(std::string category_name) const;
63 
64  private:
65  std::map<std::string, size_t> vapor_index_map_;
66  std::map<std::string, size_t> cloud_index_map_;
67  std::map<std::string, size_t> chemistry_index_map_;
68  std::map<std::string, size_t> tracer_index_map_;
69  std::map<std::string, size_t> particle_index_map_;
70 
73 };
74 
75 #endif // SRC_INDEX_MAP_HPP_
size_t GetTracerId(std::string const &name) const
Definition: index_map.hpp:56
bool HasCloud(std::string const &name) const
Definition: index_map.hpp:34
bool HasChemistry(std::string const &name) const
Definition: index_map.hpp:44
std::map< std::string, size_t > chemistry_index_map_
Definition: index_map.hpp:67
size_t GetVaporId(std::string const &name) const
Definition: index_map.hpp:28
size_t GetSpeciesId(std::string category_name) const
Definition: index_map.cpp:116
std::string GetCloudName(size_t i) const
Definition: index_map.cpp:160
bool HasVapor(std::string const &name) const
Definition: index_map.hpp:24
std::map< std::string, size_t > tracer_index_map_
Definition: index_map.hpp:68
std::string GetTracerName(size_t i) const
Definition: index_map.cpp:167
static IndexMap const * InitFromAthenaInput(ParameterInput *pin)
Definition: index_map.cpp:40
std::map< std::string, size_t > vapor_index_map_
Definition: index_map.hpp:65
static IndexMap * myindex_map_
Pointer to the single IndexMap instance.
Definition: index_map.hpp:72
IndexMap()
Protected ctor access thru static member function Instance.
Definition: index_map.hpp:13
static void Destroy()
Definition: index_map.cpp:144
size_t GetCloudId(std::string const &name) const
Definition: index_map.hpp:38
std::map< std::string, size_t > cloud_index_map_
Definition: index_map.hpp:66
bool HasTracer(std::string const &name) const
Definition: index_map.hpp:52
std::string GetVaporName(size_t i) const
Definition: index_map.cpp:153
static IndexMap const * GetInstance()
Definition: index_map.cpp:29
size_t GetChemistryId(std::string const &name) const
Definition: index_map.hpp:48
std::map< std::string, size_t > particle_index_map_
Definition: index_map.hpp:69