face_inf_quad6.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/libmesh_config.h"
22 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
23 
24 
25 // Local includes cont'd
26 #include "libmesh/face_inf_quad6.h"
27 #include "libmesh/edge_edge3.h"
28 #include "libmesh/side.h"
29 #include "libmesh/edge_inf_edge2.h"
30 
31 namespace libMesh
32 {
33 
34 
35 
36 
37 // ------------------------------------------------------------
38 // InfQuad6 class static member initializations
39 const unsigned int InfQuad6::side_nodes_map[3][3] =
40 {
41  {0, 1, 4}, // Side 0
42  {1, 3}, // Side 1
43  {0, 2} // Side 2
44 };
45 
46 
47 // ------------------------------------------------------------
48 // InfQuad6 class member functions
49 
50 bool InfQuad6::is_vertex(const unsigned int i) const
51 {
52  if (i < 2)
53  return true;
54  return false;
55 }
56 
57 bool InfQuad6::is_edge(const unsigned int i) const
58 {
59  if (i < 2)
60  return false;
61  return true;
62 }
63 
64 bool InfQuad6::is_face(const unsigned int) const
65 {
66  return false;
67 }
68 
69 bool InfQuad6::is_node_on_side(const unsigned int n,
70  const unsigned int s) const
71 {
72  libmesh_assert_less (s, n_sides());
73  for (unsigned int i = 0; i != 3; ++i)
74  if (side_nodes_map[s][i] == n)
75  return true;
76  return false;
77 }
78 
79 #ifdef LIBMESH_ENABLE_AMR
80 
81 const float InfQuad6::_embedding_matrix[2][6][6] =
82 {
83  // embedding matrix for child 0
84  {
85  // 0 1 2 3 4 5th parent node
86  { 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 }, // 0th child node
87  { 0.0, 0.0, 0.0, 0.0, 1.0, 0.0 }, // 1
88  { 0.0, 0.0, 1.0, 0.0, 0.0, 0.0 }, // 2
89  { 0.0, 0.0, 0.0, 0.0, 0.0, 1.0 }, // 3
90  { 0.375, -0.125, 0.0, 0.0, 0.75, 0.0 }, // 4
91  { 0.0, 0.0, 0.375, -0.125, 0.0, 0.75 } // 5
92  },
93 
94  // embedding matrix for child 1
95  {
96  // 0 1 2 3 4 5th parent node
97  { 0.0, 0.0, 0.0, 0.0, 1.0, 0.0 }, // 0th child node
98  { 0.0, 1.0, 0.0, 0.0, 0.0, 0.0 }, // 1
99  { 0.0, 0.0, 0.0, 0.0, 0.0, 1.0 }, // 2
100  { 0.0, 0.0, 0.0, 1.0, 0.0, 0.0 }, // 3
101  { -0.125, 0.375, 0.0, 0.0, 0.75, 0.0 }, // 4
102  { 0.0, 0.0, -0.125, 0.375, 0.0, 0.75 } // 5
103  }
104 };
105 
106 #endif
107 
108 
109 
110 
111 AutoPtr<Elem> InfQuad6::build_side (const unsigned int i,
112  bool proxy) const
113 {
114  // libmesh_assert_less (i, this->n_sides());
115 
116  if (proxy)
117  {
118  switch (i)
119  {
120  case 0:
121  {
122  AutoPtr<Elem> ap(new Side<Edge3,InfQuad6>(this,i));
123  return ap;
124  }
125  case 1:
126  case 2:
127  {
128  AutoPtr<Elem> ap(new Side<InfEdge2,InfQuad6>(this,i));
129  return ap;
130  }
131  default:
132  libmesh_error();
133  }
134  }
135 
136  else
137  {
138  // Create NULL pointer to be initialized, returned later.
139  AutoPtr<Elem> edge(NULL);
140 
141  switch (i)
142  {
143  case 0:
144  {
145  edge.reset(new Edge3);
146 
147  edge->set_node(0) = this->get_node(0);
148  edge->set_node(1) = this->get_node(1);
149  edge->set_node(2) = this->get_node(4);
150 
151  break;
152  }
153 
154  case 1:
155  {
156  // adjacent to another infinite element
157  edge.reset(new InfEdge2);
158 
159  edge->set_node(0) = this->get_node(1);
160  edge->set_node(1) = this->get_node(3);
161 
162  break;
163  }
164 
165  case 2:
166  {
167  // adjacent to another infinite element
168  edge.reset(new InfEdge2);
169 
170  edge->set_node(0) = this->get_node(0); // be aware of swapped nodes,
171  edge->set_node(1) = this->get_node(2); // compared to conventional side numbering
172 
173  break;
174  }
175  default:
176  {
177  libmesh_error();
178  }
179  }
180 
181  edge->subdomain_id() = this->subdomain_id();
182  return edge;
183  }
184 
185  // We will never get here...
186  libmesh_error();
187  AutoPtr<Elem> ap(NULL); return ap;
188 }
189 
190 
191 
192 
193 void InfQuad6::connectivity(const unsigned int sf,
194  const IOPackage iop,
195  std::vector<dof_id_type>& conn) const
196 {
197  libmesh_assert_less (sf, this->n_sub_elem());
198  libmesh_assert_not_equal_to (iop, INVALID_IO_PACKAGE);
199 
200  conn.resize(4);
201 
202  switch (iop)
203  {
204  case TECPLOT:
205  {
206  switch(sf)
207  {
208  case 0:
209  // linear sub-quad 0
210  conn[0] = this->node(0)+1;
211  conn[1] = this->node(4)+1;
212  conn[2] = this->node(5)+1;
213  conn[3] = this->node(2)+1;
214 
215  return;
216 
217  case 1:
218  // linear sub-quad 1
219  conn[0] = this->node(4)+1;
220  conn[1] = this->node(1)+1;
221  conn[2] = this->node(3)+1;
222  conn[3] = this->node(5)+1;
223 
224  return;
225 
226  default:
227  libmesh_error();
228  }
229  }
230 
231  default:
232  libmesh_error();
233  }
234 
235  libmesh_error();
236 }
237 
238 
239 
240 
241 unsigned short int InfQuad6::second_order_adjacent_vertex (const unsigned int n,
242  const unsigned int v) const
243 {
244  libmesh_assert_greater_equal (n, this->n_vertices());
245  libmesh_assert_less (n, this->n_nodes());
246  libmesh_assert_less (v, 2);
247  return _second_order_adjacent_vertices[n-this->n_vertices()][v];
248 }
249 
250 
251 
252 const unsigned short int InfQuad6::_second_order_adjacent_vertices[2][2] =
253 {
254  {0, 1}, // vertices adjacent to node 4
255  {2, 3} // vertices adjacent to node 5
256 };
257 
258 
259 
260 std::pair<unsigned short int, unsigned short int>
261 InfQuad6::second_order_child_vertex (const unsigned int n) const
262 {
263  libmesh_assert_greater_equal (n, this->n_vertices());
264  libmesh_assert_less (n, this->n_nodes());
265 
266  return std::pair<unsigned short int, unsigned short int>
267  (0, 2*n-7);
268 }
269 
270 } // namespace libMesh
271 
272 
273 
274 
275 #endif // ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS

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

Hosted By:
SourceForge.net Logo