libMesh
point_locator_tree.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2017 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 = libmesh_nullptr);
61 
62 
74  PointLocatorTree (const MeshBase & mesh,
75  const Trees::BuildType build_type,
76  const PointLocatorBase * master = libmesh_nullptr);
77 
82 
86  virtual void clear() libmesh_override;
87 
92  void init(Trees::BuildType build_type);
93 
98  virtual void init() libmesh_override;
99 
107  virtual const Elem * operator() (const Point & p,
108  const std::set<subdomain_id_type> * allowed_subdomains = libmesh_nullptr) const libmesh_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 = libmesh_nullptr) const libmesh_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 () libmesh_override;
147 
153  virtual void disable_out_of_mesh_mode () libmesh_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
unsigned int get_target_bin_size() const
Get the target bin size.
virtual void init() libmesh_override
Initializes the locator, so that the operator() methods can be used.
This is a point locator.
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.
This is the base class from which all geometric element types are derived.
Definition: elem.h:89
MeshBase & mesh
const class libmesh_nullptr_t libmesh_nullptr
static const Real TOLERANCE
virtual const Elem * operator()(const Point &p, const std::set< subdomain_id_type > *allowed_subdomains=libmesh_nullptr) const libmesh_override
Locates the element in which the point with global coordinates p is located, optionally restricted to...
The libMesh namespace provides an interface to certain functionality in the library.
PointLocatorTree(const MeshBase &mesh, const PointLocatorBase *master=libmesh_nullptr)
Constructor.
const Elem * _element
Pointer to the last element that was found by the tree.
This is the MeshBase class.
Definition: mesh_base.h:68
virtual void enable_out_of_mesh_mode() libmesh_override
Enables out-of-mesh mode.
This is the base class for point locators.
virtual void disable_out_of_mesh_mode() libmesh_override
Disables out-of-mesh mode (default).
Trees::BuildType _build_type
How the underlying tree is built.
unsigned int _target_bin_size
Target bin size, which gets passed to the constructor of _tree.
bool _out_of_mesh_mode
true if out-of-mesh mode is enabled.
This is the base class for trees, it allows pointer usage of trees.
Definition: tree_base.h:65
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
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&#39;s helpful to be able to do a linear search over the entire mesh...
BuildType
enum defining how to build the tree.
Definition: tree_base.h:55
void set_target_bin_size(unsigned int target)
Set the target bin size.
virtual void clear() libmesh_override
Clears the locator.
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:38
TreeBase * _tree
Pointer to our tree.