-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRadiationField.h
executable file
·98 lines (60 loc) · 2.51 KB
/
RadiationField.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#ifndef _rf_RadiationField_h_
#define _rf_RadiationField_h_
#include <map>
#include <string>
#include <valarray>
#include <vector>
#include <CLHEP/Vector/ThreeVector.h>
#include <Skymap.h>
namespace rf {
// Explicit assumption made is that the supplied radiation field
// is generated on a regular spatial grid. That is, there are n*m entries
// in the grid. For each entry in the grid, there is a range of validity
// (given by the cell size). Outside this range the radiation field is
// determined by interpolation within the grid. For points outside the grid
// the radiation field is considered zero
class RadiationField {
public:
enum STELLARCOMPONENT { TOTAL, DIRECT, SCATTERED, TRANSIENT, THERMAL };
#ifdef CLHEP_V1_8
typedef Hep3Vector ThreeVector;
#else
typedef CLHEP::Hep3Vector ThreeVector;
#endif
RadiationField();
RadiationField(const std::string& filename,
const std::valarray<double>& freq,
int rebinnedSkymapOrder = 0);
~RadiationField();
// Note: The method below is *very* expensive if the desired
// healpix order is different from the rebinned order supplied
// in the constructor above. Use with caution!
const Skymap<double> GetSkymap(const ThreeVector& pos,
const STELLARCOMPONENT component,
const int healpixOrder);
// This method is *much* faster if you just want the number density
const valarray<double> GetNumberDensity(const ThreeVector& pos,
const STELLARCOMPONENT component);
private:
const Skymap<double> GetSkymap(const ThreeVector& pos,
const STELLARCOMPONENT component);
bool fCacheBuilt;
string fPrefix;
int fRebinnedSkymapOrder;
unsigned int fNumberOfComponents;
double fLuminosity, fDustMass;
std::valarray<double> fFrequency, fWavelength, fStellarComponentLuminosity;
std::vector<std::string> fStellarComponentName;
std::map<ThreeVector, std::vector<std::string> > fFilenameData;
std::vector< std::vector<ThreeVector> > fPositionData, fRangeData;
std::valarray<double> fRData, fZData, fRRangeData, fZRangeData;
std::vector< std::vector< std::vector<std::string>* > > fFilenameOrderedData;
std::vector< std::vector< std::vector<Skymap<double>* > > > fSkymapOrderedData;
std::vector< std::vector< std::vector< valarray<double>* > > > fEnergyDensity;
void ReadRadiationField(const std::string& filename);
void BuildSkymapCache();
void FlushSkymapCache();
void ClearData();
};
}
#endif