1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-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 #include "wordReList.H"
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 // Forward declaration of classes
59 /*---------------------------------------------------------------------------*\
60 Class probes Declaration
61 \*---------------------------------------------------------------------------*/
71 //- Class used for grouping field types
75 public DynamicList<word>
89 //- Name of this set of probes,
90 // Also used as the name of the probes directory.
93 //- Const reference to fvMesh
96 //- Load fields from files (not from objectRegistry)
100 // Read from dictonary
102 //- Names of fields to probe
103 wordReList fieldSelection_;
107 //- Categorized scalar/vector/tensor fields
108 fieldGroup<scalar> scalarFields_;
109 fieldGroup<vector> vectorFields_;
110 fieldGroup<sphericalTensor> sphericalTensorFields_;
111 fieldGroup<symmTensor> symmTensorFields_;
112 fieldGroup<tensor> tensorFields_;
114 // Cells to be probed (obtained from the locations)
115 labelList elementList_;
117 //- Current open files
118 HashPtrTable<OFstream> probeFilePtrs_;
121 // Private Member Functions
123 //- Clear old field groups
124 void clearFieldGroups();
126 //- Append fieldName to the appropriate group
127 label appendFieldGroup(const word& fieldName, const word& fieldType);
129 //- Classify field types, returns the number of fields
130 label classifyFields();
132 //- Find cells containing probes
133 virtual void findElements(const fvMesh&);
135 //- Classify field type and Open/close file streams,
136 // returns number of fields
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
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
184 //- Return name of the set of probes
185 virtual const word& name() const
190 //- Return names of fields to probe
191 virtual const wordReList& fieldNames() const
193 return fieldSelection_;
196 //- Return locations to probe
197 virtual const pointField& probeLocations() const
202 //- Return location for probe i
203 virtual const point& probe(const label i) const
205 return operator[](i);
208 //- Cells to be probed (obtained from the locations)
209 const labelList& elemets() const
214 //- Execute, currently does nothing
215 virtual void execute();
217 //- Execute at the final time-loop, currently does nothing
221 virtual void write();
224 virtual void read(const dictionary&);
226 //- Update for changes of mesh
227 virtual void updateMesh(const mapPolyMesh&)
230 //- Update for changes of mesh
231 virtual void movePoints(const pointField&)
234 //- Update for changes of mesh due to readUpdate
235 virtual void readUpdate(const polyMesh::readUpdateState state)
238 //- Sample a volume field at all locations
240 tmp<Field<Type> > sample
242 const GeometricField<Type, fvPatchField, volMesh>&
245 //- Sample a single field on all sample locations
246 template <class Type>
247 tmp<Field<Type> > sample(const word& fieldName) const;
251 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
253 } // End namespace Foam
255 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
258 # include "probesTemplates.C"
261 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
265 // ************************************************************************* //