From b7e1ca950a0fc5dcb59f3198af0977791055bcf8 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Mon, 1 Aug 2016 14:42:49 +0100 Subject: [PATCH] Bugfix: const signature handling for manipulateMatrix in fvPatchField --- .../fields/fvPatchFields/fvPatchField/fvPatchField.C | 2 +- .../fields/fvPatchFields/fvPatchField/fvPatchField.H | 2 +- src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C index 864dcfdc0..59a7274f8 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C @@ -242,7 +242,7 @@ void Foam::fvPatchField::evaluate(const Pstream::commsTypes) template -void Foam::fvPatchField::manipulateMatrix(fvMatrix& matrix) const +void Foam::fvPatchField::manipulateMatrix(fvMatrix& matrix) { // do nothing } diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H index 0592aaee5..daed7adcb 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H @@ -463,7 +463,7 @@ public: // Matrix manipulation //- Manipulate matrix - virtual void manipulateMatrix(fvMatrix& matrix) const; + virtual void manipulateMatrix(fvMatrix& matrix); // I-O diff --git a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C index 213c71cb6..a17e1ff44 100644 --- a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C +++ b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C @@ -729,8 +729,12 @@ void Foam::fvMatrix::completeAssembly() assemblyCompleted_ = true; - const typename GeometricField:: - GeometricBoundaryField& bFields = psi_.boundaryField(); + // Cast away const to manipulate matrix + GeometricField& ncPsi = + const_cast& >(psi_); + + typename GeometricField:: + GeometricBoundaryField& bFields = ncPsi.boundaryField(); forAll(bFields, patchI) {