cell_inf_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 // Local includes
19 #include "libmesh/libmesh_config.h"
20 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
21 
22 
23 // C++ includes
24 // include <algorithm>
25 
26 // Local includes cont'd
27 #include "libmesh/cell_inf_prism.h"
29 #include "libmesh/face_tri3.h"
30 #include "libmesh/face_inf_quad4.h"
31 
32 namespace libMesh
33 {
34 
35 
36 
37 
38 // ------------------------------------------------------------
39 // InfPrism class member functions
40 dof_id_type InfPrism::key (const unsigned int s) const
41 {
42  libmesh_assert_less (s, this->n_sides());
43 
44  switch (s)
45  {
46  case 0: // the triangular face at z=-1, base face
47 
48  return
49  this->compute_key (this->node(0),
50  this->node(2),
51  this->node(1));
52 
53  case 1: // the quad face at y=0
54 
55  return
56  this->compute_key (this->node(0),
57  this->node(1),
58  this->node(4),
59  this->node(3));
60 
61  case 2: // the other quad face
62 
63  return
64  this->compute_key (this->node(1),
65  this->node(2),
66  this->node(5),
67  this->node(4));
68 
69  case 3: // the quad face at x=0
70 
71  return
72  this->compute_key (this->node(2),
73  this->node(0),
74  this->node(3),
75  this->node(5));
76  }
77 
78  // We'll never get here.
79  libmesh_error();
80  return 0;
81 }
82 
83 
84 
85 AutoPtr<Elem> InfPrism::side (const unsigned int i) const
86 {
87  libmesh_assert_less (i, this->n_sides());
88 
89  switch (i)
90  {
91  case 0: // the triangular face at z=-1, base face
92  {
93  Elem* face = new Tri3;
94  AutoPtr<Elem> ap_face(face);
95  //AutoPtr<Elem> face(new Tri3);
96 
97  // Note that for this face element, the normal points inward
98  face->set_node(0) = this->get_node(0);
99  face->set_node(1) = this->get_node(1);
100  face->set_node(2) = this->get_node(2);
101 
102  return ap_face;
103  }
104 
105  case 1: // the quad face at y=0
106  {
107  Elem* face = new InfQuad4;
108  AutoPtr<Elem> ap_face(face);
109  //AutoPtr<Elem> face(new InfQuad4);
110 
111  face->set_node(0) = this->get_node(0);
112  face->set_node(1) = this->get_node(1);
113  face->set_node(2) = this->get_node(3);
114  face->set_node(3) = this->get_node(4);
115 
116  return ap_face;
117  }
118 
119  case 2: // the other quad face
120  {
121  Elem* face = new InfQuad4;
122  AutoPtr<Elem> ap_face(face);
123  //AutoPtr<Elem> face(new InfQuad4);
124 
125  face->set_node(0) = this->get_node(1);
126  face->set_node(1) = this->get_node(2);
127  face->set_node(2) = this->get_node(4);
128  face->set_node(3) = this->get_node(5);
129 
130  return ap_face;
131  }
132 
133  case 3: // the quad face at x=0
134  {
135  Elem* face = new InfQuad4;
136  AutoPtr<Elem> ap_face(face);
137  //AutoPtr<Elem> face(new InfQuad4);
138 
139  face->set_node(0) = this->get_node(2);
140  face->set_node(1) = this->get_node(0);
141  face->set_node(2) = this->get_node(5);
142  face->set_node(3) = this->get_node(3);
143 
144  return ap_face;
145  }
146 
147  default:
148  {
149  libmesh_error();
150  AutoPtr<Elem> ap(NULL); return ap;
151  }
152  }
153 
154  // We'll never get here.
155  libmesh_error();
156  AutoPtr<Elem> ap(NULL); return ap;
157 }
158 
159 
160 
161 bool InfPrism::is_child_on_side(const unsigned int c,
162  const unsigned int s) const
163 {
164  libmesh_assert_less (c, this->n_children());
165  libmesh_assert_less (s, this->n_sides());
166 
167  return (s == 0 || c+1 == s || c == s%3);
168 }
169 
170 
171 
172 bool InfPrism::is_edge_on_side (const unsigned int e,
173  const unsigned int s) const
174 {
175  libmesh_assert_less (e, this->n_edges());
176  libmesh_assert_less (s, this->n_sides());
177 
178  return (is_node_on_side(InfPrism6::edge_nodes_map[e][0],s) &&
180 }
181 
182 
183 
184 } // namespace libMesh
185 
186 
187 
188 #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