LCOV - code coverage report
Current view: top level - generic - Include.cpp (source / functions) Hit Total Coverage
Test: plumed test coverage Lines: 14 16 87.5 %
Date: 2018-12-19 07:49:13 Functions: 9 11 81.8 %

          Line data    Source code
       1             : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
       2             :    Copyright (c) 2012-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             : #include "core/Action.h"
      23             : #include "core/ActionRegister.h"
      24             : #include "core/PlumedMain.h"
      25             : #include "tools/Exception.h"
      26             : 
      27             : using namespace std;
      28             : 
      29             : namespace PLMD {
      30             : namespace generic {
      31             : 
      32             : //+PLUMEDOC GENERIC INCLUDE
      33             : /*
      34             : Includes an external input file, similar to "#include" in C preprocessor.
      35             : 
      36             : Useful to split very large plumed.dat files.
      37             : 
      38             : \par Examples
      39             : 
      40             : This input
      41             : \verbatim
      42             : c1: COM ATOMS=1-100
      43             : c2: COM ATOMS=101-202
      44             : d: DISTANCE ATOMS=c1,c2
      45             : PRINT ARG=d
      46             : \endverbatim
      47             : 
      48             : can be replaced with
      49             : \verbatim
      50             : INCLUDE FILE=pippo.dat
      51             : d: DISTANCE ATOMS=c1,c2
      52             : PRINT ARG=d
      53             : \endverbatim
      54             : 
      55             : where the content of file pippo.dat is
      56             : \verbatim
      57             : c1: COM ATOMS=1-100
      58             : c2: COM ATOMS=101-202
      59             : \endverbatim
      60             : 
      61             : (see also \ref COM, \ref DISTANCE, and \ref PRINT).
      62             : 
      63             : */
      64             : //+ENDPLUMEDOC
      65             : 
      66           2 : class Include :
      67             :   public Action
      68             : {
      69             : public:
      70             :   static void registerKeywords( Keywords& keys );
      71             :   explicit Include(const ActionOptions&ao);
      72           0 :   void calculate() {}
      73           0 :   void apply() {}
      74             : };
      75             : 
      76        2524 : PLUMED_REGISTER_ACTION(Include,"INCLUDE")
      77             : 
      78           2 : void Include::registerKeywords( Keywords& keys ) {
      79           2 :   Action::registerKeywords(keys);
      80           2 :   keys.add("compulsory","FILE","file to be included");
      81           2 : }
      82             : 
      83           1 : Include::Include(const ActionOptions&ao):
      84           1 :   Action(ao)
      85             : {
      86           1 :   std::string f;
      87           1 :   parse("FILE",f);
      88           1 :   checkRead();
      89           1 :   plumed.readInputFile(f);
      90           1 : }
      91             : 
      92             : }
      93        2523 : }
      94             : 

Generated by: LCOV version 1.13