Greens-code
A modular quantum transport code
executable.hpp
1 #ifndef EXECUTABLE_OBJECT_HPP
2 #define EXECUTABLE_OBJECT_HPP
3 
4 #include "parallel.hpp"
5 #include "input_file.hpp"
6 #include <vector>
7 #include <list>
8 
17 public:
18  typedef STD_TR1::shared_ptr< executable_Object > ref;
19 
20  ~executable_Object() throw() {};
21 
22 // Prepare for up to N calls to perform, where reinitialize_param (see below)
23 // will be called after each run
24 // Due to parallelization, not all N calls might be done by this thread
25  void setup_data( const std::string& f, size_t n );
26 // reinit all dependencies on the param param_name (e.g. EF). This
27 // The new value of the param will be set beforehand with set_param
28  void reinitialize_param(const std::string& param_name)
29  { reinit_param(param_name);};
30 // Do one run
31  void perform( MPI_Comm comm, size_t rd );
32 // Post-Process data, close files etc, after the N runs. Communicator will be global
33 // communicator of all the processes
34  void post_process( MPI_Comm comm, const std::vector<int>& thread_ids ){
35  thread_ids_=&thread_ids;
36  post_process_(comm);};
37 
38 // Set up, do one run, and post_process
39  void perform( MPI_Comm comm, const std::string& f);
40 
41 protected:
42 
43  // get filen from xml
44  const std::string& get_filen() const { return filen;};
45  // get filen plus run_id
46  std::string get_id_filen() const;
47  size_t get_run_id() const { return run_id;};
48  size_t get_N() const { return N;};
49 
50  int get_thread_id(int i) const { return (*thread_ids_)[i];};
51 
52 private:
53  const std::vector<int>* thread_ids_;
54 
55  std::string filen;
56  size_t run_id;
57  size_t N;
58 
59  virtual void setup_data_() D_ABSTRACT(setup_data);
60 
61  virtual void reinit_param(const std::string& param_name) D_ABSTRACT(reinit_param);
62  virtual void perform_(MPI_Comm comm) D_ABSTRACT(perform);
63 
64  virtual void post_process_(MPI_Comm comm) D_ABSTRACT(post_process);
65 };
66 
67 class message;
68 
69 #endif
Definition: messages.hpp:15
An abstract base class supporting xml_file_reading of input parameters.
Definition: input_file.hpp:79
Definition: executable.hpp:16