edge_edge4.C
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2014 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_edge4.h"
22 
23 namespace libMesh
24 {
25 
26 #ifdef LIBMESH_ENABLE_AMR
27 
28 const float Edge4::_embedding_matrix[2][4][4] =
29 {
30  // embedding matrix for child 0
31 
32  {
33  // 0 1 2 3 // Shape function index
34  {1.0, 0.0, 0.0, 0.0}, // left, xi = -1
35  {-0.0625, -0.0625, 0.5625, 0.5625}, // right, xi = 0
36  {0.3125, 0.0625, 0.9375, -0.3125}, // middle left, xi = -2/3
37  {0.0, 0.0, 1.0, 0.0} // middle right, xi = -1/3
38  },
39 
40  // embedding matrix for child 1
41  {
42  // 0 1 2 3 // Shape function index
43  {-0.0625, -0.0625, 0.5625, 0.5625}, // left, xi = 0
44  {0.0, 1.0, 0.0, 0.0}, // right, xi = 1
45  {0.0, 0.0, 0.0, 1.0}, // middle left, xi = 1/3
46  {0.0625, 0.3125, -0.3125, 0.9375} // middle right, xi = 2/3
47  }
48 };
49 
50 #endif
51 
52 bool Edge4::is_vertex(const unsigned int i) const
53 {
54  return (i==0) || (i==1);
55 }
56 
57 bool Edge4::is_edge(const unsigned int i) const
58 {
59  return (i==2) || (i==3);
60 }
61 
62 bool Edge4::is_face(const unsigned int ) const
63 {
64  return false;
65 }
66 
67 bool Edge4::is_node_on_side(const unsigned int n,
68  const unsigned int s) const
69 {
70  libmesh_assert_less (s, 2);
71  libmesh_assert_less (n, 4);
72  return (s == n);
73 }
74 
75 bool Edge4::is_node_on_edge(const unsigned int,
76  const unsigned int libmesh_dbg_var(e)) const
77 {
78  libmesh_assert_equal_to (e, 0);
79  return true;
80 }
81 
82 
83 
85 {
86  if (!this->point(2).relative_fuzzy_equals
87  ((this->point(0)*2. + this->point(1))/3.))
88  return false;
89  if (!this->point(3).relative_fuzzy_equals
90  ((this->point(0) + this->point(1)*2.)/3.))
91  return false;
92  return true;
93 }
94 
95 
96 
97 void Edge4::connectivity(const unsigned int sc,
98  const IOPackage iop,
99  std::vector<dof_id_type>& conn) const
100 {
101  libmesh_assert_less_equal (sc, 2);
102  libmesh_assert_less (sc, this->n_sub_elem());
103  libmesh_assert_not_equal_to (iop, INVALID_IO_PACKAGE);
104 
105  // Create storage
106  conn.resize(2);
107 
108  switch(iop)
109  {
110  case TECPLOT:
111  {
112  switch (sc)
113  {
114  case 0:
115  conn[0] = this->node(0)+1;
116  conn[1] = this->node(2)+1;
117  return;
118 
119  case 1:
120  conn[0] = this->node(2)+1;
121  conn[1] = this->node(3)+1;
122  return;
123 
124  case 2:
125  conn[0] = this->node(3)+1;
126  conn[1] = this->node(1)+1;
127  return;
128 
129  default:
130  libmesh_error();
131  }
132 
133  }
134 
135  case VTK:
136  {
137 
138  switch (sc)
139  {
140  case 0:
141  conn[0] = this->node(0);
142  conn[1] = this->node(2);
143  return;
144 
145  case 1:
146  conn[0] = this->node(2);
147  conn[1] = this->node(3);
148  return;
149 
150  case 2:
151  conn[0] = this->node(3);
152  conn[1] = this->node(1);
153  return;
154 
155  default:
156  libmesh_error();
157  }
158  }
159 
160  default:
161  libmesh_error();
162 
163  }
164 
165 }
166 
167 } // namespace libMesh

Site Created By: libMesh Developers
Last modified: February 07 2014 16:57:04 UTC

Hosted By:
SourceForge.net Logo