tree.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2014 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_H
21 #define LIBMESH_TREE_H
22 
23 // Local includes
24 #include "libmesh/tree_node.h"
25 #include "libmesh/tree_base.h"
26 
27 // C++ includes
28 
29 namespace libMesh
30 {
31 
32 // Forward Declarations
33 class MeshBase;
34 
42 // ------------------------------------------------------------
43 // Tree class definition
44 template <unsigned int N>
45 class Tree : public TreeBase
46 {
47 public:
48 
52  Tree (const MeshBase& m, const unsigned int target_bin_size, Trees::BuildType bt=Trees::NODES);
53 
57  Tree (const Tree<N>& other_tree);
58 
62  ~Tree() {}
63 
67  void print_nodes(std::ostream& my_out=libMesh::out) const
68  { my_out << "Printing nodes...\n"; root.print_nodes(my_out); }
69 
73  void print_elements(std::ostream& my_out=libMesh::out) const
74  { my_out << "Printing elements...\n"; root.print_elements(my_out); }
75 
79  unsigned int n_active_bins() const { return root.n_active_bins(); }
80 
84  const Elem* find_element(const Point& p) const;
85 
89  const Elem* operator() (const Point& p) const;
90 
91 
92 private:
93 
94 
99 
104 
105 };
106 
107 
108 
113 namespace Trees
114 {
120 
125  typedef Tree<4> QuadTree;
126 
131  typedef Tree<8> OctTree;
132 }
133 
134 
135 
136 // ------------------------------------------------------------
137 // Tree class inline methods
138 
139 
140 
141 // copy-constructor
142 template <unsigned int N>
143 inline
144 Tree<N>::Tree (const Tree<N>& other_tree) :
145  TreeBase (other_tree),
146  root (other_tree.root),
147  build_type (other_tree.build_type)
148 {
149  libmesh_error();
150 }
151 
152 
153 
154 template <unsigned int N>
155 inline
156 const Elem* Tree<N>::operator() (const Point& p) const
157 {
158  return this->find_element(p);
159 }
160 
161 
162 } // namespace libMesh
163 
164 
165 #endif // LIBMESH_TREE_H

Site Created By: libMesh Developers
Last modified: February 07 2014 16:57:07 UTC

Hosted By:
SourceForge.net Logo