Vlasiator ebf0dd394 on dev (v5.4.0 + 1054 commits)
Loading...
Searching...
No Matches
cpu_acc_intersections.cpp
Go to the documentation of this file.
1/*
2 * This file is part of Vlasiator.
3 * Copyright 2010-2016 Finnish Meteorological Institute
4 *
5 * For details of usage, see the COPYING file and read the "Rules of the Road"
6 * at http://www.physics.helsinki.fi/vlasiator/
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 */
22
23#include <algorithm>
24#include <cmath>
25#include <utility>
26
27#include <Eigen/Geometry>
28#include "../common.h"
30#include "cpu_acc_transform.hpp"
31
32using namespace std;
33using namespace Eigen;
34
46 const uint popID,
47 const uint map_order,
48 const Real& dt,
49 int intersections_id
50 ) {
51 vmesh::VelocityMesh* vmesh = spatial_cell->get_velocity_mesh(popID);
52 spatial_cell::Population& pop = spatial_cell->get_population(popID);
53
54 // compute transform, forward in time and backward in time, performed in this acceleration
55 Transform<Real,3,Affine> fwd_transform= compute_acceleration_transformation(spatial_cell,popID,dt);
56 Transform<Real,3,Affine> bwd_transform= fwd_transform.inverse();
57
58 phiprof::Timer intersectionsTimer {intersections_id};
59 switch(map_order){
60 case 0: {
61 //Map order XYZ
62 compute_intersections_1st(vmesh,bwd_transform, fwd_transform, 0,
65 compute_intersections_2nd(vmesh,bwd_transform, fwd_transform, 1,
68 compute_intersections_3rd(vmesh,bwd_transform, fwd_transform, 2,
71 break;
72 }
73 case 1: {
74 //Map order YZX
75 compute_intersections_1st(vmesh, bwd_transform, fwd_transform, 1,
78 compute_intersections_2nd(vmesh, bwd_transform, fwd_transform, 2,
81 compute_intersections_3rd(vmesh, bwd_transform, fwd_transform, 0,
84 break;
85 }
86 case 2: {
87 //Map order Z X Y
88 compute_intersections_1st(vmesh, bwd_transform, fwd_transform, 2,
91 compute_intersections_2nd(vmesh, bwd_transform, fwd_transform, 0,
94 compute_intersections_3rd(vmesh, bwd_transform, fwd_transform, 1,
97 break;
98 }
99 }
100 intersectionsTimer.stop();
101}
102
112Eigen::Matrix<Real,3,1> line_plane_intersection(const Eigen::Matrix<Real,3,1>& l_point,const Eigen::Matrix<Real,3,1>& l_direction,
113 const Eigen::Matrix<Real,3,1>& p_point,const Eigen::Matrix<Real,3,1>& p_normal){
114 const Real nom=p_normal.dot(p_point-l_point);
115 const Real dem=p_normal.dot(l_direction);
116 return l_point+(nom/dem)*l_direction;
117}
118
134 const Transform<Real,3,Affine>& bwd_transform,const Transform<Real,3,Affine>& fwd_transform,
135 const uint dimension,
137
138 if (dimension == 0) { //Prepare intersections for mapping along X first (mapping order X-Y-Z)
139 // Normal of Lagrangian planes
140 const Eigen::Matrix<Real,3,1> plane_normal = bwd_transform.linear()*Eigen::Matrix<Real,3,1>(1.0, 0.0, 0.0);
141 // Point on lowest potential Lagrangian plane
142 const Eigen::Matrix<Real,3,1> plane_point
143 = bwd_transform*Eigen::Matrix<Real,3,1>(vmesh->getMeshMinLimits()[0], 0.0, 0.0);
144 // line along Euclidian x direction, unit vector
145 const Eigen::Matrix<Real,3,1> line_direction = Eigen::Matrix<Real,3,1>(1.0, 0.0, 0.0);
146 const Eigen::Matrix<Real,3,1> line_point(
147 0.0,
148 0.5*vmesh->getCellSize()[1]+vmesh->getMeshMinLimits()[1],
149 0.5*vmesh->getCellSize()[2]+vmesh->getMeshMinLimits()[2]);
150 const Eigen::Matrix<Real,3,1> lagrangian_di = bwd_transform.linear()
151 * Eigen::Matrix<Real,3,1>(vmesh->getCellSize()[0],0,0.0);
152 const Eigen::Matrix<Real,3,1> euclidian_dj = Eigen::Matrix<Real,3,1>(0,vmesh->getCellSize()[1],0.0);
153 const Eigen::Matrix<Real,3,1> euclidian_dk = Eigen::Matrix<Real,3,1>(0.0,0.0,vmesh->getCellSize()[2]);
154
155 // compute intersections, varying lines and plane in i,j,k
156 const Eigen::Matrix<Real,3,1> intersection_0_0_0 = line_plane_intersection(line_point, line_direction, plane_point, plane_normal);
157 const Eigen::Matrix<Real,3,1> intersection_1_0_0 = line_plane_intersection(line_point, line_direction, plane_point + lagrangian_di, plane_normal);
158 const Eigen::Matrix<Real,3,1> intersection_0_1_0 = line_plane_intersection(line_point + euclidian_dj, line_direction, plane_point, plane_normal);
159 const Eigen::Matrix<Real,3,1> intersection_0_0_1 = line_plane_intersection(line_point + euclidian_dk, line_direction, plane_point, plane_normal);
160 intersection=intersection_0_0_0[dimension];
161 intersection_di=intersection_1_0_0[dimension]-intersection_0_0_0[dimension];
162 intersection_dj=intersection_0_1_0[dimension]-intersection_0_0_0[dimension];
163 intersection_dk=intersection_0_0_1[dimension]-intersection_0_0_0[dimension];
164 }
165 if (dimension == 1) { //Prepare intersections for mapping along Y first (mapping order Y-Z-X)
166 // Normal of Lagrangian planes
167 const Eigen::Matrix<Real,3,1> plane_normal = bwd_transform.linear()*Eigen::Matrix<Real,3,1>(0.0, 1.0, 0.0);
168 // Point on lowest possible Lagrangian plane
169 const Eigen::Matrix<Real,3,1> plane_point
170 = bwd_transform*Eigen::Matrix<Real,3,1>(0.0, vmesh->getMeshMinLimits()[1], 0.0);
171 // line along Euclidian y direction, unit vector
172 const Eigen::Matrix<Real,3,1> line_direction = Eigen::Matrix<Real,3,1>(0.0, 1.0, 0.0);
173 const Eigen::Matrix<Real,3,1> line_point(
174 0.5*vmesh->getCellSize()[0]+vmesh->getMeshMinLimits()[0],
175 0.0,
176 0.5*vmesh->getCellSize()[2]+vmesh->getMeshMinLimits()[2]);
177 const Eigen::Matrix<Real,3,1> euclidian_di
178 = Eigen::Matrix<Real,3,1>(vmesh->getCellSize()[0], 0.0, 0.0);
179 const Eigen::Matrix<Real,3,1> lagrangian_dj
180 = bwd_transform.linear()*Eigen::Matrix<Real,3,1>(0.0 ,vmesh->getCellSize()[1], 0.0);
181 const Eigen::Matrix<Real,3,1> euclidian_dk
182 = Eigen::Matrix<Real,3,1>(0.0 , 0.0 ,vmesh->getCellSize()[2]);
183
184 // compute intersections, varying lines and plane in i,j,k
185 const Eigen::Matrix<Real,3,1> intersection_0_0_0 = line_plane_intersection(line_point,line_direction,plane_point,plane_normal);
186 const Eigen::Matrix<Real,3,1> intersection_1_0_0 = line_plane_intersection(line_point + euclidian_di, line_direction, plane_point, plane_normal);
187 const Eigen::Matrix<Real,3,1> intersection_0_1_0 = line_plane_intersection(line_point, line_direction, plane_point + lagrangian_dj, plane_normal);
188 const Eigen::Matrix<Real,3,1> intersection_0_0_1 = line_plane_intersection(line_point + euclidian_dk, line_direction, plane_point, plane_normal);
189
190 intersection=intersection_0_0_0[dimension];
191 intersection_di=intersection_1_0_0[dimension]-intersection_0_0_0[dimension];
192 intersection_dj=intersection_0_1_0[dimension]-intersection_0_0_0[dimension];
193 intersection_dk=intersection_0_0_1[dimension]-intersection_0_0_0[dimension];
194 }
195
196 if (dimension == 2) {
197 // This is the case presented in the Slice 3D article
198 // Prepare intersections for mapping along Z first (mapping order Z-X-Y)
199
200 //Normal of Lagrangian planes
201 const Eigen::Matrix<Real,3,1> plane_normal
202 = bwd_transform.linear()*Eigen::Matrix<Real,3,1>(0,0,1.0);
203
204 // Point on lowest possible Lagrangian plane
205 const Eigen::Matrix<Real,3,1> plane_point
206 = bwd_transform*Eigen::Matrix<Real,3,1>(0.0,0.0,vmesh->getMeshMinLimits()[2]);
207
208 // line along Euclidian z direction, unit vector
209 const Eigen::Matrix<Real,3,1> line_direction = Eigen::Matrix<Real,3,1>(0,0,1.0);
210 const Eigen::Matrix<Real,3,1> line_point(
211 0.5*vmesh->getCellSize()[0]+vmesh->getMeshMinLimits()[0],
212 0.5*vmesh->getCellSize()[1]+vmesh->getMeshMinLimits()[1],
213 0.0);
214 const Eigen::Matrix<Real,3,1> euclidian_di
215 = Eigen::Matrix<Real,3,1>(vmesh->getCellSize()[0],0,0.0);
216 const Eigen::Matrix<Real,3,1> euclidian_dj
217 = Eigen::Matrix<Real,3,1>(0,vmesh->getCellSize()[1],0.0);
218 const Eigen::Matrix<Real,3,1> lagrangian_dk
219 = bwd_transform.linear()*Eigen::Matrix<Real,3,1>(0.0,0.0,vmesh->getCellSize()[2]);
220
221 // compute intersections, varying lines and plane in i,j,k
222 const Eigen::Matrix<Real,3,1> intersection_0_0_0 = line_plane_intersection(line_point,line_direction,plane_point,plane_normal);
223 const Eigen::Matrix<Real,3,1> intersection_1_0_0 = line_plane_intersection(line_point + euclidian_di, line_direction, plane_point, plane_normal);
224 const Eigen::Matrix<Real,3,1> intersection_0_1_0 = line_plane_intersection(line_point + euclidian_dj, line_direction, plane_point, plane_normal);
225 const Eigen::Matrix<Real,3,1> intersection_0_0_1 = line_plane_intersection(line_point, line_direction, plane_point + lagrangian_dk, plane_normal);
226 intersection=intersection_0_0_0[dimension];
227 intersection_di=intersection_1_0_0[dimension]-intersection_0_0_0[dimension];
228 intersection_dj=intersection_0_1_0[dimension]-intersection_0_0_0[dimension];
229 intersection_dk=intersection_0_0_1[dimension]-intersection_0_0_0[dimension];
230 }
231}
232
248 const Transform<Real,3,Affine>& bwd_transform,const Transform<Real,3,Affine>& fwd_transform,
249 const uint dimension,
251
252 if (dimension == 0) { // Prepare intersections for mapping along X second (mapping order Z-X-Y)
253 // This is the case presented in the Slice 3D article,
254 // data along z has been moved to Lagrangian coordinates.
255
256 // Normal of Euclidian y-plane
257 const Eigen::Matrix<Real,3,1> plane_normal = Eigen::Matrix<Real,3,1>(0.0, 1.0, 0.0);
258
259 //Point on lowest Euclidian y-plane through middle of cells
260 Eigen::Matrix<Real,3,1> plane_point
261 = Eigen::Matrix<Real,3,1>(0,vmesh->getMeshMinLimits()[1]+vmesh->getCellSize()[1]*0.5,0);
262 const Eigen::Matrix<Real,3,1> lagrangian_di
263 = bwd_transform.linear()*Eigen::Matrix<Real,3,1>(vmesh->getCellSize()[0],0,0.0);
264
265 // Distance between Euclidian planes
266 const Eigen::Matrix<Real,3,1> euclidian_dj
267 = Eigen::Matrix<Real,3,1>(0,vmesh->getCellSize()[1],0.0);
268 const Eigen::Matrix<Real,3,1> lagrangian_dk
269 = bwd_transform.linear()*Eigen::Matrix<Real,3,1>(0.0,0.0,vmesh->getCellSize()[2]);
270
271 // line along Lagrangian y line, unit vector. Only rotation here, not translation
272 const Eigen::Matrix<Real,3,1> line_direction = bwd_transform.linear() * Eigen::Matrix<Real,3,1>(0,1.0,0.0);
273 const Eigen::Matrix<Real,3,1> line_point = bwd_transform * Eigen::Matrix<Real,3,1>(
274 vmesh->getMeshMinLimits()[0],
275 0.5*vmesh->getCellSize()[1]+vmesh->getMeshMinLimits()[1],
276 0.5*vmesh->getCellSize()[2]+vmesh->getMeshMinLimits()[2]);
277
278 // Compute two intersections between Lagrangian line (absolute position
279 // does not matter so set to 0,0,0, and two Euclidian planes.
280 Eigen::Matrix<Real,3,1> intersect_0_0_0 = line_plane_intersection(line_point,line_direction,plane_point,plane_normal);
281 Eigen::Matrix<Real,3,1> intersect_1_0_0 = line_plane_intersection(line_point + lagrangian_di, line_direction, plane_point, plane_normal);
282 Eigen::Matrix<Real,3,1> intersect_0_1_0 = line_plane_intersection(line_point, line_direction, plane_point + euclidian_dj, plane_normal);
283 Eigen::Matrix<Real,3,1> intersect_0_0_1 = line_plane_intersection(line_point + lagrangian_dk, line_direction, plane_point, plane_normal);
284
285 intersection=intersect_0_0_0[dimension];
286 intersection_di = intersect_1_0_0[dimension] - intersect_0_0_0[dimension];
287 intersection_dj = intersect_0_1_0[dimension] - intersect_0_0_0[dimension];
288 intersection_dk = intersect_0_0_1[dimension] - intersect_0_0_0[dimension];
289 }
290 if (dimension == 1) { //Prepare intersections for mapping along Y second (mapping order X-Y-Z)
291 // Normal of Euclidian z-plane
292 const Eigen::Matrix<Real,3,1> plane_normal = Eigen::Matrix<Real,3,1>(0.0, 0.0, 1.0);
293
294 // Point on lowest Euclidian z-plane through middle of cells
295 Eigen::Matrix<Real,3,1> plane_point
296 = Eigen::Matrix<Real,3,1>(0.0, 0.0,vmesh->getMeshMinLimits()[2]+vmesh->getCellSize()[2] * 0.5);
297
298 const Eigen::Matrix<Real,3,1> lagrangian_di
299 = bwd_transform.linear() * Eigen::Matrix<Real,3,1>(vmesh->getCellSize()[0], 0.0, 0.0);
300 const Eigen::Matrix<Real,3,1> lagrangian_dj
301 = bwd_transform.linear() * Eigen::Matrix<Real,3,1>(0.0, vmesh->getCellSize()[1], 0.0);
302 // Distance between Euclidian planes
303 const Eigen::Matrix<Real,3,1> euclidian_dk
304 = Eigen::Matrix<Real,3,1>(0.0, 0.0, vmesh->getCellSize()[2]);
305
306 // line along Lagrangian z line, unit vector. Only rotation here, not translation
307 const Eigen::Matrix<Real,3,1> line_direction
308 = bwd_transform.linear() * Eigen::Matrix<Real,3,1>(0.0, 0.0, 1.0);
309 const Eigen::Matrix<Real,3,1> line_point = bwd_transform * Eigen::Matrix<Real,3,1>(
310 0.5*vmesh->getCellSize()[0] + vmesh->getMeshMinLimits()[0],
311 vmesh->getMeshMinLimits()[1],
312 0.5*vmesh->getCellSize()[2] + vmesh->getMeshMinLimits()[2]);
313
314 // Compute two intersections between Lagrangian line (absolute position
315 // does not matter so set to 0,0,0, and two Euclidian planes.
316 Eigen::Matrix<Real,3,1> intersect_0_0_0 = line_plane_intersection(line_point,line_direction,plane_point,plane_normal);
317 Eigen::Matrix<Real,3,1> intersect_1_0_0 = line_plane_intersection(line_point + lagrangian_di, line_direction, plane_point, plane_normal);
318 Eigen::Matrix<Real,3,1> intersect_0_1_0 = line_plane_intersection(line_point + lagrangian_dj, line_direction, plane_point, plane_normal);
319 Eigen::Matrix<Real,3,1> intersect_0_0_1 = line_plane_intersection(line_point, line_direction, plane_point + euclidian_dk, plane_normal);
320
321 intersection=intersect_0_0_0[dimension];
322 intersection_di = intersect_1_0_0[dimension] - intersect_0_0_0[dimension];
323 intersection_dj = intersect_0_1_0[dimension] - intersect_0_0_0[dimension];
324 intersection_dk = intersect_0_0_1[dimension] - intersect_0_0_0[dimension];
325
326 }
327 if (dimension == 2) { //Prepare intersections for mapping along Z second (mapping order Y-Z-X)
328 // Normal of Euclidian x-plane
329 const Eigen::Matrix<Real,3,1> plane_normal = Eigen::Matrix<Real,3,1>(1.0, 0.0, 0.0);
330 //Point on lowest Euclidian x-plane through middle of cells
331 Eigen::Matrix<Real,3,1> plane_point
332 = Eigen::Matrix<Real,3,1>(vmesh->getMeshMinLimits()[0]+vmesh->getCellSize()[0]*0.5, 0.0, 0.0);
333 // Distance between Euclidian planes
334 const Eigen::Matrix<Real,3,1> euclidian_di = Eigen::Matrix<Real,3,1>(vmesh->getCellSize()[0], 0.0, 0.0);
335 const Eigen::Matrix<Real,3,1> lagrangian_dj
336 = bwd_transform.linear() * Eigen::Matrix<Real,3,1>(0.0, vmesh->getCellSize()[1], 0.0);
337 const Eigen::Matrix<Real,3,1> lagrangian_dk = bwd_transform.linear() * Eigen::Matrix<Real,3,1>(0.0, 0.0, vmesh->getCellSize()[2]);
338
339 // line along Lagrangian x line, unit vector. Only rotation here, not translation
340 const Eigen::Matrix<Real,3,1> line_direction = bwd_transform.linear() * Eigen::Matrix<Real,3,1>(1.0, 0.0, 0.0);
341 const Eigen::Matrix<Real,3,1> line_point = bwd_transform * Eigen::Matrix<Real,3,1>(
342 0.5 * vmesh->getCellSize()[0] + vmesh->getMeshMinLimits()[0],
343 0.5 * vmesh->getCellSize()[1] + vmesh->getMeshMinLimits()[1],
344 vmesh->getMeshMinLimits()[2]);
345
346 // Compute two intersections between Lagrangian line (absolute position
347 // does not matter so set to 0,0,0, and two Euclidian planes.
348 Eigen::Matrix<Real,3,1> intersect_0_0_0 = line_plane_intersection(line_point,line_direction,plane_point,plane_normal);
349 Eigen::Matrix<Real,3,1> intersect_1_0_0 = line_plane_intersection(line_point, line_direction, plane_point + euclidian_di, plane_normal);
350 Eigen::Matrix<Real,3,1> intersect_0_1_0 = line_plane_intersection(line_point + lagrangian_dj, line_direction, plane_point, plane_normal);
351 Eigen::Matrix<Real,3,1> intersect_0_0_1 = line_plane_intersection(line_point + lagrangian_dk, line_direction, plane_point, plane_normal);
352
353 intersection=intersect_0_0_0[dimension];
354 intersection_di = intersect_1_0_0[dimension] - intersect_0_0_0[dimension];
355 intersection_dj = intersect_0_1_0[dimension] - intersect_0_0_0[dimension];
356 intersection_dk = intersect_0_0_1[dimension] - intersect_0_0_0[dimension];
357 }
358}
359
378 const Transform<Real,3,Affine>& bwd_transform,const Transform<Real,3,Affine>& fwd_transform,
379 const uint dimension,
381
382 if (dimension == 0) { //Prepare intersections for mapping along X third (mapping order Y-Z-X)
383 const Eigen::Matrix<Real,3,1> point_0_0_0 = bwd_transform
384 * Eigen::Matrix<Real,3,1>(0.0 * vmesh->getCellSize()[0] + vmesh->getMeshMinLimits()[0],
385 0.5 * vmesh->getCellSize()[1] + vmesh->getMeshMinLimits()[1],
386 0.5 * vmesh->getCellSize()[2] + vmesh->getMeshMinLimits()[2]);
387 const Eigen::Matrix<Real,3,1> point_1_0_0 = bwd_transform
388 * Eigen::Matrix<Real,3,1>(1.0 * vmesh->getCellSize()[0] + vmesh->getMeshMinLimits()[0],
389 0.5 * vmesh->getCellSize()[1] + vmesh->getMeshMinLimits()[1],
390 0.5 * vmesh->getCellSize()[2] + vmesh->getMeshMinLimits()[2]);
391 const Eigen::Matrix<Real,3,1> point_0_1_0 = bwd_transform
392 * Eigen::Matrix<Real,3,1>(0.0 * vmesh->getCellSize()[0] + vmesh->getMeshMinLimits()[0],
393 1.5 * vmesh->getCellSize()[1] + vmesh->getMeshMinLimits()[1],
394 0.5 * vmesh->getCellSize()[2] + vmesh->getMeshMinLimits()[2]);
395 const Eigen::Matrix<Real,3,1> point_0_0_1 = bwd_transform
396 * Eigen::Matrix<Real,3,1>(0.0 * vmesh->getCellSize()[0] + vmesh->getMeshMinLimits()[0],
397 0.5 * vmesh->getCellSize()[1] + vmesh->getMeshMinLimits()[1],
398 1.5 * vmesh->getCellSize()[2] + vmesh->getMeshMinLimits()[2]);
399 intersection = point_0_0_0[dimension];
400 intersection_di = point_1_0_0[dimension]-point_0_0_0[dimension];
401 intersection_dj = point_0_1_0[dimension]-point_0_0_0[dimension];
402 intersection_dk = point_0_0_1[dimension]-point_0_0_0[dimension];
403 }
404 if (dimension == 1) { //Prepare intersections for mapping along Y third (mapping order Z-X-Y)
405 // This is the case presented in the Slice 3D article,
406 // data along z has been moved to Lagrangian coordinates
407 const Eigen::Matrix<Real,3,1> point_0_0_0 = bwd_transform
408 * Eigen::Matrix<Real,3,1>(0.5 * vmesh->getCellSize()[0] + vmesh->getMeshMinLimits()[0],
409 vmesh->getMeshMinLimits()[1],
410 0.5 * vmesh->getCellSize()[2] + vmesh->getMeshMinLimits()[2]);
411 const Eigen::Matrix<Real,3,1> point_1_0_0 = bwd_transform
412 * Eigen::Matrix<Real,3,1>(1.5 * vmesh->getCellSize()[0] + vmesh->getMeshMinLimits()[0],
413 vmesh->getMeshMinLimits()[1],
414 0.5 * vmesh->getCellSize()[2] + vmesh->getMeshMinLimits()[2]);
415 const Eigen::Matrix<Real,3,1> point_0_1_0 = bwd_transform
416 * Eigen::Matrix<Real,3,1>(0.5 * vmesh->getCellSize()[0] + vmesh->getMeshMinLimits()[0],
417 1.0 * vmesh->getCellSize()[1] + vmesh->getMeshMinLimits()[1],
418 0.5 * vmesh->getCellSize()[2] + vmesh->getMeshMinLimits()[2]);
419 const Eigen::Matrix<Real,3,1> point_0_0_1 = bwd_transform
420 * Eigen::Matrix<Real,3,1>(0.5 * vmesh->getCellSize()[0] + vmesh->getMeshMinLimits()[0],
421 vmesh->getMeshMinLimits()[1],
422 1.5 * vmesh->getCellSize()[2] + vmesh->getMeshMinLimits()[2]);
423 intersection = point_0_0_0[dimension];
424 intersection_di = point_1_0_0[dimension]-point_0_0_0[dimension];
425 intersection_dj = point_0_1_0[dimension]-point_0_0_0[dimension];
426 intersection_dk = point_0_0_1[dimension]-point_0_0_0[dimension];
427 }
428 if (dimension == 2) { //Prepare intersections for mapping along Z third (mapping order X-Y-Z)
429 const Eigen::Matrix<Real,3,1> point_0_0_0 = bwd_transform
430 * Eigen::Matrix<Real,3,1>(0.5 * vmesh->getCellSize()[0] + vmesh->getMeshMinLimits()[0],
431 0.5 * vmesh->getCellSize()[1] + vmesh->getMeshMinLimits()[1],
432 0.0 * vmesh->getCellSize()[2] + vmesh->getMeshMinLimits()[2]);
433 const Eigen::Matrix<Real,3,1> point_1_0_0 = bwd_transform
434 * Eigen::Matrix<Real,3,1>(1.5 * vmesh->getCellSize()[0] + vmesh->getMeshMinLimits()[0],
435 0.5 * vmesh->getCellSize()[1] + vmesh->getMeshMinLimits()[1],
436 0.0 * vmesh->getCellSize()[2] + vmesh->getMeshMinLimits()[2]);
437 const Eigen::Matrix<Real,3,1> point_0_1_0 = bwd_transform
438 * Eigen::Matrix<Real,3,1>(0.5 * vmesh->getCellSize()[0] + vmesh->getMeshMinLimits()[0],
439 1.5 * vmesh->getCellSize()[1] + vmesh->getMeshMinLimits()[1],
440 0.0 * vmesh->getCellSize()[2] + vmesh->getMeshMinLimits()[2]);
441 const Eigen::Matrix<Real,3,1> point_0_0_1 = bwd_transform
442 * Eigen::Matrix<Real,3,1>(0.5 * vmesh->getCellSize()[0] + vmesh->getMeshMinLimits()[0],
443 0.5 * vmesh->getCellSize()[1] + vmesh->getMeshMinLimits()[1],
444 1.0 * vmesh->getCellSize()[2] + vmesh->getMeshMinLimits()[2]);
445 intersection = point_0_0_0[dimension];
446 intersection_di = point_1_0_0[dimension]-point_0_0_0[dimension];
447 intersection_dj = point_0_1_0[dimension]-point_0_0_0[dimension];
448 intersection_dk = point_0_0_1[dimension]-point_0_0_0[dimension];
449 }
450}
dt
Definition Dispersion.m:39
void compute_cell_intersections(spatial_cell::SpatialCell *spatial_cell, const uint popID, const uint map_order, const Real &dt, int intersections_id)
void compute_intersections_2nd(const vmesh::VelocityMesh *vmesh, const Transform< Real, 3, Affine > &bwd_transform, const Transform< Real, 3, Affine > &fwd_transform, const uint dimension, Real &intersection, Real &intersection_di, Real &intersection_dj, Real &intersection_dk)
void compute_intersections_3rd(const vmesh::VelocityMesh *vmesh, const Transform< Real, 3, Affine > &bwd_transform, const Transform< Real, 3, Affine > &fwd_transform, const uint dimension, Real &intersection, Real &intersection_di, Real &intersection_dj, Real &intersection_dk)
void compute_intersections_1st(const vmesh::VelocityMesh *vmesh, const Transform< Real, 3, Affine > &bwd_transform, const Transform< Real, 3, Affine > &fwd_transform, const uint dimension, Real &intersection, Real &intersection_di, Real &intersection_dj, Real &intersection_dk)
Eigen::Matrix< Real, 3, 1 > line_plane_intersection(const Eigen::Matrix< Real, 3, 1 > &l_point, const Eigen::Matrix< Real, 3, 1 > &l_direction, const Eigen::Matrix< Real, 3, 1 > &p_point, const Eigen::Matrix< Real, 3, 1 > &p_normal)
Eigen::Transform< Real, 3, Eigen::Affine > compute_acceleration_transformation(const SpatialCell *spatial_cell, const uint popID, const Real &dt)
float Real
Definition definitions.h:41
const Realf intersection
const Realf intersection_dk
const Realf intersection_di
const Realf intersection_dj