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/>.
28 Set of surfaces to sample.
30 The write() method is used to sample and write files.
35 \*---------------------------------------------------------------------------*/
37 #ifndef sampledSurfaces_H
38 #define sampledSurfaces_H
40 #include "sampledSurface.H"
41 #include "surfaceWriter.H"
42 #include "volFieldsFwd.H"
43 #include "wordReList.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 /*---------------------------------------------------------------------------*\
54 Class sampledSurfaces Declaration
55 \*---------------------------------------------------------------------------*/
59 public PtrList<sampledSurface>
63 //- Class used for grouping field types
67 public DynamicList<word>
79 //- Class used for surface merging information
97 // Static data members
100 static bool verbose_;
102 //- Tolerance for merging points (fraction of mesh bounding box)
103 static scalar mergeTol_;
107 //- Name of this set of surfaces,
108 // Also used as the name of the sampledSurfaces directory.
111 //- Const reference to fvMesh
114 //- Load fields from files (not from objectRegistry)
115 const bool loadFromFiles_;
118 fileName outputPath_;
121 // Read from dictonary
123 //- Names of fields to sample
124 wordReList fieldSelection_;
126 //- Interpolation scheme to use
127 word interpolationScheme_;
131 //- Information for merging surfaces
132 List<mergeInfo> mergeList_;
137 //- Surface formatter
138 autoPtr<surfaceWriter> formatter_;
140 //- Categorized scalar/vector/tensor fields
141 fieldGroup<scalar> scalarFields_;
142 fieldGroup<vector> vectorFields_;
143 fieldGroup<sphericalTensor> sphericalTensorFields_;
144 fieldGroup<symmTensor> symmTensorFields_;
145 fieldGroup<tensor> tensorFields_;
148 // Private Member Functions
150 //- Clear old field groups
151 void clearFieldGroups();
153 //- Append fieldName to the appropriate group
154 label appendFieldGroup(const word& fieldName, const word& fieldType);
156 //- Classify field types, returns the number of fields
157 label classifyFields();
159 //- Write geometry only
160 void writeGeometry() const;
162 //- Sample and write a particular volume field
164 void sampleAndWrite(const GeometricField<Type, fvPatchField, volMesh>&);
166 //- Sample and write all the fields of the given type
168 void sampleAndWrite(fieldGroup<Type>&);
170 //- Disallow default bitwise copy construct and assignment
171 sampledSurfaces(const sampledSurfaces&);
172 void operator=(const sampledSurfaces&);
177 //- Runtime type information
178 TypeName("surfaces");
183 //- Construct for given objectRegistry and dictionary
184 // allow the possibility to load fields from files
188 const objectRegistry&,
190 const bool loadFromFiles = false
195 virtual ~sampledSurfaces();
200 //- Does any of the surfaces need an update?
201 virtual bool needsUpdate() const;
203 //- Mark the surfaces as needing an update.
204 // May also free up unneeded data.
205 // Return false if all surfaces were already marked as expired.
206 virtual bool expire();
208 //- Update the surfaces as required and merge surface points (parallel).
209 // Return false if no surfaces required an update.
210 virtual bool update();
213 //- Return name of the set of surfaces
214 virtual const word& name() const
219 //- set verbosity level
220 void verbose(const bool verbosity = true);
222 //- Execute, currently does nothing
223 virtual void execute();
225 //- Execute at the final time-loop, currently does nothing
229 virtual void write();
231 //- Read the sampledSurfaces dictionary
232 virtual void read(const dictionary&);
234 //- Update for changes of mesh - expires the surfaces
235 virtual void updateMesh(const mapPolyMesh&);
237 //- Update for mesh point-motion - expires the surfaces
238 virtual void movePoints(const pointField&);
240 //- Update for changes of mesh due to readUpdate - expires the surfaces
241 virtual void readUpdate(const polyMesh::readUpdateState state);
246 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
248 } // End namespace Foam
250 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
253 # include "sampledSurfacesTemplates.C"
256 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
260 // ************************************************************************* //