OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

correlationFunction.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) 2008-2009 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     Foam::correlationFunction
00027 
00028 Description
00029 
00030 SourceFiles
00031     correlationFunctionI.H
00032     correlationFunction.C
00033     correlationFunctionIO.C
00034 
00035 \*---------------------------------------------------------------------------*/
00036 
00037 #ifndef correlationFunction_H
00038 #define correlationFunction_H
00039 
00040 #include "bufferedAccumulator.H"
00041 #include "dictionary.H"
00042 
00043 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00044 
00045 namespace Foam
00046 {
00047 
00048 template<class Type>
00049 class correlationFunction;
00050 
00051 template<class Type>
00052 Ostream& operator<<
00053 (
00054     Ostream&,
00055     const correlationFunction<Type>&
00056 );
00057 
00058 /*---------------------------------------------------------------------------*\
00059                     Class correlationFunction Declaration
00060 \*---------------------------------------------------------------------------*/
00061 
00062 template<class Type>
00063 class correlationFunction
00064 :
00065     public bufferedAccumulator<scalar>
00066 {
00067     // Private data
00068 
00069         const polyMesh& mesh_;
00070 
00071         Field< Field<Type> > tZeroBuffers_;
00072 
00073         scalar duration_;
00074         scalar sampleInterval_;
00075         scalar averagingInterval_;
00076 
00077         label sampleSteps_;
00078 
00079 
00080     // Private Member Functions
00081 
00082         void setTimesAndSizes(const label);
00083 
00084         //- Disallow default bitwise copy construct
00085         correlationFunction(const correlationFunction<Type>&);
00086 
00087         //- Disallow default bitwise assignment
00088         void operator=(const correlationFunction<Type>&);
00089 
00090 
00091 public:
00092 
00093     //- Component type
00094     typedef typename pTraits<Type>::cmptType cmptType;
00095 
00096 
00097     // Static data members
00098 
00099         static const char* const typeName;
00100 
00101 
00102     // Constructors
00103 
00104         //- Construct from dictionary
00105         correlationFunction
00106         (
00107             const polyMesh&,
00108             const dictionary&,
00109             const label tZeroBufferSize
00110         );
00111 
00112         //- Construct from components
00113         correlationFunction
00114         (
00115             const polyMesh&,
00116             const label tZeroBufferSize,
00117             const scalar duration,
00118             const scalar sampleInterval,
00119             const scalar averagingInterval
00120 
00121         );
00122 
00123 
00124     // Destructor
00125 
00126         ~correlationFunction();
00127 
00128 
00129     // Member Functions
00130 
00131         void calculateCorrelationFunction(const Field<Type>&);
00132 
00133         void calculateCorrelationFunction(const Type&);
00134 
00135         scalar integral() const;
00136 
00137         bool writeAveraged(Ostream&) const;
00138 
00139 
00140     // Access
00141 
00142         inline const Field< Field<Type> >& tZeroBuffers() const;
00143 
00144         inline scalar duration() const;
00145 
00146         inline scalar sampleInterval() const;
00147 
00148         inline scalar averagingInterval() const;
00149 
00150         inline label sampleSteps() const;
00151 
00152         inline label measurandFieldSize() const;
00153 
00154 
00155     // IOstream Operators
00156 
00157         friend Ostream& operator<< <Type>
00158         (
00159             Ostream&,
00160             const correlationFunction<Type>&
00161         );
00162 };
00163 
00164 
00165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00166 
00167 } // End namespace Foam
00168 
00169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00170 
00171 #include "correlationFunctionI.H"
00172 
00173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00174 
00175 #ifdef NoRepository
00176 #   include "correlationFunction.C"
00177 #endif
00178 
00179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00180 
00181 #endif
00182 
00183 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd