1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "sampledIsoSurface.H"
27 #include "volFieldsFwd.H"
28 #include "pointFields.H"
29 #include "volPointInterpolation.H"
31 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
34 Foam::tmp<Foam::Field<Type> >
35 Foam::sampledIsoSurface::sampleField
37 const GeometricField<Type, fvPatchField, volMesh>& vField
40 // Recreate geometry if time has changed
43 return tmp<Field<Type> >(new Field<Type>(vField, surface().meshCells()));
48 Foam::tmp<Foam::Field<Type> >
49 Foam::sampledIsoSurface::interpolateField
51 const interpolation<Type>& interpolator
54 // Get fields to sample. Assume volPointInterpolation!
55 const GeometricField<Type, fvPatchField, volMesh>& volFld =
58 // Recreate geometry if time has changed
61 if (subMeshPtr_.valid())
63 tmp<GeometricField<Type, fvPatchField, volMesh> > tvolSubFld =
64 subMeshPtr_().interpolate(volFld);
66 const GeometricField<Type, fvPatchField, volMesh>& volSubFld =
69 tmp<GeometricField<Type, pointPatchField, pointMesh> > tpointSubFld =
70 volPointInterpolation::New(volSubFld.mesh()).interpolate(volSubFld);
73 return surface().interpolate
77 ? pointAverage(tpointSubFld())()
85 tmp<GeometricField<Type, pointPatchField, pointMesh> > tpointFld =
86 volPointInterpolation::New(volFld.mesh()).interpolate(volFld);
89 return surface().interpolate
93 ? pointAverage(tpointFld())()
102 // ************************************************************************* //