FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

distribution.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-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::distribution
00026 
00027 Description
00028 
00029 SourceFiles
00030     distributionI.H
00031     distribution.C
00032 
00033 \*---------------------------------------------------------------------------*/
00034 
00035 #ifndef distribution_H
00036 #define distribution_H
00037 
00038 #include <OpenFOAM/Map.H>
00039 #include <OpenFOAM/Pair.H>
00040 
00041 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00042 
00043 namespace Foam
00044 {
00045 
00046 /*---------------------------------------------------------------------------*\
00047                         Class distribution Declaration
00048 \*---------------------------------------------------------------------------*/
00049 
00050 class distribution
00051 :
00052     public Map<label>
00053 {
00054     // Private data
00055 
00056         scalar binWidth_;
00057 
00058 
00059 public:
00060 
00061     // Constructors
00062 
00063         //- Construct null
00064         distribution();
00065 
00066         //- Construct from binWidth
00067         distribution(const scalar binWidth);
00068 
00069         //- Construct as copy
00070         distribution(const distribution&);
00071 
00072 
00073     // Destructor
00074 
00075         ~distribution();
00076 
00077 
00078     // Member Functions
00079 
00080         label totalEntries() const;
00081 
00082         scalar approxTotalEntries() const;
00083 
00084         scalar mean() const;
00085 
00086         scalar median();
00087 
00088         //- Add a value to the appropriate bin of the distribution.
00089         void add(const scalar valueToAdd);
00090 
00091         void add(const label valueToAdd);
00092 
00093         void insertMissingKeys();
00094 
00095         List<Pair<scalar> > normalised();
00096 
00097         List<Pair<scalar> > normalisedMinusMean();
00098 
00099         List<Pair<scalar> > normalisedShifted(const scalar shiftValue);
00100 
00101         List<Pair<scalar> > raw();
00102 
00103 
00104         // Access
00105 
00106             inline scalar binWidth() const;
00107 
00108 
00109     // Member Operators
00110 
00111         void operator=(const distribution&);
00112 
00113 
00114     // IOstream Operators
00115 
00116         friend Ostream& operator<<(Ostream&, const distribution&);
00117 };
00118 
00119 
00120 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00121 
00122 } // End namespace Foam
00123 
00124 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00125 
00126 #include "distributionI.H"
00127 
00128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00129 
00130 #endif
00131 
00132 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines