mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
added: eclmpiserializer::append
this broadcasts from the root rank, and then appends the results to existing data on the others
This commit is contained in:
parent
42384c8052
commit
ee0d482b32
@ -386,6 +386,25 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! \brief Serialize and broadcast on root process, de-serialize and append on
|
||||||
|
//! others.
|
||||||
|
//!
|
||||||
|
//! \tparam T Type of class to broadcast
|
||||||
|
//! \param data Class to broadcast
|
||||||
|
template<class T>
|
||||||
|
void append(T& data)
|
||||||
|
{
|
||||||
|
if (m_comm.size() == 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
T tmp;
|
||||||
|
T& bcast = m_comm.rank() == 0 ? data : tmp;
|
||||||
|
broadcast(bcast);
|
||||||
|
|
||||||
|
if (m_comm.rank() != 0)
|
||||||
|
data.append(tmp);
|
||||||
|
}
|
||||||
|
|
||||||
//! \brief Returns current position in buffer.
|
//! \brief Returns current position in buffer.
|
||||||
size_t position() const
|
size_t position() const
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user