summaryrefslogtreecommitdiff
path: root/src/measurements.hpp
blob: aa41fd11d7b3e9bf8e8f697c8215648fc5ab26ed (plain)
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

#include <cstring>
#include <fstream>
#include <string>
#include <cinttypes>
#include <sstream>
#include <functional>
#include <iostream>
#include <array>

#include <fftw3.h>

#include <hooks.hpp>

#include "analysis_tools.hpp"

class ma : public hooks {
  // need:
  //  - interface for turning on and off specific measurements
  //
  private:
    double *fftw_forward_in;
    fftw_complex *fftw_forward_out;
    fftw_complex *fftw_reverse_in;
    double *fftw_reverse_out;
    fftw_plan forward_plan;
    fftw_plan reverse_plan;
    unsigned int N;
    double Lx;
    double Ly;
    unsigned int Mx;
    unsigned int My;
    double beta;
    Graph G;
//    std::ofstream stress_file;
    
    // measurement storage
    std::vector<uint64_t> sc; // cluster size distribution
    std::vector<uint64_t> sa; // avalanche size distribution
    std::vector<uint64_t> sC; // cluster size distribution
    std::vector<uint64_t> sA; // avalanche size distribution
    std::vector<uint64_t> sd; // avalanche size distribution
    std::vector<uint64_t> sb; // bin size distribution
    std::vector<std::vector<uint64_t>> Ccc; // cluster-cluster correlations
    std::vector<std::vector<uint64_t>> Css; // surface-surface correlations
    std::vector<std::vector<uint64_t>> Cmm; // surface-surface correlations
    std::vector<std::vector<uint64_t>> Caa; // avalanche-avalanche correlations
    std::vector<std::vector<uint64_t>> Cdd; // damage-damage distribution
    std::vector<std::vector<uint64_t>> Cll; // damage-damage distribution
    std::vector<std::vector<uint64_t>> Cee; // damage-damage distribution
    uint64_t Nc;
    uint64_t NC;
    uint64_t Na;
    uint64_t NA;

  public:
    long double lv;


    std::list<std::list<unsigned int>> avalanches;

    ma(double Lx, double Ly, unsigned int Mx, unsigned int My, double beta, unsigned Ncum);
    ~ma();

    void pre_fracture(const network &) override;
    void bond_broken(const network& net, const current_info& cur, unsigned int i) override;
    void post_fracture(network &n) override;
};