libMesh
edge.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2019 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_EDGE_H
21 #define LIBMESH_EDGE_H
22 
23 // Local includes
24 #include "libmesh/elem.h"
25 
26 namespace libMesh
27 {
28 
37 class Edge : public Elem
38 {
39 public:
40 
45  Edge (const unsigned int nn,
46  Elem * p,
47  Node ** nodelinkdata) :
48  Elem(nn, Edge::n_sides(), p, _elemlinks_data, nodelinkdata)
49  {
50  // Make sure the interior parent isn't undefined
51  if (LIBMESH_DIM > 1)
52  this->set_interior_parent(nullptr);
53  }
54 
55  Edge (Edge &&) = delete;
56  Edge (const Edge &) = delete;
57  Edge & operator= (const Edge &) = delete;
58  Edge & operator= (Edge &&) = delete;
59  virtual ~Edge() = default;
60 
64  virtual unsigned short dim () const override final { return 1; }
65 
69  virtual unsigned int n_nodes() const override { return 2; }
70 
74  virtual unsigned int n_sides() const override final { return 2; }
75 
79  virtual unsigned int n_vertices() const override final { return 2; }
80 
84  virtual unsigned int n_edges() const override final { return 0; }
85 
89  virtual unsigned int n_faces() const override final { return 0; }
90 
94  virtual unsigned int n_children() const override final { return 2; }
95 
99  virtual bool is_child_on_side(const unsigned int c,
100  const unsigned int s) const override final;
101 
105  virtual bool is_edge_on_side(const unsigned int,
106  const unsigned int) const override final
107  { return false; }
108 
113  virtual unsigned int opposite_side(const unsigned int s) const override final;
114 
120  virtual unsigned int opposite_node(const unsigned int n,
121  const unsigned int s) const override final;
122 
126  using Elem::key;
127 
133  virtual dof_id_type key (const unsigned int s) const override final
134  { return this->compute_key(this->node_id(s)); }
135 
139  virtual unsigned int which_node_am_i(unsigned int side,
140  unsigned int /*side_node*/) const override final;
141 
145  virtual std::unique_ptr<Elem> side_ptr (const unsigned int i) override final;
146 
150  virtual void side_ptr (std::unique_ptr<Elem> & side, const unsigned int i) override final;
151 
155  virtual std::unique_ptr<Elem> build_side_ptr (const unsigned int i,
156  bool proxy=true) override final;
157 
161  virtual void build_side_ptr (std::unique_ptr<Elem> & elem,
162  const unsigned int i) override final;
163 
167  virtual std::unique_ptr<Elem> build_edge_ptr (const unsigned int) override final
168  { libmesh_not_implemented(); return std::unique_ptr<Elem>(); }
169 
170  virtual std::vector<unsigned int> nodes_on_side(const unsigned int s) const override;
171 
172 protected:
173 
177  Elem * _elemlinks_data[3+(LIBMESH_DIM>1)];
178 
179 #ifdef LIBMESH_ENABLE_AMR
180 
184  unsigned int side_children_matrix (const unsigned int,
185  const unsigned int) const
186  { libmesh_not_implemented(); return 0; }
187 
188 #endif
189 
190 };
191 
192 } // namespace libMesh
193 
194 #endif // LIBMESH_EDGE_H
virtual unsigned int n_vertices() const override final
Definition: edge.h:79
A Node is like a Point, but with more information.
Definition: node.h:52
Edge(const unsigned int nn, Elem *p, Node **nodelinkdata)
Default line element, takes number of nodes and parent.
Definition: edge.h:45
Elem * _elemlinks_data[3+(LIBMESH_DIM >1)]
Data for links to parent/neighbor/interior_parent elements.
Definition: edge.h:177
virtual unsigned int opposite_node(const unsigned int n, const unsigned int s) const override final
virtual dof_id_type key(const unsigned int s) const override final
Definition: edge.h:133
unsigned int side_children_matrix(const unsigned int, const unsigned int) const
Matrix that allows children to inherit boundary conditions.
Definition: edge.h:184
virtual unsigned int opposite_side(const unsigned int s) const override final
virtual dof_id_type key() const
virtual unsigned short dim() const override final
Definition: edge.h:64
virtual unsigned int n_edges() const override final
Definition: edge.h:84
This is the base class from which all geometric element types are derived.
Definition: elem.h:101
The libMesh namespace provides an interface to certain functionality in the library.
virtual std::unique_ptr< Elem > build_side_ptr(const unsigned int i, bool proxy=true) override final
void set_interior_parent(Elem *p)
Sets the pointer to the element&#39;s interior_parent.
virtual unsigned int which_node_am_i(unsigned int side, unsigned int) const override final
virtual bool is_edge_on_side(const unsigned int, const unsigned int) const override final
Definition: edge.h:105
virtual std::unique_ptr< Elem > build_edge_ptr(const unsigned int) override final
The Elem::build_edge_ptr() member makes no sense for edges.
Definition: edge.h:167
virtual std::vector< unsigned int > nodes_on_side(const unsigned int s) const override
virtual ~Edge()=default
virtual unsigned int n_children() const override final
Definition: edge.h:94
virtual unsigned int n_faces() const override final
Definition: edge.h:89
Edge & operator=(const Edge &)=delete
virtual bool is_child_on_side(const unsigned int c, const unsigned int s) const override final
The Edge is an element in 1D.
Definition: edge.h:37
static dof_id_type compute_key(dof_id_type n0)
Definition: elem.h:2715
dof_id_type node_id(const unsigned int i) const
Definition: elem.h:1942
virtual unsigned int n_nodes() const override
Definition: edge.h:69
virtual std::unique_ptr< Elem > side_ptr(const unsigned int i) override final
uint8_t dof_id_type
Definition: id_types.h:67
virtual unsigned int n_sides() const override final
Definition: edge.h:74