Skip to content

Commit

Permalink
Make stdrng, output_file inline
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeshingles committed Nov 19, 2024
1 parent fc1028d commit bf79e44
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 22 deletions.
9 changes: 0 additions & 9 deletions exspec.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
#include <ctime>
#include <filesystem>
#include <fstream>
#ifndef GPU_ON
#include <random>
#endif
#include <vector>

#include "artisoptions.h"
Expand All @@ -24,12 +21,6 @@
#include "spectrum_lightcurve.h"
#include "version.h"

#ifndef GPU_ON
std::mt19937 stdrng{std::random_device{}()};
#endif

std::ofstream output_file;

namespace {

void do_angle_bin(const int a, Packet *pkts, bool load_allrank_packets, Spectra &rpkt_spectra, Spectra &stokes_i,
Expand Down
9 changes: 0 additions & 9 deletions sn3d.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
#include <ctime>
#include <filesystem>
#include <fstream>
#ifndef GPU_ON
#include <random>
#endif
#include <span>
#ifdef STDPAR_ON
#include <thread>
Expand All @@ -53,12 +50,6 @@
#include "version.h"
#include "vpkt.h"

#ifndef GPU_ON
std::mt19937 stdrng{std::random_device{}()};
#endif

std::ofstream output_file;

namespace {
constexpr bool VERIFY_WRITTEN_PACKETS_FILES = false;

Expand Down
4 changes: 2 additions & 2 deletions sn3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ constexpr int cellcacheslotid = 0;
inline bool use_cellcache = false;

#ifndef GPU_ON
extern std::mt19937 stdrng;
inline std::mt19937 stdrng{std::random_device{}()};
#endif

extern std::ofstream output_file;
inline std::ofstream output_file;

inline char outputlinebuf[1024] = "";
inline bool outputstartofline = true;
Expand Down
3 changes: 1 addition & 2 deletions update_grid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1127,8 +1127,7 @@ void update_grid(FILE *estimators_file, const int nts, const int nts_prev, const
// Check if this task should work on the current model grid cell.
// If yes, update the cell and write out the estimators
HeatingCoolingRates heatingcoolingrates{};
const int assoc_cells = grid::get_numpropcells(mgi);
if (assoc_cells > 0) {
if (grid::get_numpropcells(mgi) > 0) {
update_grid_cell(mgi, nts, nts_prev, titer, tratmid, deltat, &heatingcoolingrates);
}

Expand Down

0 comments on commit bf79e44

Please sign in to comment.