$extrastylesheet
location_maps.h
Go to the documentation of this file.
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_LOCATION_MAPS_H
00021 #define LIBMESH_LOCATION_MAPS_H
00022 
00023 #include "libmesh/libmesh_config.h"
00024 
00025 // Local Includes -----------------------------------
00026 #include "libmesh/libmesh_common.h"
00027 #include "libmesh/point.h"
00028 
00029 // C++ Includes   -----------------------------------
00030 #include LIBMESH_INCLUDE_UNORDERED_MULTIMAP
00031 #include <vector>
00032 
00033 namespace libMesh
00034 {
00035 
00036 // Forward Declarations -----------------------------
00037 class Elem;
00038 class MeshBase;
00039 class Node;
00040 
00041 
00048 template <typename T>
00049 class LocationMap
00050 {
00051   typedef LIBMESH_BEST_UNORDERED_MULTIMAP<unsigned int, T*> map_type;
00052 public:
00053   void init(MeshBase&);
00054 
00055   void clear() { _map.clear(); }
00056 
00057   void insert(T&);
00058 
00059   bool empty() const { return _map.empty(); }
00060 
00061   T* find(const Point&,
00062           const Real tol = TOLERANCE);
00063 
00064   Point point_of(const T&) const;
00065 
00066 protected:
00067   unsigned int key(const Point&);
00068 
00069   void fill(MeshBase&);
00070 
00071 private:
00072   map_type          _map;
00073   std::vector<Real> _lower_bound;
00074   std::vector<Real> _upper_bound;
00075 };
00076 
00077 } // namespace libMesh
00078 
00079 
00080 #endif // LIBMESH_LOCATION_MAPS_H