| 1 |
///////////////////////////////////////////////////////////// |
| 2 |
// // |
| 3 |
// Copyright (c) 2007-2017 by The University of Queensland // |
| 4 |
// Centre for Geoscience Computing // |
| 5 |
// http://earth.uq.edu.au/centre-geoscience-computing // |
| 6 |
// // |
| 7 |
// Primary Business: Brisbane, Queensland, Australia // |
| 8 |
// Licensed under the Open Software License version 3.0 // |
| 9 |
// http://www.apache.org/licenses/LICENSE-2.0 // |
| 10 |
// // |
| 11 |
///////////////////////////////////////////////////////////// |
| 12 |
|
| 13 |
#include "geometry/Sphere.h" |
| 14 |
#include "util/vector3.h" |
| 15 |
#include "InsertGenerator2D.h" |
| 16 |
#include "MNTable2D.h" |
| 17 |
#include "BoxWithLines2D.h" |
| 18 |
|
| 19 |
// --- IO includes --- |
| 20 |
#include <iostream> |
| 21 |
|
| 22 |
using std::cout; |
| 23 |
using std::cout; |
| 24 |
using std::endl; |
| 25 |
|
| 26 |
// -- System includes -- |
| 27 |
#include <cstdlib> |
| 28 |
#include <sys/time.h> |
| 29 |
using std::atoi; |
| 30 |
using std::atof; |
| 31 |
|
| 32 |
int main(int argc, char** argv) |
| 33 |
{ |
| 34 |
int ret=0; |
| 35 |
|
| 36 |
double xsize=atof(argv[1]); |
| 37 |
double ysize=atof(argv[2]); |
| 38 |
double ysize_cl=atof(argv[3]); |
| 39 |
int ntry=atoi(argv[4]); |
| 40 |
double rmin_nb=atof(argv[5]); |
| 41 |
double rmin_b=atof(argv[6]); |
| 42 |
double pbond=atof(argv[7]); |
| 43 |
|
| 44 |
int outputstyle=atoi(argv[8]); |
| 45 |
|
| 46 |
// calc dependent parameters |
| 47 |
double y_bdry_1=0.5*(ysize-ysize_cl); |
| 48 |
double y_bdry_2=ysize-y_bdry_1; |
| 49 |
|
| 50 |
MNTable2D* T=new MNTable2D(Vector3(0.0,0.0,0.0),Vector3(xsize,ysize,0.0),2.5,1); |
| 51 |
InsertGenerator2D *GB=new InsertGenerator2D(rmin_b,1.0,ntry,1000,1e-6); |
| 52 |
InsertGenerator2D *GNB=new InsertGenerator2D(rmin_nb,1.0,ntry,1000,1e-6); |
| 53 |
|
| 54 |
// seed RNG |
| 55 |
struct timeval tv; |
| 56 |
gettimeofday(&tv,NULL); |
| 57 |
int random_seed=tv.tv_usec; |
| 58 |
srand(random_seed); |
| 59 |
|
| 60 |
MNTable2D::SetOutputStyle(outputstyle); |
| 61 |
|
| 62 |
// center layer (bonded) |
| 63 |
BoxWithLines2D CenterBox(Vector3(0.0,y_bdry_1,0.0),Vector3(xsize,y_bdry_2,0.0)); |
| 64 |
|
| 65 |
CenterBox.addLine(Line2D(Vector3(0.0,y_bdry_1,0.0),Vector3(0.0,y_bdry_2,0.0))); // left |
| 66 |
CenterBox.addLine(Line2D(Vector3(xsize,y_bdry_1,0.0),Vector3(xsize,y_bdry_2,0.0))); // right |
| 67 |
CenterBox.addLine(Line2D(Vector3(0.0,y_bdry_1,0.0),Vector3(xsize,y_bdry_1,0.0))); // bottom |
| 68 |
CenterBox.addLine(Line2D(Vector3(0.0,y_bdry_2,0.0),Vector3(xsize,y_bdry_2,0.0))); // top |
| 69 |
|
| 70 |
GB->generatePacking(&CenterBox,T,0,1); |
| 71 |
T->generateRandomBonds(0,1e-5,pbond,0,1,0); |
| 72 |
|
| 73 |
|
| 74 |
// bottom layer |
| 75 |
BoxWithLines2D BottomBox(Vector3(0.0,0.0,0.0),Vector3(xsize,y_bdry_1+0.5,0.0)); |
| 76 |
|
| 77 |
BottomBox.addLine(Line2D(Vector3(0.0,0.0,0.0),Vector3(0.0,y_bdry_1,0.0))); // left |
| 78 |
BottomBox.addLine(Line2D(Vector3(xsize,0.0,0.0),Vector3(xsize,y_bdry_1,0.0))); // right |
| 79 |
BottomBox.addLine(Line2D(Vector3(0.0,0.0,0.0),Vector3(xsize,0.0,0.0))); // bottom |
| 80 |
|
| 81 |
GNB->generatePacking(&BottomBox,T,0,2); |
| 82 |
|
| 83 |
// top layer |
| 84 |
BoxWithLines2D TopBox(Vector3(0.0,y_bdry_2-0.5,0.0),Vector3(xsize,ysize,0.0)); |
| 85 |
|
| 86 |
TopBox.addLine(Line2D(Vector3(0.0,y_bdry_2,0.0),Vector3(0.0,ysize,0.0))); // left |
| 87 |
TopBox.addLine(Line2D(Vector3(xsize,y_bdry_2,0.0),Vector3(xsize,ysize,0.0))); // right |
| 88 |
TopBox.addLine(Line2D(Vector3(0.0,ysize,0.0),Vector3(xsize,ysize,0.0))); // top |
| 89 |
|
| 90 |
GNB->generatePacking(&TopBox,T,0,3); |
| 91 |
|
| 92 |
cout << *T << endl; |
| 93 |
|
| 94 |
delete T; |
| 95 |
delete GB; |
| 96 |
delete GNB; |
| 97 |
return ret; |
| 98 |
} |