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 ); 32 858 : ag = dynamic_cast<ActionWithGrid*>( (aa->getPntrToArgument(0))->getPntrToAction() ); 33 : } 34 16527 : plumed_assert( ag ); 35 16527 : return ag; 36 : } 37 : 38 1525 : void ActionWithGrid::registerKeywords( Keywords& keys ) { 39 1525 : ActionWithVector::registerKeywords( keys ); 40 1525 : } 41 : 42 772 : ActionWithGrid::ActionWithGrid(const ActionOptions&ao): 43 : Action(ao), 44 : ActionWithVector(ao), 45 772 : firststep(true) { 46 772 : } 47 : 48 10835 : void ActionWithGrid::calculate() { 49 10835 : plumed_assert( !actionInChain() ); 50 10835 : if( firststep ) { 51 753 : setupOnFirstStep( true ); 52 753 : firststep=false; 53 : } 54 : 55 10835 : runAllTasks(); 56 10835 : } 57 : 58 : } 59 : }