diff --git a/include/lbt/populations/indexing/indexing.hpp b/include/lbt/populations/indexing/indexing.hpp index 4d4914d..12ee9e6 100755 --- a/include/lbt/populations/indexing/indexing.hpp +++ b/include/lbt/populations/indexing/indexing.hpp @@ -13,40 +13,11 @@ #include #include "lbt/common/type_definitions.hpp" +#include "lbt/populations/indexing/timestep.hpp" namespace lbt { - /**\enum Timestep - * \brief Strongly typed enum for even and odd time steps required for AA access pattern - */ - enum class Timestep: bool { - Even = false, - Odd = true - }; - - /**\fn operator! - * \brief Negation operator for the timestep - * - * \param[in] ts Timestep to be negated - * \return Negated timestep - */ - inline constexpr Timestep operator! (Timestep const& ts) noexcept { - return (ts == Timestep::Even) ? Timestep::Odd : Timestep::Even; - } - - /**\fn Timestep output stream operator - * \brief Output stream operator for the timestep - * - * \param[in,out] os Output stream - * \param[in] ts Timestep to be printed to output stream - * \return Output stream including the type of timestep - */ - inline std::ostream& operator << (std::ostream& os, Timestep const& ts) noexcept { - os << ((ts == Timestep::Even) ? "even time step" : "odd time step"); - return os; - } - /**\class Indexing * \brief Class for indexing of a population * diff --git a/include/lbt/populations/indexing/timestep.hpp b/include/lbt/populations/indexing/timestep.hpp new file mode 100755 index 0000000..090819b --- /dev/null +++ b/include/lbt/populations/indexing/timestep.hpp @@ -0,0 +1,48 @@ +/** + * \file timestep.hpp + * \brief Base class for timestep + * \author Tobit Flatscher (github.com/2b-t) +*/ + +#ifndef LBT__INDEXING__TIMESTEP +#define LBT__INDEXING__TIMESTEP +#pragma once + +#include + + +namespace lbt { + + /**\enum Timestep + * \brief Strongly typed enum for even and odd time steps required for AA access pattern + */ + enum class Timestep: bool { + Even = false, + Odd = true + }; + + /**\fn operator! + * \brief Negation operator for the timestep + * + * \param[in] ts Timestep to be negated + * \return Negated timestep + */ + inline constexpr Timestep operator! (Timestep const& ts) noexcept { + return (ts == Timestep::Even) ? Timestep::Odd : Timestep::Even; + } + + /**\fn Timestep output stream operator + * \brief Output stream operator for the timestep + * + * \param[in,out] os Output stream + * \param[in] ts Timestep to be printed to output stream + * \return Output stream including the type of timestep + */ + inline std::ostream& operator << (std::ostream& os, Timestep const& ts) noexcept { + os << ((ts == Timestep::Even) ? "even time step" : "odd time step"); + return os; + } + +} + +#endif // LBT__INDEXING__TIMESTEP