summaryrefslogtreecommitdiff
path: root/src/measurements.hpp
blob: 817481b67692e03a5d59a8a6e972f1cffbaadd42 (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

#include <vector>
#include <algorithm>
#include <cmath>
#include <list>
#include <fstream>
#include <string>
#include <cinttypes>
#include <sstream>

#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/connected_components.hpp>

#include <fftw3.h>

#include <network.hpp>
#include <hooks.hpp>

class ma : public hooks {
  // need:
  //  - measurements for correlation functions (nice looking?)
  //  - interface for reading and writing from files (nice looking?)
  //  - 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;
    boost::adjacency_list <boost::listS, boost::vecS, boost::undirectedS> G;

  public:
    unsigned int N;
    unsigned int L;
    unsigned int as;
    double lv;
    double beta;


    std::vector<unsigned int> ad;
    std::vector<unsigned int> cd;
    std::vector<unsigned int> bin_counts;
    std::list<std::list<unsigned int>> avalanches;;

    ma(unsigned int N, unsigned int L, double beta);
    ~ma();

    void pre_fracture(const network &) override;
    void bond_broken(const network& net, const std::pair<double, std::vector<double>>& cur, unsigned int i) override;
    void post_fracture(network &n) override;
};