summaryrefslogtreecommitdiff
path: root/src/measurements.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/measurements.cpp')
-rw-r--r--src/measurements.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/measurements.cpp b/src/measurements.cpp
index 0732d24..c58fd84 100644
--- a/src/measurements.cpp
+++ b/src/measurements.cpp
@@ -153,7 +153,8 @@ ma::ma(unsigned n, double a, double beta) :
sc(2 * n),
sa(3 * n),
sA(3 * n),
- si(10000)
+ si(10000),
+ sI(10000)
{
if (beta != 0.0) {
model_string = "fracture_" + std::to_string(n) + "_" + std::to_string(a) + "_" + std::to_string(beta) + "_";
@@ -173,7 +174,8 @@ ma::ma(unsigned Lx, unsigned Ly, double beta) :
sc(Lx * Ly / 2),
sa(Lx * Ly),
sA(Lx * Ly),
- si(10000)
+ si(10000),
+ sI(10000)
{
if (beta != 0.0) {
model_string = "fracture_" + std::to_string(Lx) + "_" + std::to_string(Ly) + "_" + std::to_string(beta) + "_";
@@ -193,6 +195,7 @@ ma::~ma() {
update_distribution_file("sa", sa, model_string);
update_distribution_file("sA", sA, model_string);
update_distribution_file("si", si, model_string);
+ update_distribution_file("sI", sI, model_string);
}
void ma::pre_fracture(const network&) {
@@ -212,8 +215,10 @@ void ma::bond_broken(const network& net, const current_info& cur, unsigned i) {
}
for (unsigned j = 0; j < cur.currents.size(); j++) {
- if (logl(cur.currents[j]) >= -100 && logl(cur.currents[j]) < 0) {
+ if (logl(cur.currents[j]) >= -100 && logl(cur.currents[j]) < 0 && (!net.backbone[j] || j == i)) {
si[(unsigned)(10000 * (logl(cur.currents[j]) + 100) / 100)]++;
+ } else if (logl(cur.currents[j]) >= -100 && logl(cur.currents[j]) < 0 && net.backbone[j] && j != i) {
+ sI[(unsigned)(10000 * (logl(cur.currents[j]) + 100) / 100)]++;
}
}
@@ -226,7 +231,13 @@ void ma::post_fracture(network &n) {
std::vector<unsigned> component(boost::num_vertices(G));
unsigned num = boost::connected_components(G, &component[0]);
if (post_cracks.size() > 2 || post_cracks.size() == 0) {
- std::cout << post_cracks.size() << "\n";
+ for (auto c : post_cracks) {
+ for (unsigned e : c.second) {
+ std::cout << e << " ";
+ }
+ std::cout << "\n";
+ }
+ getchar();
throw badcycleex;
}
for (auto c : post_cracks) {
@@ -278,6 +289,7 @@ void ma::post_fracture(network &n) {
sc[new_components[i].size() - 1]++;
}
+ /*
current_info ct = n.get_current_info();
@@ -297,6 +309,7 @@ void ma::post_fracture(network &n) {
}
sb[bb_size - 1]++;
+ */
av_it++;