From 52fbcd4029aeb8c2de31535307f96d272e3daf24 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Tue, 7 Apr 2015 13:51:12 +0100 Subject: [PATCH] Array access optimisation --- .../cellLimitedGrad/cellLimitedGrads.C | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/cellLimitedGrad/cellLimitedGrads.C b/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/cellLimitedGrad/cellLimitedGrads.C index 9f01e6d19..9d445da36 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/cellLimitedGrad/cellLimitedGrads.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/cellLimitedGrad/cellLimitedGrads.C @@ -411,7 +411,7 @@ tmp > cellLimitedGrad::fvmGrad ) const { // Consider doing a calculateLimiter member function since both fvmGrad and - // grad use almost the same procedure to calculate limiter. VV, 9/June/2014. + // grad use almost the same procedure to calculate limiter. VV, 9/June/2014 const fvMesh& mesh = vsf.mesh(); tmp > tbs = basicGradScheme_().fvmGrad(vsf); @@ -494,9 +494,6 @@ tmp > cellLimitedGrad::fvmGrad scalarField maxMinVsf = (1.0/k_ - 1.0)*(maxVsf - minVsf); maxVsf += maxMinVsf; minVsf -= maxMinVsf; - - //maxVsf *= 1.0/k_; - //minVsf *= 1.0/k_; } @@ -600,6 +597,8 @@ tmp > cellLimitedGrad::fvmGrad const fvPatchScalarField& pf = vsf.boundaryField()[patchI]; const fvPatch& patch = pf.patch(); + const labelList& fc = patch.faceCells(); + if (patch.coupled()) { CoeffField::linearTypeField& pcoupleUpper = @@ -612,9 +611,7 @@ tmp > cellLimitedGrad::fvmGrad forAll(pf, faceI) { - label cellI = patch.faceCells()[faceI]; - - pcoupleUpper[faceI] *= lfIn[cellI]; + pcoupleUpper[faceI] *= lfIn[fc[faceI]]; pcoupleLower[faceI] *= lfNei[faceI]; } }