1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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 locations to sample.
31 Call write() to sample and write files.
36 \*---------------------------------------------------------------------------*/
41 #include "HashPtrTable.H"
44 #include "pointField.H"
45 #include "volFieldsFwd.H"
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 // Forward declaration of classes
58 /*---------------------------------------------------------------------------*\
59 Class probes Declaration
60 \*---------------------------------------------------------------------------*/
66 //- Class used for grouping field types
79 //- Construct for a list of field names
80 fieldGroup(const wordList& fieldNames)
89 //- Name of this set of probes,
90 // Also used as the name of the probes directory.
93 //- Const reference to objectRegistry
94 const objectRegistry& obr_;
96 //- Load fields from files (not from objectRegistry)
100 // Read from dictonary
102 //- Names of fields to probe
103 wordList fieldNames_;
105 //- Locations to probe
106 vectorField probeLocations_;
111 //- Categorized scalar/vector/tensor fields
112 fieldGroup<scalar> scalarFields_;
113 fieldGroup<vector> vectorFields_;
114 fieldGroup<sphericalTensor> sphericalTensorFields_;
115 fieldGroup<symmTensor> symmTensorFields_;
116 fieldGroup<tensor> tensorFields_;
118 // Cells to be probed (obtained from the locations)
121 //- Current open files
122 HashPtrTable<OFstream> probeFilePtrs_;
125 // Private Member Functions
127 //- Find cells containing probes
128 void findCells(const fvMesh&);
130 //- classify field types, return true if nFields > 0
131 bool checkFieldTypes();
133 //- Find the fields in the list of the given type, return count
137 fieldGroup<Type>& fieldList,
138 const wordList& fieldTypes
141 //- Sample and write a particular volume field
145 const GeometricField<Type, fvPatchField, volMesh>&
148 //- Sample and write all the fields of the given type
149 template <class Type>
150 void sampleAndWrite(const fieldGroup<Type>&);
152 //- Disallow default bitwise copy construct
153 probes(const probes&);
155 //- Disallow default bitwise assignment
156 void operator=(const probes&);
161 //- Runtime type information
167 //- Construct for given objectRegistry and dictionary.
168 // Allow the possibility to load fields from files
172 const objectRegistry&,
174 const bool loadFromFiles = false
185 //- Return name of the set of probes
186 virtual const word& name() const
191 //- Return names of fields to probe
192 virtual const wordList& fieldNames() const
197 //- Return locations to probe
198 virtual const vectorField& probeLocations() const
200 return probeLocations_;
203 //- Cells to be probed (obtained from the locations)
204 const labelList& cells() const
209 //- Execute, currently does nothing
210 virtual void execute();
212 //- Execute at the final time-loop, currently does nothing
216 virtual void write();
219 virtual void read(const dictionary&);
221 //- Update for changes of mesh
222 virtual void updateMesh(const mapPolyMesh&)
225 //- Update for changes of mesh
226 virtual void movePoints(const pointField&)
229 //- Update for changes of mesh due to readUpdate
230 virtual void readUpdate(const polyMesh::readUpdateState state)
233 //- Sample a volume field at all locations
235 tmp<Field<Type> > sample
237 const GeometricField<Type, fvPatchField, volMesh>&
240 //- Sample a single field on all sample locations
241 template <class Type>
242 tmp<Field<Type> > sample(const word& fieldName) const;
246 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
248 } // End namespace Foam
250 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
253 # include "probesTemplates.C"
256 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
260 // ************************************************************************* //