seapodym-parallel
Fish dynamics models with parameter estimations
Loading...
Searching...
No Matches
TaskStepWorker.h
1#include <mpi.h>
2#include <functional>
3#include <map>
4
5#ifndef TASK_STEP_WORKER
6#define TASK_STEP_WORKER
7
16
18
19 private:
20
21 // communicator
22 MPI_Comm comm;
23
24 // task function, takes task_id, stepBeg and stepEnd as input
25 // and returns a code/result
26 std::function<void(int, int, int, MPI_Comm)> taskFunc;
27
28 // task Id to first step index map
29 std::map<int, int> stepBegMap;
30
31 // task Id to last step index + 1 map
32 std::map<int, int> stepEndMap;
33
34 // local rank;
35 int rank;
36
37 public:
38
49 TaskStepWorker(MPI_Comm comm,
50 std::function<void(int, int, int, MPI_Comm)> taskFunc,
51 const std::map<int, int>& stepBegMap,
52 const std::map<int, int>& stepEndMap);
53
57 void run() const;
58
59};
60
61#endif // TASK_STEP_WORKER
void run() const
Definition TaskStepWorker.cpp:19
TaskStepWorker(MPI_Comm comm, std::function< void(int, int, int, MPI_Comm)> taskFunc, const std::map< int, int > &stepBegMap, const std::map< int, int > &stepEndMap)
Definition TaskStepWorker.cpp:7