1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-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/>.
28 Set of sets to sample.
29 Call sampledSets.write() to sample&write files.
34 \*---------------------------------------------------------------------------*/
39 #include "sampledSet.H"
40 #include "volFieldsFwd.H"
41 #include "meshSearch.H"
42 #include "interpolation.H"
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 /*---------------------------------------------------------------------------*\
56 Class sampledSets Declaration
57 \*---------------------------------------------------------------------------*/
61 public PtrList<sampledSet>
65 //- Class used for grouping field types
74 autoPtr<writer<Type> > formatter;
91 //- Class used for sampling volFields
95 public List<Field<Type> >
97 //- Name of this collection of values
102 //- Construct interpolating field to the sampleSets
105 const word& interpolationScheme,
106 const GeometricField<Type, fvPatchField, volMesh>& field,
107 const PtrList<sampledSet>&
110 //- Construct mapping field to the sampleSets
113 const GeometricField<Type, fvPatchField, volMesh>& field,
114 const PtrList<sampledSet>&
117 //- Construct from components
120 const List<Field<Type> >& values,
124 //- Return the field name
125 const word& name() const
132 // Static data members
135 static bool verbose_;
140 //- Name of this set of sets,
141 // Also used as the name of the sampledSets directory.
144 //- Const reference to fvMesh
147 //- Keep the dictionary to recreate sets for moving mesh cases
150 //- Load fields from files (not from objectRegistry)
154 fileName outputPath_;
156 //- Mesh search engine
157 meshSearch searchEngine_;
160 // Read from dictonary
162 //- Names of fields to sample
163 wordList fieldNames_;
165 //- Interpolation scheme to use
166 word interpolationScheme_;
168 //- Output format to use
172 // Categorized scalar/vector/tensor fields
174 fieldGroup<scalar> scalarFields_;
175 fieldGroup<vector> vectorFields_;
176 fieldGroup<sphericalTensor> sphericalTensorFields_;
177 fieldGroup<symmTensor> symmTensorFields_;
178 fieldGroup<tensor> tensorFields_;
181 // Merging structures
183 PtrList<coordSet> masterSampledSets_;
184 labelListList indexSets_;
187 // Private Member Functions
189 //- Classify field types, return true if nFields > 0
190 bool checkFieldTypes();
192 //- Find the fields in the list of the given type, return count
196 fieldGroup<Type>& fieldList,
197 const wordList& fieldTypes
200 //- Combine points from all processors. Sort by curveDist and produce
201 // index list. Valid result only on master processor.
202 void combineSampledSets
204 PtrList<coordSet>& masterSampledSets,
205 labelListList& indexSets
208 //- Combine values from all processors.
209 // Valid result only on master processor.
211 void combineSampledValues
213 const PtrList<volFieldSampler<T> >& sampledFields,
214 const labelListList& indexSets,
215 PtrList<volFieldSampler<T> >& masterFields
221 const coordSet& masterSampleSet,
222 const PtrList<volFieldSampler<Type> >& masterFields,
224 const fileName& timeDir,
225 const writer<Type>& formatter
229 void sampleAndWrite(fieldGroup<Type>& fields);
232 //- Disallow default bitwise copy construct and assignment
233 sampledSets(const sampledSets&);
234 void operator=(const sampledSets&);
239 //- Runtime type information
245 //- Construct for given objectRegistry and dictionary
246 // allow the possibility to load fields from files
250 const objectRegistry&,
252 const bool loadFromFiles = false
258 virtual ~sampledSets();
263 //- Return name of the set of probes
264 virtual const word& name() const
269 //- set verbosity level
270 void verbose(const bool verbosity = true);
272 //- Execute, currently does nothing
273 virtual void execute();
275 //- Execute at the final time-loop, currently does nothing
279 virtual void write();
281 //- Read the sampledSets
282 virtual void read(const dictionary&);
284 //- Correct for mesh changes
287 //- Update for changes of mesh
288 virtual void updateMesh(const mapPolyMesh&);
290 //- Update for mesh point-motion
291 virtual void movePoints(const pointField&);
293 //- Update for changes of mesh due to readUpdate
294 virtual void readUpdate(const polyMesh::readUpdateState state);
298 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
300 } // End namespace Foam
302 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
305 # include "sampledSetsTemplates.C"
308 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
312 // ************************************************************************* //