Line |
Branch |
Exec |
Source |
1 |
|
|
#pragma once |
2 |
|
|
|
3 |
|
|
#include "potentials.hpp" |
4 |
|
|
#include "types.hpp" |
5 |
|
|
#include <vector> |
6 |
|
|
|
7 |
|
|
class System; |
8 |
|
|
struct Particle; |
9 |
|
|
|
10 |
|
✗ |
class Analyzer { |
11 |
|
|
public: |
12 |
|
✗ |
virtual ~Analyzer() = default; |
13 |
|
|
virtual void update() = 0; |
14 |
|
|
}; |
15 |
|
|
|
16 |
|
|
class Clusterer : public PairFunction { |
17 |
|
|
public: |
18 |
|
|
std::vector<Particle> &particles; |
19 |
|
|
Vec L; |
20 |
|
|
double cutoff; |
21 |
|
|
double cutoffsq; |
22 |
|
|
std::vector<int> particle2Coordination; |
23 |
|
|
std::vector<int> particle2Cluster; |
24 |
|
|
std::map<int, std::list<int>> cluster2Particles; |
25 |
|
|
|
26 |
|
|
Clusterer(std::vector<Particle> &particles, const Vec &L, double cutoff); |
27 |
|
|
void reset(); |
28 |
|
|
void sortClusters(); |
29 |
|
|
double operator()(Particle &p1, Particle &p2); |
30 |
|
|
}; |
31 |
|
|
|
32 |
|
|
class PercolationAnalyzer : public Analyzer { |
33 |
|
|
public: |
34 |
|
|
System *system; |
35 |
|
|
double tLast; |
36 |
|
|
Clusterer clusterer; |
37 |
|
|
int numClusters; |
38 |
|
|
std::vector<int> coordinationCount; |
39 |
|
|
std::vector<int> clusterSizeCount; |
40 |
|
|
int clusterSizeMax; |
41 |
|
|
|
42 |
|
|
PercolationAnalyzer(System *system); |
43 |
|
|
void update(); |
44 |
|
|
}; |
45 |
|
|
|
46 |
|
|
class AnalyzerFactory { |
47 |
|
|
public: |
48 |
|
|
static Analyzer *create(System *system, const std::string &key); |
49 |
|
|
}; |
50 |
|
|
|