1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 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 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 //- Cells to be probed (obtained from the locations)
192 const labelList& cells() const
198 virtual void write();
201 virtual void read(const dictionary&);
204 virtual void execute();
206 //- Update for changes of mesh
207 virtual void updateMesh(const mapPolyMesh&)
210 //- Update for changes of mesh
211 virtual void movePoints(const pointField&)
214 //- Update for changes of mesh due to readUpdate
215 virtual void readUpdate(const polyMesh::readUpdateState state)
218 //- Sample a volume field at all locations
220 tmp<Field<Type> > sample
222 const GeometricField<Type, fvPatchField, volMesh>&
225 //- Sample a single field on all sample locations
226 template <class Type>
227 tmp<Field<Type> > sample(const word& fieldName) const;
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
233 } // End namespace Foam
235 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
238 # include "probesTemplates.C"
241 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
245 // ************************************************************************* //