OpenLB 1.7
|
#include <octree.h>
Public Member Functions | |
Octree (Vector< T, 3 > center, T rad, STLmesh< T > *mesh, short maxDepth, T overlap=0., Octree< T > *parent=nullptr) | |
~Octree () | |
Destructor destructs. | |
Octree< T > * | find (const Vector< T, 3 > &, const int &maxDepth=0) |
Find the node containing the first param with remaining maxDepth. | |
void | write (const Vector< T, 3 > &pt, const std::string no) |
Write Octree. | |
void | write (const int, const std::string) |
Write Octree. | |
void | write (const std::string) |
Write Octree. | |
int | testIntersection (const Vector< T, 3 > &pt, const Vector< T, 3 > &dir, bool print=false) |
Test intersection of ray with all triangles in Octree returns number of intersections. | |
bool | closestIntersection (const Vector< T, 3 > &pt, const Vector< T, 3 > &direction, Vector< T, 3 > &q, T &a) |
Test intersection of ray with all triangles in Octree q contains point of closest intersection to pt in direction direction. | |
bool | closestIntersection (const Vector< T, 3 > &pt, const Vector< T, 3 > &direction, Vector< T, 3 > &q, T &a, STLtriangle< T > &tri, const T &rad=0., bool print=false) |
Test intersection of ray with all triangles in Octree q contains point of closest intersection to pt in direction direction tri contains triangle with closest intersection. | |
bool | closestIntersectionSphere (const Vector< T, 3 > &pt, const T &rad, const Vector< T, 3 > &direction, Vector< T, 3 > &q, T &a, STLtriangle< T > &tri) |
Test intersection of sphere moving along ray with radius rad q contains point of closest intersection to pt in direction direction tri contains triangle with closest intersection. | |
void | checkRay (const Vector< T, 3 > &pt, const Vector< T, 3 > &dir, unsigned short &rayInside) |
It's complicated. Computes intersections of a ray with triangles inside this Octree. Sets _inside depending on value of rayInside and changes rayInside depending on the number of intersections. Also takes into account if the intersections happen before or after the center. | |
void | intersectRayNode (const Vector< T, 3 > &pt, const Vector< T, 3 > &dir, Vector< T, 3 > &s) |
Computes intersection of ray with Octree boundaries. | |
void | getCenterpoints (std::vector< std::vector< T > > &pts) |
Computes all centerpoints of Octree. | |
void | getLeafs (std::vector< Octree< T > * > &pts) |
Collectes all leafs. | |
bool | isLeaf () |
Return status of _isLeaf;. | |
void | setInside (bool ins) |
Sets Inside. | |
bool | getInside () |
Gets Inside. | |
bool | getBoundaryNode () |
Gets _boundarNode. | |
int | getMaxdepth () const |
Gets Maxdepth. | |
const std::vector< unsigned int > & | getTriangles () const |
Gets numbers of triangles contained by this Octree. | |
const Vector< T, 3 > & | getCenter () const |
Gets centerpoint. | |
const T | getRadius () const |
Gets radius. | |
void | print () |
Prints console output. | |
void | trianglesOnLine (const Vector< T, 3 > &pt1, const Vector< T, 3 > &pt2, std::set< unsigned int > &tris) |
Returns set of indices of all triangles in nodes containing a line. | |
STLmesh< T > * | getMesh () |
Returns reference to _mesh. | |
Protected Member Functions | |
void | findTriangles (T overlap=0.) |
bool | AABBTri (const STLtriangle< T > &tri, T overlap=0.) |
Protected Attributes | |
std::vector< unsigned int > | _triangles |
_vector _triangles contains number of triangles | |
Vector< T, 3 > | _center |
T | _radius |
STLmesh< T > * | _mesh |
short | _maxDepth |
bool | _isLeaf |
bool | _boundaryNode |
bool | _inside |
Octree< T > * | _parent |
Octree< T > ** | _child |
olb::Octree< T >::Octree | ( | Vector< T, 3 > | center, |
T | rad, | ||
STLmesh< T > * | mesh, | ||
short | maxDepth, | ||
T | overlap = 0., | ||
Octree< T > * | parent = nullptr ) |
Definition at line 48 of file octree.hh.
References olb::Octree< T >::_boundaryNode, olb::Octree< T >::_center, olb::Octree< T >::_child, olb::Octree< T >::_isLeaf, olb::Octree< T >::_maxDepth, olb::Octree< T >::_mesh, olb::Octree< T >::_radius, olb::Octree< T >::_triangles, and olb::Octree< T >::findTriangles().
olb::Octree< T >::~Octree | ( | ) |
|
protected |
Definition at line 143 of file octree.hh.
References olb::STLtriangle< T >::d, olb::util::fabs(), olb::util::max(), olb::util::min(), olb::STLtriangle< T >::normal, and olb::STLtriangle< T >::point.
void olb::Octree< T >::checkRay | ( | const Vector< T, 3 > & | pt, |
const Vector< T, 3 > & | dir, | ||
unsigned short & | rayInside ) |
It's complicated. Computes intersections of a ray with triangles inside this Octree. Sets _inside depending on value of rayInside and changes rayInside depending on the number of intersections. Also takes into account if the intersections happen before or after the center.
Definition at line 377 of file octree.hh.
References olb::util::nearZero(), and olb::normalize().
bool olb::Octree< T >::closestIntersection | ( | const Vector< T, 3 > & | pt, |
const Vector< T, 3 > & | direction, | ||
Vector< T, 3 > & | q, | ||
T & | a ) |
Test intersection of ray with all triangles in Octree q contains point of closest intersection to pt in direction direction.
Definition at line 669 of file octree.hh.
bool olb::Octree< T >::closestIntersection | ( | const Vector< T, 3 > & | pt, |
const Vector< T, 3 > & | direction, | ||
Vector< T, 3 > & | q, | ||
T & | a, | ||
STLtriangle< T > & | tri, | ||
const T & | rad = 0., | ||
bool | print = false ) |
Test intersection of ray with all triangles in Octree q contains point of closest intersection to pt in direction direction tri contains triangle with closest intersection.
Definition at line 639 of file octree.hh.
References olb::GenericVector< T, D, IMPL >::size().
bool olb::Octree< T >::closestIntersectionSphere | ( | const Vector< T, 3 > & | pt, |
const T & | rad, | ||
const Vector< T, 3 > & | direction, | ||
Vector< T, 3 > & | q, | ||
T & | a, | ||
STLtriangle< T > & | tri ) |
Test intersection of sphere moving along ray with radius rad q contains point of closest intersection to pt in direction direction tri contains triangle with closest intersection.
Definition at line 619 of file octree.hh.
Octree< T > * olb::Octree< T >::find | ( | const Vector< T, 3 > & | pt, |
const int & | maxDepth = 0 ) |
Find the node containing the first param with remaining maxDepth.
Definition at line 263 of file octree.hh.
References olb::util::abs().
|
protected |
Definition at line 122 of file octree.hh.
|
inline |
Gets _boundarNode.
Definition at line 104 of file octree.h.
References olb::Octree< T >::_boundaryNode.
|
inline |
void olb::Octree< T >::getCenterpoints | ( | std::vector< std::vector< T > > & | pts | ) |
|
inline |
void olb::Octree< T >::getLeafs | ( | std::vector< Octree< T > * > & | pts | ) |
|
inline |
|
inline |
Returns reference to _mesh.
Definition at line 133 of file octree.h.
References olb::Octree< T >::_mesh.
|
inline |
|
inline |
Gets numbers of triangles contained by this Octree.
Definition at line 114 of file octree.h.
References olb::Octree< T >::_triangles.
void olb::Octree< T >::intersectRayNode | ( | const Vector< T, 3 > & | pt, |
const Vector< T, 3 > & | dir, | ||
Vector< T, 3 > & | s ) |
Computes intersection of ray with Octree boundaries.
Definition at line 676 of file octree.hh.
References olb::util::fabs().
bool olb::Octree< T >::isLeaf | ( | ) |
void olb::Octree< T >::print | ( | ) |
|
inline |
int olb::Octree< T >::testIntersection | ( | const Vector< T, 3 > & | pt, |
const Vector< T, 3 > & | dir, | ||
bool | print = false ) |
Test intersection of ray with all triangles in Octree returns number of intersections.
Definition at line 324 of file octree.hh.
References olb::util::fabs(), and olb::util::nearZero().
void olb::Octree< T >::trianglesOnLine | ( | const Vector< T, 3 > & | pt1, |
const Vector< T, 3 > & | pt2, | ||
std::set< unsigned int > & | tris ) |
Returns set of indices of all triangles in nodes containing a line.
Definition at line 747 of file octree.hh.
References olb::Octree< T >::_triangles, and olb::Octree< T >::intersectRayNode().
void olb::Octree< T >::write | ( | const int | depth, |
const std::string | no ) |
Write Octree.
Definition at line 475 of file octree.hh.
References olb::singleton::directories(), and olb::singleton::Directories::getVtkOutDir().
void olb::Octree< T >::write | ( | const std::string | fName | ) |
Write Octree.
Definition at line 507 of file octree.hh.
References olb::singleton::directories(), olb::singleton::MpiManager::getRank(), olb::singleton::Directories::getVtkOutDir(), and olb::singleton::mpi().
void olb::Octree< T >::write | ( | const Vector< T, 3 > & | pt, |
const std::string | no ) |
Write Octree.
Definition at line 444 of file octree.hh.
References olb::singleton::directories(), olb::util::fabs(), and olb::singleton::Directories::getVtkOutDir().
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |