LCOV - code coverage report
Current view: top level - gridtools - HistogramOnGrid.h (source / functions) Hit Total Coverage
Test: plumed test coverage Lines: 4 4 100.0 %
Date: 2024-10-11 08:09:47 Functions: 1 1 100.0 %

          Line data    Source code
       1             : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
       2             :    Copyright (c) 2015-2023 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             : #include <memory>
      27             : 
      28             : namespace PLMD {
      29             : 
      30             : class KernelFunctions;
      31             : 
      32             : namespace gridtools {
      33             : 
      34             : class HistogramOnGrid : public GridVessel {
      35             : private:
      36             :   unsigned neigh_tot;
      37             :   bool addOneKernelAtATime;
      38             :   std::string kerneltype;
      39             :   std::vector<double> bandwidths;
      40             :   std::vector<unsigned> nneigh;
      41             : protected:
      42             :   bool discrete;
      43             : public:
      44             :   double  von_misses_norm;
      45             :   double von_misses_concentration;
      46             :   static void registerKeywords( Keywords& keys );
      47             :   explicit HistogramOnGrid( const vesselbase::VesselOptions& da );
      48             :   void setBounds( const std::vector<std::string>& smin, const std::vector<std::string>& smax,
      49             :                   const std::vector<unsigned>& nbins, const std::vector<double>& spacing ) override;
      50             :   void calculate( const unsigned& current, MultiValue& myvals, std::vector<double>& buffer, std::vector<unsigned>& der_list ) const override;
      51             :   void finish( const std::vector<double>& buffer ) override;
      52             :   virtual void accumulate( const unsigned& ipoint, const double& weight, const double& dens, const std::vector<double>& der, std::vector<double>& buffer ) const ;
      53             :   virtual void accumulateForce( const unsigned& ipoint, const double& weight, const std::vector<double>& der, std::vector<double>& intforce ) const ;
      54             :   unsigned getNumberOfBufferPoints() const override;
      55             :   std::unique_ptr<KernelFunctions> getKernelAndNeighbors( std::vector<double>& point, unsigned& num_neigh, std::vector<unsigned>& neighbors ) const;
      56             :   std::vector<std::unique_ptr<Value>> getVectorOfValues() const ;
      57          19 :   void addOneKernelEachTimeOnly() { addOneKernelAtATime=true; }
      58             :   void getFinalForces( const std::vector<double>& buffer, std::vector<double>& finalForces ) override;
      59             :   bool noDiscreteKernels() const ;
      60             :   double getFibonacciCutoff() const override;
      61             : };
      62             : 
      63             : inline
      64         269 : unsigned HistogramOnGrid::getNumberOfBufferPoints() const {
      65         269 :   if( addOneKernelAtATime ) return neigh_tot;
      66         250 :   return GridVessel::getNumberOfBufferPoints();
      67             : }
      68             : 
      69             : }
      70             : }
      71             : #endif

Generated by: LCOV version 1.15