-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPopulateMatrix_gnuplot.cpp
826 lines (676 loc) · 19.7 KB
/
PopulateMatrix_gnuplot.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
#include<iostream>
#include<stdio.h>
#include<omp.h>
#include<random>
#include<stdlib.h>
#include<map>
#include<fstream>
#include<string.h>
using namespace std;
//GLOBAL Variables
const int l_matrix = 100;
const int b_matrix = 100;
const int h_matrix = 100;
const int T_Div = 1200;
int Sim_Matrix[l_matrix][b_matrix][h_matrix];
int mig_index[l_matrix][b_matrix][h_matrix];
int persctr[l_matrix][b_matrix][h_matrix];
int divctr[l_matrix][b_matrix][h_matrix];
char gridsvisited[l_matrix][b_matrix][h_matrix];
int collide_persctr = 30;
int stationary_persctr = 5;
//MAPPING Mig_Index to Persistence counter
//map<int, int> m = {{1, 24}, {2, 24}, {3, 24}, {4, 24}, {5, 24}, {6, 24}, {7, 30}, {0, 5}};
int checkpersctr(int mig_dir)
{
int persctr;
switch(mig_dir)
{
case 0: persctr = 5;
break;
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:persctr = 24;
break;
case 7:persctr = 30;
break;
}
return persctr;
}
//Populate Matrices
void uniform_populateMatrix(int x, int y, int z)
{
double randc;
randc = ((double) rand()/(RAND_MAX));
//std::random_device rd;
//std::mt19937 gen(rd());
//std::uniform_real_distribution<> dis(0, 1);
//double randc = dis(gen);
//srand (time(NULL));
int migration;
if (randc>0.95)
{
migration = rand() % 6 + 1;
Sim_Matrix[x][y][z] = 1;
mig_index[x][y][z] = migration;
persctr[x][y][z] = checkpersctr(migration);
divctr[x][y][z] = T_Div;
gridsvisited[x][y][z] = 'N';
}
else
{
Sim_Matrix[x][y][z] = 0;
mig_index[x][y][z] = 0;
persctr[x][y][z] = 0;
divctr[x][y][z] = 0;
gridsvisited[x][y][z] = 'N';
}
}
void initseedontop()
{
int i, j, k;
int migration;
for (i=h_matrix-1;i>h_matrix-5;i--)
{
for (j=0;j<b_matrix;j++)
{
for (k=0; k<l_matrix; k++)
{
migration = rand()%6+1;
Sim_Matrix[k][j][i] = 1;
mig_index[k][j][i] = migration;
persctr[k][j][i] = checkpersctr(migration);
divctr[k][j][i] = T_Div;
}
}
}
}
void wound_healing(int radius)
{
int i,j,k;
int migration;
for (i=0; i<h_matrix; i++)
{
for (j=0; j<b_matrix; j++)
{
for(k=0; k<l_matrix; k++)
{
if (((j-b_matrix/2)*(j-b_matrix/2) + (k-l_matrix/2)*(k-l_matrix/2) - radius*radius)>0)
{
migration = rand()%6+1;
Sim_Matrix[k][j][i] = 1;
mig_index[k][j][i] = migration;
persctr[k][j][i] = checkpersctr(migration);
divctr[k][j][i] = T_Div;
}
}
}
}
}
void Seed_Matrix()
{
int i, j, k;
double t1, t2, el_time;
cout<<endl<<"Populating Scaffold";
t1 = clock();
//#pragma omp parallel for collapse(3)
for (i = 0; i<h_matrix; i++)
{
for (j=0;j<b_matrix; j++)
{
for (k=0;k<l_matrix; k++)
{
uniform_populateMatrix(k,j,i);
}
}
}
t2 = clock();
el_time = (t2-t1)/CLOCKS_PER_SEC;
cout<<"Time Elapsed_series"<<el_time;
}
void view_Matrix()
{
int i, j, k;
//Viewing Contents of the Matrix
cout<<endl<<"Contents of the Matrix are"<<endl;
for (i = 0; i<h_matrix; i++)
{
for (j=0;j<b_matrix; j++)
{
for (k=0;k<l_matrix; k++)
{
cout<<"SIM:"<<Sim_Matrix[k][j][i]<<" "<<"MIG_index:"<<mig_index[k][j][i]<<" "<<"Pers_ctr:"<<persctr[k][j][i]<<" ";
cout<<"DIV_ctr:"<<divctr[k][j][i]<<"Position:"<<k<<" "<<j<<" "<<i;
cout<<endl;
}
}
}
}
void change_grid_status()
{
int i, j, k;
for (i=0; i<h_matrix; i++)
{
for (j=0; j<b_matrix; j++)
{
for (k=0; k<l_matrix; k++)
{
gridsvisited[k][j][i] = 'N';
}
}
}
}
int checkcell(int k, int j, int i)
{
if (Sim_Matrix[k][j][i] == 1)
{
return 1;
}
else
{
return 0;
}
}
int checkdivctr(int k, int j, int i)
{
if (divctr[k][j][i] == 0)
{
return 0;
}
else
{
return 1;
}
}
int cell_neighbours(int k, int j, int i, int* xneighbour, int* yneighbour, int* zneighbour)
{
//int xneighbour[6], yneighbour[6], zneighbour[6];
int index = 0;
//Check if k-1 && k+1 is within matrix
if ((k-1)>=0 && (k-1)<l_matrix)
{
xneighbour[index] = k-1;
yneighbour[index] = j;
zneighbour[index] = i;
index ++;
}
if ((k+1)>=0 && (k+1)<l_matrix)
{
xneighbour[index] = k+1;
yneighbour[index] = j;
zneighbour[index] = i;
index ++;
}
if ((j-1)>=0 && (j-1)<b_matrix)
{
xneighbour[index] = k;
yneighbour[index] = j-1;
zneighbour[index] = i;
index ++;
}
if ((j+1)>=0 && (j+1)<b_matrix)
{
xneighbour[index] = k;
yneighbour[index] = j+1;
zneighbour[index] = i;
index ++;
}
if ((i-1)>=0 && (i-1)<h_matrix)
{
xneighbour[index] = k;
yneighbour[index] = j;
zneighbour[index] = i-1;
index ++;
}
if ((i+1)>=0 && (i+1)<h_matrix)
{
xneighbour[index] = k;
yneighbour[index] = j;
zneighbour[index] = i+1;
index ++;
}
return (index);
}
int cell_neighbours_empty(int* xneighbours, int* yneighbours, int* zneighbours, int num_neighbours, int* empty_x, int* empty_y, int* empty_z)
{
int i, timediv;
int mt_i = 0;
for (i = 0; i<num_neighbours; i++)
{
if (Sim_Matrix[xneighbours[i]][yneighbours[i]][zneighbours[i]] == 0)
{
empty_x[mt_i]= xneighbours[i];
empty_y[mt_i]= yneighbours[i];
empty_z[mt_i]= zneighbours[i];
mt_i ++;
}
}
return (mt_i);
}
void gridcell_stationaryphase(int k, int j, int i)
{
int timediv;
timediv = divctr[k][j][i];
Sim_Matrix[k][j][i] = 1;
mig_index[k][j][i] = 0;
persctr[k][j][i] = stationary_persctr;
}
void dividecells(int k, int j, int i)
{
int xneighbours[6], yneighbours[6], zneighbours[6];
int empty_x[6], empty_y[6], empty_z[6];
int num_neighbours, empty_num_neighbours;
int mig_old, randomposition, mig_new;
num_neighbours = cell_neighbours(k, j, i, xneighbours, yneighbours, zneighbours);
empty_num_neighbours = cell_neighbours_empty(xneighbours, yneighbours, zneighbours, num_neighbours, empty_x, empty_y, empty_z);
//cout<<"Number of empty neighbours"<<empty_num_neighbours;
//Check if there are no empty grids
if (empty_num_neighbours == 0)
{
gridcell_stationaryphase(k, j, i);
}
else
{
randomposition = rand()%empty_num_neighbours;
mig_old = rand()%6 + 1;
Sim_Matrix[k][j][i] = 1;
mig_index[k][j][i] = mig_old;
persctr[k][j][i] = checkpersctr(mig_old);
divctr[k][j][i] = T_Div;
mig_new = rand()%6 + 1;
Sim_Matrix[empty_x[randomposition]][empty_y[randomposition]][empty_z[randomposition]] = 1;
mig_index[empty_x[randomposition]][empty_y[randomposition]][empty_z[randomposition]] = mig_new;
persctr[empty_x[randomposition]][empty_y[randomposition]][empty_z[randomposition]] = checkpersctr(mig_new);
divctr[empty_x[randomposition]][empty_y[randomposition]][empty_z[randomposition]] = T_Div;
gridsvisited[empty_x[randomposition]][empty_y[randomposition]][empty_z[randomposition]] = 'Y';
}
}
int checkpersistencectr(int k, int j, int i)
{
if (persctr[k][j][i] == 0)
{
return 0;
}
else
{
return 1;
}
}
int checkmigdir(int k, int j, int i, int x_newpos, int y_newpos, int z_newpos)
{
int migdir = -1;
if (j+1 == y_newpos)
{
migdir = 1;
}
else if (k+1 == x_newpos)
{
migdir = 2;
}
else if (j-1 == y_newpos)
{
migdir = 3;
}
else if (k-1 == x_newpos)
{
migdir = 4;
}
else if (i-1 == z_newpos)
{
migdir = 5;
}
else if (i+1 == z_newpos)
{
migdir = 6;
}
return migdir;
}
void changedirofmigration(int k, int j, int i)
{
int xneighbours[6], yneighbours[6], zneighbours[6];
int empty_x[6], empty_y[6], empty_z[6];
int num_neighbours;
int migdir, tdiv;
int empty_num_neighbours, randomposition;
num_neighbours = cell_neighbours(k, j, i, xneighbours, yneighbours, zneighbours);
empty_num_neighbours = cell_neighbours_empty(xneighbours, yneighbours, zneighbours, num_neighbours, empty_x, empty_y, empty_z);
//cout<<"empty grids"<<empty_num_neighbours;
//Check if there are no empty grids
if (empty_num_neighbours == 0)
{
gridcell_stationaryphase(k, j, i);
}
else
{
randomposition = rand()%empty_num_neighbours;
migdir = checkmigdir(k,j,i,empty_x[randomposition], empty_y[randomposition], empty_z[randomposition]);
tdiv = divctr[k][j][i];
//NEW GRID CELL
Sim_Matrix[empty_x[randomposition]][empty_y[randomposition]][empty_z[randomposition]] = 1;
mig_index[empty_x[randomposition]][empty_y[randomposition]][empty_z[randomposition]] = migdir;
persctr[empty_x[randomposition]][empty_y[randomposition]][empty_z[randomposition]] = checkpersctr(migdir);
divctr[empty_x[randomposition]][empty_y[randomposition]][empty_z[randomposition]] = tdiv;
//OLD GRID CELL
Sim_Matrix[k][j][i] = 0;
mig_index[k][j][i] = 0;
persctr[k][j][i] = 0;
divctr[k][j][i] = 0;
//updating gridsvisited
gridsvisited[empty_x[randomposition]][empty_y[randomposition]][empty_z[randomposition]] = 'Y';
}
}
void next_step(int k, int j, int i, int mig_dir, int *newpos)
{
//int *newpos;
if (mig_dir == 1)
{
newpos[0] = k;
newpos[1] = j+1;
newpos[2] = i;
}
else if (mig_dir == 2)
{
newpos[0] = k+1;
newpos[1] = j;
newpos[2] = i;
}
else if (mig_dir == 3)
{
newpos[0] = k;
newpos[1] = j-1;
newpos[2] = i;
}
else if (mig_dir == 4)
{
newpos[0] = k-1;
newpos[1] = j;
newpos[2] = i;
}
else if (mig_dir == 5)
{
newpos[0] = k;
newpos[1] = j;
newpos[2] = i-1;
}
else if (mig_dir == 6)
{
newpos[0] = k;
newpos[1] = j;
newpos[2] = i+1;
}
else
{
newpos[0] = k;
newpos[1] = j;
newpos[2] = i;
}
if ((newpos[0]>=0 && newpos[0]<l_matrix) && (newpos[1]>=0 && newpos[1]<b_matrix) && (newpos[2]>=0 && newpos[2]<h_matrix))
{
//cout<<"Valid"<<endl;
//cout<<newpos[0]<<" "<<newpos[1]<<" "<<newpos[2]<<endl;
//return &newpos;
return;
}
else
{
//int *v;
newpos[0] = -1;
newpos[1] = -1;
newpos[2] = -1;
//return v;
}
}
void gridcell_collisionstate(int k, int j, int i)
{
int tdiv;
tdiv = divctr[k][j][i];
//cout<<"Inside grid-cell wa collisionstate desu"<<endl;
//cout<<m[7];
//Re-assign values
Sim_Matrix[k][j][i] = 1;
mig_index[k][j][i] = 7;
persctr[k][j][i] = collide_persctr;
//divctr[k][j][i] = tdiv;
}
void cell_migrate(int k, int j, int i)
{
int mig_dir;
int newpos[3];
int ctr_pers, tdiv;
mig_dir = mig_index[k][j][i];
//Checking if stationary/collision state
if (mig_dir == 0 || mig_dir == 7)
{
return;
}
next_step(k,j,i,mig_dir,newpos);
//Check if movement is valid
if (newpos[0] == -1)
{
gridcell_collisionstate(k,j,i);
return;
}
//Check if site is vacant
//cout<<"Oldsite"<<k<<" "<<j<<" "<<i<<"New site is"<<newpos[0]<<" "<<newpos[1]<<" "<<newpos[2]<<endl;
if (Sim_Matrix[newpos[0]][newpos[1]][newpos[2]] == 0)
{
//cout<<"Site is empty";
ctr_pers = persctr[k][j][i];
tdiv = divctr[k][j][i];
Sim_Matrix[newpos[0]][newpos[1]][newpos[2]] = 1;
mig_index[newpos[0]][newpos[1]][newpos[2]] = mig_dir;
persctr[newpos[0]][newpos[1]][newpos[2]] = ctr_pers;
divctr[newpos[0]][newpos[1]][newpos[2]] = tdiv;
Sim_Matrix[k][j][i] = 0;
mig_index[k][j][i] = 0;
persctr[k][j][i] = 0;
divctr[k][j][i] = 0;
}
else
{
//Go to collision state
//cout<<"Going to collision state!!!";
gridcell_collisionstate(k,j,i);
gridcell_collisionstate(newpos[0],newpos[1],newpos[2]);
divctr[newpos[0]][newpos[1]][newpos[2]] --;
}
gridsvisited[newpos[0]][newpos[1]][newpos[2]] = 'Y';
}
void tissue_state(FILE *fid)
{
int i,j,k;
const long int vectorsize = l_matrix*b_matrix*h_matrix;
//int xcoord[l_matrix*b_matrix*h_matrix], ycoord[l_matrix*b_matrix*h_matrix], zcoord[l_matrix*b_matrix*h_matrix];
short int xcoord[vectorsize];
short int ycoord[vectorsize];
short int zcoord[vectorsize];
long int index = 0;
for (i=0; i<h_matrix; i++)
{
for (j=0; j<b_matrix; j++)
{
for (k=0; k<l_matrix; k++)
{
if (Sim_Matrix[k][j][i] == 1)
{
//cout<<index<<k<<j<<i<<Sim_Matrix[k][j][i]<<" "<<divctr[k][j][i];
xcoord[index] = k;
ycoord[index] = j;
zcoord[index] = i;
index ++;
}
}
}
}
//Printing firstValue
//fprintf(fid, "%d", xcoord[0]);
//fprintf(fidy, "%d", ycoord[0]);
//fprintf(fidz, "%d", zcoord[0]);
//Print allvalues
for (int ctr = 0; ctr<index; ctr++)
{
//fprintf(fidx, ",%d", xcoord[ctr]);
//fprintf(fidy, ",%d", ycoord[ctr]);
//fprintf(fidz, ",%d", zcoord[ctr]);
fprintf(fid, "%d", xcoord[ctr]);
fprintf(fid, " ");
fprintf(fid, "%d", ycoord[ctr]);
fprintf(fid, " ");
fprintf(fid, "%d", zcoord[ctr]);
fprintf(fid, " ");
fprintf(fid,"\n");
}
//fprintf(fid, "\n");
//fprintf(fidy, "\n");
//fprintf(fidz, "\n");
}
void tissue_state1(FILE *fidx, FILE *fidy, FILE *fidz)
{
int i,j,k;
const long int vectorsize = l_matrix*b_matrix*h_matrix;
//int xcoord[l_matrix*b_matrix*h_matrix], ycoord[l_matrix*b_matrix*h_matrix], zcoord[l_matrix*b_matrix*h_matrix];
short int xcoord[vectorsize];
short int ycoord[vectorsize];
short int zcoord[vectorsize];
long int index = 0;
for (i=0; i<h_matrix; i++)
{
for (j=0; j<b_matrix; j++)
{
for (k=0; k<l_matrix; k++)
{
if (Sim_Matrix[k][j][i] == 1)
{
//cout<<index<<k<<j<<i<<Sim_Matrix[k][j][i]<<" "<<divctr[k][j][i];
xcoord[index] = k;
ycoord[index] = j;
zcoord[index] = i;
index ++;
}
}
}
}
//Writing to a file
/* FILE *fidx, *fidy, *fidz;
fidx = fopen("/home/guru/Desktop/x_coordinates.txt", "a");
fidy = fopen("/home/guru/Desktop/y_coordinates.txt", "a");
fidz = fopen("/home/guru/Desktop/z_coordinates.txt", "a");
*/
//Printing firstValue
fprintf(fidx, "%d", xcoord[0]);
fprintf(fidy, "%d", ycoord[0]);
fprintf(fidz, "%d", zcoord[0]);
//Print allvalues
for (int ctr = 1; ctr<index; ctr++)
{
fprintf(fidx, ",%d", xcoord[ctr]);
fprintf(fidy, ",%d", ycoord[ctr]);
fprintf(fidz, ",%d", zcoord[ctr]);
}
fprintf(fidx, "\n");
fprintf(fidy, "\n");
fprintf(fidz, "\n");
//delete [] xcoord;
//delete [] ycoord;
//delete [] zcoord;
}
void start_automaton()
{
int time_of_sim = 2000;
int op1, op2, op3;
int i, j, k;
char filename[20];
FILE *fid;
for (int time = 0; time<time_of_sim; time++)
{
//cout<<endl<<"Time ="<<time<<endl;
change_grid_status();
//cout<<"Changed grid status"<<endl;
for (i = 0; i<h_matrix; i++)
{
for (j=0; j<b_matrix; j++)
{
for (k=0; k<l_matrix; k++)
{
//cout<<endl<<k<<" "<<j<<" "<<i;
//cout<<endl<<"Current_Position"<<k<<j<<i<<endl;
if (gridsvisited[k][j][i] == 'Y')
{
//cout<<"Visited da! Pack off"<<" "<<k<<" "<<j<<" "<<i;
}
else
{
op1 = checkcell(k,j,i);
if (op1 == 1)
{
op2 = checkdivctr(k,j,i);
if (op2 == 0)
{
//cout<<endl<<"Cell is dividing"<<k<<" "<<j<<" "<<i<<endl;
dividecells(k,j,i);
}
else
{
divctr[k][j][i] = divctr[k][j][i] - 1;
op3 = checkpersistencectr(k,j,i);
if (op3 == 0)
{
//cout<<endl<<"changing dir of migration"<<endl;
changedirofmigration(k,j,i);
}
else
{
persctr[k][j][i] = persctr[k][j][i] - 1;
//cout<<endl<<"Cell is migrating"<<k<<" "<<j<<" "<<i<<endl;
cell_migrate(k,j,i);
//view_Matrix();
}
}
}
}
}
}
}
//Writing to a file
sprintf (filename, "/home/guru/BTP/Plots/file%d.txt", time);
fid = fopen(filename,"w");
cout<<endl<<"Viewing tissue state after t="<<time<<endl;
tissue_state(fid);
fclose(fid);
//view_Matrix();
}
}
int main()
{
int radius;
/*Writing to a file
FILE *fidx, *fidy, *fidz;
fidx = fopen("/home/guru/Desktop/x_coordinates.txt", "w");
fidy = fopen("/home/guru/Desktop/y_coordinates.txt", "w");
fidz = fopen("/home/guru/Desktop/z_coordinates.txt", "w");*/
FILE *fid;
fid = fopen("/home/guru/BTP/Plots/Initial.txt", "w");
//Initial Seeding Matrix
cout<<endl<<"Seeding Matrix"<<endl;
//Seed_Matrix();
initseedontop();
//cout<<"Enter radius of wound =";
//cin>>radius;
//wound_healing(radius);
cout<<endl<<"Viewing Tissue State"<<endl;
tissue_state(fid);
fclose(fid);
//view_Matrix();
//Running Automaton
cout<<endl<<"Starting Automaton"<<endl;
start_automaton();
/*fclose(fidx);
fclose(fidy);
fclose(fidz);*/
//Viewing Contents
//view_Matrix();
return (0);
}