-
Notifications
You must be signed in to change notification settings - Fork 24
/
computation.h
105 lines (85 loc) · 3.27 KB
/
computation.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/**********************************************************************
Copyright 2014-2016 The RIVET Developers. See the COPYRIGHT file at
the top-level directory of this distribution.
This file is part of RIVET.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
**********************************************************************/
#pragma once
#include "dcel/barcode_template.h"
#include "dcel/dcel.h"
#include "interface/input_manager.h"
#include "interface/data_reader.h"
#include "interface/input_parameters.h"
#include "math/bifiltration_data.h"
#include "math/firep.h"
#include "math/template_point.h"
#include "numerics.h"
#include "boost/multi_array.hpp"
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/signals2.hpp>
#include <interface/progress.h>
#include <vector>
class Presentation;
class MultiBetti;
//TODO: Remove either this or InputData, since there's no need for both anymore now that RIVET_0 files aren't supported.
class ComputationInput {
protected:
InputData data;
public:
std::vector<exact> x_exact;
std::vector<exact> y_exact;
std::string x_label;
std::string y_label;
bool x_reverse;
bool y_reverse;
BifiltrationData& bifiltration()
{
return *(data.bifiltration_data);
}
FIRep& rep()
{
return *(data.free_implicit_rep);
}
ComputationInput(InputData data)
: data(data)
, x_exact(data.x_exact)
, y_exact(data.y_exact)
, x_label(data.x_label)
, y_label(data.y_label)
, x_reverse(data.x_reverse)
, y_reverse(data.y_reverse)
{
}
};
struct ComputationResult {
unsigned_matrix homology_dimensions;
std::vector<TemplatePoint> template_points;
std::shared_ptr<Arrangement> arrangement;
//std::shared_ptr<FIRep> bifiltration;
};
class Computation {
public:
//TODO: these signals are a little strange. It would be better to do away
//with these, and to factor Computation::compute_raw into several functions
//that can be called separately depending on the arguments to rivet_console.
boost::signals2::signal<void(std::shared_ptr<Arrangement>)> arrangement_ready;
boost::signals2::signal<void(TemplatePointsMessage)> template_points_ready;
boost::signals2::signal<void(const Presentation&)> minpres_ready;
Computation(int vrbsty, Progress& progress);
~Computation();
std::unique_ptr<ComputationResult> compute(InputData data, bool koszul);
private:
Progress& progress;
const int verbosity;
std::unique_ptr<ComputationResult> compute_raw(ComputationInput& input, bool koszul);
void compute_min_pres_and_betti_nums(ComputationInput& input, MultiBetti& mb, Presentation& pres, std::unique_ptr<ComputationResult>& result);
};