libMesh
topology_map.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2025 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_TOPOLOGY_MAP_H
21 #define LIBMESH_TOPOLOGY_MAP_H
22 
23 // Local Includes
24 #include "libmesh/libmesh_config.h"
25 #include "libmesh/libmesh_common.h"
26 #include "libmesh/hashing.h"
27 
28 // C++ Includes
29 #include <unordered_map>
30 #include <vector>
31 
32 namespace libMesh
33 {
34 
35 // Forward Declarations
36 class Elem;
37 class MeshBase;
38 class Node;
39 
58 {
59  // We need to supply our own hash function.
60  typedef std::unordered_map<std::pair<dof_id_type, dof_id_type>, dof_id_type, libMesh::hash> map_type;
61 public:
62  void init(MeshBase &);
63 
64  void clear() { _map.clear(); }
65 
70  void add_node(const Node & mid_node,
71  const std::vector<
72  std::pair<dof_id_type, dof_id_type>> &
73  bracketing_nodes);
74 
75  bool empty() const { return _map.empty(); }
76 
77  dof_id_type find(dof_id_type bracket_node1,
78  dof_id_type bracket_node2) const;
79 
80  dof_id_type find(const std::vector<
81  std::pair<dof_id_type, dof_id_type>> &
82  bracketing_nodes) const;
83 
84 protected:
85  void fill(const MeshBase &);
86 
87 private:
89 };
90 
91 } // namespace libMesh
92 
93 
94 #endif // LIBMESH_TOPOLOGY_MAP_H
Data structures that enable topology-based lookups of nodes created by mesh refinement.
Definition: topology_map.h:57
A Node is like a Point, but with more information.
Definition: node.h:52
dof_id_type find(dof_id_type bracket_node1, dof_id_type bracket_node2) const
Definition: topology_map.C:115
void add_node(const Node &mid_node, const std::vector< std::pair< dof_id_type, dof_id_type >> &bracketing_nodes)
Add a node to the map, between each pair of specified bracketing nodes.
Definition: topology_map.C:53
void init(MeshBase &)
Definition: topology_map.C:36
void fill(const MeshBase &)
Definition: topology_map.C:136
The libMesh namespace provides an interface to certain functionality in the library.
This is the MeshBase class.
Definition: mesh_base.h:75
bool empty() const
Definition: topology_map.h:75
std::unordered_map< std::pair< dof_id_type, dof_id_type >, dof_id_type, libMesh::hash > map_type
Definition: topology_map.h:60
uint8_t dof_id_type
Definition: id_types.h:67