Line data Source code
1 : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 : Copyright (c) 2012-2017 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 "ActionWithGrid.h" 23 : 24 : namespace PLMD { 25 : namespace gridtools { 26 : 27 16527 : ActionWithGrid* ActionWithGrid::getInputActionWithGrid( Action* action ) { 28 16527 : ActionWithGrid* ag = dynamic_cast<ActionWithGrid*>( action ); 29 17385 : if( !ag && action->getName()=="ACCUMULATE" ) { 30 858 : ActionWithArguments* aa=dynamic_cast<ActionWithArguments*>( action ); 31 858 : plumed_assert( aa ); ag = dynamic_cast<ActionWithGrid*>( (aa->getPntrToArgument(0))->getPntrToAction() ); 32 : } 33 16527 : plumed_assert( ag ); return ag; 34 : } 35 : 36 1525 : void ActionWithGrid::registerKeywords( Keywords& keys ) { 37 1525 : ActionWithVector::registerKeywords( keys ); 38 1525 : } 39 : 40 772 : ActionWithGrid::ActionWithGrid(const ActionOptions&ao): 41 : Action(ao), 42 : ActionWithVector(ao), 43 772 : firststep(true) 44 : { 45 772 : } 46 : 47 10835 : void ActionWithGrid::calculate() { 48 10835 : plumed_assert( !actionInChain() ); 49 10835 : if( firststep ) { setupOnFirstStep( true ); firststep=false; } 50 : 51 10835 : runAllTasks(); 52 10835 : } 53 : 54 : } 55 : }