cell_prism.C
Go to the documentation of this file.00001 // The libMesh Finite Element Library. 00002 // Copyright (C) 2002-2012 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 00077 // We'll never get here. 00078 libmesh_error(); 00079 return 0; 00080 } 00081 00082 00083 00084 AutoPtr<Elem> Prism::side (const unsigned int i) const 00085 { 00086 libmesh_assert_less (i, this->n_sides()); 00087 00088 switch (i) 00089 { 00090 case 0: // the triangular face at z=0 00091 { 00092 Elem* facet = new Tri3; 00093 AutoPtr<Elem> ap_facet(facet); 00094 00095 facet->set_node(0) = this->get_node(0); 00096 facet->set_node(1) = this->get_node(2); 00097 facet->set_node(2) = this->get_node(1); 00098 00099 return ap_facet; 00100 } 00101 case 1: // the quad face at y=0 00102 { 00103 Elem* faceq = new Quad4; 00104 AutoPtr<Elem> ap_faceq(faceq); 00105 00106 faceq->set_node(0) = this->get_node(0); 00107 faceq->set_node(1) = this->get_node(1); 00108 faceq->set_node(2) = this->get_node(4); 00109 faceq->set_node(3) = this->get_node(3); 00110 00111 return ap_faceq; 00112 } 00113 case 2: // the other quad face 00114 { 00115 Elem* faceq = new Quad4; 00116 AutoPtr<Elem> ap_faceq(faceq); 00117 00118 faceq->set_node(0) = this->get_node(1); 00119 faceq->set_node(1) = this->get_node(2); 00120 faceq->set_node(2) = this->get_node(5); 00121 faceq->set_node(3) = this->get_node(4); 00122 00123 return ap_faceq; 00124 } 00125 case 3: // the quad face at x=0 00126 { 00127 Elem* faceq = new Quad4; 00128 AutoPtr<Elem> ap_faceq(faceq); 00129 00130 faceq->set_node(0) = this->get_node(2); 00131 faceq->set_node(1) = this->get_node(0); 00132 faceq->set_node(2) = this->get_node(3); 00133 faceq->set_node(3) = this->get_node(5); 00134 00135 return ap_faceq; 00136 } 00137 case 4: // the triangular face at z=1 00138 { 00139 Elem* facet = new Tri3; 00140 AutoPtr<Elem> ap_facet(facet); 00141 00142 facet->set_node(0) = this->get_node(3); 00143 facet->set_node(1) = this->get_node(4); 00144 facet->set_node(2) = this->get_node(5); 00145 00146 return ap_facet; 00147 } 00148 default: 00149 { 00150 libmesh_error(); 00151 Elem* facet = new Tri3; 00152 AutoPtr<Elem> ap_facet(facet); 00153 return ap_facet; 00154 } 00155 } 00156 00157 // We'll never get here. 00158 libmesh_error(); 00159 Elem* facet = new Tri3; 00160 AutoPtr<Elem> ap_facet(facet); 00161 return ap_facet; 00162 } 00163 00164 00165 00166 bool Prism::is_child_on_side(const unsigned int c, 00167 const unsigned int s) const 00168 { 00169 libmesh_assert_less (c, this->n_children()); 00170 libmesh_assert_less (s, this->n_sides()); 00171 00172 for (unsigned int i = 0; i != 4; ++i) 00173 if (Prism6::side_elems_map[s][i] == c) 00174 return true; 00175 return false; 00176 } 00177 00178 00179 00180 bool Prism::is_edge_on_side(const unsigned int e, 00181 const unsigned int s) const 00182 { 00183 libmesh_assert_less (e, this->n_edges()); 00184 libmesh_assert_less (s, this->n_sides()); 00185 00186 return (is_node_on_side(Prism6::edge_nodes_map[e][0],s) && 00187 is_node_on_side(Prism6::edge_nodes_map[e][1],s)); 00188 } 00189 00190 00191 00192 const unsigned short int Prism::_second_order_vertex_child_number[18] = 00193 { 00194 99,99,99,99,99,99, // Vertices 00195 0,1,0,0,1,2,3,4,3, // Edges 00196 0,1,0 // Faces 00197 }; 00198 00199 00200 00201 const unsigned short int Prism::_second_order_vertex_child_index[18] = 00202 { 00203 99,99,99,99,99,99, // Vertices 00204 1,2,2,3,4,5,4,5,5, // Edges 00205 4,5,5 // Faces 00206 }; 00207 00208 00209 const unsigned short int Prism::_second_order_adjacent_vertices[9][2] = 00210 { 00211 { 0, 1}, // vertices adjacent to node 6 00212 { 1, 2}, // vertices adjacent to node 7 00213 { 0, 2}, // vertices adjacent to node 8 00214 00215 { 0, 3}, // vertices adjacent to node 9 00216 { 1, 4}, // vertices adjacent to node 10 00217 { 2, 5}, // vertices adjacent to node 11 00218 00219 { 3, 4}, // vertices adjacent to node 12 00220 { 4, 5}, // vertices adjacent to node 13 00221 { 3, 5} // vertices adjacent to node 14 00222 }; 00223 00224 } // namespace libMesh
Site Created By: libMesh Developers
Last modified: February 05 2013 19:54:45 UTC
Hosted By: