mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
MPIPacker: move function definition to cpp file
This commit is contained in:
parent
167e1f413a
commit
f310698fef
@ -25,13 +25,22 @@
|
||||
#include <bitset>
|
||||
#include <cstdint>
|
||||
#include <ctime>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
|
||||
|
||||
namespace Opm {
|
||||
namespace Mpi {
|
||||
namespace detail {
|
||||
namespace Opm::Mpi::detail {
|
||||
|
||||
std::size_t mpi_buffer_size(const std::size_t bufsize, const std::size_t position)
|
||||
{
|
||||
if (bufsize < position) {
|
||||
throw std::invalid_argument("Buffer size should never be less than position!");
|
||||
}
|
||||
|
||||
return std::min(bufsize - position,
|
||||
static_cast<std::size_t>(std::numeric_limits<int>::max()));
|
||||
}
|
||||
|
||||
template<std::size_t Size>
|
||||
std::size_t Packing<false,std::bitset<Size>>::
|
||||
@ -139,6 +148,4 @@ template struct Packing<false,std::bitset<10>>;
|
||||
constexpr int NumFip = static_cast<int>(FIPConfig::OutputField::NUM_FIP_REPORT);
|
||||
template struct Packing<false,std::bitset<NumFip>>;
|
||||
|
||||
} // end namespace detail
|
||||
} // end namespace Mpi
|
||||
} // end namespace Opm
|
||||
} // end namespace Opm::Mpi::detail
|
||||
|
@ -30,17 +30,11 @@
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace Opm {
|
||||
namespace Mpi {
|
||||
namespace Opm::Mpi {
|
||||
|
||||
namespace detail {
|
||||
|
||||
static std::size_t mpi_buffer_size(const std::size_t bufsize, const std::size_t position) {
|
||||
if (bufsize < position)
|
||||
throw std::invalid_argument("Buffer size should never be less than position!");
|
||||
|
||||
return static_cast<int>(std::min(bufsize-position,
|
||||
static_cast<std::size_t>(std::numeric_limits<int>::max())));
|
||||
}
|
||||
std::size_t mpi_buffer_size(const std::size_t bufsize, const std::size_t position);
|
||||
|
||||
//! \brief Abstract struct for packing which is (partially) specialized for specific types.
|
||||
template <bool pod, class T>
|
||||
@ -190,7 +184,8 @@ ADD_PACK_SPECIALIZATION(time_point)
|
||||
}
|
||||
|
||||
//! \brief Struct handling packing of serialization for MPI communication.
|
||||
struct Packer {
|
||||
struct Packer
|
||||
{
|
||||
//! \brief Constructor.
|
||||
//! \param comm The communicator to use
|
||||
Packer(Parallel::Communication comm)
|
||||
@ -279,7 +274,6 @@ private:
|
||||
Parallel::Communication m_comm; //!< Communicator to use
|
||||
};
|
||||
|
||||
} // end namespace Mpi
|
||||
} // end namespace Opm
|
||||
} // end namespace Opm::Mpi
|
||||
|
||||
#endif // MPI_PACKER_HPP
|
||||
|
Loading…
Reference in New Issue
Block a user