msbGrid  1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
test1initialdistribution.hh
Go to the documentation of this file.
1 /*****************************************************************************
2 * This program is part of the msbGrid software *
3 * *
4 * msbGrid stands for multi-structured block Grid generator *
5 * *
6 * msbGrid is a free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation, either version 2 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * msbGrid is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * See the file COPYING for full copying permissions. *
17 *****************************************************************************/
23 #ifndef _PREDEFINED_INITIAL_DISTRIBUTION_HH_
24 #define _PREDEFINED_INITIAL_DISTRIBUTION_HH_
25 
26 #include <initialdistribution.hh>
27 
28 namespace msbGrid
29 {
31 {
32 public:
34  {}
35 
37  {
38  inData().xMin() = 0.0;
39  inData().xMax() = 10.8;
40 
41  const std :: vector< std :: pair< Scalar, Scalar > > node =
42  {
43  // 0, 1, 2, 3, 4
44  { 0.0, 0.0 },
45  { 3.9, 0.0 },
46  { 3.9, 1.7 },
47  { 2.3, 3.5 },
48  { 0.0, 3.5 },
49 
50  // 5, 6, 7
51  { 3.4, 5.4 },
52  { 2.8, 7.0 },
53  { 0.0, 7.0 },
54 
55  // 8, 9, 10
56  { 3.6, 8.0 },
57  { 3.2, 10.8 },
58  { 0.0, 10.8 },
59 
60  // 11, 12, 13
61  { 7.7, 0.0 },
62  { 7.9, 0.8 },
63  { 6.4, 3.5 },
64 
65  // 14
66  { 6.6, 4.7 },
67 
68  // 15, 16
69  { 7.0, 5.0 },
70  { 7.2, 7.4 },
71 
72  // 17, 18
73  { 7.6, 8.0 },
74  { 7.4, 10.8 },
75 
76  // 19, 20
77  { 10.8, 0.0 },
78  { 10.8, 3.6 },
79 
80  // 21
81  { 10.8, 7.6 },
82 
83  // 22
84  { 10.8, 10.8 },
85  };
86 
87  // xMax = 10.8
88  // block 1
89  const Scalar xb1 = ( node [ 0 ].first + node [ 1 ].first + node [ 2 ].first + node [ 3 ].first + node [ 4 ].first ) / 5.0;
90  const Scalar yb1 = ( node [ 0 ].second + node [ 1 ].second + node [ 2 ].second + node [ 3 ].second + node [ 4 ].second ) / 5.0;
91  // block 2
92  const Scalar xb2 = ( node [ 4 ].first + node [ 3 ].first + node [ 5 ].first + node [ 6 ].first + node [ 7 ].first ) / 5.0;
93  const Scalar yb2 = ( node [ 4 ].second + node [ 3 ].second + node [ 5 ].second + node [ 6 ].second + node [ 7 ].second ) / 5.0;
94  // block 3
95  const Scalar xb3 = ( node [ 7 ].first + node [ 6 ].first + node [ 8 ].first + node [ 9 ].first + node [ 10 ].first ) / 5.0;
96  const Scalar yb3 = ( node [ 7 ].second + node [ 6 ].second + node [ 8 ].second + node [ 9 ].second + node [ 10 ].second ) / 5.0;
97  // block 4
98  const Scalar xb4 = ( node [ 1 ].first + node [ 11 ].first + node [ 12 ].first + node [ 13 ].first + node [ 2 ].first ) / 5.0;
99  const Scalar yb4 = ( node [ 1 ].second + node [ 11 ].second + node [ 12 ].second + node [ 13 ].second + node [ 2 ].second ) / 5.0;
100  // block 5
101  const Scalar xb5 = ( node [ 3 ].first + node [ 2 ].first + node [ 13 ].first + node [ 14 ].first + node [ 5 ].first ) / 5.0;
102  const Scalar yb5 = ( node [ 3 ].second + node [ 2 ].second + node [ 13 ].second + node [ 14 ].second + node [ 5 ].second ) / 5.0;
103  // block 6
104  const Scalar xb6 = ( node [ 6 ].first + node [ 5 ].first + node [ 14 ].first + node [ 15 ].first + node [ 16 ].first + node [ 8 ].first ) / 6.0;
105  const Scalar yb6 = ( node [ 6 ].second + node [ 5 ].second + node [ 14 ].second + node [ 15 ].second + node [ 16 ].second + node [ 8 ].second ) / 6.0;
106  // block 7
107  const Scalar xb7 = ( node [ 9 ].first + node [ 8 ].first + node [ 16 ].first + node [ 17 ].first + node [ 18 ].first ) / 5.0;
108  const Scalar yb7 = ( node [ 9 ].second + node [ 8 ].second + node [ 16 ].second + node [ 17 ].second + node [ 18 ].second ) / 5.0;
109  // block 8
110  const Scalar xb8 = ( node [ 11 ].first + node [ 19 ].first + node [ 20 ].first + node [ 12 ].first ) / 4.0;
111  const Scalar yb8 = ( node [ 11 ].second + node [ 19 ].second + node [ 20 ].second + node [ 12 ].second ) / 4.0;
112  // block 9
113  const Scalar xb9 = ( node [ 13 ].first + node [ 12 ].first + node [ 20 ].first + node [ 15 ].first + node [ 14 ].first ) / 5.0;
114  const Scalar yb9 = ( node [ 13 ].second + node [ 12 ].second + node [ 20 ].second + node [ 15 ].second + node [ 14 ].second ) / 5.0;
115  // block 10
116  const Scalar xb10 = ( node [ 15 ].first + node [ 20 ].first + node [ 21 ].first + node [ 17 ].first + node [ 16 ].first ) / 5.0;
117  const Scalar yb10 = ( node [ 15 ].second + node [ 20 ].second + node [ 21 ].second + node [ 17 ].second + node [ 16 ].second ) / 5.0;
118  // block 11
119  const Scalar xb11 = ( node [ 18 ].first + node [ 17 ].first + node [ 21 ].first + node [ 22 ].first ) / 4.0;
120  const Scalar yb11 = ( node [ 18 ].second + node [ 17 ].second + node [ 21 ].second + node [ 22 ].second ) / 4.0;
121 
122  this->blockCenter() = {
123  // {x, y}
124  { xb1, yb1 },
125  { xb2, yb2 },
126  { xb3, yb3 },
127  { xb4, yb4 },
128  { xb5, yb5 },
129  { xb6, yb6 },
130  { xb7, yb7 },
131  { xb8, yb8 },
132  { xb9, yb9 },
133  { xb10, yb10 },
134  { xb11, yb11 },
135  };
136  }
137 
139  {
140  this->blockAngle() = {
141  // beta
142  00.0,
143  30.0,
144  };
145 
146  blockAngle().resize( blockCenter().size() );
147  if ( blockAngle().size() < blockCenter().size() ) {
148  const int ibMin = blockAngle().size();
149  for ( int ib = ibMin; ib < blockCenter().size(); ++ib ) {
150  blockAngle().push_back( msbGrid :: randomAngle() );
151  }
152  }
153  }
154 }; /*class Test1InitialDistribution*/
155 } /*namespace msbGrid*/
156 
157 #endif /* _PREDEFINED_INITIAL_DISTRIBUTION_HH_ */