COMP: finiteArea: dangling reference warning

This commit is contained in:
mattijs 2024-06-18 17:56:45 +01:00 committed by Mark Olesen
parent bbd6219eb2
commit 3f19e9033e
2 changed files with 8 additions and 15 deletions

View File

@ -105,20 +105,13 @@ leastSquaresFaGrad<Type>::calcGrad
{
const faPatchField<Type>& bf = vsf.boundaryField()[patchi];
//const Field<Type>& vsfp =
//(
// bf.coupled()
// ? bf.patchNeighbourField().cref()
// : const_cast<faPatchField<Type>&>(bf)
//);
tmp<Field<Type>> tvsfp(bf);
const tmp<Field<Type>> tvsfp
(
bf.coupled()
? bf.patchNeighbourField()
: bf
);
const Field<Type>& vsfp = tvsfp();
if (bf.coupled())
{
tvsfp = bf.patchNeighbourField();
}
const auto& vsfp = tvsfp();
const faePatchVectorField& ownLsp = ownLs.boundaryField()[patchi];
const labelUList& edgeFaces =

View File

@ -209,8 +209,8 @@ Foam::edgeInterpolationScheme<Type>::interpolate
label size = vf.boundaryField()[pi].patch().size();
label start = vf.boundaryField()[pi].patch().start();
Field<Type> pOwnVf = vf.boundaryField()[pi].patchInternalField();
Field<Type> pNgbVf = vf.boundaryField()[pi].patchNeighbourField();
Field<Type> pOwnVf(vf.boundaryField()[pi].patchInternalField());
Field<Type> pNgbVf(vf.boundaryField()[pi].patchNeighbourField());
Field<Type>& pSf = sf.boundaryFieldRef()[pi];