-
Notifications
You must be signed in to change notification settings - Fork 0
/
DimVecBank.cpp
100 lines (85 loc) · 2.63 KB
/
DimVecBank.cpp
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
#include "Partition.h"
#include "DimVec.h"
#include "DimVecBank.h"
#include <fstream>
using namespace std;
dim_vec_bank::dim_vec_bank(const int_partition_bank& partnBank, nat k) : thePartnBank(partnBank), K(k) {
for(nat n = 0; n <= thePartnBank.GetMaxWeight(); ++n)
push_back(dim_vec_layer(thePartnBank[n], K));
}
void dim_vec_bank::Build(dim_vec_pred pred) {
for(nat n = 1; n <= thePartnBank.GetMaxWeight(); ++n)
at(n).Build(pred);
}
void dim_vec_bank::BuildAll() {
for(nat n = 1; n <= thePartnBank.GetMaxWeight(); ++n)
at(n).BuildAll();
}
void dim_vec_bank::ComputeRootStatus() {
for(nat n = 1; n <= thePartnBank.GetMaxWeight(); ++n)
at(n).ComputeRootStatus();
}
void dim_vec_bank::ComputeRootStatusOfReducibles() {
for(nat n = 1; n <= thePartnBank.GetMaxWeight(); ++n)
at(n).ComputeRootStatusOfReducibles(*this);
}
void dim_vec_bank::ComputeEquiBrachialIndices() {
for(iterator i = begin(); i != end(); ++i)
i->ComputeEquiBrachialIndices();
}
void dim_vec_bank::ComputeDominanceStatus() {
for(iterator i = begin(); i != end(); ++i)
i->ComputeDominanceStatus();
}
void dim_vec_bank::BuildProperties() {
for(iterator i = begin(); i != end(); ++i)
i->BuildProperties();
}
void dim_vec_bank::CountReflectees() {
for(const_iterator i = begin(); i != end(); ++i)
for(dim_vec_layer::const_iterator j = i->begin(); j != i->end(); ++j)
if(j->GetReflection())
{
dim_vec_layer& layer = at(i->GetN() + j->GetChi());
layer(j->GetReflection()->GetArms()).RegisterReflectee();
}
}
nat dim_vec_bank::GetK() const { return K; }
void dim_vec_bank::Read()
{
ifstream myfile;
char filename[20] = "data/00-dimvecs.dat";
for(nat n = 0; n < size(); ++n)
{
filename[5] = (char)(n/10 + 48);
filename[6] = (char)(n%10 + 48);
myfile.open(filename, ios::in | ios::binary);
if(myfile.is_open())
{
this->at(n).Read(myfile);
myfile.close();
}
else {
cout << "Failed to open file " << filename << endl;
}
}
}
void dim_vec_bank::Write() const
{
ofstream myfile;
char filename[20] = "data/00-dimvecs.dat";
for(nat n = 0; n < size(); ++n)
{
filename[5] = (char)(n/10 + 48);
filename[6] = (char)(n%10 + 48);
myfile.open(filename, ios::out | ios::binary | ios::trunc);
if(myfile.is_open())
{
this->at(n).Write(myfile);
myfile.close();
}
else {
cout << "Failed to open file " << filename << endl;
}
}
}