From 0eeb5aa72593fb03f60b111571fe3c818b1c9a64 Mon Sep 17 00:00:00 2001
From: andy <a.heather@opencfd.co.uk>
Date: Thu, 21 Oct 2010 11:17:02 +0100
Subject: [PATCH] ENH: Added cloudReset function to base Cloud class

---
 src/lagrangian/basic/Cloud/Cloud.C | 10 ++++++++++
 src/lagrangian/basic/Cloud/Cloud.H |  3 +++
 2 files changed, 13 insertions(+)

diff --git a/src/lagrangian/basic/Cloud/Cloud.C b/src/lagrangian/basic/Cloud/Cloud.C
index 2b39e286f26..b75760294d2 100644
--- a/src/lagrangian/basic/Cloud/Cloud.C
+++ b/src/lagrangian/basic/Cloud/Cloud.C
@@ -384,6 +384,16 @@ void Foam::Cloud<ParticleType>::deleteParticle(ParticleType& p)
 }
 
 
+template<class ParticleType>
+void Foam::Cloud<ParticleType>::cloudReset(const Cloud<ParticleType>& c)
+{
+    // Reset particle cound and particles only
+    // - not changing the cloud object registry or reference to the polyMesh
+    particleCount_ = 0;
+    IDLList<ParticleType>::operator=(c);
+}
+
+
 template<class ParticleType>
 template<class TrackingData>
 void Foam::Cloud<ParticleType>::move(TrackingData& td)
diff --git a/src/lagrangian/basic/Cloud/Cloud.H b/src/lagrangian/basic/Cloud/Cloud.H
index 1868b9c8815..c784ff9bebc 100644
--- a/src/lagrangian/basic/Cloud/Cloud.H
+++ b/src/lagrangian/basic/Cloud/Cloud.H
@@ -318,6 +318,9 @@ public:
             //- Remove particle from cloud and delete
             void deleteParticle(ParticleType&);
 
+            //- Reset the particles
+            void cloudReset(const Cloud<ParticleType>& c);
+
             //- Move the particles
             //  passing the TrackingData to the track function
             template<class TrackingData>
-- 
GitLab