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