1#ifndef VISTLE_CELLINTERPOLATION_H
2#define VISTLE_CELLINTERPOLATION_H
23template<
typename Scalar,
typename Index>
35 std::cerr <<
"checkBounds: min: " <<
min[0] <<
" " <<
min[1] <<
" " <<
min[2] <<
", max: " << max[0] <<
" "
36 << max[1] <<
" " << max[2] << std::endl;
38 for (
int i = 0; i < 3; ++i) {
39 if (
min[i] > m_point[i])
41 if (max[i] < m_point[i])
50 std::cerr <<
"visit subtree: Lmax: " << node.Lmax <<
", Rmin: " << node.Rmin << std::endl;
53 const Scalar c = m_point[node.dim];
54 if (c > node.Lmax && c < node.Rmin)
63 const Scalar mean =
Scalar(0.5) * (node.Lmax + node.Rmin);
75template<
typename Scalar,
typename Index>
87 std::cerr <<
"checkBounds: min: " <<
min[0] <<
" " <<
min[1] <<
" " <<
min[2] <<
", max: " << max[0] <<
" "
88 << max[1] <<
" " << max[2] << std::endl;
90 for (
int i = 0; i < 3; ++i) {
91 if (
min[i] > m_p0[i] &&
min[i] > m_p1[i])
93 if (max[i] < m_p0[i] && max[i] < m_p1[i])
102 std::cerr <<
"visit subtree: Lmax: " << node.Lmax <<
", Rmin: " << node.Rmin << std::endl;
105 const Scalar c0 = m_p0[node.dim];
106 const Scalar c1 = m_p1[node.dim];
107 if (c0 > node.Lmax && c0 < node.Rmin && c1 > node.Lmax && c1 < node.Rmin)
109 if (c0 < node.Rmin && c1 < node.Rmin) {
112 if (c0 > node.Lmax && c1 > node.Lmax) {
116 const Scalar mean =
Scalar(0.5) * (node.Lmax + node.Rmin);
129template<
typename Scalar,
typename Index>
145template<
class Gr
id,
typename Scalar,
typename Index>
155 std::cerr <<
"PointInclusionFunctor: checking cell: " << elem << std::endl;
160 std::cerr <<
"PointInclusionFunctor: found cell: " << elem << std::endl;
174template<
class Gr
id,
typename Scalar,
typename Index>
184 std::cerr <<
"LineIntersectionFunctor: checking cell: " << elem << std::endl;
187 if (
m_grid->cellNumFaces() != 1)
189 auto verts =
m_grid->cellVertices(elem);
190 Index nCorners = verts.size();
191 std::vector<Vector> corners;
192 corners.reserve(nCorners);
193 for (
auto v: verts) {
194 corners.emplace_back(
m_grid->getVertex(v));
197 auto normal = nc.first;
198 auto center = nc.second;
201 if (std::abs(cosa) <= 1e-7) {
204 const Scalar t = normal.dot(center -
m_p0) / cosa;
205 if (t < 0 || t > 1) {
209 if (
insidePolygon(isect, corners.data(), nCorners, normal)) {
Definition: celltree.h:40
Order
Definition: celltree.h:42
@ Left
Definition: celltree.h:46
@ None
Definition: celltree.h:43
@ LeftRight
Definition: celltree.h:48
@ Right
Definition: celltree.h:47
@ RightLeft
Definition: celltree.h:49
Definition: celltree.h:31
virtual std::pair< Vector, Vector > cellBounds(Index elem) const =0
Definition: cellalgorithm.h:175
const bool m_acceptGhost
Definition: cellalgorithm.h:218
std::vector< Intersection > intersections
Definition: cellalgorithm.h:223
LineIntersectionFunctor(const Grid *grid, const Vector &p0, const Vector &p1, bool acceptGhost=false)
Definition: cellalgorithm.h:177
Index cell
Definition: cellalgorithm.h:221
Vector point
Definition: cellalgorithm.h:220
const Grid * m_grid
Definition: cellalgorithm.h:215
const Vector m_p0
Definition: cellalgorithm.h:216
const Vector m_dir
Definition: cellalgorithm.h:217
bool operator()(Index elem)
Definition: cellalgorithm.h:181
Definition: cellalgorithm.h:219
Definition: cellalgorithm.h:76
LineVisitationFunctor(const Vector &p0, const Vector &p1)
Definition: cellalgorithm.h:82
Order operator()(const typename Celltree::Node &node)
Definition: cellalgorithm.h:99
bool checkBounds(const Scalar *min, const Scalar *max)
Definition: cellalgorithm.h:84
Definition: cellalgorithm.h:146
PointInclusionFunctor(const Grid *grid, const Vector &point, bool acceptGhost=false)
Definition: cellalgorithm.h:148
Vector m_point
Definition: cellalgorithm.h:169
const Grid * m_grid
Definition: cellalgorithm.h:168
bool m_acceptGhost
Definition: cellalgorithm.h:170
Index cell
Definition: cellalgorithm.h:171
bool operator()(Index elem)
Definition: cellalgorithm.h:152
Definition: cellalgorithm.h:24
bool checkBounds(const Scalar *min, const Scalar *max)
Definition: cellalgorithm.h:32
PointVisitationFunctor(const Vector &point)
Definition: cellalgorithm.h:30
Order operator()(const typename Celltree::Node &node)
Definition: cellalgorithm.h:47
#define V_COREEXPORT
Definition: export.h:9
static T min(T a, T b)
Definition: messages.cpp:28
Definition: allobjects.cpp:30
bool insideConvexPolygon(const Vector &point, const Vector *corners, Index nCorners, const Vector &normal)
Definition: cellalgorithm.cpp:57
unsigned char Byte
Definition: scalar.h:9
Vector trilinearInverse(const Vector &pp0, const Vector pp[8])
Definition: cellalgorithm.cpp:11
Eigen::Matrix< Scalar, 3, 1 > Vector3
Definition: vector.h:33
bool insideCell(const Vector &point, Byte type, Index nverts, const Index *cl, const Scalar *x, const Scalar *y, const Scalar *z)
Definition: cellalgorithm.cpp:274
Vector3 Vector
Definition: vector.h:36
const Index InvalidIndex
Definition: index.h:17
float Scalar
Definition: scalar.h:14
bool insidePolygon(const Vector &point, const Vector *corners, Index nCorners, const Vector &normal)
Definition: cellalgorithm.cpp:134
bool originInsidePolygonZ2D(const Vector3 *corners, Index nCorners)
Definition: cellalgorithm.cpp:112
std::pair< Vector, Vector > faceNormalAndCenter(Byte type, Index f, const Index *cl, const Scalar *x, const Scalar *y, const Scalar *z)
Definition: cellalgorithm.cpp:211
uint32_t Index
Definition: index.h:13
Definition: celltree.h:20
Definition: cellalgorithm.h:130
const GridInterface * m_grid
Definition: cellalgorithm.h:141
bool operator()(Index elem, Vector *min, Vector *max) const
Definition: cellalgorithm.h:133
CellBoundsFunctor(const GridInterface *grid)
Definition: cellalgorithm.h:131