cell_inf_prism12.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 // Local includes
19 #include "libmesh/libmesh_config.h"
20 
21 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
22 
23 // C++ includes
24 
25 // Local includes cont'd
27 #include "libmesh/edge_edge3.h"
28 #include "libmesh/edge_inf_edge2.h"
29 #include "libmesh/face_tri6.h"
30 #include "libmesh/face_inf_quad6.h"
31 #include "libmesh/side.h"
32 
33 namespace libMesh
34 {
35 
36 
37 // ------------------------------------------------------------
38 // InfPrism12 class static member initializations
39 const unsigned int InfPrism12::side_nodes_map[4][6] =
40 {
41  { 0, 1, 2, 6, 7, 8}, // Side 0
42  { 0, 1, 3, 4, 6, 9}, // Side 1
43  { 1, 2, 4, 5, 7, 10}, // Side 2
44  { 2, 0, 5, 3, 8, 11} // Side 3
45 };
46 
47 const unsigned int InfPrism12::edge_nodes_map[6][3] =
48 {
49  { 0, 1, 6}, // Side 0
50  { 1, 2, 7}, // Side 1
51  { 0, 2, 8}, // Side 2
52  { 0, 3, 99}, // Side 3
53  { 1, 4, 99}, // Side 4
54  { 2, 5, 99} // Side 5
55 };
56 
57 
58 // ------------------------------------------------------------
59 // InfPrism12 class member functions
60 
61 bool InfPrism12::is_vertex(const unsigned int i) const
62 {
63  if (i < 3)
64  return true;
65  return false;
66 }
67 
68 bool InfPrism12::is_edge(const unsigned int i) const
69 {
70  if (i < 3)
71  return false;
72  if (i > 8)
73  return false;
74  return true;
75 }
76 
77 bool InfPrism12::is_face(const unsigned int i) const
78 {
79  if (i > 8)
80  return true;
81  return false;
82 }
83 
84 bool InfPrism12::is_node_on_side(const unsigned int n,
85  const unsigned int s) const
86 {
87  libmesh_assert_less (s, n_sides());
88  for (unsigned int i = 0; i != 6; ++i)
89  if (side_nodes_map[s][i] == n)
90  return true;
91  return false;
92 }
93 
94 bool InfPrism12::is_node_on_edge(const unsigned int n,
95  const unsigned int e) const
96 {
97  libmesh_assert_less (e, n_edges());
98  for (unsigned int i = 0; i != 3; ++i)
99  if (edge_nodes_map[e][i] == n)
100  return true;
101  return false;
102 }
103 
104 AutoPtr<Elem> InfPrism12::build_side (const unsigned int i,
105  bool proxy) const
106 {
107  libmesh_assert_less (i, this->n_sides());
108 
109  if (proxy)
110  {
111  switch (i)
112  {
113  // base
114  case 0:
115  {
116  AutoPtr<Elem> ap(new Side<Tri6,InfPrism12>(this,i));
117  return ap;
118  }
119  // ifem sides
120  case 1:
121  case 2:
122  case 3:
123  {
125  return ap;
126  }
127  default:
128  libmesh_error();
129  }
130  }
131 
132  else
133  {
134  // Create NULL pointer to be initialized, returned later.
135  AutoPtr<Elem> face(NULL);
136 
137  switch (i)
138  {
139  case 0: // the triangular face at z=-1, base face
140  {
141  face.reset(new Tri6);
142 
143  // Note that for this face element, the normal points inward
144  face->set_node(0) = this->get_node(0);
145  face->set_node(1) = this->get_node(1);
146  face->set_node(2) = this->get_node(2);
147  face->set_node(3) = this->get_node(6);
148  face->set_node(4) = this->get_node(7);
149  face->set_node(5) = this->get_node(8);
150 
151  break;
152  }
153 
154  case 1: // the quad face at y=0
155  {
156  face.reset(new InfQuad6);
157 
158  face->set_node(0) = this->get_node(0);
159  face->set_node(1) = this->get_node(1);
160  face->set_node(2) = this->get_node(3);
161  face->set_node(3) = this->get_node(4);
162  face->set_node(4) = this->get_node(6);
163  face->set_node(5) = this->get_node(9);
164 
165  break;
166  }
167 
168  case 2: // the other quad face
169  {
170  face.reset(new InfQuad6);
171 
172  face->set_node(0) = this->get_node(1);
173  face->set_node(1) = this->get_node(2);
174  face->set_node(2) = this->get_node(4);
175  face->set_node(3) = this->get_node(5);
176  face->set_node(4) = this->get_node(7);
177  face->set_node(5) = this->get_node(10);
178 
179  break;
180  }
181 
182  case 3: // the quad face at x=0
183  {
184  face.reset(new InfQuad6);
185 
186  face->set_node(0) = this->get_node(2);
187  face->set_node(1) = this->get_node(0);
188  face->set_node(2) = this->get_node(5);
189  face->set_node(3) = this->get_node(3);
190  face->set_node(4) = this->get_node(8);
191  face->set_node(5) = this->get_node(11);
192 
193  break;
194  }
195 
196  default:
197  {
198  libmesh_error();
199  }
200  }
201 
202  face->subdomain_id() = this->subdomain_id();
203  return face;
204  }
205 
206 
207  // We'll never get here.
208  libmesh_error();
209  AutoPtr<Elem> ap(NULL); return ap;
210 }
211 
212 
213 AutoPtr<Elem> InfPrism12::build_edge (const unsigned int i) const
214 {
215  libmesh_assert_less (i, this->n_edges());
216 
217  if (i < 3) // base edges
218  return AutoPtr<Elem>(new SideEdge<Edge3,InfPrism12>(this,i));
219  // infinite edges
220  return AutoPtr<Elem>(new SideEdge<InfEdge2,InfPrism12>(this,i));
221 }
222 
223 
224 void InfPrism12::connectivity(const unsigned int sc,
225  const IOPackage iop,
226  std::vector<dof_id_type>& conn) const
227 {
229  libmesh_assert_less (sc, this->n_sub_elem());
230  libmesh_assert_not_equal_to (iop, INVALID_IO_PACKAGE);
231 
232  switch (iop)
233  {
234  case TECPLOT:
235  {
236  conn.resize(8);
237  switch (sc)
238  {
239  case 0:
240 
241  // guess this is a collapsed hex8
242  conn[0] = this->node(0)+1;
243  conn[1] = this->node(6)+1;
244  conn[2] = this->node(8)+1;
245  conn[3] = this->node(8)+1;
246  conn[4] = this->node(3)+1;
247  conn[5] = this->node(9)+1;
248  conn[6] = this->node(11)+1;
249  conn[7] = this->node(11)+1;
250 
251  return;
252 
253  case 1:
254 
255  conn[0] = this->node(6)+1;
256  conn[1] = this->node(7)+1;
257  conn[2] = this->node(8)+1;
258  conn[3] = this->node(8)+1;
259  conn[4] = this->node(9)+1;
260  conn[5] = this->node(10)+1;
261  conn[6] = this->node(11)+1;
262  conn[7] = this->node(11)+1;
263 
264  return;
265 
266  case 2:
267 
268  conn[0] = this->node(6)+1;
269  conn[1] = this->node(1)+1;
270  conn[2] = this->node(7)+1;
271  conn[3] = this->node(7)+1;
272  conn[4] = this->node(9)+1;
273  conn[5] = this->node(4)+1;
274  conn[6] = this->node(10)+1;
275  conn[7] = this->node(10)+1;
276 
277  return;
278 
279  case 3:
280 
281  conn[0] = this->node(8)+1;
282  conn[1] = this->node(7)+1;
283  conn[2] = this->node(2)+1;
284  conn[3] = this->node(2)+1;
285  conn[4] = this->node(11)+1;
286  conn[5] = this->node(10)+1;
287  conn[6] = this->node(5)+1;
288  conn[7] = this->node(5)+1;
289 
290  return;
291 
292  default:
293  libmesh_error();
294 
295  }
296 
297  }
298 
299  default:
300  libmesh_error();
301  }
302 
303  libmesh_error();
304 }
305 
306 
307 
308 
309 
310 unsigned short int InfPrism12::second_order_adjacent_vertex (const unsigned int n,
311  const unsigned int v) const
312 {
313  libmesh_assert_greater_equal (n, this->n_vertices());
314  libmesh_assert_less (n, this->n_nodes());
315  libmesh_assert_less (v, 2);
316  return _second_order_adjacent_vertices[n-this->n_vertices()][v];
317 }
318 
319 
320 
321 const unsigned short int InfPrism12::_second_order_adjacent_vertices[6][2] =
322 {
323  { 0, 1}, // vertices adjacent to node 6
324  { 1, 2}, // vertices adjacent to node 7
325  { 0, 2}, // vertices adjacent to node 8
326 
327  { 3, 4}, // vertices adjacent to node 9
328  { 4, 5}, // vertices adjacent to node 10
329  { 3, 5} // vertices adjacent to node 11
330 };
331 
332 
333 
334 std::pair<unsigned short int, unsigned short int>
335 InfPrism12::second_order_child_vertex (const unsigned int n) const
336 {
337  libmesh_assert_greater_equal (n, this->n_vertices());
338  libmesh_assert_less (n, this->n_nodes());
339 
340  return std::pair<unsigned short int, unsigned short int>
343 }
344 
345 
346 
347 const unsigned short int InfPrism12::_second_order_vertex_child_number[12] =
348 {
349  99,99,99,99,99,99, // Vertices
350  0,1,0, // Edges
351  0,1,0 // Faces
352 };
353 
354 
355 
356 const unsigned short int InfPrism12::_second_order_vertex_child_index[12] =
357 {
358  99,99,99,99,99,99, // Vertices
359  1,2,2, // Edges
360  4,5,5 // Faces
361 };
362 
363 
364 
365 #ifdef LIBMESH_ENABLE_AMR
366 
367 const float InfPrism12::_embedding_matrix[4][12][12] =
368 {
369  // embedding matrix for child 0
370  {
371  // 0 1 2 3 4 5 6 7 8 9 10 11 th parent Node
372  { 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, // 0th child N.
373  { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0}, // 1
374  { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0}, // 2
375  { 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, // 3
376  { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0}, // 4
377  { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}, // 5
378  { 0.375, -0.125, 0.0, 0.0, 0.0, 0.0, 0.75, 0.0, 0.0, 0.0, 0.0, 0.0}, // 6
379  { 0.0, -0.125, -0.125, 0.0, 0.0, 0.0, 0.5, 0.25, 0.5, 0.0, 0.0, 0.0}, // 7
380  { 0.375, 0.0, -0.125, 0.0, 0.0, 0.0, 0.0, 0.0, 0.75, 0.0, 0.0, 0.0}, // 8
381  { 0.0, 0.0, 0.0, 0.375, -0.125, 0.0, 0.0, 0.0, 0.0, 0.75, 0.0, 0.0}, // 9
382  { 0.0, 0.0, 0.0, 0.0, -0.125, -0.125, 0.0, 0.0, 0.0, 0.5, 0.25, 0.5}, // 10
383  { 0.0, 0.0, 0.0, 0.375, 0.0, -0.125, 0.0, 0.0, 0.0, 0.0, 0.0, 0.75} // 11
384  },
385 
386  // embedding matrix for child 1
387  {
388  // 0 1 2 3 4 5 6 7 8 9 10 11 th parent Node
389  { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0}, // 0th child N.
390  { 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, // 1
391  { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0}, // 2
392  { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0}, // 3
393  { 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, // 4
394  { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0}, // 5
395  { -0.125, 0.375, 0.0, 0.0, 0.0, 0.0, 0.75, 0.0, 0.0, 0.0, 0.0, 0.0}, // 6
396  { 0.0, 0.375, -0.125, 0.0, 0.0, 0.0, 0.0, 0.75, 0.0, 0.0, 0.0, 0.0}, // 7
397  { -0.125, 0.0, -0.125, 0.0, 0.0, 0.0, 0.5, 0.5, 0.25, 0.0, 0.0, 0.0}, // 8
398  { 0.0, 0.0, 0.0, -0.125, 0.375, 0.0, 0.0, 0.0, 0.0, 0.75, 0.0, 0.0}, // 9
399  { 0.0, 0.0, 0.0, 0.0, 0.375, -0.125, 0.0, 0.0, 0.0, 0.0, 0.75, 0.0}, // 10
400  { 0.0, 0.0, 0.0, -0.125, 0.0, -0.125, 0.0, 0.0, 0.0, 0.5, 0.5, 0.25} // 11
401  },
402 
403  // embedding matrix for child 2
404  {
405  // 0 1 2 3 4 5 6 7 8 9 10 11 th parent Node
406  { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0}, // 0th child N.
407  { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0}, // 1
408  { 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, // 2
409  { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}, // 3
410  { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0}, // 4
411  { 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, // 5
412  { -0.125, -0.125, 0.0, 0.0, 0.0, 0.0, 0.25, 0.5, 0.5, 0.0, 0.0, 0.0}, // 6
413  { 0.0, -0.125, 0.375, 0.0, 0.0, 0.0, 0.0, 0.75, 0.0, 0.0, 0.0, 0.0}, // 7
414  { -0.125, 0.0, 0.375, 0.0, 0.0, 0.0, 0.0, 0.0, 0.75, 0.0, 0.0, 0.0}, // 8
415  { 0.0, 0.0, 0.0, -0.125, -0.125, 0.0, 0.0, 0.0, 0.0, 0.25, 0.5, 0.5}, // 9
416  { 0.0, 0.0, 0.0, 0.0, -0.125, 0.375, 0.0, 0.0, 0.0, 0.0, 0.75, 0.0}, // 10
417  { 0.0, 0.0, 0.0, -0.125, 0.0, 0.375, 0.0, 0.0, 0.0, 0.0, 0.0, 0.75} // 11
418  },
419 
420  // embedding matrix for child 3
421  {
422  // 0 1 2 3 4 5 6 7 8 9 10 11 th parent Node
423  { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0}, // 0th child N.
424  { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0}, // 1
425  { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0}, // 2
426  { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0}, // 3
427  { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0}, // 4
428  { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}, // 5
429  { -0.125, 0.0, -0.125, 0.0, 0.0, 0.0, 0.5, 0.5, 0.25, 0.0, 0.0, 0.0}, // 6
430  { -0.125, -0.125, 0.0, 0.0, 0.0, 0.0, 0.25, 0.5, 0.5, 0.0, 0.0, 0.0}, // 7
431  { 0.0, -0.125, -0.125, 0.0, 0.0, 0.0, 0.5, 0.25, 0.5, 0.0, 0.0, 0.0}, // 8
432  { 0.0, 0.0, 0.0, -0.125, 0.0, -0.125, 0.0, 0.0, 0.0, 0.5, 0.5, 0.25}, // 9
433  { 0.0, 0.0, 0.0, -0.125, -0.125, 0.0, 0.0, 0.0, 0.0, 0.25, 0.5, 0.5}, // 10
434  { 0.0, 0.0, 0.0, 0.0, -0.125, -0.125, 0.0, 0.0, 0.0, 0.5, 0.25, 0.5} // 11
435  }
436 
437 };
438 
439 
440 
441 
442 #endif
443 
444 } // namespace libMesh
445 
446 #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