GeometricField: New non-const access function boundaryFieldRef()
There is a need to specify const or non-const access to a non-const object which is not currently possible with the "boundaryField()" access function the const-ness of the return of which is defined by the const-ness of the object for which it is called. For consistency with the latest "tmp" storage class in which non-const access is obtained with the "ref()" function it is proposed to replace the non-const form of "boundaryField()" with "boundaryFieldRef()". Thanks to Mattijs Janssens for starting the process of migration to "boundaryFieldRef()" and providing a patch for the OpenFOAM and finiteVolume libraries.
This commit is contained in:
@ -313,7 +313,7 @@ Foam::fvMatrix<Type>::fvMatrix
|
||||
const_cast<GeometricField<Type, fvPatchField, volMesh>&>(psi_);
|
||||
|
||||
label currentStatePsi = psiRef.eventNo();
|
||||
psiRef.boundaryField().updateCoeffs();
|
||||
psiRef.boundaryFieldRef().updateCoeffs();
|
||||
psiRef.eventNo() = currentStatePsi;
|
||||
}
|
||||
|
||||
@ -928,10 +928,12 @@ flux() const
|
||||
}
|
||||
}
|
||||
|
||||
forAll(fieldFlux.boundaryField(), patchI)
|
||||
typename GeometricField<Type, fvsPatchField, surfaceMesh>::
|
||||
GeometricBoundaryField& ffbf = fieldFlux.boundaryFieldRef();
|
||||
|
||||
forAll(ffbf, patchI)
|
||||
{
|
||||
fieldFlux.boundaryField()[patchI] =
|
||||
InternalContrib[patchI] - NeighbourContrib[patchI];
|
||||
ffbf[patchI] = InternalContrib[patchI] - NeighbourContrib[patchI];
|
||||
}
|
||||
|
||||
if (faceFluxCorrectionPtr_)
|
||||
|
||||
Reference in New Issue
Block a user