82 |
toVisitSet.insert(h0); |
toVisitSet.insert(h0); |
83 |
toVisitStack.push(h0); |
toVisitStack.push(h0); |
84 |
Hexahedron* h; |
Hexahedron* h; |
85 |
|
size_t numberOfCell = 1; |
86 |
do { |
do { |
87 |
|
fferr(0) << "Visiting cell n°" << numberOfCell++ << '\n'; |
88 |
// treating next cell |
// treating next cell |
89 |
h = toVisitStack.top(); |
h = toVisitStack.top(); |
90 |
|
|
93 |
visited.insert(h); |
visited.insert(h); |
94 |
|
|
95 |
const Hexahedron& H = *h; |
const Hexahedron& H = *h; |
96 |
|
|
97 |
|
TinyVector<3> Hmin=H(0); |
98 |
|
TinyVector<3> Hmax=H(0); |
99 |
|
|
100 |
|
for (size_t k=1; k<H.numberOfVertices(); ++k) { |
101 |
|
for (size_t l=0; l<3; ++l) { |
102 |
|
Hmin[l] = std::min(Hmin[l], H(k)[l]); |
103 |
|
Hmax[l] = std::max(Hmax[l], H(k)[l]); |
104 |
|
} |
105 |
|
} |
106 |
|
|
107 |
|
fferr(0) << "Cell is:\n"; |
108 |
|
fferr(0) << '\t' << Hmin << '-' << Hmax << '\n'; |
109 |
|
|
110 |
ConformTransformationQ1Hexahedra T(H); |
ConformTransformationQ1Hexahedra T(H); |
111 |
|
|
112 |
TinyVector<3, real_t> Xhat; |
TinyVector<3, real_t> Xhat; |
113 |
TinyVector<6,bool> neighbours = false; |
TinyVector<6,bool> neighbours = false; |
114 |
found = false; |
found = false; |
115 |
if (T.invertT(x,y,z, Xhat)) { |
if (not(T.invertT(x,y,z, Xhat))) { |
116 |
const double epsilon=1E-5; |
const double epsilon=1E-5; |
117 |
bool inside = true; |
bool inside = true; |
118 |
for (size_t k=0; k<3; ++k) { |
for (size_t k=0; k<3; ++k) { |
122 |
inside &= not(neighbours[2*k] or neighbours[2*k+1]); |
inside &= not(neighbours[2*k] or neighbours[2*k+1]); |
123 |
} |
} |
124 |
found = inside; |
found = inside; |
125 |
|
} else { |
126 |
|
found = true; |
127 |
} |
} |
128 |
|
|
129 |
if(!found) { |
if(!found) { |
145 |
} while (not(found) and not(toVisitStack.empty())); |
} while (not(found) and not(toVisitStack.empty())); |
146 |
|
|
147 |
if (not(found)) { |
if (not(found)) { |
148 |
|
fferr(0) << "#### Really did not found ####\n"; |
149 |
h = 0; |
h = 0; |
150 |
} |
} |
151 |
|
|