Chi-Tech
raytracer_1D_slab.cc
Go to the documentation of this file.
1#include "raytracing.h"
2
3#include "mesh/Cell/cell.h"
5
6//###################################################################
7/**Performs raytracing within a 1D-slab.*/
9 Vector3 &pos_i,
10 Vector3 &omega_i,
11 bool& intersection_found,
12 bool& backward_tolerance_hit,
14{
15 const auto& grid = Grid();
16 chi_mesh::Vector3 intersection_point;
17 std::pair<double,double> weights;
18
19 const double fabs_mu = std::fabs(omega_i.Dot(cell.faces_[0].normal_));
20
21 double d_extend = (fabs_mu<1.0e-15)? 1.0e15 : extension_distance_ / fabs_mu;
22
23 chi_mesh::Vector3 pos_f_line = pos_i + omega_i * d_extend;
24
25 int num_faces = 2;
26 for (int f=0; f<num_faces; f++)
27 {
28 uint64_t fpi = cell.vertex_ids_[f]; //face point index
29 chi_mesh::Vertex face_point = grid.vertices[fpi];
30
31 bool intersects = chi_mesh::CheckPlaneLineIntersect(
32 cell.faces_[f].normal_, face_point,
33 pos_i, pos_f_line,
34 intersection_point, &weights);
35
36 double D = weights.first*d_extend;
37
38 if ((D > backward_tolerance_) and intersects )
39 {
41 oi.pos_f = intersection_point;
42
44 oi.destination_face_neighbor = cell.faces_[f].neighbor_id_;
45 intersection_found = true;
46 break;
47 }
48 if (intersects)
49 backward_tolerance_hit = true;
50 }//for faces
51}
std::vector< CellFace > faces_
Definition: cell.h:82
std::vector< uint64_t > vertex_ids_
Definition: cell.h:81
double extension_distance_
Definition: raytracing.h:28
void TraceSlab(const Cell &cell, Vector3 &pos_i, Vector3 &omega_i, bool &intersection_found, bool &backward_tolerance_hit, RayTracerOutputInformation &oi)
double backward_tolerance_
Definition: raytracing.h:27
const chi_mesh::MeshContinuum & Grid() const
Definition: raytracer.cc:7
bool CheckPlaneLineIntersect(const chi_mesh::Normal &plane_normal, const chi_mesh::Vector3 &plane_point, const chi_mesh::Vector3 &line_point_0, const chi_mesh::Vector3 &line_point_1, chi_mesh::Vector3 &intersection_point, std::pair< double, double > *weights=nullptr)
Vector3 Dot(const chi_mesh::TensorRank2Dim3 &that) const