Pteros  2.0
Molecular modeling library for human beings!
All Classes Functions Variables Friends Pages
task_plugin.h
1 /*
2  * This file is a part of
3  *
4  * ============================================
5  * ### Pteros molecular modeling library ###
6  * ============================================
7  *
8  * https://github.com/yesint/pteros
9  *
10  * (C) 2009-2021, Semen Yesylevskyy
11  *
12  * All works, which use Pteros, should cite the following papers:
13  *
14  * 1. Semen O. Yesylevskyy, "Pteros 2.0: Evolution of the fast parallel
15  * molecular analysis library for C++ and python",
16  * Journal of Computational Chemistry, 2015, 36(19), 1480–1488.
17  * doi: 10.1002/jcc.23943.
18  *
19  * 2. Semen O. Yesylevskyy, "Pteros: Fast and easy to use open-source C++
20  * library for molecular analysis",
21  * Journal of Computational Chemistry, 2012, 33(19), 1632–1636.
22  * doi: 10.1002/jcc.22989.
23  *
24  * This is free software distributed under Artistic License:
25  * http://www.opensource.org/licenses/artistic-license-2.0.php
26  *
27 */
28 
29 
30 #pragma once
31 
32 #include "pteros/analysis/task_base.h"
33 #include "pteros/analysis/options.h"
34 #include "pteros/analysis/jump_remover.h"
35 #include "pteros/core/pteros_error.h"
36 #include "pteros/core/logging.h"
37 
38 namespace pteros {
39 
42 
43 class TaskPlugin: public TaskBase {
44 public:
45 
46  TaskPlugin(const Options& opt): options(opt), TaskBase() { }
47  TaskPlugin(const TaskPlugin& other);
48 
49  Options options;
50  JumpRemover jump_remover;
51 
52  virtual std::string help(){ return ""; }
53 
54  TaskPlugin* clone() const override {
55  return nullptr;
56  }
57 
58 protected:
59 
60  void before_spawn_handler() override;
61  void pre_process_handler() override;
62  void process_frame_handler(const FrameInfo& info) override;
63  virtual void post_process_handler(const FrameInfo& info) override;
64 };
65 
66 }
67 
68 #define _TASK_(_name) \
69  class _name: public TaskPlugin { \
70  public: \
71  using TaskPlugin::TaskPlugin; \
72  void set_id(int _id) override {\
73  log = create_logger(fmt::format(#_name ".{}",_id)); \
74  task_id = _id; \
75  } \
76 
77 #define TASK_PARALLEL(_name) \
78  _TASK_(_name) \
79  _name* clone() const override { \
80  return new _name(*this); \
81  } \
82  protected: \
83  bool is_parallel() final { return true; }
84 
85 
86 #define TASK_SERIAL(_name) \
87  _TASK_(_name) \
88  protected: \
89  bool is_parallel() final { return false; }
90 
pteros::FrameInfo
Information about current frame, which is passed to Consumer for analysis along with the frame itself...
Definition: frame_info.h:36
pteros::Options
All options obtained from command line including nested options for tasks.
Definition: options.h:82
pteros::TaskPlugin
Base class for plugins.
Definition: task_plugin.h:43