edge_edge2.C
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2018 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 // Local includes
21 #include "libmesh/edge_edge2.h"
23 #include "libmesh/enum_order.h"
24 
25 namespace libMesh
26 {
27 
28 
29 // Edge2 class static member initializations
30 const int Edge2::num_nodes;
31 const int Edge2::num_children;
32 
33 #ifdef LIBMESH_ENABLE_AMR
34 
36  {
37  // embedding matrix for child 0
38  {
39  // 0 1
40  {1.0, 0.0}, // 0
41  {0.5, 0.5} // 1
42  },
43 
44  // embedding matrix for child 1
45  {
46  // 0 1
47  {0.5, 0.5}, // 0
48  {0.0, 1.0} // 1
49  }
50  };
51 
52 #endif
53 
54 bool Edge2::is_vertex(const unsigned int) const
55 {
56  return true;
57 }
58 
59 bool Edge2::is_edge(const unsigned int) const
60 {
61  return false;
62 }
63 
64 bool Edge2::is_face(const unsigned int) const
65 {
66  return false;
67 }
68 
69 bool Edge2::is_node_on_side(const unsigned int n,
70  const unsigned int s) const
71 {
72  libmesh_assert_less (s, Edge2::num_nodes);
73  return (s == n);
74 }
75 
76 bool Edge2::is_node_on_edge(const unsigned int,
77  const unsigned int libmesh_dbg_var(e)) const
78 {
79  libmesh_assert_equal_to (e, 0);
80  return true;
81 }
82 
83 
84 
86 {
87  return FIRST;
88 }
89 
90 
91 
92 void Edge2::connectivity(const unsigned int libmesh_dbg_var(sc),
93  const IOPackage iop,
94  std::vector<dof_id_type> & conn) const
95 {
96  libmesh_assert_equal_to (sc, 0);
97  libmesh_assert_less (sc, this->n_sub_elem());
98  libmesh_assert_not_equal_to (iop, INVALID_IO_PACKAGE);
99 
100  // Create storage
101  conn.resize(2);
102 
103  switch (iop)
104  {
105  case TECPLOT:
106  {
107  conn[0] = this->node_id(0)+1;
108  conn[1] = this->node_id(1)+1;
109  return;
110  }
111 
112  case VTK:
113  {
114  conn[0] = this->node_id(0);
115  conn[1] = this->node_id(1);
116  return;
117  }
118 
119  default:
120  libmesh_error_msg("Unsupported IO package " << iop);
121  }
122 }
123 
124 
126 {
127  // OK, so this is probably overkill, since it is equivalent to
128  // Elem::hmax() for the Edge2, but here it is nonetheless...
129  return (this->point(1) - this->point(0)).norm();
130 }
131 
132 
133 
135 {
136  return this->compute_key(this->node_id(0),
137  this->node_id(1));
138 }
139 
140 } // namespace libMesh
static const int num_children
Definition: edge_edge2.h:160
static const float _embedding_matrix[num_children][num_nodes][num_nodes]
Definition: edge_edge2.h:185
virtual dof_id_type key() const override
Definition: edge_edge2.C:134
virtual bool is_face(const unsigned int i) const override
Definition: edge_edge2.C:64
virtual bool is_node_on_side(const unsigned int n, const unsigned int s) const override
Definition: edge_edge2.C:69
virtual bool is_vertex(const unsigned int i) const override
Definition: edge_edge2.C:54
static const int num_nodes
Definition: edge_edge2.h:159
virtual bool is_edge(const unsigned int i) const override
Definition: edge_edge2.C:59
virtual Order default_order() const override
Definition: edge_edge2.C:85
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual void connectivity(const unsigned int sc, const IOPackage iop, std::vector< dof_id_type > &conn) const override
Definition: edge_edge2.C:92
virtual unsigned int n_sub_elem() const override
Definition: edge_edge2.h:73
virtual Real volume() const override
Definition: edge_edge2.C:125
static dof_id_type compute_key(dof_id_type n0)
Definition: elem.h:2754
dof_id_type node_id(const unsigned int i) const
Definition: elem.h:1914
const Point & point(const unsigned int i) const
Definition: elem.h:1892
virtual bool is_node_on_edge(const unsigned int n, const unsigned int e) const override
Definition: edge_edge2.C:76
uint8_t dof_id_type
Definition: id_types.h:64