PABLO  0.1
PArallel Balanced Linear Octree
 All Classes Functions Variables Pages
Class_Map.tpp
1 // =================================================================================== //
2 // CLASS SPECIALIZATION //
3 // =================================================================================== //
4 
8 template <int dim>
10  X0 = Y0 = Z0 = 0.0;
11  L = 1.0;
12 };
13 
21 template <int dim>
22 Class_Map<dim>::Class_Map(double & X, double & Y, double & Z, double & LL){
23  X0 = X;
24  Y0 = Y;
25  Z0 = Z;
26  L = LL;
27 };
28 
29 // ------------------------------------------------------------------------------- //
30 // METHODS ----------------------------------------------------------------------- //
31 
32 template <int dim>
33 double Class_Map<dim>::mapX(uint32_t const & X){
34  return (X0 + L/double(globals.max_length) * double(X));
35 };
36 
37 template <int dim>
38 double Class_Map<dim>::mapY(uint32_t const & Y){
39  return (Y0 + L/double(globals.max_length) * double(Y));
40 };
41 
42 template <int dim>
43 double Class_Map<dim>::mapZ(uint32_t const & Z){
44  return (Z0 + L/double(globals.max_length) * double(Z));
45 };
46 
47 template <int dim>
48 uint32_t Class_Map<dim>::mapX(double const & X){
49  return (uint32_t)(double(globals.max_length)/L * (X - X0));
50 };
51 
52 template <int dim>
53 uint32_t Class_Map<dim>::mapY(double const & Y){
54  return (uint32_t)(double(globals.max_length)/L * (Y - Y0));
55 };
56 
57 template <int dim>
58 uint32_t Class_Map<dim>::mapZ(double const & Z){
59  return (uint32_t)(double(globals.max_length)/L * (Z - Z0));
60 };
61 
62 template <int dim>
63 double Class_Map<dim>::mapSize(uint32_t const & size){
64  return ((L/double(globals.max_length))*double(size));
65 };
66 
67 template <int dim>
68 double Class_Map<dim>::mapArea(uint64_t const & Area){
69  return ((pow(L,2.0)/pow(double(globals.max_length),2.0))*double(Area));
70 };
71 
72 template <int dim>
73 double Class_Map<dim>::mapVolume(uint64_t const & Volume){
74  return ((pow(L,3.0)/pow(double(globals.max_length),3.0))*double(Volume));
75 };
76 
77 template <int dim>
78 void Class_Map<dim>::mapCenter(double* & center,
79  vector<double> & mapcenter){
80  vector<double> orig;
81  orig.push_back(X0);
82  orig.push_back(Y0);
83  orig.push_back(Z0);
84 #if defined(__INTEL_COMPILER) || defined(__ICC)
85 #else
86  orig.shrink_to_fit();
87 #endif
88  mapcenter.resize(3);
89  mapcenter = orig;
90  for (int i=0; i<dim; i++){
91  mapcenter[i] = mapcenter[i] + L/double(globals.max_length) * center[i];
92  }
93 #if defined(__INTEL_COMPILER) || defined(__ICC)
94 #else
95  mapcenter.shrink_to_fit();
96 #endif
97 };
98 
99 template <int dim>
100 void Class_Map<dim>::mapCenter(vector<double> & center,
101  vector<double> & mapcenter){
102  vector<double> orig;
103  orig.push_back(X0);
104  orig.push_back(Y0);
105  orig.push_back(Z0);
106 #if defined(__INTEL_COMPILER) || defined(__ICC)
107 #else
108  orig.shrink_to_fit();
109 #endif
110  mapcenter.resize(3);
111  mapcenter = orig;
112  for (int i=0; i<dim; i++){
113  mapcenter[i] = mapcenter[i] + L/double(globals.max_length) * center[i];
114  }
115 #if defined(__INTEL_COMPILER) || defined(__ICC)
116 #else
117  mapcenter.shrink_to_fit();
118 #endif
119 };
120 
121 template <int dim>
122 void Class_Map<dim>::mapNodes(uint32_t (*nodes)[3],
123  vector<vector<double> > & mapnodes){
124  vector<double> orig;
125  orig.push_back(X0);
126  orig.push_back(Y0);
127  orig.push_back(Z0);
128 #if defined(__INTEL_COMPILER) || defined(__ICC)
129 #else
130  orig.shrink_to_fit();
131 #endif
132  mapnodes.resize(globals.nnodes);
133  for (int i=0; i<globals.nnodes; i++){
134  mapnodes[i].resize(3);
135  for (int j=0; j<3; j++){
136  mapnodes[i][j] = orig[j] + L/double(globals.max_length) * double(nodes[i][j]);
137  }
138 #if defined(__INTEL_COMPILER) || defined(__ICC)
139 #else
140  mapnodes[i].shrink_to_fit();
141 #endif
142  }
143 #if defined(__INTEL_COMPILER) || defined(__ICC)
144 #else
145  mapnodes.shrink_to_fit();
146 #endif
147 
148 };
149 
150 template <int dim>
151 void Class_Map<dim>::mapNodes(vector<vector<uint32_t> > nodes,
152  vector<vector<double> > & mapnodes){
153  vector<double> orig;
154  orig.push_back(X0);
155  orig.push_back(Y0);
156  orig.push_back(Z0);
157 #if defined(__INTEL_COMPILER) || defined(__ICC)
158 #else
159  orig.shrink_to_fit();
160 #endif
161  mapnodes.resize(globals.nnodes);
162  for (int i=0; i<globals.nnodes; i++){
163  mapnodes[i].resize(3);
164  for (int j=0; j<3; j++){
165  mapnodes[i][j] = orig[j] + L/double(globals.max_length) * double(nodes[i][j]);
166  }
167 #if defined(__INTEL_COMPILER) || defined(__ICC)
168 #else
169  mapnodes[i].shrink_to_fit();
170 #endif
171  }
172 #if defined(__INTEL_COMPILER) || defined(__ICC)
173 #else
174  mapnodes.shrink_to_fit();
175 #endif
176 };
177 
178 template <int dim>
179 void Class_Map<dim>::mapNode(vector<uint32_t> & node,
180  vector<double> & mapnode){
181  vector<double> orig;
182  orig.push_back(X0);
183  orig.push_back(Y0);
184  orig.push_back(Z0);
185 #if defined(__INTEL_COMPILER) || defined(__ICC)
186 #else
187  orig.shrink_to_fit();
188 #endif
189  mapnode.resize(3);
190  for (int j=0; j<3; j++){
191  mapnode[j] = orig[j] + L/double(globals.max_length) * double(node[j]);
192 
193  }
194 };
195 
196 template <int dim>
197 void Class_Map<dim>::mapNodesIntersection(uint32_t (*nodes)[3],
198  vector<vector<double> > & mapnodes){
199  vector<double> orig;
200  orig.push_back(X0);
201  orig.push_back(Y0);
202  orig.push_back(Z0);
203 #if defined(__INTEL_COMPILER) || defined(__ICC)
204 #else
205  orig.shrink_to_fit();
206 #endif
207  mapnodes.resize(globals.nnodesperface);
208  for (int i=0; i<globals.nnodesperface; i++){
209  mapnodes[i].resize(3);
210  for (int j=0; j<3; j++){
211  mapnodes[i][j] = orig[j] + L/double(globals.max_length) * double(nodes[i][j]);
212  }
213 #if defined(__INTEL_COMPILER) || defined(__ICC)
214 #else
215  mapnodes[i].shrink_to_fit();
216 #endif
217  }
218 #if defined(__INTEL_COMPILER) || defined(__ICC)
219 #else
220  mapnodes.shrink_to_fit();
221 #endif
222 };
223 
224 template <int dim>
225 void Class_Map<dim>::mapNodesIntersection(vector<vector<uint32_t> > nodes,
226  vector<vector<double> > & mapnodes){
227  vector<double> orig;
228  orig.push_back(X0);
229  orig.push_back(Y0);
230  orig.push_back(Z0);
231 #if defined(__INTEL_COMPILER) || defined(__ICC)
232 #else
233  orig.shrink_to_fit();
234 #endif
235  mapnodes.resize(globals.nnodesperface);
236  for (int i=0; i<globals.nnodesperface; i++){
237  mapnodes[i].resize(3);
238  for (int j=0; j<3; j++){
239  mapnodes[i][j] = orig[j] + L/double(globals.max_length) * double(nodes[i][j]);
240  }
241 #if defined(__INTEL_COMPILER) || defined(__ICC)
242 #else
243  mapnodes[i].shrink_to_fit();
244 #endif
245  }
246 #if defined(__INTEL_COMPILER) || defined(__ICC)
247 #else
248  mapnodes.shrink_to_fit();
249 #endif
250 };
251 
252 template <int dim>
253 void Class_Map<dim>::mapNormals(vector<int8_t> normal,
254  vector<double> & mapnormal){
255  mapnormal = vector<double>(normal.begin(), normal.end());
256 #if defined(__INTEL_COMPILER) || defined(__ICC)
257 #else
258  mapnormal.shrink_to_fit();
259 #endif
260 };
double mapSize(uint32_t const &size)
Definition: Class_Map.tpp:63
double mapArea(uint64_t const &area)
Definition: Class_Map.tpp:68
void mapNodesIntersection(uint32_t(*nodes)[3], vector< vector< double > > &mapnodes)
Definition: Class_Map.tpp:197
void mapCenter(double *&center, vector< double > &mapcenter)
Definition: Class_Map.tpp:78
void mapNodes(uint32_t(*nodes)[3], vector< vector< double > > &mapnodes)
Definition: Class_Map.tpp:122
void mapNode(vector< uint32_t > &node, vector< double > &mapnode)
Definition: Class_Map.tpp:179
void mapNormals(vector< int8_t > normal, vector< double > &mapnormal)
Definition: Class_Map.tpp:253
double mapX(uint32_t const &X)
Definition: Class_Map.tpp:33
double mapZ(uint32_t const &Z)
Definition: Class_Map.tpp:43
double mapVolume(uint64_t const &volume)
Definition: Class_Map.tpp:73
double mapY(uint32_t const &Y)
Definition: Class_Map.tpp:38