From ffa2836a75b5ee66040dd5039a57ea28c9c865d4 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@Germany>
Date: Fri, 17 Dec 2010 17:05:38 +0100
Subject: [PATCH] COMP: avoid ambiguous construct from tmp - lagrangian

---
 .../vectorTensorTransform/vectorTensorTransformI.H | 14 ++++++++++----
 .../collisionModel/ORourke/sameCell.H              |  6 +++---
 .../collisionModel/trajectoryModel/trajectoryCM.H  |  6 +++---
 .../gradientDispersionRAS/gradientDispersionRAS.C  |  2 +-
 .../stochasticDispersionRAS.C                      |  2 +-
 .../dsmc/clouds/Templates/DsmcCloud/DsmcCloudI.H   | 11 ++++++++---
 .../InflowBoundaryModel/FreeStream/FreeStream.C    |  6 ++++--
 .../clouds/Templates/ThermoCloud/ThermoCloudI.H    |  2 +-
 .../ReactingMultiphaseParcel.C                     |  6 +++---
 .../ReactingMultiphaseParcelIO.C                   |  6 +++---
 .../parcels/include/createKinematicParcelTypes.H   |  2 +-
 .../CompositionModel/CompositionModel.C            |  3 ++-
 .../LiquidEvaporation/LiquidEvaporation.C          |  2 +-
 .../LiquidEvaporation/LiquidEvaporation.H          |  2 +-
 14 files changed, 42 insertions(+), 28 deletions(-)

diff --git a/src/lagrangian/basic/InteractionLists/globalIndexAndTransform/vectorTensorTransform/vectorTensorTransformI.H b/src/lagrangian/basic/InteractionLists/globalIndexAndTransform/vectorTensorTransform/vectorTensorTransformI.H
index f322fc786fb..b42ec621538 100644
--- a/src/lagrangian/basic/InteractionLists/globalIndexAndTransform/vectorTensorTransform/vectorTensorTransformI.H
+++ b/src/lagrangian/basic/InteractionLists/globalIndexAndTransform/vectorTensorTransform/vectorTensorTransformI.H
@@ -120,14 +120,17 @@ inline Foam::pointField Foam::vectorTensorTransform::transform
     const pointField& pts
 ) const
 {
+    tmp<pointField> tfld;
+
     if (hasR_)
     {
-        return t() + (R() & pts);
+        tfld = t() + (R() & pts);
     }
     else
     {
-        return t() + pts;
+        tfld = t() + pts;
     }
+    return tfld();
 }
 
 
@@ -152,14 +155,17 @@ inline Foam::pointField Foam::vectorTensorTransform::invTransform
     const pointField& pts
 ) const
 {
+    tmp<pointField> tfld;
+
     if (hasR_)
     {
-        return (R().T() & (pts - t()));
+        tfld = (R().T() & (pts - t()));
     }
     else
     {
-        return pts - t();
+        tfld = pts - t();
     }
+    return tfld();
 }
 
 
diff --git a/src/lagrangian/dieselSpray/spraySubModels/collisionModel/ORourke/sameCell.H b/src/lagrangian/dieselSpray/spraySubModels/collisionModel/ORourke/sameCell.H
index 7743a06f7cc..ed34a3fda00 100644
--- a/src/lagrangian/dieselSpray/spraySubModels/collisionModel/ORourke/sameCell.H
+++ b/src/lagrangian/dieselSpray/spraySubModels/collisionModel/ORourke/sameCell.H
@@ -103,9 +103,9 @@ if ((xx > collProb) && (mMin > VSMALL) && (mMax > VSMALL))
         pMax().U() = (momMax + (1.0-newMinMass/mMin)*momMin)/newMaxMass;
 
         // update the liquid molar fractions
-        scalarField Ymin = spray_.fuels().Y(pMin().X());
-        scalarField Ymax = spray_.fuels().Y(pMax().X());
-        scalarField Ynew = mMax*Ymax + (mMin - newMinMass)*Ymin;
+        scalarField Ymin(spray_.fuels().Y(pMin().X()));
+        scalarField Ymax(spray_.fuels().Y(pMax().X()));
+        scalarField Ynew(mMax*Ymax + (mMin - newMinMass)*Ymin);
         scalar Wlinv = 0.0;
         forAll(Ynew, i)
         {
diff --git a/src/lagrangian/dieselSpray/spraySubModels/collisionModel/trajectoryModel/trajectoryCM.H b/src/lagrangian/dieselSpray/spraySubModels/collisionModel/trajectoryModel/trajectoryCM.H
index d9e83f68752..657e018e11e 100644
--- a/src/lagrangian/dieselSpray/spraySubModels/collisionModel/trajectoryModel/trajectoryCM.H
+++ b/src/lagrangian/dieselSpray/spraySubModels/collisionModel/trajectoryModel/trajectoryCM.H
@@ -139,9 +139,9 @@ if (vAlign > 0)
                         (momMax + (1.0-newMinMass/mMin)*momMin)/newMaxMass;
 
                     // update the liquid molar fractions
-                    scalarField Ymin = spray_.fuels().Y(pMin().X());
-                    scalarField Ymax = spray_.fuels().Y(pMax().X());
-                    scalarField Ynew = mMax*Ymax + (mMin - newMinMass)*Ymin;
+                    scalarField Ymin(spray_.fuels().Y(pMin().X()));
+                    scalarField Ymax(spray_.fuels().Y(pMax().X()));
+                    scalarField Ynew(mMax*Ymax + (mMin - newMinMass)*Ymin);
                     scalar Wlinv = 0.0;
                     forAll(Ynew, i)
                     {
diff --git a/src/lagrangian/dieselSpray/spraySubModels/dispersionModel/gradientDispersionRAS/gradientDispersionRAS.C b/src/lagrangian/dieselSpray/spraySubModels/dispersionModel/gradientDispersionRAS/gradientDispersionRAS.C
index 9c7f0dffd08..1076c002221 100644
--- a/src/lagrangian/dieselSpray/spraySubModels/dispersionModel/gradientDispersionRAS/gradientDispersionRAS.C
+++ b/src/lagrangian/dieselSpray/spraySubModels/dispersionModel/gradientDispersionRAS/gradientDispersionRAS.C
@@ -70,7 +70,7 @@ void Foam::gradientDispersionRAS::disperseParcels() const
 
     scalar dt = spray_.runTime().deltaTValue();
     const volScalarField& k = turbulence().k();
-    volVectorField gradk = fvc::grad(k);
+    const volVectorField gradk(fvc::grad(k));
     const volScalarField& epsilon = turbulence().epsilon();
     const volVectorField& U = spray_.U();
 
diff --git a/src/lagrangian/dieselSpray/spraySubModels/dispersionModel/stochasticDispersionRAS/stochasticDispersionRAS.C b/src/lagrangian/dieselSpray/spraySubModels/dispersionModel/stochasticDispersionRAS/stochasticDispersionRAS.C
index 7085f45839d..eb96e3f6537 100644
--- a/src/lagrangian/dieselSpray/spraySubModels/dispersionModel/stochasticDispersionRAS/stochasticDispersionRAS.C
+++ b/src/lagrangian/dieselSpray/spraySubModels/dispersionModel/stochasticDispersionRAS/stochasticDispersionRAS.C
@@ -71,7 +71,7 @@ void Foam::stochasticDispersionRAS::disperseParcels() const
 
     scalar dt = spray_.runTime().deltaTValue();
     const volScalarField& k = turbulence().k();
-    //volVectorField gradk = fvc::grad(k);
+    // volVectorField gradk(fvc::grad(k));
     const volScalarField& epsilon = turbulence().epsilon();
     const volVectorField& U = spray_.U();
 
diff --git a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloudI.H b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloudI.H
index 6390bfbc82b..57b48986a13 100644
--- a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloudI.H
+++ b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloudI.H
@@ -352,8 +352,9 @@ inline Foam::scalarField Foam::DsmcCloud<ParcelType>::maxwellianAverageSpeed
     scalar mass
 ) const
 {
-    return
+    tmp<scalarField> tfld =
         2.0*sqrt(2.0*physicoChemical::k.value()*temperature/(pi*mass));
+    return tfld();
 }
 
 
@@ -375,7 +376,9 @@ inline Foam::scalarField Foam::DsmcCloud<ParcelType>::maxwellianRMSSpeed
     scalar mass
 ) const
 {
-    return sqrt(3.0*physicoChemical::k.value()*temperature/mass);
+    tmp<scalarField> tfld =
+        sqrt(3.0*physicoChemical::k.value()*temperature/mass);
+    return tfld();
 }
 
 
@@ -399,7 +402,9 @@ Foam::DsmcCloud<ParcelType>::maxwellianMostProbableSpeed
     scalar mass
 ) const
 {
-    return sqrt(2.0*physicoChemical::k.value()*temperature/mass);
+    tmp<scalarField> tfld =
+        sqrt(2.0*physicoChemical::k.value()*temperature/mass);
+    return tfld();
 }
 
 
diff --git a/src/lagrangian/dsmc/submodels/InflowBoundaryModel/FreeStream/FreeStream.C b/src/lagrangian/dsmc/submodels/InflowBoundaryModel/FreeStream/FreeStream.C
index df835e735d0..4cda733a867 100644
--- a/src/lagrangian/dsmc/submodels/InflowBoundaryModel/FreeStream/FreeStream.C
+++ b/src/lagrangian/dsmc/submodels/InflowBoundaryModel/FreeStream/FreeStream.C
@@ -188,9 +188,11 @@ void Foam::FreeStream<CloudType>::inflow()
             // negated), dividing by the most probable speed to form
             // molecularSpeedRatio * cosTheta
 
-            scalarField sCosTheta =
+            scalarField sCosTheta
+            (
                 (boundaryU[patchI] & -patch.faceAreas()/mag(patch.faceAreas()))
-               /mostProbableSpeed;
+              / mostProbableSpeed
+            );
 
             // From Bird eqn 4.22
 
diff --git a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H
index dabbdc12116..ceff5e02c8e 100644
--- a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H
+++ b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H
@@ -137,7 +137,7 @@ Foam::ThermoCloud<ParcelType>::Sh(volScalarField& hs) const
     {
         if (this->solution().semiImplicit("hs"))
         {
-            const volScalarField Cp = thermo_.thermo().Cp();
+            const volScalarField Cp(thermo_.thermo().Cp());
 
             return
                 hsTrans()/(this->mesh().V()*this->db().time().deltaT())
diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C
index f0e175904c3..958c938969f 100644
--- a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C
+++ b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C
@@ -357,9 +357,9 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
     // Update component mass fractions
     // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-    scalarField dMassGas = dMassDV + dMassSRGas;
-    scalarField dMassLiquid = dMassPC + dMassSRLiquid;
-    scalarField dMassSolid = dMassSRSolid;
+    scalarField dMassGas(dMassDV + dMassSRGas);
+    scalarField dMassLiquid(dMassPC + dMassSRLiquid);
+    scalarField dMassSolid(dMassSRSolid);
 
     scalar mass1 =
         updateMassFractions(mass0, dMassGas, dMassLiquid, dMassSolid);
diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelIO.C b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelIO.C
index 414638d6990..d0e8e130d44 100644
--- a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelIO.C
+++ b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelIO.C
@@ -286,9 +286,9 @@ Foam::Ostream& Foam::operator<<
     const ReactingMultiphaseParcel<ParcelType>& p
 )
 {
-    scalarField YGasLoc = p.YGas()*p.Y()[0];
-    scalarField YLiquidLoc = p.YLiquid()*p.Y()[1];
-    scalarField YSolidLoc = p.YSolid()*p.Y()[2];
+    scalarField YGasLoc(p.YGas()*p.Y()[0]);
+    scalarField YLiquidLoc(p.YLiquid()*p.Y()[1]);
+    scalarField YSolidLoc(p.YSolid()*p.Y()[2]);
     if (os.format() == IOstream::ASCII)
     {
         os  << static_cast<const ReactingParcel<ParcelType>&>(p)
diff --git a/src/lagrangian/intermediate/parcels/include/createKinematicParcelTypes.H b/src/lagrangian/intermediate/parcels/include/createKinematicParcelTypes.H
index acdace44af1..d48969ca748 100644
--- a/src/lagrangian/intermediate/parcels/include/createKinematicParcelTypes.H
+++ b/src/lagrangian/intermediate/parcels/include/createKinematicParcelTypes.H
@@ -33,7 +33,7 @@ License
 
 #define createKinematicParcelTypes(ParcelType)                                \
                                                                               \
-    defineTemplateTypeNameAndDebug(ParcelType, 0);                            \
+    defineTypeNameAndDebug(ParcelType, 0);                                    \
     defineTemplateTypeNameAndDebug(Particle<ParcelType>, 0);                  \
     defineTemplateTypeNameAndDebug(Cloud<ParcelType>, 0);                     \
                                                                               \
diff --git a/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.C b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.C
index 6cf80b2c171..e5212f91a30 100644
--- a/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.C
+++ b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.C
@@ -322,7 +322,8 @@ Foam::scalarField Foam::CompositionModel<CloudType>::X
         }
     }
 
-    return X/WInv;
+    tmp<scalarField> tfld = X/WInv;
+    return tfld();
 }
 
 
diff --git a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.C b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.C
index c1369cdcc3c..6b72e9db0cc 100644
--- a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.C
+++ b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.C
@@ -149,7 +149,7 @@ void Foam::LiquidEvaporation<CloudType>::calculate
 ) const
 {
     // construct carrier phase species volume fractions for cell, cellI
-    const scalarField Xc = calcXc(cellI);
+    const scalarField Xc(calcXc(cellI));
 
     // droplet surface area
     const scalar A = pi*sqr(d);
diff --git a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.H b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.H
index b998e9e4d2a..dbae15d93d4 100644
--- a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.H
+++ b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.H
@@ -72,7 +72,7 @@ protected:
         scalar Sh(const scalar Re, const scalar Sc) const;
 
         //- Calculate the carrier phase component volume fractions at cellI
-        scalarField calcXc(const label cellI) const;
+        tmp<scalarField> calcXc(const label cellI) const;
 
 
 public:
-- 
GitLab