FreeFOAM The Cross-Platform CFD Toolkit
sampledTriSurfaceMesh.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 Class
25  Foam::sampledTriSurfaceMesh
26 
27 Description
28  A sampledSurface from a triSurfaceMesh. It samples on the points/triangles
29  of the triSurface.
30 
31  It samples using the cell nearest to the triangle centre so does
32  not check the cell the centre is actually in ...
33 
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.
37 
38 SourceFiles
39  sampledTriSurfaceMesh.C
40 
41 \*---------------------------------------------------------------------------*/
42 
43 #ifndef sampledTriSurfaceMesh_H
44 #define sampledTriSurfaceMesh_H
45 
48 #include <surfMesh/MeshedSurface.H>
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 /*---------------------------------------------------------------------------*\
56  Class sampledTriSurfaceMesh Declaration
57 \*---------------------------------------------------------------------------*/
58 
60 :
61  public sampledSurface,
62  public MeshedSurface<face>
63 {
64  //- Private typedefs for convenience
66 
67  // Private data
68 
69  //- Surface to sample on
70  const triSurfaceMesh surface_;
71 
72  //- Track if the surface needs an update
73  mutable bool needsUpdate_;
74 
75  //- From local surface triangle to mesh cell.
76  labelList cellLabels_;
77 
78  //- From local surface back to surface_
79  labelList pointToFace_;
80 
81 
82  // Private Member Functions
83 
84  //- sample field on faces
85  template <class Type>
86  tmp<Field<Type> > sampleField
87  (
89  ) const;
90 
91 
92  template <class Type>
94  interpolateField(const interpolation<Type>&) const;
95 
96 public:
97 
98  //- Runtime type information
99  TypeName("sampledTriSurfaceMesh");
100 
101 
102  // Constructors
103 
104  //- Construct from components
106  (
107  const word& name,
108  const polyMesh& mesh,
109  const word& surfaceName
110  );
111 
112  //- Construct from dictionary
114  (
115  const word& name,
116  const polyMesh& mesh,
117  const dictionary& dict
118  );
119 
120 
121  // Destructor
122 
123  virtual ~sampledTriSurfaceMesh();
124 
125 
126  // Member Functions
127 
128  //- Does the surface need an update?
129  virtual bool needsUpdate() const;
130 
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();
135 
136  //- Update the surface as required.
137  // Do nothing (and return false) if no update was needed
138  virtual bool update();
139 
140 
141  //- Points of surface
142  virtual const pointField& points() const
143  {
144  return MeshStorage::points();
145  }
146 
147  //- Faces of surface
148  virtual const faceList& faces() const
149  {
150  return MeshStorage::faces();
151  }
152 
153 
154  //- sample field on surface
155  virtual tmp<scalarField> sample
156  (
157  const volScalarField&
158  ) const;
159 
160  //- sample field on surface
161  virtual tmp<vectorField> sample
162  (
163  const volVectorField&
164  ) const;
165 
166  //- sample field on surface
168  (
170  ) const;
171 
172  //- sample field on surface
174  (
175  const volSymmTensorField&
176  ) const;
177 
178  //- sample field on surface
179  virtual tmp<tensorField> sample
180  (
181  const volTensorField&
182  ) const;
183 
184 
185  //- interpolate field on surface
187  (
188  const interpolation<scalar>&
189  ) const;
190 
191 
192  //- interpolate field on surface
194  (
195  const interpolation<vector>&
196  ) const;
197 
198  //- interpolate field on surface
200  (
202  ) const;
203 
204  //- interpolate field on surface
206  (
208  ) const;
209 
210  //- interpolate field on surface
212  (
213  const interpolation<tensor>&
214  ) const;
215 
216  //- Write
217  virtual void print(Ostream&) const;
218 };
219 
220 
221 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
222 
223 } // End namespace Foam
224 
225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 
227 #ifdef NoRepository
229 #endif
230 
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232 
233 #endif
234 
235 // ************************ vim: set sw=4 sts=4 et: ************************ //