std::fclose(file);
}
-int dive_in(std::vector< std::vector< std::pair< int, int > > > graph, int start, int steps, int frames, int depth, int depth_go, std::vector< std::pair< int, int > > path)
-{
- int steps_old = 0, steps_new = 0;
- if (depth > frames) {
- return steps;
- }
- bool flag = true;
- for (int i = 0; i < path.size(); i++) {
- if (path[i].first == start) {
- flag = false;
- }
- }
- if (flag) {
- path.push_back(std::make_pair(start, depth_go));
- }
- for (int i = 0; i < graph[start].size(); i++) {
- flag = true;
- for (int j = 0; j < path.size(); j++) {
- if (path[j].first == graph[start][i].first) {
- flag = false;
- }
- }
- if (flag) {
- steps_new = dive_in(graph, graph[start][i].first, steps + 1, frames, depth + graph[start][i].second, graph[start][i].second, path);
- if (steps_old < steps_new) {
- steps_old = steps_new;
- }
- }
- }
- return (std::max(steps_old, steps));
-}
-
-bool mysortfunc (std::vector<int> a, std::vector<int> b) { return (a.size() > b.size()); }
+//template < typename T >
+bool mysortfunc (std::vector< int > a, std::vector< int > b) { return (a.size() > b.size()); }
/*! \brief
* Class used to compute free volume in a simulations box.
std::cout << "\n" ;
std::cout << "printing correlation's file\n" ;
- make_correlation_file(crltns, "corrs_vectors.txt", m);
- make_correlation_file(crltns_scalars, "corrs_vectors_scalars.txt", m);
- make_correlation_file(crltns_mini, "corrs_mini_vectors.txt", m);
+ //make_correlation_file(crltns, "corrs_vectors.txt", m);
+ //make_correlation_file(crltns_scalars, "corrs_vectors_scalars.txt", m);
+ //make_correlation_file(crltns_mini, "corrs_mini_vectors.txt", m);
std::cout << "done\n" ;
for (int i1 = 0; i1 < 100; i1++) {
std::cout << "\n\n";
- std::vector< std::vector< int > > graph;
+ std::vector< std::vector< int > > graph, graph_tau;
graph.resize(index.size());
+ graph_tau.resize(index.size());
+
for (int i = 1; i <= k; i++) {
for (int j = 0; j < index.size(); j++) {
- for (int f = j; f < index.size(); f++) {
+ for (int f = 0; f < index.size(); f++) {
if (std::abs(crltns[i][j][f]) >= crl_border) {
bool local_flag = true;
for (int f2 = 0; f2 < graph[j].size(); f2++) {
}
if (local_flag) {
graph[j].push_back(f);
+ graph_tau[j].push_back(i);
}
}
}
}*/
std::cout << "\n";
- std::vector< std::vector < int > > rout_old, rout_new;
+ std::vector< std::vector < int > > rout_old, rout_new, rout_out;
bool flag = true;
rout_new.resize(0);
rout_old.resize(index.size());
std::sort(rout_old.begin(), rout_old.end(), mysortfunc);
- std::cout << "\nfinished routs\n\n" ;
-
- /*graph.resize(0);
- graph.resize(index.size());
- rout_new.resize(0);
-
- for (int i = 0; i < rout_old.size(); i++) {
- int lflag2 = false;
- for (int j = 0; j < rout_old[i].size() - 1; j++) {
- int lflag1 = true;
- for (int f = 0; f < graph[rout_old[i][j]].size(); f++) {
- if (graph[rout_old[i][j]][f] == rout_old[i][j + 1]) {
- lflag1 = false;
- }
- }
- if (lflag1) {
- graph[rout_old[i][j]].push_back(rout_old[i][j + 1]);
- lflag2 = true;
- }
- }
- if (lflag2) {
- rout_new.push_back(rout_old[i]);
- }
- }*/
-
-
- /*std::cout << "\n test old \n";
- for (int i = 0; i < rout_old.size(); i++) {
- for (int j = 0; j < rout_old[i].size(); j++) {
- std::cout << index[rout_old[i][j]] << " ";
- }
- std::cout << "\n";
+ rout_out = rout_old;
+ for (int i = 0; i < rout_out.size(); i++) {
+ std::sort(rout_out[i].begin(), rout_out[i].end());
}
- std::cout << "\n test new \n";*/
+ std::cout << "\nfinished routs\n\n" ;
rout_new.resize(0);
for (int i = rout_old.size() - 1; i >= 0; i--) {
bool lflag1 = true;
for (int j = 0; j < i; j++) {
if (rout_old[i].size() < rout_old[j].size()) {
- int la = 0;
+ int la = 0/*, lb1 = 0, lb2 = 0*/;
for (int f = 0; f < rout_old[j].size(); f++) {
- if (rout_old[j][f] == rout_old[i][la]) {
+ if (rout_out[j][f] == rout_out[i][la]) {
la++;
+ /*if (la < rout_old[i].size()) {
+ lb1 += rout_old[i][la];
+ }*/
}
+ /*if (la > 0 && la < rout_old[i].size() && f + 1 < rout_old[j].size()) {
+ lb2 += rout_old[j][f + 1];
+ }*/
}
- if (la == rout_old[i].size()) {
+ if (la == rout_out[i].size() /*&& lb1 >= lb2*/) {
lflag1 = false;
}
}
make_rout_file(crl_border, index, rout_new, "routs.txt");
- /*for (int i = 0; i < rout_new.size(); i++) {
- for (int j = 0; j < rout_new[i].size(); j++) {
- std::cout << index[rout_new[i][j]] << " ";
- }
- std::cout << "\n";
- }*/
-
std::cout << "\n\n\n job done \n\n\n";
}