From 8961e44dc5f63de77f1efee2ad44403988bc2df7 Mon Sep 17 00:00:00 2001
From: graham <g.macpherson@opencfd.co.uk>
Date: Mon, 6 Jun 2011 14:35:07 +0100
Subject: [PATCH] COMP: clang caught ambiguous constructions from tmp.

---
 .../infinitelyFastChemistry.C                 |  8 +++--
 .../directMappedFlowRateFvPatchVectorField.C  |  4 +--
 .../autoHexMeshDriver/autoSnapDriver.C        |  2 +-
 .../autoHexMeshDriver/autoSnapDriverFeature.C |  2 +-
 .../reactingOneDim/reactingOneDim.C           | 32 +++++++++++--------
 ...rolysisVelocityCoupledFvPatchVectorField.C |  2 +-
 .../sampledSet/writers/csv/csvSetWriter.C     |  4 +--
 ...peratureThermoBaffle1DFvPatchScalarField.C | 20 +++++++-----
 8 files changed, 43 insertions(+), 31 deletions(-)

diff --git a/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.C b/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.C
index fb0dbe79b40..2748e31efa2 100644
--- a/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.C
+++ b/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.C
@@ -109,11 +109,13 @@ Foam::combustionModels::infinitelyFastChemistry::R(volScalarField& Y) const
 
     const label fNorm = singleMixture_.specieProd()[specieI];
 
-    const volScalarField fres = singleMixture_.fres(specieI);
+    const volScalarField fres(singleMixture_.fres(specieI));
 
-    const volScalarField wSpecie =
+    const volScalarField wSpecie
+    (
         wFuelNorm_*singleMixture_.specieStoichCoeffs()[specieI]
-      / max(fNorm*(Y - fres), scalar(0.001));
+      / max(fNorm*(Y - fres), scalar(0.001))
+    );
 
     return -fNorm*wSpecie*fres + fNorm*fvm::Sp(wSpecie, Y);
 }
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/directMappedFlowRate/directMappedFlowRateFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/directMappedFlowRate/directMappedFlowRateFvPatchVectorField.C
index 3bc74d3e05d..91ed7d1a2e6 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/directMappedFlowRate/directMappedFlowRateFvPatchVectorField.C
+++ b/src/finiteVolume/fields/fvPatchFields/derived/directMappedFlowRate/directMappedFlowRateFvPatchVectorField.C
@@ -134,9 +134,9 @@ void Foam::directMappedFlowRateFvPatchVectorField::updateCoeffs()
     const surfaceScalarField& phiName =
         db().lookupObject<surfaceScalarField>(phiName_);
 
-    scalarField U = -phi/patch().magSf();
+    scalarField U(-phi/patch().magSf());
 
-    vectorField n = patch().nf();
+    vectorField n(patch().nf());
 
     if (phiName.dimensions() == dimVelocity*dimArea)
     {
diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C
index 6c1925f0641..8b68e53e6bb 100644
--- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C
+++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C
@@ -648,7 +648,7 @@ Foam::scalarField Foam::autoSnapDriver::calcSnapDistance
         -GREAT              // null value
     );
 
-    return snapParams.snapTol()*maxEdgeLen;
+    return scalarField(snapParams.snapTol()*maxEdgeLen);
 }
 
 
diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriverFeature.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriverFeature.C
index e357dbba655..8d2a2b77b26 100644
--- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriverFeature.C
+++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriverFeature.C
@@ -773,7 +773,7 @@ void Foam::autoSnapDriver::determineAllFeatures
     labelList nearPointFeat;
     labelList nearPointIndex;
     {
-        scalarField snapDistSqr = sqr(snapDist);
+        scalarField snapDistSqr(sqr(snapDist));
         features.findNearestEdge
         (
             pp.localPoints(),
diff --git a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C
index 606957c4593..6b95d77d03a 100644
--- a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C
+++ b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C
@@ -133,8 +133,8 @@ void reactingOneDim::updatePhiGas()
         const volScalarField& HsiGas = tHsiGas();
         const volScalarField& RRiGas = tRRiGas();
 
-        const surfaceScalarField HsiGasf = fvc::interpolate(HsiGas);
-        const surfaceScalarField RRiGasf = fvc::interpolate(RRiGas);
+        const surfaceScalarField HsiGasf(fvc::interpolate(HsiGas));
+        const surfaceScalarField RRiGasf(fvc::interpolate(RRiGas));
 
         forAll(intCoupledPatchIDs_, i)
         {
@@ -185,7 +185,7 @@ void reactingOneDim::updateMesh(const scalarField& mass0)
         return;
     }
 
-    const scalarField newV = mass0/rho_;
+    const scalarField newV(mass0/rho_);
 
     Info<< "Initial/final volumes = " << gSum(regionMesh().V()) << ", "
         << gSum(newV) << " [m3]" << endl;
@@ -227,7 +227,7 @@ void reactingOneDim::solveSpeciesMass()
         Info<< "reactingOneDim::solveSpeciesMass()" << endl;
     }
 
-    volScalarField Yt = 0.0*Ys_[0];
+    volScalarField Yt(0.0*Ys_[0]);
 
     for (label i=0; i<Ys_.size()-1; i++)
     {
@@ -242,8 +242,10 @@ void reactingOneDim::solveSpeciesMass()
 
         if (moveMesh_)
         {
-            surfaceScalarField phiRhoMesh =
-                fvc::interpolate(Yi*rho_)*regionMesh().phi();
+            surfaceScalarField phiRhoMesh
+            (
+                fvc::interpolate(Yi*rho_)*regionMesh().phi()
+            );
 
             YiEqn -= fvc::div(phiRhoMesh);
         }
@@ -264,11 +266,11 @@ void reactingOneDim::solveEnergy()
         Info<< "reactingOneDim::solveEnergy()" << endl;
     }
 
-    const volScalarField rhoCp = rho_*solidThermo_.Cp();
+    const volScalarField rhoCp(rho_*solidThermo_.Cp());
 
-    const surfaceScalarField phiQr = fvc::interpolate(Qr_)*nMagSf();
+    const surfaceScalarField phiQr(fvc::interpolate(Qr_)*nMagSf());
 
-    const surfaceScalarField phiGas = fvc::interpolate(phiHsGas_);
+    const surfaceScalarField phiGas(fvc::interpolate(phiHsGas_));
 
     fvScalarMatrix TEqn
     (
@@ -282,8 +284,10 @@ void reactingOneDim::solveEnergy()
 
     if (moveMesh_)
     {
-        surfaceScalarField phiMesh =
-            fvc::interpolate(rhoCp*T_)*regionMesh().phi();
+        surfaceScalarField phiMesh
+        (
+            fvc::interpolate(rhoCp*T_)*regionMesh().phi()
+        );
 
         TEqn -= fvc::div(phiMesh);
     }
@@ -456,10 +460,12 @@ scalar reactingOneDim::solidRegionDiffNo() const
     scalar meanDiNum = 0.0;
     if (regionMesh().nInternalFaces() > 0)
     {
-        surfaceScalarField KrhoCpbyDelta =
+        surfaceScalarField KrhoCpbyDelta
+        (
             regionMesh().surfaceInterpolation::deltaCoeffs()
           * fvc::interpolate(K_)
-          / fvc::interpolate(Cp()*rho_);
+          / fvc::interpolate(Cp()*rho_)
+        );
 
         DiNum = max(KrhoCpbyDelta.internalField())*time_.deltaTValue();
 
diff --git a/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisVelocityCoupled/filmPyrolysisVelocityCoupledFvPatchVectorField.C b/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisVelocityCoupled/filmPyrolysisVelocityCoupledFvPatchVectorField.C
index 57955d166cc..b956492d016 100644
--- a/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisVelocityCoupled/filmPyrolysisVelocityCoupledFvPatchVectorField.C
+++ b/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisVelocityCoupled/filmPyrolysisVelocityCoupledFvPatchVectorField.C
@@ -199,7 +199,7 @@ void Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::updateCoeffs()
             << exit(FatalError);
     }
 
-    const scalarField UAvePyr = -phiPyr/patch().magSf();
+    const scalarField UAvePyr(-phiPyr/patch().magSf());
     const vectorField& nf = patch().nf();
 
     forAll(deltaFilm, i)
diff --git a/src/sampling/sampledSet/writers/csv/csvSetWriter.C b/src/sampling/sampledSet/writers/csv/csvSetWriter.C
index a1020576268..8b5e7fa8920 100644
--- a/src/sampling/sampledSet/writers/csv/csvSetWriter.C
+++ b/src/sampling/sampledSet/writers/csv/csvSetWriter.C
@@ -76,7 +76,7 @@ void Foam::csvSetWriter<Type>::write
         columns[i] = valueSets[i];
     }
 
-    writeTable(points, columns, os);
+    this->writeTable(points, columns, os);
 }
 
 
@@ -110,7 +110,7 @@ void Foam::csvSetWriter<Type>::write
             columns[i] = &valueSets[i][trackI];
         }
 
-        writeTable(points[trackI], columns, os);
+        this->writeTable(points[trackI], columns, os);
         os  << nl << nl;
     }
 }
diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/temperatureThermoBaffle1D/temperatureThermoBaffle1DFvPatchScalarField.C b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/temperatureThermoBaffle1D/temperatureThermoBaffle1DFvPatchScalarField.C
index ee926c706e4..4da5d82bb15 100644
--- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/temperatureThermoBaffle1D/temperatureThermoBaffle1DFvPatchScalarField.C
+++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/temperatureThermoBaffle1D/temperatureThermoBaffle1DFvPatchScalarField.C
@@ -230,7 +230,7 @@ void temperatureThermoBaffle1DFvPatchScalarField<solidType>::updateCoeffs()
 
         const scalarField Cpw(model.thermo().Cp(Ti, patchI));
 
-        scalarField myh = patch().deltaCoeffs()*alphaw*Cpw;
+        scalarField myh(patch().deltaCoeffs()*alphaw*Cpw);
 
         scalarField alphawCp(alphaw*Cpw);
 
@@ -265,15 +265,16 @@ void temperatureThermoBaffle1DFvPatchScalarField<solidType>::updateCoeffs()
         scalarField nbrTi(nbrField.patchInternalField());
         mpp.map().distribute(nbrTi);
 
-        const scalarField nbrCpw = model.thermo().Cp
+        const scalarField nbrCpw
         (
-            nbrField.patchInternalField(),
-            nbrPatchI
+            model.thermo().Cp(nbrField.patchInternalField(), nbrPatchI)
         );
 
-        scalarField nbrh =
+        scalarField nbrh
+        (
             nbrPatch.deltaCoeffs()*nbrCpw
-           *model.alphaEff()().boundaryField()[nbrPatchI];
+           *model.alphaEff()().boundaryField()[nbrPatchI]
+        );
 
         mpp.map().distribute(nbrh);
 
@@ -290,8 +291,11 @@ void temperatureThermoBaffle1DFvPatchScalarField<solidType>::updateCoeffs()
             KDeltaw[i] = solid_().K((Tp[i] + nbrTp[i])/2.0)/thickness_[i];
         }
 
-        const scalarField q =
-            (Ti() - nbrTi)/(1.0/KDeltaw + 1.0/nbrh + 1.0/myh);
+        const scalarField q
+        (
+            (Ti() - nbrTi)/(1.0/KDeltaw + 1.0/nbrh + 1.0/myh)
+        );
+
 
         forAll(qDot, i)
         {
-- 
GitLab