OpenFOAM logo
The Open Source CFD Toolbox
  Programmer’s C++ Doxygen OpenCFD Solutions Contact OpenFOAM

probes.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2007 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     probes
00027 
00028 Description
00029     Set of locations to sample.
00030     Call probes.write() to sample&write files.
00031 
00032 SourceFiles
00033     probes.C
00034 
00035 \*---------------------------------------------------------------------------*/
00036 
00037 #ifndef probes_H
00038 #define probes_H
00039 
00040 #include "OFstream.H"
00041 #include "HashPtrTable.H"
00042 #include "vectorField.H"
00043 #include "boolList.H"
00044 
00045 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00046 
00047 namespace Foam
00048 {
00049 
00050 class objectRegistry;
00051 class dictionary;
00052 class fvMesh;
00053 
00054 /*---------------------------------------------------------------------------*\
00055                            Class probes Declaration
00056 \*---------------------------------------------------------------------------*/
00057 
00058 class probes
00059 {
00060     // Private data
00061 
00062         const objectRegistry& obr_;
00063 
00064         // Read from dictonary
00065 
00066             //- Names of fields to probe
00067             wordList fieldNames_;
00068 
00069             //- Locations to probe
00070             vectorField probeLocations_;
00071 
00072 
00073         // Calculated
00074 
00075             //- Indices (into fieldNames_) of scalar/vector/tensor fields
00076             wordList scalarFields_;
00077             wordList vectorFields_;
00078             wordList sphericalTensorFields_;
00079             wordList symmTensorFields_;
00080             wordList tensorFields_;
00081 
00082             //- Cells to be probed (obtained from the locations)
00083             labelList cellList_;
00084 
00085             //- Current open files
00086             HashPtrTable<OFstream> probeFilePtrs_;
00087 
00088 
00089     // Private Member Functions
00090 
00091         //- Find cells containing probes
00092         void findCells(const fvMesh&);
00093 
00094         //- Find the fields in the list of the given type
00095         template<class T>
00096         void findFields(wordList& typeFieldNames, boolList& foundFields);
00097 
00098         //- Sample and write field
00099         template<class T>
00100         void sampleAndWrite(const word& fieldName);
00101 
00102         //- Sample and write all the fields of the given type
00103         template <class T>
00104         void sampleAndWrite(const wordList& typeFields);
00105 
00106         //- Disallow default bitwise copy construct and assignment
00107         probes(const probes&);
00108         void operator=(const probes&);
00109 
00110 
00111 public:
00112 
00113     //- Debug switch
00114     static int debug;
00115 
00116 
00117     // Constructors
00118 
00119         //- Construct for given objectRegistry and dictionary
00120         probes(const objectRegistry&, const dictionary&);
00121 
00122 
00123     // Destructor
00124 
00125         virtual ~probes();
00126 
00127 
00128     // Member Functions
00129 
00130         //- Sample single field on all sample locations
00131         template <class T>
00132         Field<T> sample(const word& fieldName) const;
00133 
00134         //- Sample and write
00135         void write();
00136 
00137         //- Read the probes
00138         void read(const dictionary&);
00139 };
00140 
00141 
00142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00143 
00144 } // End namespace Foam
00145 
00146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00147 
00148 #ifdef NoRepository
00149 #   include "probesTemplates.C"
00150 #endif
00151 
00152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00153 
00154 #endif
00155 
00156 // ************************************************************************* //
Copyright © 2000-2007 OpenCFD Ltd