libMesh
point_locator_base.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_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 #include "libmesh/auto_ptr.h"
27 #include "libmesh/enum_point_locator_type.h"
28 
29 // C++ includes
30 #include <cstddef>
31 #include <vector>
32 
33 namespace libMesh
34 {
35 
36 
37 
38 // Forward Declarations
39 class PointLocatorBase;
40 class MeshBase;
41 class Point;
42 class TreeBase;
43 class Elem;
44 class Node;
45 
46 
47 
56 class PointLocatorBase : public ReferenceCountedObject<PointLocatorBase>
57 {
58 protected:
65  const PointLocatorBase * master);
66 
67 public:
71  virtual ~PointLocatorBase ();
72 
80  const MeshBase & mesh,
81  const PointLocatorBase * master = libmesh_nullptr);
82 
86  virtual void clear() = 0;
87 
92  virtual void init() = 0;
93 
99  virtual const Elem * operator() (const Point & p,
100  const std::set<subdomain_id_type> * allowed_subdomains = libmesh_nullptr) const = 0;
101 
106  virtual void operator() (const Point & p,
107  std::set<const Elem *> & candidate_elements,
108  const std::set<subdomain_id_type> * allowed_subdomains = libmesh_nullptr) const = 0;
109 
126  virtual const Node *
127  locate_node (const Point & p,
128  const std::set<subdomain_id_type> * allowed_subdomains = libmesh_nullptr,
129  Real tol = TOLERANCE) const;
130 
135  bool initialized () const;
136 
143  virtual void enable_out_of_mesh_mode () = 0;
144 
150  virtual void disable_out_of_mesh_mode () = 0;
151 
156  virtual void set_close_to_point_tol(Real close_to_point_tol);
157 
162  virtual void unset_close_to_point_tol();
163 
167  bool _verbose;
168 
169 protected:
176 
180  const MeshBase & _mesh;
181 
186 
192 
197 };
198 
199 } // namespace libMesh
200 
201 #endif // LIBMESH_POINT_LOCATOR_BASE_H
virtual void disable_out_of_mesh_mode()=0
Disables out-of-mesh mode (default).
virtual ~PointLocatorBase()
Destructor.
A Node is like a Point, but with more information.
Definition: node.h:52
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.
bool _use_close_to_point_tol
true if we will use a user-specified tolerance for locating the element.
Real _close_to_point_tol
The tolerance to use.
virtual const Elem * operator()(const Point &p, const std::set< subdomain_id_type > *allowed_subdomains=libmesh_nullptr) const =0
Locates the element in which the point with global coordinates p is located.
PointLocatorType
defines an enum for the types of point locators (given a point with global coordinates, locate the corresponding element in space) available in libMesh.
This is the base class from which all geometric element types are derived.
Definition: elem.h:89
bool _initialized
true when properly initialized, false otherwise.
MeshBase & mesh
const class libmesh_nullptr_t libmesh_nullptr
static const Real TOLERANCE
The libMesh namespace provides an interface to certain functionality in the library.
virtual void init()=0
Initializes the point locator, so that the operator() methods can be used.
This is the MeshBase class.
Definition: mesh_base.h:68
std::unique_ptr< T > UniquePtr
Definition: auto_ptr.h:46
const MeshBase & _mesh
constant reference to the mesh in which the point is looked for.
virtual const Node * locate_node(const Point &p, const std::set< subdomain_id_type > *allowed_subdomains=libmesh_nullptr, Real tol=TOLERANCE) const
This is the base class for point locators.
virtual void clear()=0
Clears the PointLocator.
This class implements reference counting.
static UniquePtr< PointLocatorBase > build(PointLocatorType t, const MeshBase &mesh, const PointLocatorBase *master=libmesh_nullptr)
Builds an PointLocator for the mesh mesh.
PointLocatorBase(const MeshBase &mesh, const PointLocatorBase *master)
Constructor.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
bool _verbose
Boolean flag to indicate whether to print out extra info.
const PointLocatorBase * _master
Const pointer to our master, initialized to NULL if none given.
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...
virtual void enable_out_of_mesh_mode()=0
Enables out-of-mesh mode.
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:38