From 7d505177131e23bf503a0ccb9222eee8ef2fdc18 Mon Sep 17 00:00:00 2001
From: andy <a.heather@opencfd.co.uk>
Date: Thu, 21 Oct 2010 16:21:27 +0100
Subject: [PATCH] ENH: Restructured and cleaned cloud evolution functions

---
 .../Templates/KinematicCloud/KinematicCloud.C | 12 ++--
 .../Templates/KinematicCloud/KinematicCloud.H |  2 +-
 .../Templates/ReactingCloud/ReactingCloud.C   | 63 ++-----------------
 .../Templates/ReactingCloud/ReactingCloud.H   | 12 ----
 .../ReactingMultiphaseCloud.C                 | 63 ++-----------------
 .../ReactingMultiphaseCloud.H                 | 12 ----
 .../Templates/ThermoCloud/ThermoCloud.C       | 63 ++-----------------
 .../Templates/ThermoCloud/ThermoCloud.H       | 12 ----
 8 files changed, 23 insertions(+), 216 deletions(-)

diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C
index a7990be458e..71b0d95f790 100644
--- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C
+++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C
@@ -179,10 +179,11 @@ void Foam::KinematicCloud<ParcelType>::updateCellOccupancy()
 
 
 template<class ParcelType>
-void Foam::KinematicCloud<ParcelType>::evolveCloud()
+void Foam::KinematicCloud<ParcelType>::evolveCloud
+(
+    typename ParcelType::trackData& td
+)
 {
-    typename ParcelType::trackData td(*this);
-
     label preInjectionSize = this->size();
 
     this->surfaceFilm().inject(td);
@@ -195,7 +196,6 @@ void Foam::KinematicCloud<ParcelType>::evolveCloud()
 
         preInjectionSize = this->size();
     }
-
     this->injection().inject(td);
 
     if (solution_.coupled())
@@ -572,9 +572,11 @@ void Foam::KinematicCloud<ParcelType>::evolve()
 {
     if (solution_.active())
     {
+        typename ParcelType::trackData td(*this);
+
         preEvolve();
 
-        evolveCloud();
+        evolveCloud(td);
 
         postEvolve();
 
diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H
index b041c4c2dfc..7b176a59ceb 100644
--- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H
+++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H
@@ -297,7 +297,7 @@ protected:
             void updateCellOccupancy();
 
             //- Evolve the cloud
-            void evolveCloud();
+            void evolveCloud(typename ParcelType::trackData& td);
 
             //- Particle motion
             void motion(typename ParcelType::trackData& td);
diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C
index cf1521e8425..561fc680dac 100644
--- a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C
+++ b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C
@@ -80,61 +80,6 @@ void Foam::ReactingCloud<ParcelType>::checkSuppliedComposition
 }
 
 
-template<class ParcelType>
-void Foam::ReactingCloud<ParcelType>::preEvolve()
-{
-    ThermoCloud<ParcelType>::preEvolve();
-}
-
-
-template<class ParcelType>
-void Foam::ReactingCloud<ParcelType>::evolveCloud()
-{
-    typename ParcelType::trackData td(*this);
-
-    label preInjectionSize = this->size();
-
-    this->surfaceFilm().inject(td);
-
-    // Update the cellOccupancy if the size of the cloud has changed
-    // during the injection.
-    if (preInjectionSize != this->size())
-    {
-        this->updateCellOccupancy();
-
-        preInjectionSize = this->size();
-    }
-
-    this->injection().inject(td);
-
-    if (this->solution().coupled())
-    {
-        resetSourceTerms();
-    }
-
-    // Assume that motion will update the cellOccupancy as necessary
-    // before it is required.
-    motion(td);
-}
-
-
-template<class ParcelType>
-void  Foam::ReactingCloud<ParcelType>::motion
-(
-    typename ParcelType::trackData& td
-)
-{
-    ThermoCloud<ParcelType>::motion(td);
-}
-
-
-template<class ParcelType>
-void Foam::ReactingCloud<ParcelType>::postEvolve()
-{
-    ThermoCloud<ParcelType>::postEvolve();
-}
-
-
 template<class ParcelType>
 void Foam::ReactingCloud<ParcelType>::cloudReset(ReactingCloud<ParcelType>& c)
 {
@@ -319,11 +264,13 @@ void Foam::ReactingCloud<ParcelType>::evolve()
 {
     if (this->solution().active())
     {
-        preEvolve();
+        typename ParcelType::trackData td(*this);
+
+        this->preEvolve();
 
-        evolveCloud();
+        this->evolveCloud(td);
 
-        postEvolve();
+        this->postEvolve();
 
         info();
         Info<< endl;
diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.H b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.H
index 4fa3153d6e2..c265117c82d 100644
--- a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.H
+++ b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.H
@@ -136,18 +136,6 @@ protected:
 
         // Cloud evolution functions
 
-            //- Pre-evolve
-            void preEvolve();
-
-            //- Evolve the cloud
-            void evolveCloud();
-
-            //- Particle motion
-            void motion(typename ParcelType::trackData& td);
-
-            //- Post-evolve
-            void postEvolve();
-
             //- Reset state of cloud
             void cloudReset(ReactingCloud<ParcelType>& c);
 
diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C
index ca41f745727..843aa343ed1 100644
--- a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C
+++ b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C
@@ -53,61 +53,6 @@ void Foam::ReactingMultiphaseCloud<ParcelType>::restoreState()
 
 // * * * * * * * * * * * * * Protected Member Functions  * * * * * * * * * * //
 
-template<class ParcelType>
-void Foam::ReactingMultiphaseCloud<ParcelType>::preEvolve()
-{
-    ReactingCloud<ParcelType>::preEvolve();
-}
-
-
-template<class ParcelType>
-void Foam::ReactingMultiphaseCloud<ParcelType>::evolveCloud()
-{
-    typename ParcelType::trackData td(*this);
-
-    label preInjectionSize = this->size();
-
-    this->surfaceFilm().inject(td);
-
-    // Update the cellOccupancy if the size of the cloud has changed
-    // during the injection.
-    if (preInjectionSize != this->size())
-    {
-        this->updateCellOccupancy();
-
-        preInjectionSize = this->size();
-    }
-
-    this->injection().inject(td);
-
-    if (this->solution().coupled())
-    {
-        resetSourceTerms();
-    }
-
-    // Assume that motion will update the cellOccupancy as necessary
-    // before it is required.
-    motion(td);
-}
-
-
-template<class ParcelType>
-void  Foam::ReactingMultiphaseCloud<ParcelType>::motion
-(
-    typename ParcelType::trackData& td
-)
-{
-    ReactingCloud<ParcelType>::motion(td);
-}
-
-
-template<class ParcelType>
-void Foam::ReactingMultiphaseCloud<ParcelType>::postEvolve()
-{
-    ReactingCloud<ParcelType>::postEvolve();
-}
-
-
 template<class ParcelType>
 void Foam::ReactingMultiphaseCloud<ParcelType>::cloudReset
 (
@@ -274,11 +219,13 @@ void Foam::ReactingMultiphaseCloud<ParcelType>::evolve()
 {
     if (this->solution().active())
     {
-        preEvolve();
+        typename ParcelType::trackData td(*this);
+
+        this->preEvolve();
 
-        evolveCloud();
+        this->evolveCloud(td);
 
-        postEvolve();
+        this->postEvolve();
 
         info();
         Info<< endl;
diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.H b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.H
index 86302703d37..b291e74dce4 100644
--- a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.H
+++ b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.H
@@ -127,18 +127,6 @@ protected:
 
         // Cloud evolution functions
 
-            //- Pre-evolve
-            void preEvolve();
-
-            //- Evolve the cloud
-            void evolveCloud();
-
-            //- Particle motion
-            void motion(typename ParcelType::trackData& td);
-
-            //- Post-evolve
-            void postEvolve();
-
             //- Reset state of cloud
             void cloudReset(ReactingMultiphaseCloud<ParcelType>& c);
 
diff --git a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C
index 52190e52c4b..ebddd47aa96 100644
--- a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C
+++ b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C
@@ -54,61 +54,6 @@ void Foam::ThermoCloud<ParcelType>::restoreState()
 
 // * * * * * * * * * * * * * Protected Member Functions  * * * * * * * * * * //
 
-template<class ParcelType>
-void Foam::ThermoCloud<ParcelType>::preEvolve()
-{
-    KinematicCloud<ParcelType>::preEvolve();
-}
-
-
-template<class ParcelType>
-void Foam::ThermoCloud<ParcelType>::evolveCloud()
-{
-    typename ParcelType::trackData td(*this);
-
-    label preInjectionSize = this->size();
-
-    // Update the cellOccupancy if the size of the cloud has changed
-    // during the injection.
-    this->surfaceFilm().inject(td);
-
-    if (preInjectionSize != this->size())
-    {
-        this->updateCellOccupancy();
-
-        preInjectionSize = this->size();
-    }
-
-    this->injection().inject(td);
-
-    if (this->solution().coupled())
-    {
-        resetSourceTerms();
-    }
-
-    // Assume that motion will update the cellOccupancy as necessary
-    // before it is required.
-    motion(td);
-}
-
-
-template<class ParcelType>
-void  Foam::ThermoCloud<ParcelType>::motion
-(
-    typename ParcelType::trackData& td
-)
-{
-    KinematicCloud<ParcelType>::motion(td);
-}
-
-
-template<class ParcelType>
-void Foam::ThermoCloud<ParcelType>::postEvolve()
-{
-    KinematicCloud<ParcelType>::postEvolve();
-}
-
-
 template<class ParcelType>
 void Foam::ThermoCloud<ParcelType>::cloudReset(ThermoCloud<ParcelType>& c)
 {
@@ -294,11 +239,13 @@ void Foam::ThermoCloud<ParcelType>::evolve()
 {
     if (this->solution().active())
     {
-        preEvolve();
+        typename ParcelType::trackData td(*this);
+
+        this->preEvolve();
 
-        evolveCloud();
+        this->evolveCloud(td);
 
-        postEvolve();
+        this->postEvolve();
 
         info();
         Info<< endl;
diff --git a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.H b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.H
index d7b9cc7d8de..05bac41ef5c 100644
--- a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.H
+++ b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.H
@@ -133,18 +133,6 @@ protected:
 
         // Cloud evolution functions
 
-            //- Pre-evolve
-            void preEvolve();
-
-            //- Evolve the cloud
-            void evolveCloud();
-
-            //- Particle motion
-            void motion(typename ParcelType::trackData& td);
-
-            //- Post-evolve
-            void postEvolve();
-
             //- Reset state of cloud
             void cloudReset(ThermoCloud<ParcelType>& c);
 
-- 
GitLab