$extrastylesheet
00001 // The libMesh Finite Element Library. 00002 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner 00003 00004 // This library is free software; you can redistribute it and/or 00005 // modify it under the terms of the GNU Lesser General Public 00006 // License as published by the Free Software Foundation; either 00007 // version 2.1 of the License, or (at your option) any later version. 00008 00009 // This library is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 // Lesser General Public License for more details. 00013 00014 // You should have received a copy of the GNU Lesser General Public 00015 // License along with this library; if not, write to the Free Software 00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 00018 00019 // C++ includes 00020 00021 // Local includes 00022 #include "libmesh/cell_prism.h" 00023 #include "libmesh/cell_prism6.h" 00024 #include "libmesh/face_quad4.h" 00025 #include "libmesh/face_tri3.h" 00026 00027 namespace libMesh 00028 { 00029 00030 00031 // ------------------------------------------------------------ 00032 // Prism class member functions 00033 dof_id_type Prism::key (const unsigned int s) const 00034 { 00035 libmesh_assert_less (s, this->n_sides()); 00036 00037 switch (s) 00038 { 00039 case 0: // the triangular face at z=0 00040 00041 return 00042 this->compute_key (this->node(0), 00043 this->node(2), 00044 this->node(1)); 00045 00046 case 1: // the quad face at y=0 00047 00048 return 00049 this->compute_key (this->node(0), 00050 this->node(1), 00051 this->node(4), 00052 this->node(3)); 00053 00054 case 2: // the other quad face 00055 00056 return 00057 this->compute_key (this->node(1), 00058 this->node(2), 00059 this->node(5), 00060 this->node(4)); 00061 00062 case 3: // the quad face at x=0 00063 00064 return 00065 this->compute_key (this->node(2), 00066 this->node(0), 00067 this->node(3), 00068 this->node(5)); 00069 case 4: // the triangular face at z=1 00070 00071 return 00072 this->compute_key (this->node(3), 00073 this->node(4), 00074 this->node(5)); 00075 00076 default: 00077 libmesh_error_msg("Invalid side " << s); 00078 } 00079 00080 libmesh_error_msg("We'll never get here!"); 00081 return 0; 00082 } 00083 00084 00085 00086 UniquePtr<Elem> Prism::side (const unsigned int i) const 00087 { 00088 libmesh_assert_less (i, this->n_sides()); 00089 00090 Elem* face = NULL; 00091 00092 switch (i) 00093 { 00094 case 0: // the triangular face at z=0 00095 { 00096 face = new Tri3; 00097 00098 face->set_node(0) = this->get_node(0); 00099 face->set_node(1) = this->get_node(2); 00100 face->set_node(2) = this->get_node(1); 00101 00102 break; 00103 } 00104 case 1: // the quad face at y=0 00105 { 00106 face = new Quad4; 00107 00108 face->set_node(0) = this->get_node(0); 00109 face->set_node(1) = this->get_node(1); 00110 face->set_node(2) = this->get_node(4); 00111 face->set_node(3) = this->get_node(3); 00112 00113 break; 00114 } 00115 case 2: // the other quad face 00116 { 00117 face = new Quad4; 00118 00119 face->set_node(0) = this->get_node(1); 00120 face->set_node(1) = this->get_node(2); 00121 face->set_node(2) = this->get_node(5); 00122 face->set_node(3) = this->get_node(4); 00123 00124 break; 00125 } 00126 case 3: // the quad face at x=0 00127 { 00128 face = new Quad4; 00129 00130 face->set_node(0) = this->get_node(2); 00131 face->set_node(1) = this->get_node(0); 00132 face->set_node(2) = this->get_node(3); 00133 face->set_node(3) = this->get_node(5); 00134 00135 break; 00136 } 00137 case 4: // the triangular face at z=1 00138 { 00139 face = new Tri3; 00140 00141 face->set_node(0) = this->get_node(3); 00142 face->set_node(1) = this->get_node(4); 00143 face->set_node(2) = this->get_node(5); 00144 00145 break; 00146 } 00147 default: 00148 libmesh_error_msg("Invalid side i = " << i); 00149 } 00150 00151 return UniquePtr<Elem>(face); 00152 } 00153 00154 00155 00156 bool Prism::is_child_on_side(const unsigned int c, 00157 const unsigned int s) const 00158 { 00159 libmesh_assert_less (c, this->n_children()); 00160 libmesh_assert_less (s, this->n_sides()); 00161 00162 for (unsigned int i = 0; i != 4; ++i) 00163 if (Prism6::side_elems_map[s][i] == c) 00164 return true; 00165 return false; 00166 } 00167 00168 00169 00170 bool Prism::is_edge_on_side(const unsigned int e, 00171 const unsigned int s) const 00172 { 00173 libmesh_assert_less (e, this->n_edges()); 00174 libmesh_assert_less (s, this->n_sides()); 00175 00176 return (is_node_on_side(Prism6::edge_nodes_map[e][0],s) && 00177 is_node_on_side(Prism6::edge_nodes_map[e][1],s)); 00178 } 00179 00180 00181 00182 const unsigned short int Prism::_second_order_vertex_child_number[18] = 00183 { 00184 99,99,99,99,99,99, // Vertices 00185 0,1,0,0,1,2,3,4,3, // Edges 00186 0,1,0 // Faces 00187 }; 00188 00189 00190 00191 const unsigned short int Prism::_second_order_vertex_child_index[18] = 00192 { 00193 99,99,99,99,99,99, // Vertices 00194 1,2,2,3,4,5,4,5,5, // Edges 00195 4,5,5 // Faces 00196 }; 00197 00198 00199 const unsigned short int Prism::_second_order_adjacent_vertices[9][2] = 00200 { 00201 { 0, 1}, // vertices adjacent to node 6 00202 { 1, 2}, // vertices adjacent to node 7 00203 { 0, 2}, // vertices adjacent to node 8 00204 00205 { 0, 3}, // vertices adjacent to node 9 00206 { 1, 4}, // vertices adjacent to node 10 00207 { 2, 5}, // vertices adjacent to node 11 00208 00209 { 3, 4}, // vertices adjacent to node 12 00210 { 4, 5}, // vertices adjacent to node 13 00211 { 3, 5} // vertices adjacent to node 14 00212 }; 00213 00214 } // namespace libMesh