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 : private: 39 : bool firststep; 40 : /// The parallel task manager 41 : PTM taskmanager; 42 : unsigned gbuffer; 43 : std::vector<unsigned> active_cells; 44 : public: 45 : static void registerKeywords( Keywords& keys ); 46 : explicit FindContour(const ActionOptions&ao); 47 : std::string getOutputComponentDescription( const std::string& cname, const Keywords& keys ) const override ; 48 : const gridtools::GridCoordinatesObject& getInputGridObject() const ; 49 : unsigned getNumberOfDerivatives() override ; 50 : void getNumberOfTasks( unsigned& ntasks ) override ; 51 : int checkTaskIsActive( const unsigned& taskno ) const override; 52 : void calculate() override; 53 : void getInputData( std::vector<double>& inputdata ) const override; 54 : static void performTask( std::size_t task_index, 55 : const ContourFindingObject<gridtools::EvaluateGridFunction>& actiondata, 56 : ParallelActionsInput& input, 57 : ParallelActionsOutput& output ); 58 : }; 59 : 60 : inline 61 235991 : const gridtools::GridCoordinatesObject& FindContour::getInputGridObject() const { 62 235991 : return taskmanager.getActionInput().function.getGridObject(); 63 : } 64 : 65 : } 66 : } 67 : #endif