ENH: autoLayerDriver: better layering information message
[OpenFOAM-2.0.x.git] / src / sampling / sampledSurface / isoSurface / sampledIsoSurfaceCellTemplates.C
blob78ad62954389cd68c9d23da41f221f4e67aa7c44
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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 "sampledIsoSurfaceCell.H"
27 #include "isoSurface.H"
28 #include "volFieldsFwd.H"
29 #include "pointFields.H"
30 #include "volPointInterpolation.H"
32 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
34 template <class Type>
35 Foam::tmp<Foam::Field<Type> >
36 Foam::sampledIsoSurfaceCell::sampleField
38     const GeometricField<Type, fvPatchField, volMesh>& vField
39 ) const
41     // Recreate geometry if time has changed
42     updateGeometry();
44     return tmp<Field<Type> >(new Field<Type>(vField, meshCells_));
48 template <class Type>
49 Foam::tmp<Foam::Field<Type> >
50 Foam::sampledIsoSurfaceCell::interpolateField
52     const interpolation<Type>& interpolator
53 ) const
55     // Recreate geometry if time has changed
56     updateGeometry();
58     // One value per point
59     tmp<Field<Type> > tvalues(new Field<Type>(points().size()));
60     Field<Type>& values = tvalues();
62     boolList pointDone(points().size(), false);
64     forAll(faces(), cutFaceI)
65     {
66         const face& f = faces()[cutFaceI];
68         forAll(f, faceVertI)
69         {
70             label pointI = f[faceVertI];
72             if (!pointDone[pointI])
73             {
74                 values[pointI] = interpolator.interpolate
75                 (
76                     points()[pointI],
77                     meshCells_[cutFaceI]
78                 );
79                 pointDone[pointI] = true;
80             }
81         }
82     }
84     return tvalues;
88 // ************************************************************************* //