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

          Line data    Source code
       1             : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
       2             :    Copyright (c) 2011-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_function_Function_h
      23             : #define __PLUMED_function_Function_h
      24             : 
      25             : #include "core/ActionWithValue.h"
      26             : #include "core/ActionWithArguments.h"
      27             : #include "tools/Communicator.h"
      28             : 
      29             : namespace PLMD {
      30             : namespace function {
      31             : 
      32             : /**
      33             : \ingroup INHERIT
      34             : This is the abstract base class to use for implementing new CV function, within it there is
      35             : \ref AddingAFunction "information" as to how to go about implementing a new function.
      36             : */
      37             : 
      38             : class Function:
      39             :   public ActionWithValue,
      40             :   public ActionWithArguments
      41             : {
      42             : protected:
      43             :   void setDerivative(int,double);
      44             :   void setDerivative(Value*,int,double);
      45             :   void addValueWithDerivatives();
      46             :   void addComponentWithDerivatives( const std::string& name );
      47             : public:
      48             :   explicit Function(const ActionOptions&);
      49         950 :   virtual ~Function() {}
      50             :   void apply();
      51             :   static void registerKeywords(Keywords&);
      52             :   unsigned getNumberOfDerivatives();
      53             : };
      54             : 
      55             : inline
      56             : void Function::setDerivative(Value*v,int i,double d) {
      57        2910 :   v->addDerivative(i,d);
      58             : }
      59             : 
      60             : inline
      61             : void Function::setDerivative(int i,double d) {
      62       28989 :   setDerivative(getPntrToValue(),i,d);
      63             : }
      64             : 
      65             : inline
      66     3470859 : unsigned Function::getNumberOfDerivatives() {
      67     3470859 :   return getNumberOfArguments();
      68             : }
      69             : 
      70             : }
      71             : }
      72             : 
      73             : #endif
      74             : 

Generated by: LCOV version 1.13