diff --git a/corsika/framework/utility/SaveBootHistogram.hpp b/corsika/detail/framework/utility/SaveBoostHistogram.inl similarity index 88% rename from corsika/framework/utility/SaveBootHistogram.hpp rename to corsika/detail/framework/utility/SaveBoostHistogram.inl index 76576406264c4d15b34273d704ea87b5c6319612..d7ac77a97fd615c5bfc585094884ecebb56e324e 100644 --- a/corsika/framework/utility/SaveBootHistogram.hpp +++ b/corsika/detail/framework/utility/SaveBoostHistogram.inl @@ -21,16 +21,6 @@ namespace corsika { - enum class SaveMode { overwrite, append }; - - /** - * This functions saves a boost::histogram into a numpy file. Only rather basic axis - * types are supported: regular, variable, integer, category<int>. Only "ordinary" bin - * counts (i.e. a double or int) are supported, nothing fancy like profiles. - * - * Note that this function makes a temporary, dense copy of the histogram, which could - * be an issue for huge sizes (e.g. for high dimensions) - */ template <class Axes, class Storage> inline void save_hist(boost::histogram::histogram<Axes, Storage> const& h, std::string const& filename, SaveMode mode = SaveMode::append) { @@ -111,5 +101,6 @@ namespace corsika { cnpy::npz_save(filename, "data", temp.get(), axes_dims, mode_str); // In Python this array can directly be assigned to a histogram view if that // histogram has its axes correspondingly: hist.view(flow=True)[:] = file['data'] - } -} // namespace corsika + } // namespace corsika + +} // namespace corsika \ No newline at end of file diff --git a/corsika/framework/utility/SaveBoostHistogram.hpp b/corsika/framework/utility/SaveBoostHistogram.hpp new file mode 100644 index 0000000000000000000000000000000000000000..707900466df579e5711080f926beb89291272152 --- /dev/null +++ b/corsika/framework/utility/SaveBoostHistogram.hpp @@ -0,0 +1,31 @@ +/* + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu + * + * This software is distributed under the terms of the GNU General Public + * Licence version 3 (GPL Version 3). See file LICENSE for a full version of + * the license. + */ + +#pragma once + + + +#include <boost/histogram.hpp> + + +namespace corsika { + + enum class SaveMode { overwrite, append }; + + /** + * This functions saves a boost::histogram into a numpy file. Only rather basic axis + * types are supported: regular, variable, integer, category<int>. Only "ordinary" bin + * counts (i.e. a double or int) are supported, nothing fancy like profiles. + * + * Note that this function makes a temporary, dense copy of the histogram, which could + * be an issue for huge sizes (e.g. for high dimensions) + */ + template <class Axes, class Storage> + inline void save_hist(boost::histogram::histogram<Axes, Storage> const& h, + std::string const& filename, SaveMode mode = SaveMode::append); +} // namespace corsika