From e5da46a6742b2d0b490971c0ea71aa819f18d602 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 19 Dec 2013 15:41:56 +0000 Subject: [PATCH] ENH: PstreamBuffers: added clear function --- .../db/IOstreams/Pstreams/PstreamBuffers.C | 15 +++++++++++++++ .../db/IOstreams/Pstreams/PstreamBuffers.H | 5 +++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.C b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.C index a1db6529f1..dfb60891d6 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.C +++ b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.C @@ -145,4 +145,19 @@ void Foam::PstreamBuffers::finishedSends(labelListList& sizes, const bool block) } +void Foam::PstreamBuffers::clear() +{ + forAll(sendBuf_, i) + { + sendBuf_[i].clear(); + } + forAll(recvBuf_, i) + { + recvBuf_[i].clear(); + } + recvBufPos_ = 0; + finishedSendsCalled_ = false; +} + + // ************************************************************************* // diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.H b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.H index 52b9960bde..8d5998fe82 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.H +++ b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.H @@ -112,8 +112,6 @@ class PstreamBuffers bool finishedSendsCalled_; - // Private Member Functions - public: // Static data @@ -155,6 +153,9 @@ public: // non-blocking. void finishedSends(labelListList& sizes, const bool block = true); + //- Clear storage and reset + void clear(); + };