libMesh
Loading...
Searching...
No Matches
tree_base.h
Go to the documentation of this file.
1// The libMesh Finite Element Library.
2// Copyright (C) 2002-2026 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#include "libmesh/id_types.h" // subdomain_id_type
26#include "libmesh/libmesh_common.h" // TOLERANCE
27
28// C++ includes
29#include <set>
30#include <ostream>
31
32namespace libMesh
33{
34
35
36// Forward Declarations
37class TreeBase;
38class MeshBase;
39class Point;
40class Elem;
41
42
43namespace Trees
44{
62}
63
68class TreeBase : public ReferenceCountedObject<TreeBase>
69{
70protected:
74 explicit
75 TreeBase (const MeshBase & m) : mesh(m) {}
76
77public:
81 virtual ~TreeBase() = default;
82
86 virtual void print_nodes(std::ostream & out_stream=libMesh::out) const = 0;
87
91 virtual void print_elements(std::ostream & out_stream=libMesh::out) const = 0;
92
96 virtual unsigned int n_active_bins() const = 0;
97
103 virtual const Elem * find_element(const Point & p,
104 const std::set<subdomain_id_type> * allowed_subdomains = nullptr,
105 Real relative_tol = TOLERANCE) const = 0;
106
113 virtual void find_elements(const Point & p,
114 std::set<const Elem *> & candidate_elements,
115 const std::set<subdomain_id_type> * allowed_subdomains = nullptr,
116 Real relative_tol = TOLERANCE) const = 0;
117
118protected:
119
124 const MeshBase & mesh;
125};
126
127} // namespace libMesh
128
129
130#endif // LIBMESH_TREE_BASE_H
This is the base class from which all geometric element types are derived.
Definition elem.h:96
This is the MeshBase class.
Definition mesh_base.h:81
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition point.h:40
This class implements reference counting.
This is the base class for trees, it allows pointer usage of trees.
Definition tree_base.h:69
virtual void print_elements(std::ostream &out_stream=libMesh::out) const =0
Prints the nodes.
const MeshBase & mesh
Constant reference to a mesh.
Definition tree_base.h:124
virtual const Elem * find_element(const Point &p, const std::set< subdomain_id_type > *allowed_subdomains=nullptr, Real relative_tol=TOLERANCE) const =0
virtual ~TreeBase()=default
Destructor.
virtual void print_nodes(std::ostream &out_stream=libMesh::out) const =0
Prints the nodes.
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...
virtual unsigned int n_active_bins() const =0
TreeBase(const MeshBase &m)
Constructor.
Definition tree_base.h:75
BuildType
enum defining how to build the tree.
Definition tree_base.h:58
The libMesh namespace provides an interface to certain functionality in the library.
OStreamProxy out
static constexpr Real TOLERANCE
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real