libMesh
point_locator_tree.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2019 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 
20 #ifndef LIBMESH_POINT_LOCATOR_TREE_H
21 #define LIBMESH_POINT_LOCATOR_TREE_H
22 
23 // Local Includes
24 #include "libmesh/point_locator_base.h"
25 #include "libmesh/tree_base.h"
26 
27 // C++ includes
28 #include <cstddef>
29 
30 namespace libMesh
31 {
32 
33 // Forward Declarations
34 class MeshBase;
35 class Point;
36 class Elem;
37 
49 {
50 public:
60  const PointLocatorBase * master = nullptr);
61 
62 
75  const Trees::BuildType build_type,
76  const PointLocatorBase * master = nullptr);
77 
82 
86  virtual void clear() override;
87 
92  void init(Trees::BuildType build_type);
93 
98  virtual void init() override;
99 
107  virtual const Elem * operator() (const Point & p,
108  const std::set<subdomain_id_type> * allowed_subdomains = nullptr) const override;
109 
114  virtual void operator() (const Point & p,
115  std::set<const Elem *> & candidate_elements,
116  const std::set<subdomain_id_type> * allowed_subdomains = nullptr) const override;
117 
126  const Elem * perform_linear_search(const Point & p,
127  const std::set<subdomain_id_type> * allowed_subdomains,
128  bool use_close_to_point,
129  Real close_to_point_tolerance=TOLERANCE) const;
130 
136  std::set<const Elem *> perform_fuzzy_linear_search(const Point & p,
137  const std::set<subdomain_id_type> * allowed_subdomains,
138  Real close_to_point_tolerance=TOLERANCE) const;
139 
146  virtual void enable_out_of_mesh_mode () override;
147 
153  virtual void disable_out_of_mesh_mode () override;
154 
158  void set_target_bin_size(unsigned int target);
159 
163  unsigned int get_target_bin_size() const;
164 
165 protected:
172 
178  mutable const Elem * _element;
179 
185 
189  unsigned int _target_bin_size;
190 
195 };
196 
197 } // namespace libMesh
198 
199 #endif // LIBMESH_POINT_LOCATOR_TREE_H
libMesh::PointLocatorTree::enable_out_of_mesh_mode
virtual void enable_out_of_mesh_mode() override
Enables out-of-mesh mode.
Definition: point_locator_tree.C:334
libMesh::PointLocatorTree::_build_type
Trees::BuildType _build_type
How the underlying tree is built.
Definition: point_locator_tree.h:194
libMesh::PointLocatorTree::_target_bin_size
unsigned int _target_bin_size
Target bin size, which gets passed to the constructor of _tree.
Definition: point_locator_tree.h:189
libMesh
The libMesh namespace provides an interface to certain functionality in the library.
Definition: factoryfunction.C:55
libMesh::TOLERANCE
static const Real TOLERANCE
Definition: libmesh_common.h:128
mesh
MeshBase & mesh
Definition: mesh_communication.C:1257
libMesh::Trees::BuildType
BuildType
enum defining how to build the tree.
Definition: tree_base.h:55
libMesh::PointLocatorTree::PointLocatorTree
PointLocatorTree(const MeshBase &mesh, const PointLocatorBase *master=nullptr)
Constructor.
Definition: point_locator_tree.C:37
libMesh::PointLocatorTree
This is a point locator.
Definition: point_locator_tree.h:48
libMesh::PointLocatorTree::set_target_bin_size
void set_target_bin_size(unsigned int target)
Set the target bin size.
Definition: point_locator_tree.C:348
libMesh::MeshBase
This is the MeshBase class.
Definition: mesh_base.h:78
libMesh::PointLocatorTree::clear
virtual void clear() override
Clears the locator.
Definition: point_locator_tree.C:73
libMesh::Point
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:38
libMesh::TreeBase
This is the base class for trees, it allows pointer usage of trees.
Definition: tree_base.h:65
libMesh::PointLocatorTree::_out_of_mesh_mode
bool _out_of_mesh_mode
true if out-of-mesh mode is enabled.
Definition: point_locator_tree.h:184
libMesh::PointLocatorTree::init
virtual void init() override
Initializes the locator, so that the operator() methods can be used.
Definition: point_locator_tree.C:92
libMesh::PointLocatorTree::operator()
virtual const Elem * operator()(const Point &p, const std::set< subdomain_id_type > *allowed_subdomains=nullptr) const override
Locates the element in which the point with global coordinates p is located, optionally restricted to...
Definition: point_locator_tree.C:196
libMesh::PointLocatorTree::perform_linear_search
const Elem * perform_linear_search(const Point &p, const std::set< subdomain_id_type > *allowed_subdomains, bool use_close_to_point, Real close_to_point_tolerance=TOLERANCE) const
As a fallback option, it's helpful to be able to do a linear search over the entire mesh.
Definition: point_locator_tree.C:270
libMesh::Elem
This is the base class from which all geometric element types are derived.
Definition: elem.h:100
libMesh::PointLocatorTree::_element
const Elem * _element
Pointer to the last element that was found by the tree.
Definition: point_locator_tree.h:178
libMesh::PointLocatorTree::disable_out_of_mesh_mode
virtual void disable_out_of_mesh_mode() override
Disables out-of-mesh mode (default).
Definition: point_locator_tree.C:342
libMesh::Real
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Definition: libmesh_common.h:121
libMesh::PointLocatorTree::get_target_bin_size
unsigned int get_target_bin_size() const
Get the target bin size.
Definition: point_locator_tree.C:354
libMesh::PointLocatorTree::_tree
TreeBase * _tree
Pointer to our tree.
Definition: point_locator_tree.h:171
libMesh::PointLocatorBase
This is the base class for point locators.
Definition: point_locator_base.h:62
libMesh::PointLocatorTree::~PointLocatorTree
~PointLocatorTree()
Destructor.
Definition: point_locator_tree.C:66
libMesh::PointLocatorTree::perform_fuzzy_linear_search
std::set< const Elem * > perform_fuzzy_linear_search(const Point &p, const std::set< subdomain_id_type > *allowed_subdomains, Real close_to_point_tolerance=TOLERANCE) const
A method to check if "fat" point p is in multiple elements.
Definition: point_locator_tree.C:308