LCOV - code coverage report
Current view: top level - vesselbase - ValueVessel.h (source / functions) Hit Total Coverage
Test: plumed test coverage Lines: 3 3 100.0 %
Date: 2020-11-18 11:20:57 Functions: 0 0 -

          Line data    Source code
       1             : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
       2             :    Copyright (c) 2015-2019 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_vesselbase_ValueVessel_h
      23             : #define __PLUMED_vesselbase_ValueVessel_h
      24             : 
      25             : #include <string>
      26             : #include <cstring>
      27             : #include <vector>
      28             : 
      29             : #include "Vessel.h"
      30             : #include "core/Value.h"
      31             : 
      32             : namespace PLMD {
      33             : namespace vesselbase {
      34             : 
      35             : class ValueVessel : public Vessel {
      36             : private:
      37             :   bool no_output_value;
      38             :   Value* final_value;
      39             : protected:
      40             : /// The component that is being averaged/accumulated whatever
      41             :   unsigned mycomp;
      42             : /// Set the final value
      43             :   void setOutputValue( const double& val );
      44             : public:
      45             :   static void registerKeywords( Keywords& keys );
      46             :   explicit ValueVessel( const VesselOptions& da );
      47             :   ~ValueVessel();
      48             :   std::string description();
      49             :   virtual std::string value_descriptor()=0;
      50             :   bool applyForce( std::vector<double>& forces );
      51             :   double getOutputValue() const ;
      52             :   Value* getFinalValue() const ;
      53             : };
      54             : 
      55             : inline
      56             : Value* ValueVessel::getFinalValue() const {
      57     2343325 :   return final_value;
      58             : }
      59             : 
      60             : inline
      61             : double ValueVessel::getOutputValue() const {
      62        3389 :   return final_value->get();
      63             : }
      64             : 
      65             : inline
      66             : void ValueVessel::setOutputValue( const double& val ) {
      67        2073 :   final_value->set( val );
      68             : }
      69             : 
      70             : }
      71             : }
      72             : #endif

Generated by: LCOV version 1.13