$extrastylesheet
00001 // The libMesh Finite Element Library. 00002 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner 00003 00004 // This library is free software; you can redistribute it and/or 00005 // modify it under the terms of the GNU Lesser General Public 00006 // License as published by the Free Software Foundation; either 00007 // version 2.1 of the License, or (at your option) any later version. 00008 00009 // This library is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 // Lesser General Public License for more details. 00013 00014 // You should have received a copy of the GNU Lesser General Public 00015 // License along with this library; if not, write to the Free Software 00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 00018 00019 00020 #ifndef LIBMESH_TREE_H 00021 #define LIBMESH_TREE_H 00022 00023 // Local includes 00024 #include "libmesh/tree_node.h" 00025 #include "libmesh/tree_base.h" 00026 00027 // C++ includes 00028 00029 namespace libMesh 00030 { 00031 00032 // Forward Declarations 00033 class MeshBase; 00034 00041 template <unsigned int N> 00042 class Tree : public TreeBase 00043 { 00044 public: 00048 Tree (const MeshBase& m, 00049 unsigned int target_bin_size, 00050 Trees::BuildType bt=Trees::NODES); 00051 00055 Tree (const Tree<N>& other_tree); 00056 00060 ~Tree() {} 00061 00065 void print_nodes(std::ostream& my_out=libMesh::out) const; 00066 00070 void print_elements(std::ostream& my_out=libMesh::out) const; 00071 00075 unsigned int n_active_bins() const { return root.n_active_bins(); } 00076 00082 const Elem* find_element(const Point& p, 00083 const std::set<subdomain_id_type> 00084 *allowed_subdomains = NULL, 00085 Real relative_tol = TOLERANCE) const; 00086 00092 const Elem* operator() (const Point& p, 00093 const std::set<subdomain_id_type> 00094 *allowed_subdomains = NULL, 00095 Real relative_tol = TOLERANCE) const; 00096 00097 private: 00101 TreeNode<N> root; 00102 00106 const Trees::BuildType build_type; 00107 }; 00108 00109 00110 00115 namespace Trees 00116 { 00121 typedef Tree<2> BinaryTree; 00122 00127 typedef Tree<4> QuadTree; 00128 00133 typedef Tree<8> OctTree; 00134 } 00135 00136 } // namespace libMesh 00137 00138 00139 #endif // LIBMESH_TREE_H