7 #ifndef PORTAGE_SEARCH_SEARCH_KDTREE_H_     8 #define PORTAGE_SEARCH_SEARCH_KDTREE_H_    17 #include "wonton/support/Point.h"    31 template <
int D, Entity_kind on_what,
    32           typename SourceMeshType, 
typename TargetMeshType>
    50                const TargetMeshType & target_mesh)
    51       : sourceMesh_(source_mesh), targetMesh_(target_mesh)  {}
    64     std::vector<int> candidates;
    65     std::cerr << 
"Search not implemented for generic entity kind" << std::endl;
    70   const SourceMeshType & sourceMesh_;
    71   const TargetMeshType & targetMesh_;
    72   std::shared_ptr<Portage::KDTree<D>> tree_;
    88 template <
int D, 
typename SourceMeshType, 
typename TargetMeshType>
    89 class SearchKDTree<D, Entity_kind::CELL, SourceMeshType, TargetMeshType> {
   105                const TargetMeshType & target_mesh)
   106       : sourceMesh_(source_mesh), targetMesh_(target_mesh)  {
   108     const int numCells = sourceMesh_.num_owned_cells();
   109     std::vector<Portage::IsotheticBBox<D>> bboxes;
   110     bboxes.reserve(numCells);
   113     for (
int c = 0; c < numCells; ++c) {
   114       std::vector<Wonton::Point<D>> cell_coord;
   115       sourceMesh_.cell_get_coordinates(c, &cell_coord);
   117       for (
const auto& cc : cell_coord) {
   120       bboxes.emplace_back(bb);
   138     std::vector<Wonton::Point<D>> cell_coord;
   139     targetMesh_.cell_get_coordinates(cellId, &cell_coord);
   141     for (
const auto& cc : cell_coord)
   148     std::vector<int> lcandidates;
   151     std::vector<int> candidates(lcandidates.begin(), lcandidates.end());
   156   const SourceMeshType & sourceMesh_;
   157   const TargetMeshType & targetMesh_;
   158   std::shared_ptr<Portage::KDTree<D>> tree_;
   175 template <
int D, 
typename SourceMeshType, 
typename TargetMeshType>
   176 class SearchKDTree<D, Entity_kind::NODE, SourceMeshType, TargetMeshType> {
   193                const TargetMeshType & target_mesh)
   194       : sourceMesh_(source_mesh), targetMesh_(target_mesh)  {
   196     const int numNodes = sourceMesh_.num_owned_nodes();
   197     std::vector<Portage::IsotheticBBox<D>> bboxes;
   198     bboxes.reserve(numNodes);
   201     for (
int n = 0; n < numNodes; ++n) {
   202       std::vector<Wonton::Point<D>> dual_cell_coord;
   203       sourceMesh_.dual_cell_get_coordinates(n, &dual_cell_coord);
   205       for (
const auto& cc : dual_cell_coord)
   207       bboxes.emplace_back(bb);
   230     std::vector<Wonton::Point<D>> dual_cell_coord;
   231     targetMesh_.dual_cell_get_coordinates(nodeId, &dual_cell_coord);
   233     for (
const auto& cc : dual_cell_coord)
   240     std::vector<int> lcandidates;
   243     std::vector<int> candidates(lcandidates.begin(), lcandidates.end());
   248   const SourceMeshType & sourceMesh_;
   249   const TargetMeshType & targetMesh_;
   250   std::shared_ptr<Portage::KDTree<D>> tree_;
   255 #endif  // PORTAGE_SEARCH_SEARCH_KDTREE_H_ A k-d tree search class that allows us to search for control volumes of entities from one mesh (sourc...
Definition: search_kdtree.h:33
SearchKDTree(const SourceMeshType &source_mesh, const TargetMeshType &target_mesh)
Builds the k-d tree for searching for intersection candidates. 
Definition: search_kdtree.h:192
SearchKDTree(const SourceMeshType &source_mesh, const TargetMeshType &target_mesh)
Builds the k-d tree for searching for intersection candidates. 
Definition: search_kdtree.h:104
SearchKDTree()=delete
Default constructor (disabled) 
void add(const Point< D > &p)
Update the bounding box by adding an additional Point. 
Definition: BoundBox.h:59
Definition: coredriver.h:42
std::vector< int > operator()(const int entityId) const
Find the source mesh entities whose control volumes potentially overlap control volumes of a given ta...
Definition: search_kdtree.h:63
An isothetic (axis-aligned) N-dimensional bounding box. 
Definition: BoundBox.h:46
SearchKDTree(const SourceMeshType &source_mesh, const TargetMeshType &target_mesh)
Builds the k-d tree for searching for intersection candidates. 
Definition: search_kdtree.h:49
KDTree< D > * KDTreeCreate(const std::vector< IsotheticBBox< D > > &bbox)
Definition: kdtree.h:189
void Intersect(const IsotheticBBox< D > &box, const KDTree< D > *kdtree, std::vector< int > &pfound)
Definition: kdtree.h:439