cell_inf_prism12.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 // Local includes 00019 #include "libmesh/libmesh_config.h" 00020 00021 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 00022 00023 // C++ includes 00024 00025 // Local includes cont'd 00026 #include "libmesh/cell_inf_prism12.h" 00027 #include "libmesh/edge_edge3.h" 00028 #include "libmesh/edge_inf_edge2.h" 00029 #include "libmesh/face_tri6.h" 00030 #include "libmesh/face_inf_quad6.h" 00031 #include "libmesh/side.h" 00032 00033 namespace libMesh 00034 { 00035 00036 00037 // ------------------------------------------------------------ 00038 // InfPrism12 class static member initializations 00039 const unsigned int InfPrism12::side_nodes_map[4][6] = 00040 { 00041 { 0, 1, 2, 6, 7, 8}, // Side 0 00042 { 0, 1, 3, 4, 6, 9}, // Side 1 00043 { 1, 2, 4, 5, 7, 10}, // Side 2 00044 { 2, 0, 5, 3, 8, 11} // Side 3 00045 }; 00046 00047 const unsigned int InfPrism12::edge_nodes_map[6][3] = 00048 { 00049 { 0, 1, 6}, // Side 0 00050 { 1, 2, 7}, // Side 1 00051 { 0, 2, 8}, // Side 2 00052 { 0, 3, 99}, // Side 3 00053 { 1, 4, 99}, // Side 4 00054 { 2, 5, 99} // Side 5 00055 }; 00056 00057 00058 // ------------------------------------------------------------ 00059 // InfPrism12 class member functions 00060 00061 bool InfPrism12::is_vertex(const unsigned int i) const 00062 { 00063 if (i < 3) 00064 return true; 00065 return false; 00066 } 00067 00068 bool InfPrism12::is_edge(const unsigned int i) const 00069 { 00070 if (i < 3) 00071 return false; 00072 if (i > 8) 00073 return false; 00074 return true; 00075 } 00076 00077 bool InfPrism12::is_face(const unsigned int i) const 00078 { 00079 if (i > 8) 00080 return true; 00081 return false; 00082 } 00083 00084 bool InfPrism12::is_node_on_side(const unsigned int n, 00085 const unsigned int s) const 00086 { 00087 libmesh_assert_less (s, n_sides()); 00088 for (unsigned int i = 0; i != 6; ++i) 00089 if (side_nodes_map[s][i] == n) 00090 return true; 00091 return false; 00092 } 00093 00094 bool InfPrism12::is_node_on_edge(const unsigned int n, 00095 const unsigned int e) const 00096 { 00097 libmesh_assert_less (e, n_edges()); 00098 for (unsigned int i = 0; i != 3; ++i) 00099 if (edge_nodes_map[e][i] == n) 00100 return true; 00101 return false; 00102 } 00103 00104 AutoPtr<Elem> InfPrism12::build_side (const unsigned int i, 00105 bool proxy) const 00106 { 00107 libmesh_assert_less (i, this->n_sides()); 00108 00109 if (proxy) 00110 { 00111 switch (i) 00112 { 00113 // base 00114 case 0: 00115 { 00116 AutoPtr<Elem> ap(new Side<Tri6,InfPrism12>(this,i)); 00117 return ap; 00118 } 00119 // ifem sides 00120 case 1: 00121 case 2: 00122 case 3: 00123 { 00124 AutoPtr<Elem> ap(new Side<InfQuad6,InfPrism12>(this,i)); 00125 return ap; 00126 } 00127 default: 00128 libmesh_error(); 00129 } 00130 } 00131 00132 else 00133 { 00134 switch (i) 00135 { 00136 case 0: // the triangular face at z=-1, base face 00137 { 00138 AutoPtr<Elem> face(new Tri6); 00139 00140 // Note that for this face element, the normal points inward 00141 face->set_node(0) = this->get_node(0); 00142 face->set_node(1) = this->get_node(1); 00143 face->set_node(2) = this->get_node(2); 00144 face->set_node(3) = this->get_node(6); 00145 face->set_node(4) = this->get_node(7); 00146 face->set_node(5) = this->get_node(8); 00147 00148 return face; 00149 } 00150 00151 case 1: // the quad face at y=0 00152 { 00153 AutoPtr<Elem> face(new InfQuad6); 00154 00155 face->set_node(0) = this->get_node(0); 00156 face->set_node(1) = this->get_node(1); 00157 face->set_node(2) = this->get_node(3); 00158 face->set_node(3) = this->get_node(4); 00159 face->set_node(4) = this->get_node(6); 00160 face->set_node(5) = this->get_node(9); 00161 00162 return face; 00163 } 00164 00165 case 2: // the other quad face 00166 { 00167 AutoPtr<Elem> face(new InfQuad6); 00168 00169 face->set_node(0) = this->get_node(1); 00170 face->set_node(1) = this->get_node(2); 00171 face->set_node(2) = this->get_node(4); 00172 face->set_node(3) = this->get_node(5); 00173 face->set_node(4) = this->get_node(7); 00174 face->set_node(5) = this->get_node(10); 00175 00176 return face; 00177 } 00178 00179 case 3: // the quad face at x=0 00180 { 00181 AutoPtr<Elem> face(new InfQuad6); 00182 00183 face->set_node(0) = this->get_node(2); 00184 face->set_node(1) = this->get_node(0); 00185 face->set_node(2) = this->get_node(5); 00186 face->set_node(3) = this->get_node(3); 00187 face->set_node(4) = this->get_node(8); 00188 face->set_node(5) = this->get_node(11); 00189 00190 return face; 00191 } 00192 00193 default: 00194 { 00195 libmesh_error(); 00196 AutoPtr<Elem> ap(NULL); return ap; 00197 } 00198 } 00199 } 00200 00201 00202 // We'll never get here. 00203 libmesh_error(); 00204 AutoPtr<Elem> ap(NULL); return ap; 00205 } 00206 00207 00208 AutoPtr<Elem> InfPrism12::build_edge (const unsigned int i) const 00209 { 00210 libmesh_assert_less (i, this->n_edges()); 00211 00212 if (i < 3) // base edges 00213 return AutoPtr<Elem>(new SideEdge<Edge3,InfPrism12>(this,i)); 00214 // infinite edges 00215 return AutoPtr<Elem>(new SideEdge<InfEdge2,InfPrism12>(this,i)); 00216 } 00217 00218 00219 void InfPrism12::connectivity(const unsigned int sc, 00220 const IOPackage iop, 00221 std::vector<dof_id_type>& conn) const 00222 { 00223 libmesh_assert(_nodes); 00224 libmesh_assert_less (sc, this->n_sub_elem()); 00225 libmesh_assert_not_equal_to (iop, INVALID_IO_PACKAGE); 00226 00227 switch (iop) 00228 { 00229 case TECPLOT: 00230 { 00231 conn.resize(8); 00232 switch (sc) 00233 { 00234 case 0: 00235 00236 // guess this is a collapsed hex8 00237 conn[0] = this->node(0)+1; 00238 conn[1] = this->node(6)+1; 00239 conn[2] = this->node(8)+1; 00240 conn[3] = this->node(8)+1; 00241 conn[4] = this->node(3)+1; 00242 conn[5] = this->node(9)+1; 00243 conn[6] = this->node(11)+1; 00244 conn[7] = this->node(11)+1; 00245 00246 return; 00247 00248 case 1: 00249 00250 conn[0] = this->node(6)+1; 00251 conn[1] = this->node(7)+1; 00252 conn[2] = this->node(8)+1; 00253 conn[3] = this->node(8)+1; 00254 conn[4] = this->node(9)+1; 00255 conn[5] = this->node(10)+1; 00256 conn[6] = this->node(11)+1; 00257 conn[7] = this->node(11)+1; 00258 00259 return; 00260 00261 case 2: 00262 00263 conn[0] = this->node(6)+1; 00264 conn[1] = this->node(1)+1; 00265 conn[2] = this->node(7)+1; 00266 conn[3] = this->node(7)+1; 00267 conn[4] = this->node(9)+1; 00268 conn[5] = this->node(4)+1; 00269 conn[6] = this->node(10)+1; 00270 conn[7] = this->node(10)+1; 00271 00272 return; 00273 00274 case 3: 00275 00276 conn[0] = this->node(8)+1; 00277 conn[1] = this->node(7)+1; 00278 conn[2] = this->node(2)+1; 00279 conn[3] = this->node(2)+1; 00280 conn[4] = this->node(11)+1; 00281 conn[5] = this->node(10)+1; 00282 conn[6] = this->node(5)+1; 00283 conn[7] = this->node(5)+1; 00284 00285 return; 00286 00287 default: 00288 libmesh_error(); 00289 00290 } 00291 00292 } 00293 00294 default: 00295 libmesh_error(); 00296 } 00297 00298 libmesh_error(); 00299 } 00300 00301 00302 00303 00304 00305 unsigned short int InfPrism12::second_order_adjacent_vertex (const unsigned int n, 00306 const unsigned int v) const 00307 { 00308 libmesh_assert_greater_equal (n, this->n_vertices()); 00309 libmesh_assert_less (n, this->n_nodes()); 00310 libmesh_assert_less (v, 2); 00311 return _second_order_adjacent_vertices[n-this->n_vertices()][v]; 00312 } 00313 00314 00315 00316 const unsigned short int InfPrism12::_second_order_adjacent_vertices[6][2] = 00317 { 00318 { 0, 1}, // vertices adjacent to node 6 00319 { 1, 2}, // vertices adjacent to node 7 00320 { 0, 2}, // vertices adjacent to node 8 00321 00322 { 3, 4}, // vertices adjacent to node 9 00323 { 4, 5}, // vertices adjacent to node 10 00324 { 3, 5} // vertices adjacent to node 11 00325 }; 00326 00327 00328 00329 std::pair<unsigned short int, unsigned short int> 00330 InfPrism12::second_order_child_vertex (const unsigned int n) const 00331 { 00332 libmesh_assert_greater_equal (n, this->n_vertices()); 00333 libmesh_assert_less (n, this->n_nodes()); 00334 00335 return std::pair<unsigned short int, unsigned short int> 00336 (_second_order_vertex_child_number[n], 00337 _second_order_vertex_child_index[n]); 00338 } 00339 00340 00341 00342 const unsigned short int InfPrism12::_second_order_vertex_child_number[12] = 00343 { 00344 99,99,99,99,99,99, // Vertices 00345 0,1,0, // Edges 00346 0,1,0 // Faces 00347 }; 00348 00349 00350 00351 const unsigned short int InfPrism12::_second_order_vertex_child_index[12] = 00352 { 00353 99,99,99,99,99,99, // Vertices 00354 1,2,2, // Edges 00355 4,5,5 // Faces 00356 }; 00357 00358 00359 00360 #ifdef LIBMESH_ENABLE_AMR 00361 00362 const float InfPrism12::_embedding_matrix[4][12][12] = 00363 { 00364 // embedding matrix for child 0 00365 { 00366 // 0 1 2 3 4 5 6 7 8 9 10 11 th parent Node 00367 { 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. 00368 { 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 00369 { 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 00370 { 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 00371 { 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 00372 { 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 00373 { 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 00374 { 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 00375 { 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 00376 { 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 00377 { 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 00378 { 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 00379 }, 00380 00381 // embedding matrix for child 1 00382 { 00383 // 0 1 2 3 4 5 6 7 8 9 10 11 th parent Node 00384 { 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. 00385 { 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 00386 { 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 00387 { 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 00388 { 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 00389 { 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 00390 { -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 00391 { 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 00392 { -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 00393 { 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 00394 { 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 00395 { 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 00396 }, 00397 00398 // embedding matrix for child 2 00399 { 00400 // 0 1 2 3 4 5 6 7 8 9 10 11 th parent Node 00401 { 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. 00402 { 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 00403 { 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 00404 { 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 00405 { 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 00406 { 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 00407 { -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 00408 { 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 00409 { -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 00410 { 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 00411 { 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 00412 { 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 00413 }, 00414 00415 // embedding matrix for child 3 00416 { 00417 // 0 1 2 3 4 5 6 7 8 9 10 11 th parent Node 00418 { 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. 00419 { 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 00420 { 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 00421 { 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 00422 { 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 00423 { 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 00424 { -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 00425 { -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 00426 { 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 00427 { 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 00428 { 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 00429 { 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 00430 } 00431 00432 }; 00433 00434 00435 00436 00437 #endif 00438 00439 } // namespace libMesh 00440 00441 #endif // ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
Site Created By: libMesh Developers
Last modified: February 05 2013 19:54:45 UTC
Hosted By: