libMesh
tree_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_TREE_BASE_H
21 #define LIBMESH_TREE_BASE_H
22 
23 // Local includes
24 #include "libmesh/reference_counted_object.h"
25 
26 // C++ includes
27 #include <set>
28 
29 namespace libMesh
30 {
31 
32 
33 // Forward Declarations
34 class TreeBase;
35 class MeshBase;
36 class Point;
37 class Elem;
38 
39 
40 namespace Trees
41 {
55 enum BuildType {NODES=0,
59 }
60 
65 class TreeBase : public ReferenceCountedObject<TreeBase>
66 {
67 protected:
71  explicit
72  TreeBase (const MeshBase & m);
73 
74 public:
78  virtual ~TreeBase() {}
79 
83  virtual void print_nodes(std::ostream & out=libMesh::out) const = 0;
84 
88  virtual void print_elements(std::ostream & out=libMesh::out) const = 0;
89 
93  virtual unsigned int n_active_bins() const = 0;
94 
100  virtual const Elem * find_element(const Point & p,
101  const std::set<subdomain_id_type> * allowed_subdomains = nullptr,
102  Real relative_tol = TOLERANCE) const = 0;
103 
110  virtual void find_elements(const Point & p,
111  std::set<const Elem *> & candidate_elements,
112  const std::set<subdomain_id_type> * allowed_subdomains = nullptr,
113  Real relative_tol = TOLERANCE) const = 0;
114 
115 
116 protected:
117 
122  const MeshBase & mesh;
123 };
124 
125 // ------------------------------------------------------------
126 // TreeBase class inline methods
127 
128 // constructor
129 inline
131  mesh(m)
132 {
133 }
134 
135 } // namespace libMesh
136 
137 
138 #endif // LIBMESH_TREE_BASE_H
libMesh::TreeBase::mesh
const MeshBase & mesh
Constant reference to a mesh.
Definition: tree_base.h:122
libMesh::Trees::LOCAL_ELEMENTS
Definition: tree_base.h:57
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::TreeBase::n_active_bins
virtual unsigned int n_active_bins() const =0
libMesh::TreeBase::print_nodes
virtual void print_nodes(std::ostream &out=libMesh::out) const =0
Prints the nodes.
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::TreeBase::find_element
virtual const Elem * find_element(const Point &p, const std::set< subdomain_id_type > *allowed_subdomains=nullptr, Real relative_tol=TOLERANCE) const =0
libMesh::Trees::INVALID_BUILD_TYPE
Definition: tree_base.h:58
libMesh::MeshBase
This is the MeshBase class.
Definition: mesh_base.h:78
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::TreeBase::find_elements
virtual void find_elements(const Point &p, std::set< const Elem * > &candidate_elements, const std::set< subdomain_id_type > *allowed_subdomains=nullptr, Real relative_tol=TOLERANCE) const =0
Fills candidate_elements with any elements containing the specified point p, optionally restricted to...
libMesh::Elem
This is the base class from which all geometric element types are derived.
Definition: elem.h:100
libMesh::TreeBase::TreeBase
TreeBase(const MeshBase &m)
Constructor.
Definition: tree_base.h:130
libMesh::Trees::NODES
Definition: tree_base.h:55
libMesh::Real
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Definition: libmesh_common.h:121
libMesh::TreeBase::~TreeBase
virtual ~TreeBase()
Destructor.
Definition: tree_base.h:78
libMesh::TreeBase::print_elements
virtual void print_elements(std::ostream &out=libMesh::out) const =0
Prints the nodes.
libMesh::out
OStreamProxy out
libMesh::Trees::ELEMENTS
Definition: tree_base.h:56