From d4560178e2cce4643ca4677abed81bf7161ff64a Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@Germany> Date: Fri, 17 Dec 2010 16:58:09 +0100 Subject: [PATCH] COMP: avoid ambiguous construct from tmp - gradSchemes --- .../extendedLeastSquaresGrad.C | 6 +++-- .../extendedLeastSquaresVectors.C | 25 +++++++++++-------- .../gradSchemes/fourthGrad/fourthGrad.C | 18 +++++++------ .../gradSchemes/gaussGrad/gaussGrad.C | 6 +++-- .../leastSquaresGrad/leastSquaresGrad.C | 6 +++-- .../leastSquaresGrad/leastSquaresVectors.C | 20 +++++++++------ .../cellLimitedGrad/cellLimitedGrads.C | 8 +++--- .../cellMDLimitedGrad/cellMDLimitedGrads.C | 8 +++--- .../faceLimitedGrad/faceLimitedGrads.C | 4 +-- .../faceMDLimitedGrad/faceMDLimitedGrads.C | 4 +-- .../gaussLaplacianScheme.C | 23 ++++++++++------- .../limitedSnGrad/limitedSnGrad.C | 8 +++--- 12 files changed, 80 insertions(+), 56 deletions(-) diff --git a/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresGrad.C b/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresGrad.C index 722bbf32908..a77e47051e3 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresGrad.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresGrad.C @@ -112,8 +112,10 @@ Foam::fv::extendedLeastSquaresGrad<Type>::calcGrad if (vsf.boundaryField()[patchi].coupled()) { - Field<Type> neiVsf = - vsf.boundaryField()[patchi].patchNeighbourField(); + const Field<Type> neiVsf + ( + vsf.boundaryField()[patchi].patchNeighbourField() + ); forAll(neiVsf, patchFaceI) { diff --git a/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresVectors.C b/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresVectors.C index 54da2b8bc26..4be71b70379 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresVectors.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresVectors.C @@ -111,7 +111,10 @@ void Foam::extendedLeastSquaresVectors::makeLeastSquaresVectors() const const labelUList& neighbour = mesh_.neighbour(); // Build the d-vectors - surfaceVectorField d = mesh_.Sf()/(mesh_.magSf()*mesh_.deltaCoeffs()); + surfaceVectorField d + ( + mesh_.Sf()/(mesh_.magSf()*mesh_.deltaCoeffs()) + ); if (!mesh_.orthogonal()) { @@ -124,7 +127,7 @@ void Foam::extendedLeastSquaresVectors::makeLeastSquaresVectors() const forAll(owner, faceI) { - symmTensor wdd = 1.0/magSqr(d[faceI])*sqr(d[faceI]); + const symmTensor wdd(1.0/magSqr(d[faceI])*sqr(d[faceI])); dd[owner[faceI]] += wdd; dd[neighbour[faceI]] += wdd; @@ -146,11 +149,11 @@ void Foam::extendedLeastSquaresVectors::makeLeastSquaresVectors() const } } - scalarField detdd = det(dd); + scalarField detdd(det(dd)); - Info<< "max(detdd) = " << max(detdd) << endl; - Info<< "min(detdd) = " << min(detdd) << endl; - Info<< "average(detdd) = " << average(detdd) << endl; + Info<< "max(detdd) = " << max(detdd) << nl + << "min(detdd) = " << min(detdd) << nl + << "average(detdd) = " << average(detdd) << endl; label nAddCells = 0; label maxNaddCells = 4*detdd.size(); @@ -219,13 +222,13 @@ void Foam::extendedLeastSquaresVectors::makeLeastSquaresVectors() const additionalCells_.setSize(nAddCells); - Info<< "max(detdd) = " << max(detdd) << endl; - Info<< "min(detdd) = " << min(detdd) << endl; - Info<< "average(detdd) = " << average(detdd) << endl; - Info<< "nAddCells/nCells = " << scalar(nAddCells)/mesh.nCells() << endl; + Info<< "max(detdd) = " << max(detdd) << nl + << "min(detdd) = " << min(detdd) << nl + << "average(detdd) = " << average(detdd) << nl + << "nAddCells/nCells = " << scalar(nAddCells)/mesh.nCells() << endl; // Invert the dd tensor - symmTensorField invDd = inv(dd); + const symmTensorField invDd(inv(dd)); // Revisit all faces and calculate the lsP and lsN vectors diff --git a/src/finiteVolume/finiteVolume/gradSchemes/fourthGrad/fourthGrad.C b/src/finiteVolume/finiteVolume/gradSchemes/fourthGrad/fourthGrad.C index efbacc24aae..6d9ff04f8e5 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/fourthGrad/fourthGrad.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/fourthGrad/fourthGrad.C @@ -122,12 +122,14 @@ Foam::fv::fourthGrad<Type>::calcGrad const scalarField& lambdap = lambda.boundaryField()[patchi]; // Build the d-vectors - vectorField pd = + vectorField pd + ( mesh.Sf().boundaryField()[patchi] - /( - mesh.magSf().boundaryField()[patchi] - *mesh.deltaCoeffs().boundaryField()[patchi] - ); + / ( + mesh.magSf().boundaryField()[patchi] + * mesh.deltaCoeffs().boundaryField()[patchi] + ) + ); if (!mesh.orthogonal()) { @@ -138,8 +140,10 @@ Foam::fv::fourthGrad<Type>::calcGrad const labelUList& faceCells = fGrad.boundaryField()[patchi].patch().faceCells(); - Field<GradType> neighbourSecondfGrad = - secondfGrad.boundaryField()[patchi].patchNeighbourField(); + const Field<GradType> neighbourSecondfGrad + ( + secondfGrad.boundaryField()[patchi].patchNeighbourField() + ); forAll(faceCells, patchFaceI) { diff --git a/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.C b/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.C index 562285d2d05..17895c1d213 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.C @@ -154,9 +154,11 @@ void Foam::fv::gaussGrad<Type>::correctBoundaryConditions { if (!vsf.boundaryField()[patchi].coupled()) { - vectorField n = + const vectorField n + ( vsf.mesh().Sf().boundaryField()[patchi] - /vsf.mesh().magSf().boundaryField()[patchi]; + / vsf.mesh().magSf().boundaryField()[patchi] + ); gGrad.boundaryField()[patchi] += n * ( diff --git a/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresGrad.C b/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresGrad.C index 708d578779c..073dda4b978 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresGrad.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresGrad.C @@ -108,8 +108,10 @@ Foam::fv::leastSquaresGrad<Type>::calcGrad if (vsf.boundaryField()[patchi].coupled()) { - Field<Type> neiVsf = - vsf.boundaryField()[patchi].patchNeighbourField(); + const Field<Type> neiVsf + ( + vsf.boundaryField()[patchi].patchNeighbourField() + ); forAll(neiVsf, patchFaceI) { diff --git a/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.C b/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.C index b6735d48347..da750b544ba 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.C @@ -130,12 +130,14 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const const labelUList& faceCells = p.patch().faceCells(); // Build the d-vectors - vectorField pd = + vectorField pd + ( mesh.Sf().boundaryField()[patchi] - /( - mesh.magSf().boundaryField()[patchi] - *mesh.deltaCoeffs().boundaryField()[patchi] - ); + / ( + mesh.magSf().boundaryField()[patchi] + * mesh.deltaCoeffs().boundaryField()[patchi] + ) + ); if (!mesh.orthogonal()) { @@ -167,7 +169,7 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const // Invert the dd tensor - symmTensorField invDd = inv(dd); + const symmTensorField invDd(inv(dd)); // Revisit all faces and calculate the lsP and lsN vectors @@ -194,12 +196,14 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const const labelUList& faceCells = p.faceCells(); // Build the d-vectors - vectorField pd = + vectorField pd + ( mesh.Sf().boundaryField()[patchi] /( mesh.magSf().boundaryField()[patchi] *mesh.deltaCoeffs().boundaryField()[patchi] - ); + ) + ); if (!mesh.orthogonal()) { diff --git a/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/cellLimitedGrad/cellLimitedGrads.C b/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/cellLimitedGrad/cellLimitedGrads.C index 7fa5683a955..6bb5c3b4ef2 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/cellLimitedGrad/cellLimitedGrads.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/cellLimitedGrad/cellLimitedGrads.C @@ -97,7 +97,7 @@ Foam::fv::cellLimitedGrad<Foam::scalar>::calcGrad if (psf.coupled()) { - scalarField psfNei = psf.patchNeighbourField(); + const scalarField psfNei(psf.patchNeighbourField()); forAll(pOwner, pFacei) { @@ -126,7 +126,7 @@ Foam::fv::cellLimitedGrad<Foam::scalar>::calcGrad if (k_ < 1.0) { - scalarField maxMinVsf = (1.0/k_ - 1.0)*(maxVsf - minVsf); + const scalarField maxMinVsf((1.0/k_ - 1.0)*(maxVsf - minVsf)); maxVsf += maxMinVsf; minVsf -= maxMinVsf; @@ -250,7 +250,7 @@ Foam::fv::cellLimitedGrad<Foam::vector>::calcGrad if (psf.coupled()) { - vectorField psfNei = psf.patchNeighbourField(); + const vectorField psfNei(psf.patchNeighbourField()); forAll(pOwner, pFacei) { @@ -279,7 +279,7 @@ Foam::fv::cellLimitedGrad<Foam::vector>::calcGrad if (k_ < 1.0) { - vectorField maxMinVsf = (1.0/k_ - 1.0)*(maxVsf - minVsf); + const vectorField maxMinVsf((1.0/k_ - 1.0)*(maxVsf - minVsf)); maxVsf += maxMinVsf; minVsf -= maxMinVsf; diff --git a/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/cellMDLimitedGrad/cellMDLimitedGrads.C b/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/cellMDLimitedGrad/cellMDLimitedGrads.C index 2a1fa06e64e..0030742069c 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/cellMDLimitedGrad/cellMDLimitedGrads.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/cellMDLimitedGrad/cellMDLimitedGrads.C @@ -98,7 +98,7 @@ Foam::fv::cellMDLimitedGrad<Foam::scalar>::calcGrad if (psf.coupled()) { - scalarField psfNei = psf.patchNeighbourField(); + const scalarField psfNei(psf.patchNeighbourField()); forAll(pOwner, pFacei) { @@ -127,7 +127,7 @@ Foam::fv::cellMDLimitedGrad<Foam::scalar>::calcGrad if (k_ < 1.0) { - scalarField maxMinVsf = (1.0/k_ - 1.0)*(maxVsf - minVsf); + const scalarField maxMinVsf((1.0/k_ - 1.0)*(maxVsf - minVsf)); maxVsf += maxMinVsf; minVsf -= maxMinVsf; @@ -240,7 +240,7 @@ Foam::fv::cellMDLimitedGrad<Foam::vector>::calcGrad if (psf.coupled()) { - vectorField psfNei = psf.patchNeighbourField(); + const vectorField psfNei(psf.patchNeighbourField()); forAll(pOwner, pFacei) { @@ -269,7 +269,7 @@ Foam::fv::cellMDLimitedGrad<Foam::vector>::calcGrad if (k_ < 1.0) { - vectorField maxMinVsf = (1.0/k_ - 1.0)*(maxVsf - minVsf); + const vectorField maxMinVsf((1.0/k_ - 1.0)*(maxVsf - minVsf)); maxVsf += maxMinVsf; minVsf -= maxMinVsf; diff --git a/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/faceLimitedGrad/faceLimitedGrads.C b/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/faceLimitedGrad/faceLimitedGrads.C index febc19eb17d..e1f3e5cab14 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/faceLimitedGrad/faceLimitedGrads.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/faceLimitedGrad/faceLimitedGrads.C @@ -116,7 +116,7 @@ Foam::fv::faceLimitedGrad<Foam::scalar>::calcGrad if (psf.coupled()) { - scalarField psfNei = psf.patchNeighbourField(); + const scalarField psfNei(psf.patchNeighbourField()); forAll(pOwner, pFacei) { @@ -267,7 +267,7 @@ Foam::fv::faceLimitedGrad<Foam::vector>::calcGrad if (psf.coupled()) { - vectorField psfNei = psf.patchNeighbourField(); + const vectorField psfNei(psf.patchNeighbourField()); forAll(pOwner, pFacei) { diff --git a/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/faceMDLimitedGrad/faceMDLimitedGrads.C b/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/faceMDLimitedGrad/faceMDLimitedGrads.C index 906324e0ebd..ba3c9528a9d 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/faceMDLimitedGrad/faceMDLimitedGrads.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/faceMDLimitedGrad/faceMDLimitedGrads.C @@ -119,7 +119,7 @@ Foam::fv::faceMDLimitedGrad<Foam::scalar>::calcGrad if (psf.coupled()) { - scalarField psfNei = psf.patchNeighbourField(); + const scalarField psfNei(psf.patchNeighbourField()); forAll(pOwner, pFacei) { @@ -261,7 +261,7 @@ Foam::fv::faceMDLimitedGrad<Foam::vector>::calcGrad if (psf.coupled()) { - vectorField psfNei = psf.patchNeighbourField(); + const vectorField psfNei(psf.patchNeighbourField()); forAll(pOwner, pFacei) { diff --git a/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianScheme.C b/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianScheme.C index f9a49efdaf6..9d49f1f3aed 100644 --- a/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianScheme.C +++ b/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianScheme.C @@ -153,11 +153,14 @@ gaussLaplacianScheme<Type, GType>::fvmLaplacian { const fvMesh& mesh = this->mesh(); - surfaceVectorField Sn = mesh.Sf()/mesh.magSf(); + const surfaceVectorField Sn(mesh.Sf()/mesh.magSf()); - surfaceVectorField SfGamma = mesh.Sf() & gamma; - GeometricField<scalar, fvsPatchField, surfaceMesh> SfGammaSn = SfGamma & Sn; - surfaceVectorField SfGammaCorr = SfGamma - SfGammaSn*Sn; + const surfaceVectorField SfGamma(mesh.Sf() & gamma); + const GeometricField<scalar, fvsPatchField, surfaceMesh> SfGammaSn + ( + SfGamma & Sn + ); + const surfaceVectorField SfGammaCorr(SfGamma - SfGammaSn*Sn); tmp<fvMatrix<Type> > tfvm = fvmLaplacianUncorrected(SfGammaSn, vf); fvMatrix<Type>& fvm = tfvm(); @@ -192,11 +195,13 @@ gaussLaplacianScheme<Type, GType>::fvcLaplacian { const fvMesh& mesh = this->mesh(); - surfaceVectorField Sn = mesh.Sf()/mesh.magSf(); - - surfaceVectorField SfGamma = mesh.Sf() & gamma; - GeometricField<scalar, fvsPatchField, surfaceMesh> SfGammaSn = SfGamma & Sn; - surfaceVectorField SfGammaCorr = SfGamma - SfGammaSn*Sn; + const surfaceVectorField Sn(mesh.Sf()/mesh.magSf()); + const surfaceVectorField SfGamma(mesh.Sf() & gamma); + const GeometricField<scalar, fvsPatchField, surfaceMesh> SfGammaSn + ( + SfGamma & Sn + ); + const surfaceVectorField SfGammaCorr(SfGamma - SfGammaSn*Sn); tmp<GeometricField<Type, fvPatchField, volMesh> > tLaplacian ( diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/limitedSnGrad/limitedSnGrad.C b/src/finiteVolume/finiteVolume/snGradSchemes/limitedSnGrad/limitedSnGrad.C index 2ae13959924..8107d88226e 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/limitedSnGrad/limitedSnGrad.C +++ b/src/finiteVolume/finiteVolume/snGradSchemes/limitedSnGrad/limitedSnGrad.C @@ -66,10 +66,12 @@ limitedSnGrad<Type>::correction const GeometricField<Type, fvPatchField, volMesh>& vf ) const { - GeometricField<Type, fvsPatchField, surfaceMesh> corr = - correctedSnGrad<Type>(this->mesh()).correction(vf); + const GeometricField<Type, fvsPatchField, surfaceMesh> corr + ( + correctedSnGrad<Type>(this->mesh()).correction(vf) + ); - surfaceScalarField limiter + const surfaceScalarField limiter ( min ( -- GitLab