Strip extra spaces from code.
[voro++.git] / branches / 2d / boundary / voro++_test1.cc
blobab84c15cfe057ba74482ab7895b18a8eab1c5a9d
1 #include "voro++_2d.hh"
4 using namespace voro;
5 #include <stdio.h>
6 #include <iostream>
7 #include <vector>
8 using namespace std;
9 /*
10 void add_memory_array(double* &old,int size){
11 double *newa= new double[2*size];
12 for(int i=0;i<(size);i++){
13 newa[9-i]=old[i];
15 delete [] old;
16 old=newa;
17 }*/
19 int main(int argc,char **argv){
21 v_connect connect;
22 char *outfn;
24 FILE *fp=fopen(argv[1],"r");
25 connect.import(fp);
26 connect.assemble_vertex();
27 connect.assemble_gen_ed();
28 connect.assemble_boundary();
29 // connect.lloyds(.0001);
31 outfn=new char[1000];
32 sprintf(outfn,"%s.gv",argv[1]);
33 connect.draw_vtg_gnu(outfn);
34 delete [] outfn;
36 outfn=new char[1000];
37 sprintf(outfn,"%s.vertlabel",argv[1]);
38 connect.label_vertices(outfn);
39 delete [] outfn;
41 outfn=new char[1000];
42 sprintf(outfn,"%s.genlabel",argv[1]);
43 connect.label_generators(outfn);
44 delete [] outfn;
46 outfn=new char[1000];
47 sprintf(outfn,"%s.edlabel",argv[1]);
48 connect.label_edges(outfn);
49 delete [] outfn;
51 outfn=new char[1000];
52 sprintf(outfn,"%s.neighbors",argv[1]);
53 connect.draw_gen_gen(outfn);
54 delete [] outfn;
56 outfn=new char[1000];
57 sprintf(outfn,"%s.gen_to_ed_table",argv[1]);
58 connect.print_gen_to_ed_table(outfn);
59 delete outfn;
61 outfn=new char[1000];
62 sprintf(outfn,"%s.gen_to_vert_table",argv[1]);
63 connect.print_gen_to_vert_table(outfn);
64 delete [] outfn;
66 outfn=new char[1000];
67 sprintf(outfn,"%s.vert_to_gen_table",argv[1]);
68 connect.print_vert_to_gen_table(outfn);
69 delete [] outfn;
71 outfn=new char[1000];
72 sprintf(outfn,"%s.ed_to_gen_table",argv[1]);
73 connect.print_ed_to_gen_table(outfn);
74 delete []outfn;
76 outfn=new char[1000];
77 sprintf(outfn,"%s.vert_to_ed_table",argv[1]);
78 connect.print_vert_to_ed_table(outfn);
79 delete [] outfn;
81 outfn=new char[1000];
82 sprintf(outfn,"%s.vert_boundary_table",argv[1]);
83 connect.print_vert_boundary(outfn);
84 delete [] outfn;
86 outfn=new char[1000];
87 sprintf(outfn,"%s.ed_boundary_table",argv[1]);
88 connect.print_ed_boundary(outfn);
89 delete [] outfn;
91 outfn=new char[1000];
92 sprintf(outfn,"%s.gnu",argv[1]);
93 connect.draw_gnu(outfn);
94 delete [] outfn;
96 outfn=new char[1000];
97 sprintf(outfn,"%s.centroidlabel",argv[1]);
98 connect.label_centroids(outfn);
99 delete [] outfn;
101 outfn=new char[1000];
102 sprintf(outfn,"%s.dualmesh",argv[1]);
103 connect.draw_median_mesh(outfn);
104 delete [] outfn;
106 outfn=new char[1000];
107 sprintf(outfn,"%s.ascii",argv[1]);
108 connect.ascii_output(outfn);
109 delete [] outfn;
111 if(argc==4){
112 double x=atof(argv[2]);
113 double y=atof(argv[3]);
114 outfn=new char[1000];
115 sprintf(outfn,"%s.closest",argv[1]);
116 connect.draw_closest_generator(outfn,x,y);
117 delete [] outfn;
120 double *test=new double[10];
121 for(int i=0;i<10;i++){
122 test[i]=i;
124 for(int i=0;i<10;i++){
125 cout << test[i] << endl;
127 cout << "\n\n\n" << endl;
128 add_memory_array(test,10);
129 for(int i=0;i<20;i++){
130 cout << test[i] << endl;