1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. 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 \*---------------------------------------------------------------------------*/
65 //- Class used for grouping field types
78 //- Construct for a list of field names
79 fieldGroup(const wordList& fieldNames)
88 //- Name of this set of probes,
89 // Also used as the name of the probes directory.
92 //- Const reference to objectRegistry
93 const objectRegistry& obr_;
95 //- Load fields from files (not from objectRegistry)
99 // Read from dictonary
101 //- Names of fields to probe
102 wordList fieldNames_;
104 //- Locations to probe
105 vectorField probeLocations_;
110 //- Categorized scalar/vector/tensor fields
111 fieldGroup<scalar> scalarFields_;
112 fieldGroup<vector> vectorFields_;
113 fieldGroup<sphericalTensor> sphericalTensorFields_;
114 fieldGroup<symmTensor> symmTensorFields_;
115 fieldGroup<tensor> tensorFields_;
117 // Cells to be probed (obtained from the locations)
120 //- Current open files
121 HashPtrTable<OFstream> probeFilePtrs_;
124 // Private Member Functions
126 //- Find cells containing probes
127 void findCells(const fvMesh&);
129 //- classify field types, return true if nFields > 0
130 bool checkFieldTypes();
132 //- Find the fields in the list of the given type, return count
136 fieldGroup<Type>& fieldList,
137 const wordList& fieldTypes
140 //- Sample and write a particular volume field
144 const GeometricField<Type, fvPatchField, volMesh>&
147 //- Sample and write all the fields of the given type
148 template <class Type>
149 void sampleAndWrite(const fieldGroup<Type>&);
151 //- Disallow default bitwise copy construct
152 probes(const probes&);
154 //- Disallow default bitwise assignment
155 void operator=(const probes&);
160 //- Runtime type information
166 //- Construct for given objectRegistry and dictionary.
167 // Allow the possibility to load fields from files
171 const objectRegistry&,
173 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 wordList& fieldNames() const
196 //- Return locations to probe
197 virtual const vectorField& probeLocations() const
199 return probeLocations_;
202 //- Cells to be probed (obtained from the locations)
203 const labelList& cells() const
208 //- Execute, currently does nothing
209 virtual void execute();
211 //- Execute at the final time-loop, currently does nothing
215 virtual void write();
218 virtual void read(const dictionary&);
220 //- Update for changes of mesh
221 virtual void updateMesh(const mapPolyMesh&)
224 //- Update for changes of mesh
225 virtual void movePoints(const pointField&)
228 //- Update for changes of mesh due to readUpdate
229 virtual void readUpdate(const polyMesh::readUpdateState state)
232 //- Sample a volume field at all locations
234 tmp<Field<Type> > sample
236 const GeometricField<Type, fvPatchField, volMesh>&
239 //- Sample a single field on all sample locations
240 template <class Type>
241 tmp<Field<Type> > sample(const word& fieldName) const;
245 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
247 } // End namespace Foam
249 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
252 # include "probesTemplates.C"
255 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
259 // ************************************************************************* //