Cloudy
Spectral Synthesis Code for Astrophysics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
hydro_tbl.h
Go to the documentation of this file.
1 /* This file is part of Cloudy and is copyright (C)1978-2022 by Gary J. Ferland and
2  * others. For conditions of distribution and use see copyright notice in license.txt */
3 
4 #ifndef ATMDAT_HYDR_TP_H
5 #define ATMDAT_HYDR_TP_H
6 
7 #include "container_classes.h"
8 
9 class t_hydro_tbl : public Singleton<t_hydro_tbl>
10 {
11  friend class Singleton<t_hydro_tbl>;
12 
13  // The n -> n' and n,l -> n',l' files are much too big to be read in
14  // its entirety for each sim. The vast majority of the data would
15  // never be used. To reduce I/O time and memory use we initially read
16  // data with 0 <= n_up < p_stride. If data for higher levels are
17  // needed, we read the next chunk: p_stride <= n_up < 2*n_stride, etc.
18  // Each chunk is kept in a separate data structure of type arrn or
19  // arrnl. The pointers to these structures are kept in the vectors
20  // p_tpn and p_tpnl. Pointers into the ascii files are kept in p_posn
21  // and p_posnl so that for each chunk we can immediately start reading
22  // in the correct position in the file.
23 
24  static const size_t p_stride = 64;
25 
26  size_t p_nmaxn;
27  size_t p_nmaxn_read;
28  long p_posn;
30  vector<arrn*> p_tpn;
31 
32  size_t p_nmaxnl_l;
33  size_t p_nmaxnl_u;
34  size_t p_nmaxnl_read;
35  long p_posnl;
37  vector<arrnl*> p_tpnl;
38 
39  size_t p_Zmax;
40  size_t p_nmaxnn;
43 
44  size_t p_nmaxcs;
45  size_t p_nenrgs;
48 
49  void p_initn(long nu);
50  void p_initnl(long nu);
51  void p_initnn();
52  void p_initcs();
53 
54  realnum p_RM(long Z) const;
55 protected:
57  {
58  p_nmaxn = 0;
59  p_nmaxnl_l = 0;
60  p_nmaxnl_u = 0;
61  }
63  {
64  for( size_t i=0; i < p_tpn.size(); ++i )
65  delete p_tpn[i];
66  for( size_t i=0; i < p_tpnl.size(); ++i )
67  delete p_tpnl[i];
68  }
69 public:
70  size_t nmaxn() { p_initn(-1); return p_nmaxn; }
71  size_t nmaxnl_l() { p_initnl(-1); return p_nmaxnl_l; }
72  size_t nmaxnl_u() { p_initnl(-1); return p_nmaxnl_u; }
73  size_t nmaxnn() { p_initnn(); return p_nmaxnn; }
74  size_t nmaxcs() { p_initcs(); return p_nmaxcs; }
75 
76  realnum tp(long nl, long nu, long Z);
77  realnum tp(long nl, long ll, long nu, long lu, long Z);
78  realnum tp(long n, long ll, long lu, long Z);
79  double wn(long n, long ll, long lu, long Z);
80  double cs(double e, long n, long l, long Z);
81 };
82 
83 #endif
size_t p_nmaxn
Definition: hydro_tbl.h:26
Definition: cddefines.h:213
size_t p_nmaxnl_u
Definition: hydro_tbl.h:33
void p_initnn()
Definition: hydro_tbl.cpp:183
void p_initn(long nu)
Definition: hydro_tbl.cpp:29
~t_hydro_tbl()
Definition: hydro_tbl.h:62
multi_arr< double, 3 > p_wnnn
Definition: hydro_tbl.h:42
size_t p_nmaxnn
Definition: hydro_tbl.h:40
size_t nmaxn()
Definition: hydro_tbl.h:70
multi_arr< realnum, 2 > arrn
Definition: hydro_tbl.h:29
void p_initcs()
Definition: hydro_tbl.cpp:246
size_t nmaxnn()
Definition: hydro_tbl.h:73
multi_arr< double, 3 > p_en
Definition: hydro_tbl.h:46
size_t p_nmaxnl_read
Definition: hydro_tbl.h:34
size_t nmaxnl_u()
Definition: hydro_tbl.h:72
long p_posnl
Definition: hydro_tbl.h:35
static const size_t p_stride
Definition: hydro_tbl.h:24
size_t nmaxcs()
Definition: hydro_tbl.h:74
vector< arrnl * > p_tpnl
Definition: hydro_tbl.h:37
size_t p_Zmax
Definition: hydro_tbl.h:39
float realnum
Definition: cddefines.h:127
void p_initnl(long nu)
Definition: hydro_tbl.cpp:94
size_t p_nmaxcs
Definition: hydro_tbl.h:44
multi_arr< realnum, 4 > arrnl
Definition: hydro_tbl.h:36
vector< arrn * > p_tpn
Definition: hydro_tbl.h:30
double wn(long n, long ll, long lu, long Z)
Definition: hydro_tbl.cpp:355
size_t nmaxnl_l()
Definition: hydro_tbl.h:71
size_t p_nenrgs
Definition: hydro_tbl.h:45
multi_arr< double, 3 > p_cs
Definition: hydro_tbl.h:47
size_t p_nmaxnl_l
Definition: hydro_tbl.h:32
Definition: hydro_tbl.h:9
multi_arr< realnum, 3 > p_tpnn
Definition: hydro_tbl.h:41
size_t p_nmaxn_read
Definition: hydro_tbl.h:27
t_hydro_tbl()
Definition: hydro_tbl.h:56
realnum tp(long nl, long nu, long Z)
Definition: hydro_tbl.cpp:308
long p_posn
Definition: hydro_tbl.h:28
double cs(double e, long n, long l, long Z)
Definition: hydro_tbl.cpp:368
realnum p_RM(long Z) const
Definition: hydro_tbl.cpp:299