mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +00:00
This change requires that the de-reference operator '()' returns a const-reference to the object stored irrespective of the const-ness of object stored and the new member function 'ref()' is provided to return an non-const reference to stored object which throws a fatal error if the stored object is const. In order to smooth the transition to this new safer 'tmp' the now deprecated and unsafe non-const de-reference operator '()' is still provided by default but may be switched-off with the compilation switch 'CONST_TMP'. The main OpenFOAM library has already been upgraded and '-DCONST_TMP' option specified in the 'options' file to switch to the new 'tmp' behavior. The rest of OpenFOAM-dev will be upgraded over the following few weeks. Henry G. Weller CFD Direct
59 lines
1.8 KiB
C
59 lines
1.8 KiB
C
/*---------------------------------------------------------------------------*\
|
|
========= |
|
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
\\ / O peration |
|
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
|
\\/ M anipulation |
|
|
-------------------------------------------------------------------------------
|
|
License
|
|
This file is part of OpenFOAM.
|
|
|
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
|
under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
\*---------------------------------------------------------------------------*/
|
|
|
|
#include "GAMGInterface.H"
|
|
|
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
|
|
template<class Type>
|
|
Foam::tmp<Foam::Field<Type>> Foam::GAMGInterface::interfaceInternalField
|
|
(
|
|
const UList<Type>& iF
|
|
) const
|
|
{
|
|
tmp<Field<Type>> tresult(new Field<Type>(size()));
|
|
interfaceInternalField(iF, tresult.ref());
|
|
return tresult;
|
|
}
|
|
|
|
|
|
template<class Type>
|
|
void Foam::GAMGInterface::interfaceInternalField
|
|
(
|
|
const UList<Type>& iF,
|
|
List<Type>& result
|
|
) const
|
|
{
|
|
result.setSize(size());
|
|
|
|
forAll(result, elemI)
|
|
{
|
|
result[elemI] = iF[faceCells_[elemI]];
|
|
}
|
|
}
|
|
|
|
|
|
// ************************************************************************* //
|