From e5e100abd30ff16afeaee9174fcb3d81419b2a22 Mon Sep 17 00:00:00 2001
From: mattijs <mattijs>
Date: Thu, 11 Apr 2013 15:13:54 +0100
Subject: [PATCH] ENH: motionSmoother: split off patch consistency

---
 .../motionSmoother/motionSmoother.C           | 64 +++++++++++--------
 .../motionSmoother/motionSmoother.H           |  4 ++
 2 files changed, 41 insertions(+), 27 deletions(-)

diff --git a/src/dynamicMesh/motionSmoother/motionSmoother.C b/src/dynamicMesh/motionSmoother/motionSmoother.C
index c7d5d28e765..dad3ea59774 100644
--- a/src/dynamicMesh/motionSmoother/motionSmoother.C
+++ b/src/dynamicMesh/motionSmoother/motionSmoother.C
@@ -678,34 +678,8 @@ void Foam::motionSmoother::correct()
 }
 
 
-void Foam::motionSmoother::setDisplacement(pointField& patchDisp)
+void Foam::motionSmoother::setDisplacementPatchFields()
 {
-    // See comment in .H file about shared points.
-    const polyBoundaryMesh& patches = mesh_.boundaryMesh();
-
-    forAll(patches, patchI)
-    {
-        const polyPatch& pp = patches[patchI];
-
-        if (pp.coupled())
-        {
-            const labelList& meshPoints = pp.meshPoints();
-
-            forAll(meshPoints, i)
-            {
-                displacement_[meshPoints[i]] = vector::zero;
-            }
-        }
-    }
-
-    const labelList& ppMeshPoints = pp_.meshPoints();
-
-    // Set internal point data from displacement on combined patch points.
-    forAll(ppMeshPoints, patchPointI)
-    {
-        displacement_[ppMeshPoints[patchPointI]] = patchDisp[patchPointI];
-    }
-
     // Adapt the fixedValue bc's (i.e. copy internal point data to
     // boundaryField for all affected patches)
     forAll(adaptPatchIDs_, i)
@@ -765,6 +739,42 @@ void Foam::motionSmoother::setDisplacement(pointField& patchDisp)
         displacement_.boundaryField()[patchI] ==
             displacement_.boundaryField()[patchI].patchInternalField();
     }
+}
+
+
+void Foam::motionSmoother::setDisplacement(pointField& patchDisp)
+{
+    // See comment in .H file about shared points.
+    const polyBoundaryMesh& patches = mesh_.boundaryMesh();
+
+    forAll(patches, patchI)
+    {
+        const polyPatch& pp = patches[patchI];
+
+        if (pp.coupled())
+        {
+            const labelList& meshPoints = pp.meshPoints();
+
+            forAll(meshPoints, i)
+            {
+                displacement_[meshPoints[i]] = vector::zero;
+            }
+        }
+    }
+
+    const labelList& ppMeshPoints = pp_.meshPoints();
+
+    // Set internal point data from displacement on combined patch points.
+    forAll(ppMeshPoints, patchPointI)
+    {
+        displacement_[ppMeshPoints[patchPointI]] = patchDisp[patchPointI];
+    }
+
+
+    // Adapt the fixedValue bc's (i.e. copy internal point data to
+    // boundaryField for all affected patches)
+    setDisplacementPatchFields();
+
 
     if (debug)
     {
diff --git a/src/dynamicMesh/motionSmoother/motionSmoother.H b/src/dynamicMesh/motionSmoother/motionSmoother.H
index ee5432ad4ec..fff07c4b94a 100644
--- a/src/dynamicMesh/motionSmoother/motionSmoother.H
+++ b/src/dynamicMesh/motionSmoother/motionSmoother.H
@@ -385,6 +385,10 @@ public:
             //- Take over existing mesh position.
             void correct();
 
+            //- Set patch fields on displacement to be consistent with
+            //  internal values.
+            void setDisplacementPatchFields();
+
             //- Set displacement field from displacement on patch points.
             //  Modify provided displacement to be consistent with actual
             //  boundary conditions on displacement. Note: resets the
-- 
GitLab