Loading...
Searching...
No Matches
shootRays_CGAL.H
Go to the documentation of this file.
1// Maximum length for dynamicList
2const label maxDynListLength
3(
4 viewFactorDict.getOrDefault<label>("maxDynListLength", 1000000000)
5);
6
7for (const int proci : Pstream::allProcs())
8{
9 std::vector<Point> start;
10 start.reserve(coarseMesh.nFaces());
11
12 std::vector<Point> end(start.size());
13 end.reserve(start.size());
14
15 DynamicList<label> startIndex(start.size());
16 DynamicList<label> endIndex(start.size());
17
18 DynamicList<label> startAgg(start.size());
19 DynamicList<label> endAgg(start.size());
20
21 const pointField& myFc = remoteCoarseCf[Pstream::myProcNo()];
22 const vectorField& myArea = remoteCoarseSf[Pstream::myProcNo()];
23 const labelField& myAgg = remoteCoarseAgg[Pstream::myProcNo()];
24
25 const pointField& remoteArea = remoteCoarseSf[proci];
26 const pointField& remoteFc = remoteCoarseCf[proci];
27 const labelField& remoteAgg = remoteCoarseAgg[proci];
28
29 label i = 0;
30 label j = 0;
31 do
32 {
33 for (; i < myFc.size(); i++)
34 {
35 const point& fc = myFc[i];
36 const vector& fA = myArea[i];
37 const label& fAgg = myAgg[i];
38
39 for (; j < remoteFc.size(); j++)
40 {
41 if (proci != Pstream::myProcNo() || i != j)
42 {
43 const point& remFc = remoteFc[j];
44 const vector& remA = remoteArea[j];
45 const label& remAgg = remoteAgg[j];
46
47 const vector d(remFc - fc);
48
49
50 const vector nd = d/mag(d);
51 const vector nfA = fA/mag(fA);
52 const vector nremA = remA/mag(remA);
53
54 if (((nd & nfA) < 0) && ((nd & nremA) > 0))
55 {
56 vector direction(d[0], d[1], d[2]);
57 vector s(fc[0], fc[1], fc[2]);
58 vector rayEnd(s + (1-intTol)*direction);
59 end.push_back(Point(rayEnd[0], rayEnd[1], rayEnd[2]));
60
61 s += vector(intTol*d[0], intTol*d[1], intTol*d[2]);
62
63 start.push_back(Point(s[0], s[1], s[2]));
64 startIndex.append(i);
65 if (useAgglomeration)
66 {
67 startAgg.append
68 (
69 globalNumbering.toGlobal(proci, fAgg)
70 );
71 endAgg.append
72 (
73 globalNumbering.toGlobal(proci, remAgg)
74 );
75 }
76
77 label globalI = globalNumbering.toGlobal(proci, j);
78 endIndex.append(globalI);
79
80 if (startIndex.size() > maxDynListLength)
81 {
83 << "Dynamic list need from capacity."
84 << "Actual size maxDynListLength : "
86 << abort(FatalError);
87 }
88 }
89 }
90 }
91
92 if (j == remoteFc.size())
93 {
94 j = 0;
95 }
96 }
97
98 } while (i < myFc.size());
99
100 label totalRays(startIndex.size());
101 reduce(totalRays, sumOp<scalar>());
102
103 if (debug)
104 {
105 Pout<< "Number of rays :" << totalRays << endl;
106 }
107
108 for (unsigned long rayI = 0; rayI < start.size(); ++rayI)
109 {
110 Segment ray(start[rayI], end[rayI]);
111 Segment_intersection intersects = tree.any_intersection(ray);
112
113 if (!intersects)
114 {
115 rayStartFace.append(startIndex[rayI]);
116 rayEndFace.append(endIndex[rayI]);
117 }
118 }
119 start.clear();
120
121 if (debug)
122 {
123 Pout << "hits : " << rayStartFace.size()<< endl;
124 }
125
126 startIndex.clear();
127 end.clear();
128 endIndex.clear();
129 startAgg.clear();
130 endAgg.clear();
131}
CGAL::Segment_3< K > Segment
CGAL::Point_3< K > Point
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition error.H:600
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Tree tree(triangles.begin(), triangles.end())
const label maxDynListLength(viewFactorDict.getOrDefault< label >("maxDynListLength", 1000000))
const label maxDynListLength(viewFactorDict.getOrDefault< label >("maxDynListLength", 1000000000))