-
Notifications
You must be signed in to change notification settings - Fork 1
/
node.h
58 lines (41 loc) · 1.08 KB
/
node.h
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
#include "lattice.h"
#include <iostream>
using namespace std;
class Node {
protected:
// Particle distibution functions (distros)
doubleNQ* f;
// Node Collision
// Collision* collision;
public:
Node() {
f=new doubleNQ (0.);
}
doubleNQ& getF() {return *f;}
const doubleNQ& getF() const {return *f;}
// Read-Write access
double& operator[] (const int& q){return (*f)[q];}
// Read-Only access
double const& operator[] (const int& q) const {return (*f)[q];}
// Set all distros to a number
Node& operator= (const double& rhs){
*f=rhs;
}
Node& operator= (const double rhs[]){
*f=rhs;
}
// Set node with another node
Node& operator= (const Node& rhs){
*f = *(rhs.f);
}
void mirror () {
for (int i=0;i<lattice::nQ/2;++i){
int iQ = lattice::iHalfQs[i];
std::swap((*f)[iQ],(*f)[lattice::iOpposite[iQ]]);
}
}
friend std::ostream& operator<<(std::ostream& os, const Node& node){
cout<<*(node.f);
return os;
}
};