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 locations to sample.
30 Call write() to sample and write files.
35 \*---------------------------------------------------------------------------*/
40 #include "HashPtrTable.H"
43 #include "pointField.H"
44 #include "volFieldsFwd.H"
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 // Forward declaration of classes
57 /*---------------------------------------------------------------------------*\
58 Class probes Declaration
59 \*---------------------------------------------------------------------------*/
67 //- Class used for grouping field types
80 //- Construct for a list of field names
81 fieldGroup(const wordList& fieldNames)
90 //- Name of this set of probes,
91 // Also used as the name of the probes directory.
94 //- Const reference to objectRegistry
95 const objectRegistry& obr_;
97 //- Load fields from files (not from objectRegistry)
101 // Read from dictonary
103 //- Names of fields to probe
104 wordList fieldNames_;
106 //- Locations to probe
107 vectorField probeLocations_;
112 //- Categorized scalar/vector/tensor fields
113 fieldGroup<scalar> scalarFields_;
114 fieldGroup<vector> vectorFields_;
115 fieldGroup<sphericalTensor> sphericalTensorFields_;
116 fieldGroup<symmTensor> symmTensorFields_;
117 fieldGroup<tensor> tensorFields_;
119 // Cells to be probed (obtained from the locations)
120 labelList elementList_;
122 //- Current open files
123 HashPtrTable<OFstream> probeFilePtrs_;
126 // Private Member Functions
128 //- Find element containing probes
129 virtual void findElements(const fvMesh&);
131 //- classify field types, return true if nFields > 0
132 bool checkFieldTypes();
134 //- Find the fields in the list of the given type, return count
138 fieldGroup<Type>& fieldList,
139 const wordList& fieldTypes
145 //- Sample and write a particular volume field
149 const GeometricField<Type, fvPatchField, volMesh>&
152 //- Sample and write all the fields of the given type
153 template <class Type>
154 void sampleAndWrite(const fieldGroup<Type>&);
156 //- Disallow default bitwise copy construct
157 probes(const probes&);
159 //- Disallow default bitwise assignment
160 void operator=(const probes&);
165 //- Runtime type information
171 //- Construct for given objectRegistry and dictionary.
172 // Allow the possibility to load fields from files
176 const objectRegistry&,
178 const bool loadFromFiles = false
188 //- Return name of the set of probes
189 virtual const word& name() const
194 //- Return names of fields to probe
195 virtual const wordList& fieldNames() const
200 //- Return locations to probe
201 virtual const vectorField& probeLocations() const
203 return probeLocations_;
206 //- Cells to be probed (obtained from the locations)
207 const labelList& elements() const
212 //- Execute, currently does nothing
213 virtual void execute();
215 //- Execute at the final time-loop, currently does nothing
219 virtual void write();
222 virtual void read(const dictionary&);
224 //- Update for changes of mesh
225 virtual void updateMesh(const mapPolyMesh&)
228 //- Update for changes of mesh
229 virtual void movePoints(const pointField&)
232 //- Update for changes of mesh due to readUpdate
233 virtual void readUpdate(const polyMesh::readUpdateState state)
236 //- Sample a volume field at all locations
238 tmp<Field<Type> > sample
240 const GeometricField<Type, fvPatchField, volMesh>&
243 //- Sample a single field on all sample locations
244 template <class Type>
245 tmp<Field<Type> > sample(const word& fieldName) const;
249 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
251 } // End namespace Foam
253 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
256 # include "probesTemplates.C"
259 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
263 // ************************************************************************* //