Line data Source code
1 : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 : Copyright (c) 2015-2018 The plumed team
3 : (see the PEOPLE file at the root of the distribution for a list of names)
4 :
5 : See http://www.plumed.org for more information.
6 :
7 : This file is part of plumed, version 2.
8 :
9 : plumed is free software: you can redistribute it and/or modify
10 : it under the terms of the GNU Lesser General Public License as published by
11 : the Free Software Foundation, either version 3 of the License, or
12 : (at your option) any later version.
13 :
14 : plumed is distributed in the hope that it will be useful,
15 : but WITHOUT ANY WARRANTY; without even the implied warranty of
16 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 : GNU Lesser General Public License for more details.
18 :
19 : You should have received a copy of the GNU Lesser General Public License
20 : along with plumed. If not, see <http://www.gnu.org/licenses/>.
21 : +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
22 : #ifndef __PLUMED_gridtools_HistogramOnGrid_h
23 : #define __PLUMED_gridtools_HistogramOnGrid_h
24 :
25 : #include "GridVessel.h"
26 :
27 : namespace PLMD {
28 :
29 : class KernelFunctions;
30 :
31 : namespace gridtools {
32 :
33 48 : class HistogramOnGrid : public GridVessel {
34 : private:
35 : unsigned neigh_tot;
36 : bool addOneKernelAtATime;
37 : std::string kerneltype;
38 : std::vector<double> bandwidths;
39 : std::vector<unsigned> nneigh;
40 : protected:
41 : bool discrete;
42 : public:
43 : static void registerKeywords( Keywords& keys );
44 : explicit HistogramOnGrid( const vesselbase::VesselOptions& da );
45 : void setBounds( const std::vector<std::string>& smin, const std::vector<std::string>& smax,
46 : const std::vector<unsigned>& nbins, const std::vector<double>& spacing );
47 : void calculate( const unsigned& current, MultiValue& myvals, std::vector<double>& buffer, std::vector<unsigned>& der_list ) const ;
48 : void finish( const std::vector<double>& buffer );
49 : virtual void accumulate( const unsigned& ipoint, const double& weight, const double& dens, const std::vector<double>& der, std::vector<double>& buffer ) const ;
50 : unsigned getNumberOfBufferPoints() const ;
51 : KernelFunctions* getKernelAndNeighbors( std::vector<double>& point, unsigned& num_neigh, std::vector<unsigned>& neighbors ) const;
52 : std::vector<Value*> getVectorOfValues() const ;
53 16 : void addOneKernelEachTimeOnly() { addOneKernelAtATime=true; }
54 : bool noDiscreteKernels() const ;
55 : };
56 :
57 : inline
58 75 : unsigned HistogramOnGrid::getNumberOfBufferPoints() const {
59 75 : if( addOneKernelAtATime ) return neigh_tot;
60 59 : return GridVessel::getNumberOfBufferPoints();
61 : }
62 :
63 : }
64 : }
65 : #endif
|