/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- 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 . \*---------------------------------------------------------------------------*/ #include "meshSubsetHelper.H" #include "fvMesh.H" #include "volFields.H" #include "globalIndex.H" #include "zeroGradientFvPatchField.H" // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // template Foam::tmp> Foam::meshSubsetHelper::zeroGradientField ( const typename GeometricField < Type, fvPatchField, volMesh >::Internal& df ) { IOobject io(df); io.readOpt() = IOobject::NO_READ; io.writeOpt() = IOobject::NO_WRITE; io.registerObject() = false; tmp> tvf ( new GeometricField ( io, df.mesh(), dimensioned("0", df.dimensions(), Zero), zeroGradientFvPatchField::typeName ) ); tvf.ref().primitiveFieldRef() = df; tvf.ref().correctBoundaryConditions(); return tvf; } template Foam::tmp> Foam::meshSubsetHelper::interpolate ( const GeometricField& vf ) const { if (subsetter_.hasSubMesh()) { tmp> tfld ( subsetter_.interpolate(vf) ); tfld.ref().checkOut(); tfld.ref().rename(vf.name()); return tfld; } else { return vf; } } template Foam::tmp> Foam::meshSubsetHelper::interpolate ( const typename GeometricField < Type, fvPatchField, volMesh >::Internal& df ) const { tmp> tvf = zeroGradientField(df); if (subsetter_.hasSubMesh()) { return interpolate(tvf()); } else { return tvf; } } // ************************************************************************* //