1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
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/>.
25 Foam::sampledTriSurfaceMesh
28 A sampledSurface from a triSurfaceMesh. It samples on the points/triangles
31 It samples using the cell nearest to the triangle centre so does
32 not check the cell the centre is actually in ...
34 In parallel every processor just operates on the part of the surface
35 where the face centres are inside the mesh. It is then up to the
36 caller to stitch the partial surfaces together.
39 sampledTriSurfaceMesh.C
41 \*---------------------------------------------------------------------------*/
43 #ifndef sampledTriSurfaceMesh_H
44 #define sampledTriSurfaceMesh_H
46 #include "sampledSurface.H"
47 #include "triSurfaceMesh.H"
48 #include "MeshedSurface.H"
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 /*---------------------------------------------------------------------------*\
56 Class sampledTriSurfaceMesh Declaration
57 \*---------------------------------------------------------------------------*/
59 class sampledTriSurfaceMesh
61 public sampledSurface,
62 public MeshedSurface<face>
64 //- Private typedefs for convenience
65 typedef MeshedSurface<face> MeshStorage;
69 //- Surface to sample on
70 const triSurfaceMesh surface_;
72 //- Track if the surface needs an update
73 mutable bool needsUpdate_;
75 //- From local surface triangle to mesh cell.
76 labelList cellLabels_;
78 //- From local surface back to surface_
79 labelList pointToFace_;
82 // Private Member Functions
84 //- sample field on faces
86 tmp<Field<Type> > sampleField
88 const GeometricField<Type, fvPatchField, volMesh>& vField
94 interpolateField(const interpolation<Type>&) const;
98 //- Runtime type information
99 TypeName("sampledTriSurfaceMesh");
104 //- Construct from components
105 sampledTriSurfaceMesh
108 const polyMesh& mesh,
109 const word& surfaceName
112 //- Construct from dictionary
113 sampledTriSurfaceMesh
116 const polyMesh& mesh,
117 const dictionary& dict
123 virtual ~sampledTriSurfaceMesh();
128 //- Does the surface need an update?
129 virtual bool needsUpdate() const;
131 //- Mark the surface as needing an update.
132 // May also free up unneeded data.
133 // Return false if surface was already marked as expired.
134 virtual bool expire();
136 //- Update the surface as required.
137 // Do nothing (and return false) if no update was needed
138 virtual bool update();
141 //- Points of surface
142 virtual const pointField& points() const
144 return MeshStorage::points();
148 virtual const faceList& faces() const
150 return MeshStorage::faces();
154 //- sample field on surface
155 virtual tmp<scalarField> sample
157 const volScalarField&
160 //- sample field on surface
161 virtual tmp<vectorField> sample
163 const volVectorField&
166 //- sample field on surface
167 virtual tmp<sphericalTensorField> sample
169 const volSphericalTensorField&
172 //- sample field on surface
173 virtual tmp<symmTensorField> sample
175 const volSymmTensorField&
178 //- sample field on surface
179 virtual tmp<tensorField> sample
181 const volTensorField&
185 //- interpolate field on surface
186 virtual tmp<scalarField> interpolate
188 const interpolation<scalar>&
192 //- interpolate field on surface
193 virtual tmp<vectorField> interpolate
195 const interpolation<vector>&
198 //- interpolate field on surface
199 virtual tmp<sphericalTensorField> interpolate
201 const interpolation<sphericalTensor>&
204 //- interpolate field on surface
205 virtual tmp<symmTensorField> interpolate
207 const interpolation<symmTensor>&
210 //- interpolate field on surface
211 virtual tmp<tensorField> interpolate
213 const interpolation<tensor>&
217 virtual void print(Ostream&) const;
221 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 } // End namespace Foam
225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 # include "sampledTriSurfaceMeshTemplates.C"
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235 // ************************************************************************* //