-
Notifications
You must be signed in to change notification settings - Fork 16
/
test.cpp
42 lines (36 loc) · 1.24 KB
/
test.cpp
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
#include "voro++.hh"
#include <iostream>
using namespace voro;
using namespace std;
const int particles=20;
double rnd() {return double(rand())/RAND_MAX;}
int main(){
int i;
int id,nx,ny,nz;
double x,y,z,r,rx,ry,rz;
vector<int> neigh,f_vert;
vector<double> face;
voronoicell_neighbor c;
// Create a container with the geometry given above, and make it
// non-periodic in each of the three coordinates. Allocate space for
// eight particles within each computational block
pre_container pcon(0,1,0,1,0,1,true,true,true,8);
container con(0,1,0,1,0,1,5,5,5,true,true,true,8);
// Randomly add particles into the container
for(i=0;i<particles;i++) {
x=rnd();
y=rnd();
z=rnd();
con.put(i+100,x,y,z);
}
//con.compute_all_cells();
c_loop_all cl(con);
if (cl.start()) do if(con.compute_cell(c,cl)) {
cl.pos(x,y,z);id=cl.pid();
int a=1;
c.face_areas(face);
c.neighbors(neigh);
cout<<face[0]<<endl;
cout<<neigh[0]<<endl;
} while (cl.inc());
}