LCOV - code coverage report
Current view: top level - core - ActionShortcut.cpp (source / functions) Hit Total Coverage
Test: plumed test coverage Lines: 21 27 77.8 %
Date: 2024-10-11 08:09:47 Functions: 4 6 66.7 %

          Line data    Source code
       1             : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
       2             :    Copyright (c) 2018-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             : #include "ActionShortcut.h"
      23             : #include "PlumedMain.h"
      24             : #include "ActionSet.h"
      25             : 
      26             : namespace PLMD {
      27             : 
      28          15 : void ActionShortcut::registerKeywords( Keywords& keys ) {
      29          15 :   Action::registerKeywords( keys );
      30          30 :   keys.add("hidden","IS_SHORTCUT","hidden keyword to tell if actions are shortcuts so that example generator can provide expansions of shortcuts");
      31          15 : }
      32             : 
      33          12 : ActionShortcut::ActionShortcut(const ActionOptions&ao):
      34             :   Action(ao),
      35          12 :   shortcutlabel(label)
      36             : {
      37          12 :   std::string s; Tools::convert(plumed.getActionSet().size(),s);
      38          12 :   if( shortcutlabel==("@" + s) ) {
      39           6 :     std::string t; Tools::convert(plumed.getActionSet().size()+1,t);
      40          12 :     shortcutlabel="@" + t;
      41          12 :   } else label = ("@" + s);
      42          12 : }
      43             : 
      44          36 : void ActionShortcut::readInputLine( const std::string& input ) {
      45          36 :   std::string f_input = input; savedInputLines.push_back( input );
      46          36 :   if( update_from!=std::numeric_limits<double>::max() ) {
      47           0 :     std::string ufrom; Tools::convert( update_from, ufrom ); f_input += " UPDATE_FROM=" + ufrom;
      48             :   }
      49          36 :   if( update_until!=std::numeric_limits<double>::max() ) {
      50           0 :     std::string util; Tools::convert( update_until, util ); f_input += " UPDATE_UNTIL=" + util;
      51             :   }
      52          72 :   if( keywords.exists("RESTART") ) {
      53           0 :     if( restart ) f_input += " RESTART=YES";
      54           0 :     if( !restart ) f_input += " RESTART=NO";
      55             :   }
      56          36 :   plumed.readInputLine( f_input );
      57          36 : }
      58             : 
      59          54 : const std::string & ActionShortcut::getShortcutLabel() const {
      60          54 :   return shortcutlabel;
      61             : }
      62             : 
      63           0 : std::vector<std::string> ActionShortcut::getSavedInputLines() const {
      64           0 :   return savedInputLines;
      65             : }
      66             : 
      67             : }

Generated by: LCOV version 1.15