From 45a00a1377805e4b9c7501d066317aa840f8d009 Mon Sep 17 00:00:00 2001
From: Henry <Henry>
Date: Fri, 25 Oct 2013 15:08:54 +0100
Subject: [PATCH] interstitialInletVelocity: corrected mapping for
 decomposition and reconstruction

---
 ...erstitialInletVelocityFvPatchVectorField.C | 39 +++++++++++++++----
 ...erstitialInletVelocityFvPatchVectorField.H | 22 ++++++++++-
 2 files changed, 52 insertions(+), 9 deletions(-)

diff --git a/src/finiteVolume/fields/fvPatchFields/derived/interstitialInletVelocity/interstitialInletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/interstitialInletVelocity/interstitialInletVelocityFvPatchVectorField.C
index 745918403b5..e5f7a049f4e 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/interstitialInletVelocity/interstitialInletVelocityFvPatchVectorField.C
+++ b/src/finiteVolume/fields/fvPatchFields/derived/interstitialInletVelocity/interstitialInletVelocityFvPatchVectorField.C
@@ -38,7 +38,7 @@ interstitialInletVelocityFvPatchVectorField
     const DimensionedField<vector, volMesh>& iF
 )
 :
-    fixedValueFvPatchField<vector>(p, iF),
+    fixedValueFvPatchVectorField(p, iF),
     inletVelocity_(p.size(), vector::zero),
     alphaName_("alpha")
 {}
@@ -53,8 +53,8 @@ interstitialInletVelocityFvPatchVectorField
     const fvPatchFieldMapper& mapper
 )
 :
-    fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
-    inletVelocity_(ptf.inletVelocity_),
+    fixedValueFvPatchVectorField(ptf, p, iF, mapper),
+    inletVelocity_(ptf.inletVelocity_, mapper),
     alphaName_(ptf.alphaName_)
 {}
 
@@ -67,7 +67,7 @@ interstitialInletVelocityFvPatchVectorField
     const dictionary& dict
 )
 :
-    fixedValueFvPatchField<vector>(p, iF, dict),
+    fixedValueFvPatchVectorField(p, iF, dict),
     inletVelocity_("inletVelocity", dict, p.size()),
     alphaName_(dict.lookupOrDefault<word>("alpha", "alpha"))
 {}
@@ -79,7 +79,7 @@ interstitialInletVelocityFvPatchVectorField
     const interstitialInletVelocityFvPatchVectorField& ptf
 )
 :
-    fixedValueFvPatchField<vector>(ptf),
+    fixedValueFvPatchVectorField(ptf),
     inletVelocity_(ptf.inletVelocity_),
     alphaName_(ptf.alphaName_)
 {}
@@ -92,7 +92,7 @@ interstitialInletVelocityFvPatchVectorField
     const DimensionedField<vector, volMesh>& iF
 )
 :
-    fixedValueFvPatchField<vector>(ptf, iF),
+    fixedValueFvPatchVectorField(ptf, iF),
     inletVelocity_(ptf.inletVelocity_),
     alphaName_(ptf.alphaName_)
 {}
@@ -100,6 +100,31 @@ interstitialInletVelocityFvPatchVectorField
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
+void Foam::interstitialInletVelocityFvPatchVectorField::autoMap
+(
+    const fvPatchFieldMapper& m
+)
+{
+    fixedValueFvPatchVectorField::autoMap(m);
+    inletVelocity_.autoMap(m);
+}
+
+
+void Foam::interstitialInletVelocityFvPatchVectorField::rmap
+(
+    const fvPatchVectorField& ptf,
+    const labelList& addr
+)
+{
+    fixedValueFvPatchVectorField::rmap(ptf, addr);
+
+    const interstitialInletVelocityFvPatchVectorField& tiptf =
+        refCast<const interstitialInletVelocityFvPatchVectorField>(ptf);
+
+    inletVelocity_.rmap(tiptf.inletVelocity_, addr);
+}
+
+
 void Foam::interstitialInletVelocityFvPatchVectorField::updateCoeffs()
 {
     if (updated())
@@ -111,7 +136,7 @@ void Foam::interstitialInletVelocityFvPatchVectorField::updateCoeffs()
         patch().lookupPatchField<volScalarField, scalar>(alphaName_);
 
     operator==(inletVelocity_/alphap);
-    fixedValueFvPatchField<vector>::updateCoeffs();
+    fixedValueFvPatchVectorField::updateCoeffs();
 }
 
 
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/interstitialInletVelocity/interstitialInletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/interstitialInletVelocity/interstitialInletVelocityFvPatchVectorField.H
index 1952b826335..6affdefada4 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/interstitialInletVelocity/interstitialInletVelocityFvPatchVectorField.H
+++ b/src/finiteVolume/fields/fvPatchFields/derived/interstitialInletVelocity/interstitialInletVelocityFvPatchVectorField.H
@@ -141,8 +141,26 @@ public:
 
     // Member functions
 
-        //- Update the coefficients associated with the patch field
-        virtual void updateCoeffs();
+        // Mapping functions
+
+            //- Map (and resize as needed) from self given a mapping object
+            virtual void autoMap
+            (
+                const fvPatchFieldMapper&
+            );
+
+            //- Reverse map the given fvPatchField onto this fvPatchField
+            virtual void rmap
+            (
+                const fvPatchVectorField&,
+                const labelList&
+            );
+
+
+        // Evaluation functions
+
+            //- Update the coefficients associated with the patch field
+            virtual void updateCoeffs();
 
         //- Write
         virtual void write(Ostream&) const;
-- 
GitLab