-
Notifications
You must be signed in to change notification settings - Fork 0
/
task.h
65 lines (54 loc) · 1.95 KB
/
task.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#pragma once
#include "kernels.h"
#include <string>
#include <vector>
const std::string kTaskFileDefaultName = "sample";
class Task {
private:
std::unique_ptr<Kernels> kernels_; /* birth and death parameters */
double b_; /* birth rate */
double s_; /* competition rate */
double d_; /* death rate */
double alpha_; /* closure parameters */
double beta_;
double gamma_;
int nodes_; /* iteration count */
int iter_; /* nodes count */
double radius_; /* integration limit */
double step_size_; /* step between nodes */
std::string research_name_; /* path for storing data */
public:
Task() = delete;
Task(const Task& other) = delete;
Task(Task&& other) = default;
Task& operator=(const Task& other) = delete;
Task& operator=(Task&& other) = default;
~Task() = default;
Task(const std::string& task_file_name = kTaskFileDefaultName);
static void CreateTaskFile(const std::string& task_file_name = kTaskFileDefaultName);
double m(double xi) const { return kernels_->m(xi); }
double w(double xi) const { return kernels_->w(xi); }
double b() const { return b_; }
double s() const { return s_; }
double d() const { return d_; }
double alpha() const { return alpha_; }
double beta() const { return beta_; }
double gamma() const { return gamma_; }
int nodes() const { return nodes_; }
int iter() const { return iter_; }
double radius() const { return radius_; }
double step_size() const { return step_size_; }
std::string ResearchName() const { return research_name_; }
};
struct Result {
double N;
double step_size;
int nodes;
std::vector<double> C;
void SaveToFile(std::string path_result_file);
};
class TaskFileParseException : public std::runtime_error {
public:
TaskFileParseException(const std::string& error_message) : std::runtime_error(error_message) {
}
};