Cloudy
Spectral Synthesis Code for Astrophysics
Loading...
Searching...
No Matches
hydro_tbl.h
Go to the documentation of this file.
1/* This file is part of Cloudy and is copyright (C)1978-2025 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
9class 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;
28 long p_posn;
30 vector<arrn*> p_tpn;
31
32 size_t p_nmaxnl_l;
33 size_t p_nmaxnl_u;
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 size_t p_Zmaxm1;
50 vector<realnum> p_tpwn;
51
52 void p_initn(long nu);
53 void p_initnl(long nu);
54 void p_initnn();
55 void p_initcs();
56 void p_initwn();
57
58 realnum p_RM(long Z) const;
59protected:
61 {
62 p_nmaxn = 0;
63 p_nmaxnl_l = 0;
64 p_nmaxnl_u = 0;
65 }
67 {
68 for( size_t i=0; i < p_tpn.size(); ++i )
69 delete p_tpn[i];
70 for( size_t i=0; i < p_tpnl.size(); ++i )
71 delete p_tpnl[i];
72 }
73public:
74 size_t nmaxn() { p_initn(-1); return p_nmaxn; }
75 size_t nmaxnl_l() { p_initnl(-1); return p_nmaxnl_l; }
76 size_t nmaxnl_u() { p_initnl(-1); return p_nmaxnl_u; }
77 size_t nmaxnn() { p_initnn(); return p_nmaxnn; }
78 size_t nmaxcs() { p_initcs(); return p_nmaxcs; }
79
80 realnum tp(long nl, long nu, long Z);
81 realnum tp(long nl, long ll, long nu, long lu, long Z);
82 realnum tp(long n, long ll, long lu, long Z);
83 realnum m1wn(long n, long l, long Z);
84 double wn(long n, long ll, long lu, long Z);
85 double cs(double e, long n, long l, long Z);
86};
87
88#endif
float realnum
Definition cddefines.h:127
Definition cddefines.h:214
Definition container_classes.h:916
vector< arrn * > p_tpn
Definition hydro_tbl.h:30
void p_initcs()
Definition hydro_tbl.cpp:248
size_t p_Zmaxm1
Definition hydro_tbl.h:49
size_t p_nmaxnl_l
Definition hydro_tbl.h:32
multi_arr< realnum, 2 > arrn
Definition hydro_tbl.h:29
size_t p_nenrgs
Definition hydro_tbl.h:45
size_t nmaxn()
Definition hydro_tbl.h:74
multi_arr< double, 3 > p_en
Definition hydro_tbl.h:46
static const size_t p_stride
Definition hydro_tbl.h:24
multi_arr< realnum, 3 > p_tpnn
Definition hydro_tbl.h:41
double wn(long n, long ll, long lu, long Z)
Definition hydro_tbl.cpp:399
size_t p_Zmax
Definition hydro_tbl.h:39
long p_posnl
Definition hydro_tbl.h:35
size_t nmaxnl_u()
Definition hydro_tbl.h:76
~t_hydro_tbl()
Definition hydro_tbl.h:66
vector< realnum > p_tpwn
Definition hydro_tbl.h:50
realnum m1wn(long n, long l, long Z)
Definition hydro_tbl.cpp:368
size_t nmaxnl_l()
Definition hydro_tbl.h:75
size_t p_nmaxcs
Definition hydro_tbl.h:44
multi_arr< double, 3 > p_cs
Definition hydro_tbl.h:47
size_t p_nmaxnl_read
Definition hydro_tbl.h:34
void p_initnl(long nu)
Definition hydro_tbl.cpp:96
double cs(double e, long n, long l, long Z)
Definition hydro_tbl.cpp:412
size_t p_nmaxnl_u
Definition hydro_tbl.h:33
multi_arr< double, 3 > p_wnnn
Definition hydro_tbl.h:42
void p_initwn()
Definition hydro_tbl.cpp:301
size_t p_nmaxn
Definition hydro_tbl.h:26
t_hydro_tbl()
Definition hydro_tbl.h:60
vector< arrnl * > p_tpnl
Definition hydro_tbl.h:37
size_t p_nmaxnn
Definition hydro_tbl.h:40
size_t nmaxcs()
Definition hydro_tbl.h:78
void p_initnn()
Definition hydro_tbl.cpp:185
size_t nmaxnn()
Definition hydro_tbl.h:77
multi_arr< realnum, 4 > arrnl
Definition hydro_tbl.h:36
size_t p_nmaxn_read
Definition hydro_tbl.h:27
realnum tp(long nl, long nu, long Z)
Definition hydro_tbl.cpp:337
long p_posn
Definition hydro_tbl.h:28
void p_initn(long nu)
Definition hydro_tbl.cpp:31
realnum p_RM(long Z) const
Definition hydro_tbl.cpp:328