Line data Source code
1 : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 : Copyright (c) 2017-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 : #ifndef __PLUMED_core_ActionToGetData_h 23 : #define __PLUMED_core_ActionToGetData_h 24 : 25 : #include "ActionWithArguments.h" 26 : #include "ActionPilot.h" 27 : #include "DataPassingObject.h" 28 : 29 : namespace PLMD { 30 : 31 : class ActionToGetData : 32 : public ActionPilot, 33 : public ActionWithArguments 34 : { 35 : private: 36 : /// What do you want to collect to pass back to python 37 : enum {val,deriv,force} gtype; 38 : /// This holds the pointer that we are setting 39 : std::unique_ptr<DataPassingObject> mydata; 40 : /// This temporarily holds the data so it can be passed out 41 : std::vector<double> data; 42 : public: 43 : static void registerKeywords(Keywords& keys); 44 : explicit ActionToGetData(const ActionOptions&ao); 45 : /// Get the rank of the output 46 : void get_rank( const TypesafePtr & rank ); 47 : /// Get the shape of the output 48 : void get_shape( const TypesafePtr & dims ); 49 : /// Set the memory that holds the output 50 : void set_memory( const TypesafePtr & val ); 51 : /// Actually set the values for the output 52 : void calculate(); 53 12437 : void apply() {} 54 0 : ActionToGetData* castToActionToGetData() noexcept final { return this; } 55 : }; 56 : 57 : } 58 : #endif