cell_prism.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 // C++ includes
20 
21 // Local includes
22 #include "libmesh/cell_prism.h"
23 #include "libmesh/cell_prism6.h"
24 #include "libmesh/face_quad4.h"
25 #include "libmesh/face_tri3.h"
26 
27 namespace libMesh
28 {
29 
30 
31 // ------------------------------------------------------------
32 // Prism class member functions
33 dof_id_type Prism::key (const unsigned int s) const
34 {
35  libmesh_assert_less (s, this->n_sides());
36 
37  switch (s)
38  {
39  case 0: // the triangular face at z=0
40 
41  return
42  this->compute_key (this->node(0),
43  this->node(2),
44  this->node(1));
45 
46  case 1: // the quad face at y=0
47 
48  return
49  this->compute_key (this->node(0),
50  this->node(1),
51  this->node(4),
52  this->node(3));
53 
54  case 2: // the other quad face
55 
56  return
57  this->compute_key (this->node(1),
58  this->node(2),
59  this->node(5),
60  this->node(4));
61 
62  case 3: // the quad face at x=0
63 
64  return
65  this->compute_key (this->node(2),
66  this->node(0),
67  this->node(3),
68  this->node(5));
69  case 4: // the triangular face at z=1
70 
71  return
72  this->compute_key (this->node(3),
73  this->node(4),
74  this->node(5));
75  }
76 
77  // We'll never get here.
78  libmesh_error();
79  return 0;
80 }
81 
82 
83 
84 AutoPtr<Elem> Prism::side (const unsigned int i) const
85 {
86  libmesh_assert_less (i, this->n_sides());
87 
88  switch (i)
89  {
90  case 0: // the triangular face at z=0
91  {
92  Elem* facet = new Tri3;
93  AutoPtr<Elem> ap_facet(facet);
94 
95  facet->set_node(0) = this->get_node(0);
96  facet->set_node(1) = this->get_node(2);
97  facet->set_node(2) = this->get_node(1);
98 
99  return ap_facet;
100  }
101  case 1: // the quad face at y=0
102  {
103  Elem* faceq = new Quad4;
104  AutoPtr<Elem> ap_faceq(faceq);
105 
106  faceq->set_node(0) = this->get_node(0);
107  faceq->set_node(1) = this->get_node(1);
108  faceq->set_node(2) = this->get_node(4);
109  faceq->set_node(3) = this->get_node(3);
110 
111  return ap_faceq;
112  }
113  case 2: // the other quad face
114  {
115  Elem* faceq = new Quad4;
116  AutoPtr<Elem> ap_faceq(faceq);
117 
118  faceq->set_node(0) = this->get_node(1);
119  faceq->set_node(1) = this->get_node(2);
120  faceq->set_node(2) = this->get_node(5);
121  faceq->set_node(3) = this->get_node(4);
122 
123  return ap_faceq;
124  }
125  case 3: // the quad face at x=0
126  {
127  Elem* faceq = new Quad4;
128  AutoPtr<Elem> ap_faceq(faceq);
129 
130  faceq->set_node(0) = this->get_node(2);
131  faceq->set_node(1) = this->get_node(0);
132  faceq->set_node(2) = this->get_node(3);
133  faceq->set_node(3) = this->get_node(5);
134 
135  return ap_faceq;
136  }
137  case 4: // the triangular face at z=1
138  {
139  Elem* facet = new Tri3;
140  AutoPtr<Elem> ap_facet(facet);
141 
142  facet->set_node(0) = this->get_node(3);
143  facet->set_node(1) = this->get_node(4);
144  facet->set_node(2) = this->get_node(5);
145 
146  return ap_facet;
147  }
148  default:
149  {
150  libmesh_error();
151  Elem* facet = new Tri3;
152  AutoPtr<Elem> ap_facet(facet);
153  return ap_facet;
154  }
155  }
156 
157  // We'll never get here.
158  libmesh_error();
159  Elem* facet = new Tri3;
160  AutoPtr<Elem> ap_facet(facet);
161  return ap_facet;
162 }
163 
164 
165 
166 bool Prism::is_child_on_side(const unsigned int c,
167  const unsigned int s) const
168 {
169  libmesh_assert_less (c, this->n_children());
170  libmesh_assert_less (s, this->n_sides());
171 
172  for (unsigned int i = 0; i != 4; ++i)
173  if (Prism6::side_elems_map[s][i] == c)
174  return true;
175  return false;
176 }
177 
178 
179 
180 bool Prism::is_edge_on_side(const unsigned int e,
181  const unsigned int s) const
182 {
183  libmesh_assert_less (e, this->n_edges());
184  libmesh_assert_less (s, this->n_sides());
185 
186  return (is_node_on_side(Prism6::edge_nodes_map[e][0],s) &&
188 }
189 
190 
191 
192 const unsigned short int Prism::_second_order_vertex_child_number[18] =
193 {
194  99,99,99,99,99,99, // Vertices
195  0,1,0,0,1,2,3,4,3, // Edges
196  0,1,0 // Faces
197 };
198 
199 
200 
201 const unsigned short int Prism::_second_order_vertex_child_index[18] =
202 {
203  99,99,99,99,99,99, // Vertices
204  1,2,2,3,4,5,4,5,5, // Edges
205  4,5,5 // Faces
206 };
207 
208 
209 const unsigned short int Prism::_second_order_adjacent_vertices[9][2] =
210 {
211  { 0, 1}, // vertices adjacent to node 6
212  { 1, 2}, // vertices adjacent to node 7
213  { 0, 2}, // vertices adjacent to node 8
214 
215  { 0, 3}, // vertices adjacent to node 9
216  { 1, 4}, // vertices adjacent to node 10
217  { 2, 5}, // vertices adjacent to node 11
218 
219  { 3, 4}, // vertices adjacent to node 12
220  { 4, 5}, // vertices adjacent to node 13
221  { 3, 5} // vertices adjacent to node 14
222 };
223 
224 } // namespace libMesh

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

Hosted By:
SourceForge.net Logo