1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 Set of surfaces to sample.
31 The write() method is used to sample and write files.
36 \*---------------------------------------------------------------------------*/
38 #ifndef sampledSurfaces_H
39 #define sampledSurfaces_H
41 #include "sampledSurface.H"
42 #include "surfaceWriter.H"
43 #include "volFieldsFwd.H"
44 #include "volPointInterpolation.H"
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 /*---------------------------------------------------------------------------*\
55 Class sampledSurfaces Declaration
56 \*---------------------------------------------------------------------------*/
60 public PtrList<sampledSurface>
64 //- Class used for grouping field types
73 autoPtr<surfaceWriter<Type> > formatter;
82 //- Construct for a particular surface format
83 fieldGroup(const word& writeFormat)
86 formatter(surfaceWriter<Type>::New(writeFormat))
89 //- Construct for a particular surface format and a list of field names
92 const word& writeFormat,
93 const wordList& fieldNames
97 formatter(surfaceWriter<Type>::New(writeFormat))
100 void operator=(const word& writeFormat)
102 formatter = surfaceWriter<Type>::New(writeFormat);
105 void operator=(const wordList& fieldNames)
107 wordList::operator=(fieldNames);
112 //- Class used for surface merging information
122 // Static data members
125 static bool verbose_;
130 //- Name of this set of surfaces,
131 // Also used as the name of the sampledSurfaces directory.
134 //- Const reference to fvMesh
137 //- Load fields from files (not from objectRegistry)
141 fileName outputPath_;
143 //- pointMesh for interpolation
144 autoPtr<pointMesh> pMeshPtr_;
146 //- volPointInterpolation for interpolation
147 autoPtr<volPointInterpolation> pInterpPtr_;
150 // Read from dictonary
152 //- Names of fields to sample
153 wordList fieldNames_;
155 //- Interpolation scheme to use
156 word interpolationScheme_;
158 //- Output format to use
164 //- Information for merging surfaces
165 List<mergeInfo> mergeList_;
170 //- Categorized scalar/vector/tensor fields
171 fieldGroup<scalar> scalarFields_;
172 fieldGroup<vector> vectorFields_;
173 fieldGroup<sphericalTensor> sphericalTensorFields_;
174 fieldGroup<symmTensor> symmTensorFields_;
175 fieldGroup<tensor> tensorFields_;
178 // Private Member Functions
180 //- Classify field types, return true if nFields > 0
181 bool checkFieldTypes();
183 //- Merge points on surfaces
184 void mergeSurfaces();
186 //- Find the fields in the list of the given type, return count
190 fieldGroup<Type>& fieldList,
191 const wordList& fieldTypes
194 //- Set interpolator for the field
196 autoPtr<interpolation<Type> > setInterpolator
198 const GeometricField<Type, fvPatchField, volMesh>&
201 //- Sample and write a particular volume field
205 const GeometricField<Type, fvPatchField, volMesh>&,
206 const surfaceWriter<Type>& formatter
209 //- Sample and write all the fields of the given type
210 template <class Type>
211 void sampleAndWrite(fieldGroup<Type>&);
213 //- Disallow default bitwise copy construct and assignment
214 sampledSurfaces(const sampledSurfaces&);
215 void operator=(const sampledSurfaces&);
220 //- Runtime type information
221 TypeName("surfaces");
226 //- Construct for given objectRegistry and dictionary
227 // allow the possibility to load fields from files
231 const objectRegistry&,
233 const bool loadFromFiles = false
239 virtual ~sampledSurfaces();
244 //- Return name of the set of probes
245 virtual const word& name() const
250 //- set verbosity level
251 void verbose(const bool verbosity = true);
254 virtual void write();
256 //- Read the sampledSurfaces
257 virtual void read(const dictionary&);
259 //- Correct for mesh changes
262 //- Update for changes of mesh
263 virtual void updateMesh(const mapPolyMesh&);
265 //- Update for mesh point-motion
266 virtual void movePoints(const pointField&);
268 //- Update for changes of mesh due to readUpdate
269 virtual void readUpdate(const polyMesh::readUpdateState state);
273 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
275 } // End namespace Foam
277 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
280 # include "sampledSurfacesTemplates.C"
283 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
287 // ************************************************************************* //