libMesh
point_locator_base.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_BASE_H
21 #define LIBMESH_POINT_LOCATOR_BASE_H
22 
23 // Local Includes
24 #include "libmesh/reference_counted_object.h"
25 #include "libmesh/libmesh_common.h"
26 
27 #ifdef LIBMESH_FORWARD_DECLARE_ENUMS
28 namespace libMesh
29 {
30 enum PointLocatorType : int;
31 }
32 #else
33 #include "libmesh/enum_point_locator_type.h"
34 #endif
35 
36 // C++ includes
37 #include <cstddef>
38 #include <memory>
39 #include <set>
40 #include <vector>
41 
42 namespace libMesh
43 {
44 
45 // Forward Declarations
46 class PointLocatorBase;
47 class MeshBase;
48 class Point;
49 class TreeBase;
50 class Elem;
51 class Node;
52 
53 
62 class PointLocatorBase : public ReferenceCountedObject<PointLocatorBase>
63 {
64 protected:
71  const PointLocatorBase * master);
72 
73 public:
77  virtual ~PointLocatorBase ();
78 
85  static std::unique_ptr<PointLocatorBase> build (PointLocatorType t,
86  const MeshBase & mesh,
87  const PointLocatorBase * master = nullptr);
88 
92  virtual void clear() = 0;
93 
98  virtual void init() = 0;
99 
105  virtual const Elem * operator() (const Point & p,
106  const std::set<subdomain_id_type> * allowed_subdomains = nullptr) const = 0;
107 
112  virtual void operator() (const Point & p,
113  std::set<const Elem *> & candidate_elements,
114  const std::set<subdomain_id_type> * allowed_subdomains = nullptr) const = 0;
115 
132  virtual const Node *
133  locate_node (const Point & p,
134  const std::set<subdomain_id_type> * allowed_subdomains = nullptr,
135  Real tol = TOLERANCE) const;
136 
141  bool initialized () const;
142 
149  virtual void enable_out_of_mesh_mode () = 0;
150 
156  virtual void disable_out_of_mesh_mode () = 0;
157 
162 
167  virtual void set_close_to_point_tol(Real close_to_point_tol);
168 
173  virtual void unset_close_to_point_tol();
174 
178  const MeshBase & get_mesh() const;
179 
183  bool _verbose;
184 
185 protected:
192 
196  const MeshBase & _mesh;
197 
202 
208 
213 };
214 
215 } // namespace libMesh
216 
217 #endif // LIBMESH_POINT_LOCATOR_BASE_H
libMesh::PointLocatorBase::_master
const PointLocatorBase * _master
Const pointer to our master, initialized to nullptr if none given.
Definition: point_locator_base.h:191
libMesh::PointLocatorBase::set_close_to_point_tol
virtual void set_close_to_point_tol(Real close_to_point_tol)
Set a tolerance to use when determining if a point is contained within the mesh.
Definition: point_locator_base.C:92
libMesh::ReferenceCountedObject
This class implements reference counting.
Definition: reference_counted_object.h:65
libMesh
The libMesh namespace provides an interface to certain functionality in the library.
Definition: factoryfunction.C:55
libMesh::PointLocatorBase::_verbose
bool _verbose
Boolean flag to indicate whether to print out extra info.
Definition: point_locator_base.h:183
libMesh::TOLERANCE
static const Real TOLERANCE
Definition: libmesh_common.h:128
libMesh::PointLocatorBase::_close_to_point_tol
Real _close_to_point_tol
The tolerance to use.
Definition: point_locator_base.h:212
libMesh::PointLocatorBase::get_close_to_point_tol
Real get_close_to_point_tol() const
Get the close-to-point tolerance.
Definition: point_locator_base.C:86
mesh
MeshBase & mesh
Definition: mesh_communication.C:1257
libMesh::PointLocatorBase::disable_out_of_mesh_mode
virtual void disable_out_of_mesh_mode()=0
Disables out-of-mesh mode (default).
libMesh::PointLocatorBase::enable_out_of_mesh_mode
virtual void enable_out_of_mesh_mode()=0
Enables out-of-mesh mode.
libMesh::PointLocatorBase::_use_close_to_point_tol
bool _use_close_to_point_tol
true if we will use a user-specified tolerance for locating the element.
Definition: point_locator_base.h:207
libMesh::PointLocatorBase::init
virtual void init()=0
Initializes the point locator, so that the operator() methods can be used.
libMesh::MeshBase
This is the MeshBase class.
Definition: mesh_base.h:78
libMesh::PointLocatorBase::build
static std::unique_ptr< PointLocatorBase > build(PointLocatorType t, const MeshBase &mesh, const PointLocatorBase *master=nullptr)
Builds an PointLocator for the mesh mesh.
Definition: point_locator_base.C:66
libMesh::PointLocatorBase::operator()
virtual const Elem * operator()(const Point &p, const std::set< subdomain_id_type > *allowed_subdomains=nullptr) const =0
Locates the element in which the point with global coordinates p is located.
libMesh::Point
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:38
libMesh::Node
A Node is like a Point, but with more information.
Definition: node.h:52
libMesh::PointLocatorBase::initialized
bool initialized() const
Definition: point_locator_base.C:59
libMesh::PointLocatorBase::locate_node
virtual const Node * locate_node(const Point &p, const std::set< subdomain_id_type > *allowed_subdomains=nullptr, Real tol=TOLERANCE) const
Definition: point_locator_base.C:114
libMesh::PointLocatorBase::get_mesh
const MeshBase & get_mesh() const
Get a const reference to this PointLocator's mesh.
Definition: point_locator_base.C:106
libMesh::PointLocatorBase::~PointLocatorBase
virtual ~PointLocatorBase()
Destructor.
Definition: point_locator_base.C:53
libMesh::PointLocatorBase::_mesh
const MeshBase & _mesh
constant reference to the mesh in which the point is looked for.
Definition: point_locator_base.h:196
libMesh::PointLocatorType
PointLocatorType
Definition: enum_point_locator_type.h:35
libMesh::Elem
This is the base class from which all geometric element types are derived.
Definition: elem.h:100
libMesh::Real
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Definition: libmesh_common.h:121
libMesh::PointLocatorBase::clear
virtual void clear()=0
Clears the PointLocator.
libMesh::PointLocatorBase::unset_close_to_point_tol
virtual void unset_close_to_point_tol()
Specify that we do not want to use a user-specified tolerance to determine if a point is contained wi...
Definition: point_locator_base.C:99
libMesh::PointLocatorBase
This is the base class for point locators.
Definition: point_locator_base.h:62
libMesh::PointLocatorBase::_initialized
bool _initialized
true when properly initialized, false otherwise.
Definition: point_locator_base.h:201
int
void ErrorVector unsigned int
Definition: adjoints_ex3.C:360
libMesh::PointLocatorBase::PointLocatorBase
PointLocatorBase(const MeshBase &mesh, const PointLocatorBase *master)
Constructor.
Definition: point_locator_base.C:34