1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 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 sets to sample.
30 Call sampledSets.write() to sample&write files.
35 \*---------------------------------------------------------------------------*/
40 #include "sampledSet.H"
41 #include "volFieldsFwd.H"
42 #include "meshSearch.H"
43 #include "interpolation.H"
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 /*---------------------------------------------------------------------------*\
57 Class sampledSets Declaration
58 \*---------------------------------------------------------------------------*/
62 public PtrList<sampledSet>
66 //- Class used for grouping field types
75 autoPtr<writer<Type> > formatter;
92 //- Class used for sampling volFields
96 public List<Field<Type> >
98 //- Name of this collection of values
103 //- Construct interpolating field to the sampleSets
106 const word& interpolationScheme,
107 const GeometricField<Type, fvPatchField, volMesh>& field,
108 const PtrList<sampledSet>&
111 //- Construct mapping field to the sampleSets
114 const GeometricField<Type, fvPatchField, volMesh>& field,
115 const PtrList<sampledSet>&
118 //- Construct from components
121 const List<Field<Type> >& values,
125 //- Return the field name
126 const word& name() const
133 // Static data members
136 static bool verbose_;
141 //- Name of this set of sets,
142 // Also used as the name of the sampledSets directory.
145 //- Const reference to fvMesh
148 //- Keep the dictionary to recreate sets for moving mesh cases
151 //- Load fields from files (not from objectRegistry)
155 fileName outputPath_;
157 //- Mesh search engine
158 meshSearch searchEngine_;
161 // Read from dictonary
163 //- Names of fields to sample
164 wordList fieldNames_;
166 //- Interpolation scheme to use
167 word interpolationScheme_;
169 //- Output format to use
173 // Categorized scalar/vector/tensor fields
175 fieldGroup<scalar> scalarFields_;
176 fieldGroup<vector> vectorFields_;
177 fieldGroup<sphericalTensor> sphericalTensorFields_;
178 fieldGroup<symmTensor> symmTensorFields_;
179 fieldGroup<tensor> tensorFields_;
182 // Merging structures
184 PtrList<coordSet> masterSampledSets_;
185 labelListList indexSets_;
188 // Private Member Functions
190 //- Classify field types, return true if nFields > 0
191 bool checkFieldTypes();
193 //- Find the fields in the list of the given type, return count
197 fieldGroup<Type>& fieldList,
198 const wordList& fieldTypes
201 //- Combine points from all processors. Sort by curveDist and produce
202 // index list. Valid result only on master processor.
203 void combineSampledSets
205 PtrList<coordSet>& masterSampledSets,
206 labelListList& indexSets
209 //- Combine values from all processors.
210 // Valid result only on master processor.
212 void combineSampledValues
214 const PtrList<volFieldSampler<T> >& sampledFields,
215 const labelListList& indexSets,
216 PtrList<volFieldSampler<T> >& masterFields
222 const coordSet& masterSampleSet,
223 const PtrList<volFieldSampler<Type> >& masterFields,
225 const fileName& timeDir,
226 const writer<Type>& formatter
230 void sampleAndWrite(fieldGroup<Type>& fields);
233 //- Disallow default bitwise copy construct and assignment
234 sampledSets(const sampledSets&);
235 void operator=(const sampledSets&);
240 //- Runtime type information
246 //- Construct for given objectRegistry and dictionary
247 // allow the possibility to load fields from files
251 const objectRegistry&,
253 const bool loadFromFiles = false
259 virtual ~sampledSets();
264 //- Return name of the set of probes
265 virtual const word& name() const
270 //- set verbosity level
271 void verbose(const bool verbosity = true);
273 //- Execute, currently does nothing
274 virtual void execute();
276 //- Execute at the final time-loop, currently does nothing
280 virtual void write();
282 //- Read the sampledSets
283 virtual void read(const dictionary&);
285 //- Correct for mesh changes
288 //- Update for changes of mesh
289 virtual void updateMesh(const mapPolyMesh&);
291 //- Update for mesh point-motion
292 virtual void movePoints(const pointField&);
294 //- Update for changes of mesh due to readUpdate
295 virtual void readUpdate(const polyMesh::readUpdateState state);
299 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
301 } // End namespace Foam
303 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
306 # include "sampledSetsTemplates.C"
309 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
313 // ************************************************************************* //