From 7c12f7743b3fa762fac3f0007429f9f247805306 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Sat, 23 Apr 2016 23:16:30 +0100 Subject: [PATCH] boundaryField() -> boundaryFieldRef() --- .../consumptionSpeed/consumptionSpeed.C | 2 +- .../dynamicRefineFvMesh/dynamicRefineFvMesh.C | 16 ++--- .../fvMeshAdder/fvMeshAdderTemplates.C | 4 +- .../fvMeshDistributeTemplates.C | 4 +- .../fvMeshTools/fvMeshToolsTemplates.C | 12 ++-- .../motionSmoother/motionSmootherAlgo.C | 70 ++++++++++--------- .../fvMotionSolverEngineMesh.C | 7 +- .../cfdTools/general/adjustPhi/adjustPhi.C | 2 +- ...lacementComponentLaplacianFvMotionSolver.C | 2 +- ...velocityComponentLaplacianFvMotionSolver.C | 2 +- .../displacementSBRStressFvMotionSolver.C | 2 +- .../displacementLaplacianFvMotionSolver.C | 2 +- .../displacementLayeredMotionMotionSolver.C | 2 +- .../velocityLaplacianFvMotionSolver.C | 2 +- .../inverseFaceDistanceDiffusivity.C | 9 ++- .../inversePointDistanceDiffusivity.C | 10 ++- .../limitTemperature/limitTemperature.C | 4 +- .../ParticleErosion/ParticleErosion.C | 4 +- .../LocalInteraction/LocalInteraction.C | 4 +- .../displacementMeshMoverMotionSolver.C | 2 +- .../meshRefinement/meshRefinementTemplates.C | 16 ++--- .../snappyHexMeshDriver/snappyLayerDriver.C | 20 +++++- .../nearWallFields/nearWallFieldsTemplates.C | 7 +- .../utilities/dsmcFields/dsmcFields.C | 6 +- .../wallShearStress/wallShearStress.C | 28 ++++---- .../utilities/yPlus/yPlusTemplates.C | 13 ++-- 26 files changed, 142 insertions(+), 110 deletions(-) diff --git a/src/combustionModels/FSD/reactionRateFlameAreaModels/consumptionSpeed/consumptionSpeed.C b/src/combustionModels/FSD/reactionRateFlameAreaModels/consumptionSpeed/consumptionSpeed.C index 1aa0e0ae83..bd4a6505cd 100644 --- a/src/combustionModels/FSD/reactionRateFlameAreaModels/consumptionSpeed/consumptionSpeed.C +++ b/src/combustionModels/FSD/reactionRateFlameAreaModels/consumptionSpeed/consumptionSpeed.C @@ -111,7 +111,7 @@ Foam::tmp Foam::consumptionSpeed::omega0Sigma iomega0[celli] = omega0Sigma(sigma[celli], 1.0); } - volScalarField::GeometricBoundaryField& bomega0 = omega0.boundaryField(); + volScalarField::GeometricBoundaryField& bomega0 = omega0.boundaryFieldRef(); forAll(bomega0, patchi) { diff --git a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C index 35979a147e..3446cedd5e 100644 --- a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C +++ b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C @@ -384,11 +384,11 @@ Foam::dynamicRefineFvMesh::refine } // Recalculate new boundary faces. - surfaceScalarField::GeometricBoundaryField& bphi = - phi.boundaryField(); - forAll(bphi, patchI) + surfaceScalarField::GeometricBoundaryField& phiBf = + phi.boundaryFieldRef(); + forAll(phiBf, patchI) { - fvsPatchScalarField& patchPhi = bphi[patchI]; + fvsPatchScalarField& patchPhi = phiBf[patchI]; const fvsPatchScalarField& patchPhiU = phiU.boundaryField()[patchI]; @@ -430,7 +430,7 @@ Foam::dynamicRefineFvMesh::refine const fvsPatchScalarField& patchPhiU = phiU.boundaryField()[patchI]; - fvsPatchScalarField& patchPhi = bphi[patchI]; + fvsPatchScalarField& patchPhi = phiBf[patchI]; patchPhi[i] = patchPhiU[i]; } @@ -574,8 +574,8 @@ Foam::dynamicRefineFvMesh::unrefine } surfaceScalarField& phi = *iter(); - surfaceScalarField::GeometricBoundaryField& bphi = - phi.boundaryField(); + surfaceScalarField::GeometricBoundaryField& phiBf = + phi.boundaryFieldRef(); const surfaceScalarField phiU ( @@ -610,7 +610,7 @@ Foam::dynamicRefineFvMesh::unrefine const fvsPatchScalarField& patchPhiU = phiU.boundaryField()[patchI]; - fvsPatchScalarField& patchPhi = bphi[patchI]; + fvsPatchScalarField& patchPhi = phiBf[patchI]; patchPhi[i] = patchPhiU[i]; } } diff --git a/src/dynamicMesh/fvMeshAdder/fvMeshAdderTemplates.C b/src/dynamicMesh/fvMeshAdder/fvMeshAdderTemplates.C index c85d79793f..a9cdcc02c6 100644 --- a/src/dynamicMesh/fvMeshAdder/fvMeshAdderTemplates.C +++ b/src/dynamicMesh/fvMeshAdder/fvMeshAdderTemplates.C @@ -62,7 +62,7 @@ void Foam::fvMeshAdder::MapVolField // ~~~~~~~~~~~~~~~~~~~~~~~~~~ typename GeometricField:: - GeometricBoundaryField& bfld = fld.boundaryField(); + GeometricBoundaryField& bfld = fld.boundaryFieldRef(); { const labelList& oldPatchMap = meshMap.oldPatchMap(); @@ -330,7 +330,7 @@ void Foam::fvMeshAdder::MapSurfaceField const labelList& oldPatchStarts = meshMap.oldPatchStarts(); typename GeometricField:: - GeometricBoundaryField& bfld = fld.boundaryField(); + GeometricBoundaryField& bfld = fld.boundaryFieldRef(); // Internal field // ~~~~~~~~~~~~~~ diff --git a/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C b/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C index 5ccf6d8b56..87b87d0ee8 100644 --- a/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C +++ b/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C @@ -114,7 +114,7 @@ void Foam::fvMeshDistribute::mapBoundaryFields { fldType& fld = *iter(); typename fldType::GeometricBoundaryField& bfld = - fld.boundaryField(); + fld.boundaryFieldRef(); const FieldField& oldBfld = oldBflds[fieldI++]; @@ -162,7 +162,7 @@ void Foam::fvMeshDistribute::initPatchFields GeoField& fld = *iter(); typename GeoField::GeometricBoundaryField& bfld = - fld.boundaryField(); + fld.boundaryFieldRef(); forAll(bfld, patchI) { diff --git a/src/dynamicMesh/fvMeshTools/fvMeshToolsTemplates.C b/src/dynamicMesh/fvMeshTools/fvMeshToolsTemplates.C index 424fc29b3c..fa033a357a 100644 --- a/src/dynamicMesh/fvMeshTools/fvMeshToolsTemplates.C +++ b/src/dynamicMesh/fvMeshTools/fvMeshToolsTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -48,7 +48,7 @@ void Foam::fvMeshTools::addPatchFields GeoField& fld = *iter(); typename GeoField::GeometricBoundaryField& bfld = - fld.boundaryField(); + fld.boundaryFieldRef(); label sz = bfld.size(); bfld.setSize(sz+1); @@ -102,7 +102,7 @@ void Foam::fvMeshTools::setPatchFields GeoField& fld = *iter(); typename GeoField::GeometricBoundaryField& bfld = - fld.boundaryField(); + fld.boundaryFieldRef(); if (patchFieldDict.found(fld.name())) { @@ -141,7 +141,7 @@ void Foam::fvMeshTools::setPatchFields GeoField& fld = *iter(); typename GeoField::GeometricBoundaryField& bfld = - fld.boundaryField(); + fld.boundaryFieldRef(); bfld[patchI] == value; } @@ -160,7 +160,7 @@ void Foam::fvMeshTools::trimPatchFields(fvMesh& mesh, const label nPatches) forAllIter(typename HashTable, flds, iter) { GeoField& fld = *iter(); - fld.boundaryField().setSize(nPatches); + fld.boundaryFieldRef().setSize(nPatches); } } @@ -183,7 +183,7 @@ void Foam::fvMeshTools::reorderPatchFields GeoField& fld = *iter(); typename GeoField::GeometricBoundaryField& bfld = - fld.boundaryField(); + fld.boundaryFieldRef(); bfld.reorder(oldToNew); } diff --git a/src/dynamicMesh/motionSmoother/motionSmootherAlgo.C b/src/dynamicMesh/motionSmoother/motionSmootherAlgo.C index 384663939e..2515a5cc8d 100644 --- a/src/dynamicMesh/motionSmoother/motionSmootherAlgo.C +++ b/src/dynamicMesh/motionSmoother/motionSmootherAlgo.C @@ -428,14 +428,17 @@ void Foam::motionSmootherAlgo::setDisplacementPatchFields pointVectorField& displacement ) { + typename pointVectorField::GeometricBoundaryField& displacementBf = + displacement.boundaryFieldRef(); + // Adapt the fixedValue bc's (i.e. copy internal point data to // boundaryField for all affected patches) forAll(patchIDs, i) { - label patchI = patchIDs[i]; + label patchi = patchIDs[i]; - displacement.boundaryField()[patchI] == - displacement.boundaryField()[patchI].patchInternalField(); + displacementBf[patchi] == + displacementBf[patchi].patchInternalField(); } // Make consistent with non-adapted bc's by evaluating those now and @@ -449,18 +452,18 @@ void Foam::motionSmootherAlgo::setDisplacementPatchFields forAll(patchSchedule, patchEvalI) { - label patchI = patchSchedule[patchEvalI].patch; + label patchi = patchSchedule[patchEvalI].patch; - if (!adaptPatchSet.found(patchI)) + if (!adaptPatchSet.found(patchi)) { if (patchSchedule[patchEvalI].init) { - displacement.boundaryField()[patchI] + displacementBf[patchi] .initEvaluate(Pstream::scheduled); } else { - displacement.boundaryField()[patchI] + displacementBf[patchi] .evaluate(Pstream::scheduled); } } @@ -474,10 +477,10 @@ void Foam::motionSmootherAlgo::setDisplacementPatchFields // by multi-corner constraints into account. forAll(patchIDs, i) { - label patchI = patchIDs[i]; + label patchi = patchIDs[i]; - displacement.boundaryField()[patchI] == - displacement.boundaryField()[patchI].patchInternalField(); + displacementBf[patchi] == + displacementBf[patchi].patchInternalField(); } } @@ -581,21 +584,24 @@ void Foam::motionSmootherAlgo::correctBoundaryConditions const lduSchedule& patchSchedule = mesh_.globalData().patchSchedule(); + typename pointVectorField::GeometricBoundaryField& displacementBf = + displacement.boundaryFieldRef(); + // 1. evaluate on adaptPatches forAll(patchSchedule, patchEvalI) { - label patchI = patchSchedule[patchEvalI].patch; + label patchi = patchSchedule[patchEvalI].patch; - if (adaptPatchSet.found(patchI)) + if (adaptPatchSet.found(patchi)) { if (patchSchedule[patchEvalI].init) { - displacement.boundaryField()[patchI] + displacementBf[patchi] .initEvaluate(Pstream::blocking); } else { - displacement.boundaryField()[patchI] + displacementBf[patchi] .evaluate(Pstream::blocking); } } @@ -605,18 +611,18 @@ void Foam::motionSmootherAlgo::correctBoundaryConditions // 2. evaluate on non-AdaptPatches forAll(patchSchedule, patchEvalI) { - label patchI = patchSchedule[patchEvalI].patch; + label patchi = patchSchedule[patchEvalI].patch; - if (!adaptPatchSet.found(patchI)) + if (!adaptPatchSet.found(patchi)) { if (patchSchedule[patchEvalI].init) { - displacement.boundaryField()[patchI] + displacementBf[patchi] .initEvaluate(Pstream::blocking); } else { - displacement.boundaryField()[patchI] + displacementBf[patchi] .evaluate(Pstream::blocking); } } @@ -757,9 +763,9 @@ Foam::tmp Foam::motionSmootherAlgo::curPoints() const { const pointBoundaryMesh& pbm = displacement_.mesh().boundary(); actualPatchTypes.setSize(pbm.size()); - forAll(pbm, patchI) + forAll(pbm, patchi) { - actualPatchTypes[patchI] = pbm[patchI].type(); + actualPatchTypes[patchi] = pbm[patchi].type(); } } @@ -768,17 +774,17 @@ Foam::tmp Foam::motionSmootherAlgo::curPoints() const const pointVectorField::GeometricBoundaryField& pfld = displacement_.boundaryField(); actualPatchFieldTypes.setSize(pfld.size()); - forAll(pfld, patchI) + forAll(pfld, patchi) { - if (isA>(pfld[patchI])) + if (isA>(pfld[patchi])) { // Get rid of funny - actualPatchFieldTypes[patchI] = + actualPatchFieldTypes[patchi] = fixedValuePointPatchField::typeName; } else { - actualPatchFieldTypes[patchI] = pfld[patchI].type(); + actualPatchFieldTypes[patchi] = pfld[patchi].type(); } } } @@ -847,14 +853,14 @@ bool Foam::motionSmootherAlgo::scaleMesh const polyBoundaryMesh& patches = mesh_.boundaryMesh(); Pout<< "Entering scaleMesh : coupled patches:" << endl; - forAll(patches, patchI) + forAll(patches, patchi) { - if (patches[patchI].coupled()) + if (patches[patchi].coupled()) { const coupledPolyPatch& pp = - refCast(patches[patchI]); + refCast(patches[patchi]); - Pout<< '\t' << patchI << '\t' << pp.name() + Pout<< '\t' << patchi << '\t' << pp.name() << " parallel:" << pp.parallel() << " separated:" << pp.separated() << " forwardT:" << pp.forwardT().size() @@ -1034,20 +1040,20 @@ void Foam::motionSmootherAlgo::updateMesh() // Check whether displacement has fixed value b.c. on adaptPatchID forAll(adaptPatchIDs_, i) { - label patchI = adaptPatchIDs_[i]; + label patchi = adaptPatchIDs_[i]; if ( !isA ( - displacement_.boundaryField()[patchI] + displacement_.boundaryField()[patchi] ) ) { FatalErrorInFunction - << "Patch " << patches[patchI].name() + << "Patch " << patches[patchi].name() << " has wrong boundary condition " - << displacement_.boundaryField()[patchI].type() + << displacement_.boundaryField()[patchi].type() << " on field " << displacement_.name() << nl << "Only type allowed is " << fixedValuePointPatchVectorField::typeName diff --git a/src/engine/engineMesh/fvMotionSolverEngineMesh/fvMotionSolverEngineMesh.C b/src/engine/engineMesh/fvMotionSolverEngineMesh/fvMotionSolverEngineMesh.C index 507fc66e1b..2238fe09df 100644 --- a/src/engine/engineMesh/fvMotionSolverEngineMesh/fvMotionSolverEngineMesh.C +++ b/src/engine/engineMesh/fvMotionSolverEngineMesh/fvMotionSolverEngineMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -71,7 +71,8 @@ void Foam::fvMotionSolverEngineMesh::move() scalar pistonSpeed = deltaZ/engineDB_.deltaTValue(); - motionSolver_.pointMotionU().boundaryField()[pistonIndex_] == pistonSpeed; + motionSolver_.pointMotionU().boundaryFieldRef()[pistonIndex_] == + pistonSpeed; { scalarField linerPoints @@ -79,7 +80,7 @@ void Foam::fvMotionSolverEngineMesh::move() boundary()[linerIndex_].patch().localPoints().component(vector::Z) ); - motionSolver_.pointMotionU().boundaryField()[linerIndex_] == + motionSolver_.pointMotionU().boundaryFieldRef()[linerIndex_] == pistonSpeed*pos(deckHeight_.value() - linerPoints) *(deckHeight_.value() - linerPoints) /(deckHeight_.value() - pistonPlusLayers); diff --git a/src/finiteVolume/cfdTools/general/adjustPhi/adjustPhi.C b/src/finiteVolume/cfdTools/general/adjustPhi/adjustPhi.C index c34239a4c3..20aab55e3b 100644 --- a/src/finiteVolume/cfdTools/general/adjustPhi/adjustPhi.C +++ b/src/finiteVolume/cfdTools/general/adjustPhi/adjustPhi.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/fvMotionSolver/fvMotionSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.C index fe9ac195c7..396ef6f902 100644 --- a/src/fvMotionSolver/fvMotionSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.C @@ -223,7 +223,7 @@ void Foam::displacementComponentLaplacianFvMotionSolver::solve() movePoints(fvMesh_.points()); diffusivityPtr_->correct(); - pointDisplacement_.boundaryField().updateCoeffs(); + pointDisplacement_.boundaryFieldRef().updateCoeffs(); Foam::solve ( diff --git a/src/fvMotionSolver/fvMotionSolvers/componentVelocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/componentVelocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.C index bb40c74881..e4df765084 100644 --- a/src/fvMotionSolver/fvMotionSolvers/componentVelocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/componentVelocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.C @@ -121,7 +121,7 @@ void Foam::velocityComponentLaplacianFvMotionSolver::solve() movePoints(fvMesh_.points()); diffusivityPtr_->correct(); - pointMotionU_.boundaryField().updateCoeffs(); + pointMotionU_.boundaryFieldRef().updateCoeffs(); Foam::solve ( diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.C index 42ddced8ee..9da8e59836 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.C @@ -121,7 +121,7 @@ void Foam::displacementSBRStressFvMotionSolver::solve() movePoints(fvMesh_.points()); diffusivityPtr_->correct(); - pointDisplacement_.boundaryField().updateCoeffs(); + pointDisplacement_.boundaryFieldRef().updateCoeffs(); surfaceScalarField Df(diffusivityPtr_->operator()()); diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C index 71fc5e1aa7..617193e0fa 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C @@ -227,7 +227,7 @@ void Foam::displacementLaplacianFvMotionSolver::solve() movePoints(fvMesh_.points()); diffusivity().correct(); - pointDisplacement_.boundaryField().updateCoeffs(); + pointDisplacement_.boundaryFieldRef().updateCoeffs(); Foam::solve ( diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C index fa29dff619..4577df756a 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C @@ -525,7 +525,7 @@ void Foam::displacementLayeredMotionMotionSolver::solve() movePoints(mesh().points()); // Apply boundary conditions - pointDisplacement_.boundaryField().updateCoeffs(); + pointDisplacement_.boundaryFieldRef().updateCoeffs(); // Solve motion on all regions (=cellZones) const dictionary& regionDicts = coeffDict().subDict("regions"); diff --git a/src/fvMotionSolver/fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.C index ccf29e4221..6d7c00a259 100644 --- a/src/fvMotionSolver/fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.C @@ -116,7 +116,7 @@ void Foam::velocityLaplacianFvMotionSolver::solve() movePoints(fvMesh_.points()); diffusivityPtr_->correct(); - pointMotionU_.boundaryField().updateCoeffs(); + pointMotionU_.boundaryFieldRef().updateCoeffs(); Foam::solve ( diff --git a/src/fvMotionSolver/motionDiffusivity/inverseFaceDistance/inverseFaceDistanceDiffusivity.C b/src/fvMotionSolver/motionDiffusivity/inverseFaceDistance/inverseFaceDistanceDiffusivity.C index a288667998..95cd856f99 100644 --- a/src/fvMotionSolver/motionDiffusivity/inverseFaceDistance/inverseFaceDistanceDiffusivity.C +++ b/src/fvMotionSolver/motionDiffusivity/inverseFaceDistance/inverseFaceDistanceDiffusivity.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -127,9 +127,12 @@ void Foam::inverseFaceDistanceDiffusivity::correct() faceDiffusivity_[faceI] = 1.0/sqrt(dist); } - forAll(faceDiffusivity_.boundaryField(), patchI) + typename surfaceScalarField::GeometricBoundaryField& faceDiffusivityBf = + faceDiffusivity_.boundaryFieldRef(); + + forAll(faceDiffusivityBf, patchI) { - fvsPatchScalarField& bfld = faceDiffusivity_.boundaryField()[patchI]; + fvsPatchScalarField& bfld = faceDiffusivityBf[patchI]; const labelUList& faceCells = bfld.patch().faceCells(); diff --git a/src/fvMotionSolver/motionDiffusivity/inversePointDistance/inversePointDistanceDiffusivity.C b/src/fvMotionSolver/motionDiffusivity/inversePointDistance/inversePointDistanceDiffusivity.C index de8a3fd273..920fa5c22d 100644 --- a/src/fvMotionSolver/motionDiffusivity/inversePointDistance/inversePointDistanceDiffusivity.C +++ b/src/fvMotionSolver/motionDiffusivity/inversePointDistance/inversePointDistanceDiffusivity.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -152,9 +152,13 @@ void Foam::inversePointDistanceDiffusivity::correct() faceDiffusivity_[faceI] = 1.0/dist; } - forAll(faceDiffusivity_.boundaryField(), patchI) + + typename surfaceScalarField::GeometricBoundaryField& faceDiffusivityBf = + faceDiffusivity_.boundaryFieldRef(); + + forAll(faceDiffusivityBf, patchI) { - fvsPatchScalarField& bfld = faceDiffusivity_.boundaryField()[patchI]; + fvsPatchScalarField& bfld = faceDiffusivityBf[patchI]; if (patchSet.found(patchI)) { diff --git a/src/fvOptions/corrections/limitTemperature/limitTemperature.C b/src/fvOptions/corrections/limitTemperature/limitTemperature.C index 033f2f4f69..d2f5530c6f 100644 --- a/src/fvOptions/corrections/limitTemperature/limitTemperature.C +++ b/src/fvOptions/corrections/limitTemperature/limitTemperature.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -95,7 +95,7 @@ void Foam::fv::limitTemperature::correct(volScalarField& he) // handle boundaries in the case of 'all' if (selectionMode_ == smAll) { - volScalarField::GeometricBoundaryField& bf = he.boundaryField(); + volScalarField::GeometricBoundaryField& bf = he.boundaryFieldRef(); forAll(bf, patchi) { diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleErosion/ParticleErosion.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleErosion/ParticleErosion.C index d4d90fbf6e..db12655987 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleErosion/ParticleErosion.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleErosion/ParticleErosion.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -197,7 +197,7 @@ void Foam::ParticleErosion::postPatch const scalar coeff = p.nParticle()*p.mass()*sqr(magU)/(p_*psi_*K_); const label patchFaceI = pp.whichFace(p.face()); - scalar& Q = QPtr_->boundaryField()[patchI][patchFaceI]; + scalar& Q = QPtr_->boundaryFieldRef()[patchI][patchFaceI]; if (tan(alpha) < K_/6.0) { Q += coeff*(sin(2.0*alpha) - 6.0/K_*sqr(sin(alpha))); diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C index 6bd49e57ac..ed94b26bd4 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C @@ -204,7 +204,7 @@ bool Foam::LocalInteraction::correct { label pI = pp.index(); label fI = pp.whichFace(p.face()); - massEscape().boundaryField()[pI][fI] += dm; + massEscape().boundaryFieldRef()[pI][fI] += dm; } break; } @@ -221,7 +221,7 @@ bool Foam::LocalInteraction::correct { label pI = pp.index(); label fI = pp.whichFace(p.face()); - massStick().boundaryField()[pI][fI] += dm; + massStick().boundaryFieldRef()[pI][fI] += dm; } break; } diff --git a/src/mesh/snappyHexMesh/externalDisplacementMeshMover/displacementMeshMoverMotionSolver.C b/src/mesh/snappyHexMesh/externalDisplacementMeshMover/displacementMeshMoverMotionSolver.C index 1c90909ebe..33d535e9a4 100644 --- a/src/mesh/snappyHexMesh/externalDisplacementMeshMover/displacementMeshMoverMotionSolver.C +++ b/src/mesh/snappyHexMesh/externalDisplacementMeshMover/displacementMeshMoverMotionSolver.C @@ -102,7 +102,7 @@ void Foam::displacementMeshMoverMotionSolver::solve() movePoints(mesh().points()); // Update any point motion bcs (e.g. timevarying) - pointDisplacement().boundaryField().updateCoeffs(); + pointDisplacement().boundaryFieldRef().updateCoeffs(); label nAllowableErrors = 0; labelList checkFaces(identity(mesh().nFaces())); diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementTemplates.C b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementTemplates.C index 12a1011e87..f4a9adbc71 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementTemplates.C +++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementTemplates.C @@ -199,7 +199,6 @@ void Foam::meshRefinement::collectAndPrint } -//template template void Foam::meshRefinement::addPatchFields ( @@ -215,11 +214,12 @@ void Foam::meshRefinement::addPatchFields forAllIter(typename HashTable, flds, iter) { GeoField& fld = *iter(); - typename GeoField::GeometricBoundaryField& bfld = fld.boundaryField(); + typename GeoField::GeometricBoundaryField& fldBf = + fld.boundaryFieldRef(); - label sz = bfld.size(); - bfld.setSize(sz+1); - bfld.set + label sz = fldBf.size(); + fldBf.setSize(sz+1); + fldBf.set ( sz, GeoField::PatchFieldType::New @@ -233,7 +233,6 @@ void Foam::meshRefinement::addPatchFields } -// Reorder patch field template void Foam::meshRefinement::reorderPatchFields ( @@ -248,10 +247,7 @@ void Foam::meshRefinement::reorderPatchFields forAllIter(typename HashTable, flds, iter) { - GeoField& fld = *iter(); - typename GeoField::GeometricBoundaryField& bfld = fld.boundaryField(); - - bfld.reorder(oldToNew); + iter()->boundaryFieldRef().reorder(oldToNew); } } diff --git a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyLayerDriver.C b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyLayerDriver.C index 08aaa80cf9..9d4c1d997e 100644 --- a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyLayerDriver.C +++ b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyLayerDriver.C @@ -2657,6 +2657,10 @@ bool Foam::snappyLayerDriver::writeLayerData fixedValueFvPatchScalarField::typeName ); const polyBoundaryMesh& pbm = mesh.boundaryMesh(); + + typename volScalarField::GeometricBoundaryField& fldBf = + fld.boundaryFieldRef(); + forAll(patchIDs, i) { label patchI = patchIDs[i]; @@ -2667,7 +2671,7 @@ bool Foam::snappyLayerDriver::writeLayerData { pfld[i] = cellNLayers[faceCells[i]]; } - fld.boundaryField()[patchI] == pfld; + fldBf[patchI] == pfld; } Info<< indent << fld.name() << " : actual number of layers" << endl; @@ -2690,11 +2694,16 @@ bool Foam::snappyLayerDriver::writeLayerData dimensionedScalar("zero", dimless, 0), fixedValueFvPatchScalarField::typeName ); + const polyBoundaryMesh& pbm = mesh.boundaryMesh(); + + typename volScalarField::GeometricBoundaryField& fldBf = + fld.boundaryFieldRef(); + forAll(patchIDs, i) { label patchI = patchIDs[i]; - fld.boundaryField()[patchI] == pbm[patchI].patchSlice + fldBf[patchI] == pbm[patchI].patchSlice ( faceRealThickness ); @@ -2720,7 +2729,12 @@ bool Foam::snappyLayerDriver::writeLayerData dimensionedScalar("zero", dimless, 0), fixedValueFvPatchScalarField::typeName ); + const polyBoundaryMesh& pbm = mesh.boundaryMesh(); + + typename volScalarField::GeometricBoundaryField& fldBf = + fld.boundaryFieldRef(); + forAll(patchIDs, i) { label patchI = patchIDs[i]; @@ -2744,7 +2758,7 @@ bool Foam::snappyLayerDriver::writeLayerData } } - fld.boundaryField()[patchI] == pfld; + fldBf[patchI] == pfld; } Info<< indent << fld.name() << " : overall layer thickness (fraction" diff --git a/src/postProcessing/functionObjects/field/nearWallFields/nearWallFieldsTemplates.C b/src/postProcessing/functionObjects/field/nearWallFields/nearWallFieldsTemplates.C index c01104a8e4..ae619bcece 100644 --- a/src/postProcessing/functionObjects/field/nearWallFields/nearWallFieldsTemplates.C +++ b/src/postProcessing/functionObjects/field/nearWallFields/nearWallFieldsTemplates.C @@ -99,13 +99,16 @@ void Foam::nearWallFields::sampleBoundaryField sampledValues ); + typename GeometricField:: + GeometricBoundaryField& fldBf = fld.boundaryFieldRef(); + // Pick up data label nPatchFaces = 0; forAllConstIter(labelHashSet, patchSet_, iter) { - label patchI = iter.key(); + label patchi = iter.key(); - fvPatchField& pfld = fld.boundaryField()[patchI]; + fvPatchField& pfld = fldBf[patchi]; Field newFld(pfld.size()); forAll(pfld, i) diff --git a/src/postProcessing/functionObjects/utilities/dsmcFields/dsmcFields.C b/src/postProcessing/functionObjects/utilities/dsmcFields/dsmcFields.C index 121a9af230..1accf88db5 100644 --- a/src/postProcessing/functionObjects/utilities/dsmcFields/dsmcFields.C +++ b/src/postProcessing/functionObjects/utilities/dsmcFields/dsmcFields.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -223,13 +223,15 @@ void Foam::dsmcFields::write() const fvMesh& mesh = fDMean.mesh(); + volScalarField::GeometricBoundaryField& pBf = p.boundaryFieldRef(); + forAll(mesh.boundaryMesh(), i) { const polyPatch& patch = mesh.boundaryMesh()[i]; if (isA(patch)) { - p.boundaryField()[i] = + pBf[i] = fDMean.boundaryField()[i] & (patch.faceAreas()/mag(patch.faceAreas())); } diff --git a/src/postProcessing/functionObjects/utilities/wallShearStress/wallShearStress.C b/src/postProcessing/functionObjects/utilities/wallShearStress/wallShearStress.C index b8a7bf66d2..ab6bc0e487 100644 --- a/src/postProcessing/functionObjects/utilities/wallShearStress/wallShearStress.C +++ b/src/postProcessing/functionObjects/utilities/wallShearStress/wallShearStress.C @@ -61,13 +61,13 @@ void Foam::wallShearStress::calcShearStress { forAllConstIter(labelHashSet, patchSet_, iter) { - label patchI = iter.key(); - const polyPatch& pp = mesh.boundaryMesh()[patchI]; + label patchi = iter.key(); + const polyPatch& pp = mesh.boundaryMesh()[patchi]; - vectorField& ssp = shearStress.boundaryField()[patchI]; - const vectorField& Sfp = mesh.Sf().boundaryField()[patchI]; - const scalarField& magSfp = mesh.magSf().boundaryField()[patchI]; - const symmTensorField& Reffp = Reff.boundaryField()[patchI]; + vectorField& ssp = shearStress.boundaryFieldRef()[patchi]; + const vectorField& Sfp = mesh.Sf().boundaryField()[patchi]; + const scalarField& magSfp = mesh.magSf().boundaryField()[patchi]; + const symmTensorField& Reffp = Reff.boundaryField()[patchi]; ssp = (-Sfp/magSfp) & Reffp; @@ -175,11 +175,11 @@ void Foam::wallShearStress::read(const dictionary& dict) if (patchSet_.empty()) { - forAll(pbm, patchI) + forAll(pbm, patchi) { - if (isA(pbm[patchI])) + if (isA(pbm[patchi])) { - patchSet_.insert(patchI); + patchSet_.insert(patchi); } } @@ -191,17 +191,17 @@ void Foam::wallShearStress::read(const dictionary& dict) labelHashSet filteredPatchSet; forAllConstIter(labelHashSet, patchSet_, iter) { - label patchI = iter.key(); - if (isA(pbm[patchI])) + label patchi = iter.key(); + if (isA(pbm[patchi])) { - filteredPatchSet.insert(patchI); - Info<< " " << pbm[patchI].name() << endl; + filteredPatchSet.insert(patchi); + Info<< " " << pbm[patchi].name() << endl; } else { WarningInFunction << "Requested wall shear stress on non-wall boundary " - << "type patch: " << pbm[patchI].name() << endl; + << "type patch: " << pbm[patchi].name() << endl; } } diff --git a/src/postProcessing/functionObjects/utilities/yPlus/yPlusTemplates.C b/src/postProcessing/functionObjects/utilities/yPlus/yPlusTemplates.C index ca10f3d781..9f418ccc77 100644 --- a/src/postProcessing/functionObjects/utilities/yPlus/yPlusTemplates.C +++ b/src/postProcessing/functionObjects/utilities/yPlus/yPlusTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -51,6 +51,9 @@ void Foam::yPlus::calcYPlus const fvPatchList& patches = mesh.boundary(); + volScalarField::GeometricBoundaryField& yPlusBf = + yPlus.boundaryFieldRef(); + forAll(patches, patchi) { const fvPatch& patch = patches[patchi]; @@ -63,8 +66,8 @@ void Foam::yPlus::calcYPlus nutBf[patchi] ); - yPlus.boundaryField()[patchi] = nutPf.yPlus(); - const scalarField& yPlusp = yPlus.boundaryField()[patchi]; + yPlusBf[patchi] = nutPf.yPlus(); + const scalarField& yPlusp = yPlusBf[patchi]; const scalar minYplus = gMin(yPlusp); const scalar maxYplus = gMax(yPlusp); @@ -88,14 +91,14 @@ void Foam::yPlus::calcYPlus } else if (isA(patch)) { - yPlus.boundaryField()[patchi] = + yPlusBf[patchi] = d[patchi] *sqrt ( nuEffBf[patchi] *mag(turbulenceModel.U().boundaryField()[patchi].snGrad()) )/nuBf[patchi]; - const scalarField& yPlusp = yPlus.boundaryField()[patchi]; + const scalarField& yPlusp = yPlusBf[patchi]; const scalar minYplus = gMin(yPlusp); const scalar maxYplus = gMax(yPlusp);