-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathspectrum_lightcurve.h
More file actions
57 lines (44 loc) · 2.18 KB
/
spectrum_lightcurve.h
File metadata and controls
57 lines (44 loc) · 2.18 KB
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
#ifndef SPECTRUM_H
#define SPECTRUM_H
#include <array>
#include <cstddef>
#include <span>
#include <string>
#include "exspec.h"
#include "mpi_logging.h"
#include "packet.h"
struct Spectra {
double nu_min = -1.;
double nu_max = -1.;
std::array<float, MNUBINS> lower_freq{};
std::array<float, MNUBINS> delta_freq{};
MPI_shared_array<double> fluxalltimesteps;
MPI_shared_array<double> absorptionalltimesteps;
MPI_shared_array<double> emissionalltimesteps;
MPI_shared_array<double> trueemissionalltimesteps;
bool do_emission_absorption = false;
[[nodiscard]] auto mem_usage_bytes() const -> size_t {
auto mem_usage = sizeof(Spectra);
mem_usage += sizeof(float) * (lower_freq.size() + delta_freq.size());
mem_usage += sizeof(double) * (fluxalltimesteps.size() + absorptionalltimesteps.size() +
emissionalltimesteps.size() + trueemissionalltimesteps.size());
// Note: Allocator overhead is not included in this calculation.
return mem_usage;
}
};
void write_spectra(const std::string& spec_filename, const std::string& emission_filename,
const std::string& trueemission_filename, const std::string& absorption_filename,
const Spectra& spectra, int numtimesteps);
void write_specpol(const std::string& specpol_filename, const std::string& emission_filename,
const std::string& absorption_filename, const Spectra* stokes_i, const Spectra* stokes_q,
const Spectra* stokes_u);
void add_to_spec_res(const Packet& pkt, int dirbin, Spectra& spectra, Spectra* stokes_i, Spectra* stokes_q,
Spectra* stokes_u);
void init_spectra(Spectra& spectra, double nu_min, double nu_max, bool do_emission_absorption);
void init_spectrum_trace();
void write_partial_lightcurve_spectra(int nts, std::span<const Packet> pkts);
void add_to_lc_res(const Packet& pkt, int dirbin, std::span<double> light_curve_lum,
std::span<double> light_curve_lumcmf);
void write_light_curve(const std::string& lc_filename, std::span<const double> light_curve_lum,
std::span<const double> light_curve_lumcmf, int numtimesteps);
#endif // SPECTRUM_H