Skip to content

Commit

Permalink
Revert "Update vpkt.cc"
Browse files Browse the repository at this point in the history
This reverts commit 9232315.
  • Loading branch information
lukeshingles committed Oct 26, 2024
1 parent 9232315 commit 587230a
Showing 1 changed file with 34 additions and 34 deletions.
68 changes: 34 additions & 34 deletions vpkt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ auto rlc_emiss_vpkt(const Packet &pkt, const double t_current, const double t_ar
// the excluded line

vpkt.next_trans -= 1;
// printoutf("ldist > sdist : line in the next cell\n");
// printout("ldist > sdist : line in the next cell\n");
break;
}

Expand Down Expand Up @@ -486,7 +486,7 @@ void read_vspecpol(const int my_rank, const int nts) {
char filename[MAXFILENAMELENGTH];

snprintf(filename, MAXFILENAMELENGTH, "vspecpol_%.4d_ts%d.tmp", my_rank, nts);
printoutf("Reading %s\n", filename);
printout("Reading %s\n", filename);

FILE *vspecpol_file = fopen_required(filename, "r");

Expand Down Expand Up @@ -573,7 +573,7 @@ void read_vpkt_grid(const int my_rank, const int nts) {

char filename[MAXFILENAMELENGTH];
snprintf(filename, MAXFILENAMELENGTH, "vpkt_grid_%.4d_ts%d.tmp", my_rank, nts);
printoutf("Reading vpkt grid file %s\n", filename);
printout("Reading vpkt grid file %s\n", filename);
FILE *vpkt_grid_file = fopen_required(filename, "r");

for (int obsdirindex = 0; obsdirindex < Nobs; obsdirindex++) {
Expand Down Expand Up @@ -602,7 +602,7 @@ void vpkt_remove_temp_file(const int nts, const int my_rank) {
for (const auto *filename : filenames) {
if (std::filesystem::exists(filename)) {
std::remove(filename);
printoutf("Deleted %s\n", filename);
printout("Deleted %s\n", filename);
}
}
}
Expand All @@ -613,15 +613,15 @@ void read_parameterfile_vpkt() {
// Nobs
assert_always(fscanf(input_file, "%d", &Nobs) == 1);

printoutf("vpkt.txt: Nobs %d directions\n", Nobs);
printout("vpkt.txt: Nobs %d directions\n", Nobs);

// nz_obs_vpkt. Cos(theta) to the observer. A list in the case of many observers
nz_obs_vpkt.resize(Nobs);
for (int i = 0; i < Nobs; i++) {
assert_always(fscanf(input_file, "%lg", &nz_obs_vpkt[i]) == 1);

if (fabs(nz_obs_vpkt[i]) > 1) {
printoutf("Wrong observer direction\n");
printout("Wrong observer direction\n");
std::abort();
} else if (nz_obs_vpkt[i] == 1) {
nz_obs_vpkt[i] = 0.9999;
Expand All @@ -638,8 +638,8 @@ void read_parameterfile_vpkt() {
phiobs[i] = phi_degrees * PI / 180.;
const double theta_degrees = std::acos(nz_obs_vpkt[i]) / PI * 180.;

printoutf("vpkt.txt: direction %d costheta %g (%.1f degrees) phi %g (%.1f degrees)\n", i, nz_obs_vpkt[i],
theta_degrees, phiobs[i], phi_degrees);
printout("vpkt.txt: direction %d costheta %g (%.1f degrees) phi %g (%.1f degrees)\n", i, nz_obs_vpkt[i],
theta_degrees, phiobs[i], phi_degrees);
}

// Nspectra opacity choices (i.e. Nspectra spectra for each observer)
Expand All @@ -663,7 +663,7 @@ void read_parameterfile_vpkt() {
}
}

printoutf("vpkt.txt: Nspectra %d per observer\n", Nspectra);
printout("vpkt.txt: Nspectra %d per observer\n", Nspectra);
tau_vpkt.resize(Nspectra, 0.);

// time window. If dum4=1 it restrict vpkt to time windown (dum5,dum6)
Expand All @@ -672,17 +672,17 @@ void read_parameterfile_vpkt() {
double vspec_tmax_in_days = 0.;
assert_always(fscanf(input_file, "%d %lg %lg \n", &override_tminmax, &vspec_tmin_in_days, &vspec_tmax_in_days) == 3);

printoutf("vpkt: compiled with VSPEC_TIMEMIN %.1fd VSPEC_TIMEMAX %1.fd VMTBINS %d\n", VSPEC_TIMEMIN / DAY,
VSPEC_TIMEMAX / DAY, VMTBINS);
printout("vpkt: compiled with VSPEC_TIMEMIN %.1fd VSPEC_TIMEMAX %1.fd VMTBINS %d\n", VSPEC_TIMEMIN / DAY,
VSPEC_TIMEMAX / DAY, VMTBINS);
if (override_tminmax == 1) {
VSPEC_TIMEMIN_input = vspec_tmin_in_days * DAY;
VSPEC_TIMEMAX_input = vspec_tmax_in_days * DAY;
printoutf("vpkt.txt: VSPEC_TIMEMIN_input %.1fd, VSPEC_TIMEMAX_input %.1fd\n", VSPEC_TIMEMIN_input / DAY,
VSPEC_TIMEMAX_input / DAY);
printout("vpkt.txt: VSPEC_TIMEMIN_input %.1fd, VSPEC_TIMEMAX_input %.1fd\n", VSPEC_TIMEMIN_input / DAY,
VSPEC_TIMEMAX_input / DAY);
} else {
VSPEC_TIMEMIN_input = VSPEC_TIMEMIN;
VSPEC_TIMEMAX_input = VSPEC_TIMEMAX;
printoutf(
printout(
"vpkt.txt: VSPEC_TIMEMIN_input %.1fd, VSPEC_TIMEMAX_input %.1fd (inherited from VSPEC_TIMEMIN and "
"VSPEC_TIMEMAX)\n",
VSPEC_TIMEMIN_input / DAY, VSPEC_TIMEMAX_input / DAY);
Expand All @@ -698,17 +698,17 @@ void read_parameterfile_vpkt() {
int flag_custom_freq_ranges = 0;
assert_always(fscanf(input_file, "%d ", &flag_custom_freq_ranges) == 1);

printoutf("vpkt: compiled with VMNUBINS %d\n", VMNUBINS);
printout("vpkt: compiled with VMNUBINS %d\n", VMNUBINS);
assert_always(VSPEC_NUMAX > VSPEC_NUMIN);
printoutf("vpkt: compiled with VSPEC_NUMAX %g lambda_min %g Å\n", VSPEC_NUMAX, 1e8 * CLIGHT / VSPEC_NUMAX);
printoutf("vpkt: compiled with VSPEC_NUMIN %g lambda_max %g Å\n", VSPEC_NUMIN, 1e8 * CLIGHT / VSPEC_NUMIN);
printout("vpkt: compiled with VSPEC_NUMAX %g lambda_min %g Å\n", VSPEC_NUMAX, 1e8 * CLIGHT / VSPEC_NUMAX);
printout("vpkt: compiled with VSPEC_NUMIN %g lambda_max %g Å\n", VSPEC_NUMIN, 1e8 * CLIGHT / VSPEC_NUMIN);

if (flag_custom_freq_ranges == 1) {
assert_always(fscanf(input_file, "%d ", &Nrange) == 1);
VSPEC_NUMIN_input.resize(Nrange, 0.);
VSPEC_NUMAX_input.resize(Nrange, 0.);

printoutf("vpkt.txt: Nrange %d frequency intervals per spectrum per observer\n", Nrange);
printout("vpkt.txt: Nrange %d frequency intervals per spectrum per observer\n", Nrange);

for (int i = 0; i < Nrange; i++) {
double lmin_vspec_input = 0.;
Expand All @@ -727,35 +727,35 @@ void read_parameterfile_vpkt() {
VSPEC_NUMIN_input.push_back(VSPEC_NUMIN);
VSPEC_NUMAX_input.push_back(VSPEC_NUMAX);

printoutf("vpkt.txt: Nrange 1 frequency interval (inherited from VSPEC_NUMIN and VSPEC_NUMAX)\n");
printout("vpkt.txt: Nrange 1 frequency interval (inherited from VSPEC_NUMIN and VSPEC_NUMAX)\n");
}

for (int i = 0; i < Nrange; i++) {
printoutf("vpkt.txt: range %d lambda [%g, %g] Angstroms\n", i, 1e8 * CLIGHT / VSPEC_NUMAX_input[i],
1e8 * CLIGHT / VSPEC_NUMIN_input[i]);
printout("vpkt.txt: range %d lambda [%g, %g] Angstroms\n", i, 1e8 * CLIGHT / VSPEC_NUMAX_input[i],
1e8 * CLIGHT / VSPEC_NUMIN_input[i]);
}

// if dum7=1, vpkt are not created when cell optical depth is larger than cell_is_optically_thick_vpkt
int override_thickcell_tau = 0;
assert_always(fscanf(input_file, "%d %lg \n", &override_thickcell_tau, &cell_is_optically_thick_vpkt) == 2);

if (override_thickcell_tau == 1) {
printoutf("vpkt.txt: cell_is_optically_thick_vpkt %lg\n", cell_is_optically_thick_vpkt);
printout("vpkt.txt: cell_is_optically_thick_vpkt %lg\n", cell_is_optically_thick_vpkt);
} else {
cell_is_optically_thick_vpkt = globals::cell_is_optically_thick;
printoutf("vpkt.txt: cell_is_optically_thick_vpkt %lg (inherited from cell_is_optically_thick)\n",
cell_is_optically_thick_vpkt);
printout("vpkt.txt: cell_is_optically_thick_vpkt %lg (inherited from cell_is_optically_thick)\n",
cell_is_optically_thick_vpkt);
}

// Maximum optical depth. If a vpkt reaches dum7 is thrown away
assert_always(fscanf(input_file, "%lg \n", &tau_max_vpkt) == 1);
printoutf("vpkt.txt: tau_max_vpkt %g\n", tau_max_vpkt);
printout("vpkt.txt: tau_max_vpkt %g\n", tau_max_vpkt);

// Produce velocity grid map if =1
int in_vgrid_on = 0;
assert_always(fscanf(input_file, "%d \n", &in_vgrid_on) == 1);
vgrid_on = in_vgrid_on != 0;
printoutf("vpkt.txt: velocity grid map %s\n", (vgrid_on) ? "ENABLED" : "DISABLED");
printout("vpkt.txt: velocity grid map %s\n", (vgrid_on) ? "ENABLED" : "DISABLED");

if (vgrid_on) {
double tmin_grid_in_days{NAN};
Expand All @@ -765,12 +765,12 @@ void read_parameterfile_vpkt() {
tmin_grid = tmin_grid_in_days * DAY;
tmax_grid = tmax_grid_in_days * DAY;

printoutf("vpkt.txt: velocity grid time range tmin_grid %gd tmax_grid %gd\n", tmin_grid / DAY, tmax_grid / DAY);
printout("vpkt.txt: velocity grid time range tmin_grid %gd tmax_grid %gd\n", tmin_grid / DAY, tmax_grid / DAY);

// Specify wavelength range: number of intervals (dum9) and limits (dum10,dum11)
assert_always(fscanf(input_file, "%d ", &Nrange_grid) == 1);

printoutf("vpkt.txt: velocity grid frequency intervals %d\n", Nrange_grid);
printout("vpkt.txt: velocity grid frequency intervals %d\n", Nrange_grid);

nu_grid_max.resize(Nrange_grid, 0.);
nu_grid_min.resize(Nrange_grid, 0.);
Expand All @@ -782,8 +782,8 @@ void read_parameterfile_vpkt() {
nu_grid_max[i] = CLIGHT / (range_lambda_min * 1e-8);
nu_grid_min[i] = CLIGHT / (range_lambda_max * 1e-8);

printoutf("vpkt.txt: velgrid range %d lambda [%g, %g] Angstroms\n", i, 1e8 * CLIGHT / nu_grid_max[i],
1e8 * CLIGHT / nu_grid_min[i]);
printout("vpkt.txt: velgrid range %d lambda [%g, %g] Angstroms\n", i, 1e8 * CLIGHT / nu_grid_max[i],
1e8 * CLIGHT / nu_grid_min[i]);
}
}

Expand All @@ -804,7 +804,7 @@ void vpkt_write_timestep(const int nts, const int my_rank, const bool is_final)
snprintf(filename_vspecpol, MAXFILENAMELENGTH, "vspecpol_%.4d_ts%d.tmp", my_rank, nts);
}

printoutf("Writing %s\n", filename_vspecpol);
printout("Writing %s\n", filename_vspecpol);
FILE *vspecpol_file = fopen_required(filename_vspecpol, "w");
write_vspecpol(vspecpol_file);
fclose(vspecpol_file);
Expand All @@ -817,7 +817,7 @@ void vpkt_write_timestep(const int nts, const int my_rank, const bool is_final)
snprintf(filename_vpktgrid, MAXFILENAMELENGTH, "vpkt_grid_%.4d_ts%d.tmp", my_rank, nts);
}

printoutf("Writing vpkt grid file %s\n", filename_vpktgrid);
printout("Writing vpkt grid file %s\n", filename_vpktgrid);
FILE *vpkt_grid_file = fopen_required(filename_vpktgrid, "w");
write_vpkt_grid(vpkt_grid_file);
fclose(vpkt_grid_file);
Expand All @@ -836,7 +836,7 @@ void vpkt_write_timestep(const int nts, const int my_rank, const bool is_final)
}

std::filesystem::copy_file(filename_prev, filename, std::filesystem::copy_options::overwrite_existing);
printoutf("Copying %s to %s\n", filename_prev, filename);
printout("Copying %s to %s\n", filename_prev, filename);

if (!is_final) {
vpkt_contrib_file = std::ofstream(filename, std::ios::app);
Expand All @@ -862,7 +862,7 @@ void vpkt_init(const int nts, const int my_rank, const bool continued_from_saved
char filename_prev[MAXFILENAMELENGTH];
snprintf(filename_prev, MAXFILENAMELENGTH, "vpackets_%.4d_ts%d.tmp", my_rank, nts);
std::filesystem::copy_file(filename_prev, filename, std::filesystem::copy_options::overwrite_existing);
printoutf("Copying %s to %s\n", filename_prev, filename);
printout("Copying %s to %s\n", filename_prev, filename);
} else {
// Create new file with header line
vpkt_contrib_file = std::ofstream(filename, std::ios::trunc);
Expand Down

0 comments on commit 587230a

Please sign in to comment.