diff --git a/include/openmc/cell.h b/include/openmc/cell.h index 8a330060c3..d3b411dda3 100644 --- a/include/openmc/cell.h +++ b/include/openmc/cell.h @@ -2,12 +2,14 @@ #define OPENMC_CELL_H #include +#include // for hash #include #include // for unique_ptr #include #include #include +#include #include "hdf5.h" #include "pugixml.hpp" #include "dagmc.h" @@ -286,10 +288,40 @@ private: std::vector> partitions_; }; +//============================================================================== +//! Define an instance of a particular cell +//============================================================================== + +struct CellInstance { + //! Check for equality + bool operator==(const CellInstance& other) const + { return index_cell == other.index_cell && instance == other.instance; } + + gsl::index index_cell; + gsl::index instance; +}; +} // namespace openmc + +namespace std { +template<> +struct hash { + // Taken from https://stackoverflow.com/a/17017281 + std::size_t operator()(const openmc::CellInstance& k) const + { + std::size_t res = 17; + res = 31 * res + std::hash()(k.index_cell); + res = 31 * res + std::hash()(k.instance); + return res; + } +}; +} // namespace std + //============================================================================== // Non-member functions //============================================================================== +namespace openmc { + void read_cells(pugi::xml_node node); #ifdef DAGMC diff --git a/include/openmc/tallies/filter_cell_instance.h b/include/openmc/tallies/filter_cell_instance.h index 0895cc1eff..33874b85d6 100644 --- a/include/openmc/tallies/filter_cell_instance.h +++ b/include/openmc/tallies/filter_cell_instance.h @@ -2,43 +2,14 @@ #define OPENMC_TALLIES_FILTER_CELL_INSTANCE_H #include -#include // for hash #include #include #include +#include "openmc/cell.h" #include "openmc/tallies/filter.h" -//============================================================================== -//! Define an instance of a particular cell -//============================================================================== - -namespace openmc { -struct CellInstance { - //! Check for equality - bool operator==(const CellInstance& other) const - { return index_cell == other.index_cell && instance == other.instance; } - - gsl::index index_cell; - gsl::index instance; -}; -} // namespace openmc - -namespace std { -template<> -struct hash { - // Taken from https://stackoverflow.com/a/17017281 - std::size_t operator()(const openmc::CellInstance& k) const - { - std::size_t res = 17; - res = 31 * res + std::hash()(k.index_cell); - res = 31 * res + std::hash()(k.instance); - return res; - } -}; -} // namespace std - namespace openmc {