Pteros  2.0
Molecular modeling library for human beings!
trajectory_processor.h
1 /*
2  *
3  * This source code is part of
4  * ******************
5  * *** Pteros ***
6  * ******************
7  * molecular modeling library
8  *
9  * Copyright (c) 2009-2013, Semen Yesylevskyy
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of Artistic License:
13  *
14  * Please note, that Artistic License is slightly more restrictive
15  * then GPL license in terms of distributing the modified versions
16  * of this software (they should be approved first).
17  * Read http://www.opensource.org/licenses/artistic-license-2.0.php
18  * for details. Such license fits scientific software better then
19  * GPL because it prevents the distribution of bugged derivatives.
20  *
21 */
22 
23 
24 #ifndef TRAJECTORY_PROCESSOR_H
25 #define TRAJECTORY_PROCESSOR_H
26 
27 #include <string>
28 #include "pteros/core/selection.h"
29 #include "pteros/analysis/options.h"
30 #include "pteros/analysis/consumer_base.h"
31 
32 namespace pteros {
33 
34 typedef std::shared_ptr<Frame> Frame_ptr;
35 typedef Message_channel<std::shared_ptr<Data_container> > Data_channel;
36 
44  friend class Consumer_base;
45  public:
46 
51  options = opt;
52  }
54  virtual ~Trajectory_processor();
55 
57  void set_options(const Options& opt){
58  options = opt;
59  }
60 
62  virtual void run();
63 
65  std::string help();
66 
67  protected:
68  // Options
69  Options options;
70 
71  int log_interval;
72 
73  bool is_frame_valid(int fr, float t);
74  bool is_end_of_interval(int fr, float t);
75 
76  std::vector<Consumer_base*> consumers;
77 
78  void add_consumer(Consumer_base* p);
79 
81  int first_frame, last_frame;
82  float first_time, last_time;
83  int skip;
84 
85  float custom_start_time;
86  float custom_dt;
87 
88  void reader_thread_body(Data_channel& channel);
89  std::vector<std::string> traj_files;
90 };
91 
92 }
93 #endif
94 
std::string help()
Print summary of allowed options.
Definition: trajectory_processor.cpp:41
Pteros namespace.
Definition: options.cpp:32
The base class for trajectory processing It provides facilities for loading large trajectories by fra...
Definition: trajectory_processor.h:43
virtual void run()
Do computation.
Definition: trajectory_processor.cpp:162
void set_options(const Options &opt)
Pass options.
Definition: trajectory_processor.h:57
Trajectory_processor(const Options &opt)
Constructor with options.
Definition: trajectory_processor.h:50
All options obtained from command line including nested options for tasks.
Definition: options.h:75
Base class for asynchronous data analysis.
Definition: consumer_base.h:55
virtual ~Trajectory_processor()
Destructor.
Definition: trajectory_processor.cpp:38
Trajectory_processor()
Default constructor.
Definition: trajectory_processor.h:48