Line data Source code
1 : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 : Copyright (c) 2015-2020 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_contour_FindContour_h 23 : #define __PLUMED_contour_FindContour_h 24 : 25 : #include "core/ActionWithVector.h" 26 : #include "ContourFindingObject.h" 27 : #include "gridtools/EvaluateGridFunction.h" 28 : #include "core/ParallelTaskManager.h" 29 : 30 : namespace PLMD { 31 : namespace contour { 32 : 33 : class FindContour : public ActionWithVector { 34 : friend class DumpContour; 35 : public: 36 : using input_type = ContourFindingObject<gridtools::EvaluateGridFunction>; 37 : using PTM = ParallelTaskManager<FindContour>; 38 : typedef typename PTM::ParallelActionsInput ParallelActionsInput; 39 : typedef typename PTM::ParallelActionsOutput ParallelActionsOutput; 40 : private: 41 : bool firststep; 42 : /// The parallel task manager 43 : PTM taskmanager; 44 : unsigned gbuffer; 45 : std::vector<unsigned> active_cells; 46 : public: 47 : static void registerKeywords( Keywords& keys ); 48 : explicit FindContour(const ActionOptions&ao); 49 : std::string getOutputComponentDescription( const std::string& cname, const Keywords& keys ) const override ; 50 : const gridtools::GridCoordinatesObject& getInputGridObject() const ; 51 : unsigned getNumberOfDerivatives() override ; 52 : void getNumberOfTasks( unsigned& ntasks ) override ; 53 : int checkTaskIsActive( const unsigned& taskno ) const override; 54 : void calculate() override; 55 : void getArgumentInputData( std::vector<double>& inputdata ) const override; 56 : static void performTask( std::size_t task_index, 57 : const ContourFindingObject<gridtools::EvaluateGridFunction>& actiondata, 58 : ParallelActionsInput& input, 59 : ParallelActionsOutput& output ); 60 : }; 61 : 62 : inline 63 235991 : const gridtools::GridCoordinatesObject& FindContour::getInputGridObject() const { 64 235991 : return taskmanager.getActionInput().function.getGridObject(); 65 : } 66 : 67 : } 68 : } 69 : #endif