$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 00020 // Local includes 00021 #include "libmesh/libmesh_config.h" 00022 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 00023 00024 00025 // Local includes cont'd 00026 #include "libmesh/face_inf_quad6.h" 00027 #include "libmesh/edge_edge3.h" 00028 #include "libmesh/side.h" 00029 #include "libmesh/edge_inf_edge2.h" 00030 00031 namespace libMesh 00032 { 00033 00034 00035 00036 00037 // ------------------------------------------------------------ 00038 // InfQuad6 class static member initializations 00039 const unsigned int InfQuad6::side_nodes_map[3][3] = 00040 { 00041 {0, 1, 4}, // Side 0 00042 {1, 3}, // Side 1 00043 {0, 2} // Side 2 00044 }; 00045 00046 00047 // ------------------------------------------------------------ 00048 // InfQuad6 class member functions 00049 00050 bool InfQuad6::is_vertex(const unsigned int i) const 00051 { 00052 if (i < 2) 00053 return true; 00054 return false; 00055 } 00056 00057 bool InfQuad6::is_edge(const unsigned int i) const 00058 { 00059 if (i < 2) 00060 return false; 00061 return true; 00062 } 00063 00064 bool InfQuad6::is_face(const unsigned int) const 00065 { 00066 return false; 00067 } 00068 00069 bool InfQuad6::is_node_on_side(const unsigned int n, 00070 const unsigned int s) const 00071 { 00072 libmesh_assert_less (s, n_sides()); 00073 for (unsigned int i = 0; i != 3; ++i) 00074 if (side_nodes_map[s][i] == n) 00075 return true; 00076 return false; 00077 } 00078 00079 #ifdef LIBMESH_ENABLE_AMR 00080 00081 const float InfQuad6::_embedding_matrix[2][6][6] = 00082 { 00083 // embedding matrix for child 0 00084 { 00085 // 0 1 2 3 4 5th parent node 00086 { 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 }, // 0th child node 00087 { 0.0, 0.0, 0.0, 0.0, 1.0, 0.0 }, // 1 00088 { 0.0, 0.0, 1.0, 0.0, 0.0, 0.0 }, // 2 00089 { 0.0, 0.0, 0.0, 0.0, 0.0, 1.0 }, // 3 00090 { 0.375, -0.125, 0.0, 0.0, 0.75, 0.0 }, // 4 00091 { 0.0, 0.0, 0.375, -0.125, 0.0, 0.75 } // 5 00092 }, 00093 00094 // embedding matrix for child 1 00095 { 00096 // 0 1 2 3 4 5th parent node 00097 { 0.0, 0.0, 0.0, 0.0, 1.0, 0.0 }, // 0th child node 00098 { 0.0, 1.0, 0.0, 0.0, 0.0, 0.0 }, // 1 00099 { 0.0, 0.0, 0.0, 0.0, 0.0, 1.0 }, // 2 00100 { 0.0, 0.0, 0.0, 1.0, 0.0, 0.0 }, // 3 00101 { -0.125, 0.375, 0.0, 0.0, 0.75, 0.0 }, // 4 00102 { 0.0, 0.0, -0.125, 0.375, 0.0, 0.75 } // 5 00103 } 00104 }; 00105 00106 #endif 00107 00108 00109 00110 00111 UniquePtr<Elem> InfQuad6::build_side (const unsigned int i, 00112 bool proxy) const 00113 { 00114 // libmesh_assert_less (i, this->n_sides()); 00115 00116 if (proxy) 00117 { 00118 switch (i) 00119 { 00120 case 0: 00121 return UniquePtr<Elem>(new Side<Edge3,InfQuad6>(this,i)); 00122 00123 case 1: 00124 case 2: 00125 return UniquePtr<Elem>(new Side<InfEdge2,InfQuad6>(this,i)); 00126 00127 default: 00128 libmesh_error_msg("Invalid side i = " << i); 00129 } 00130 } 00131 00132 else 00133 { 00134 // Create NULL pointer to be initialized, returned later. 00135 Elem* edge = NULL; 00136 00137 switch (i) 00138 { 00139 case 0: 00140 { 00141 edge = new Edge3; 00142 00143 edge->set_node(0) = this->get_node(0); 00144 edge->set_node(1) = this->get_node(1); 00145 edge->set_node(2) = this->get_node(4); 00146 00147 break; 00148 } 00149 00150 case 1: 00151 { 00152 // adjacent to another infinite element 00153 edge = new InfEdge2; 00154 00155 edge->set_node(0) = this->get_node(1); 00156 edge->set_node(1) = this->get_node(3); 00157 00158 break; 00159 } 00160 00161 case 2: 00162 { 00163 // adjacent to another infinite element 00164 edge = new InfEdge2; 00165 00166 edge->set_node(0) = this->get_node(0); // be aware of swapped nodes, 00167 edge->set_node(1) = this->get_node(2); // compared to conventional side numbering 00168 00169 break; 00170 } 00171 default: 00172 libmesh_error_msg("Invalid side i = " << i); 00173 } 00174 00175 edge->subdomain_id() = this->subdomain_id(); 00176 return UniquePtr<Elem>(edge); 00177 } 00178 00179 libmesh_error_msg("We'll never get here!"); 00180 return UniquePtr<Elem>(); 00181 } 00182 00183 00184 00185 00186 void InfQuad6::connectivity(const unsigned int sf, 00187 const IOPackage iop, 00188 std::vector<dof_id_type>& conn) const 00189 { 00190 libmesh_assert_less (sf, this->n_sub_elem()); 00191 libmesh_assert_not_equal_to (iop, INVALID_IO_PACKAGE); 00192 00193 conn.resize(4); 00194 00195 switch (iop) 00196 { 00197 case TECPLOT: 00198 { 00199 switch(sf) 00200 { 00201 case 0: 00202 // linear sub-quad 0 00203 conn[0] = this->node(0)+1; 00204 conn[1] = this->node(4)+1; 00205 conn[2] = this->node(5)+1; 00206 conn[3] = this->node(2)+1; 00207 00208 return; 00209 00210 case 1: 00211 // linear sub-quad 1 00212 conn[0] = this->node(4)+1; 00213 conn[1] = this->node(1)+1; 00214 conn[2] = this->node(3)+1; 00215 conn[3] = this->node(5)+1; 00216 00217 return; 00218 00219 default: 00220 libmesh_error_msg("Invalid sf = " << sf); 00221 } 00222 } 00223 00224 default: 00225 libmesh_error_msg("Unsupported IO package " << iop); 00226 } 00227 } 00228 00229 00230 00231 00232 unsigned short int InfQuad6::second_order_adjacent_vertex (const unsigned int n, 00233 const unsigned int v) const 00234 { 00235 libmesh_assert_greater_equal (n, this->n_vertices()); 00236 libmesh_assert_less (n, this->n_nodes()); 00237 libmesh_assert_less (v, 2); 00238 return _second_order_adjacent_vertices[n-this->n_vertices()][v]; 00239 } 00240 00241 00242 00243 const unsigned short int InfQuad6::_second_order_adjacent_vertices[2][2] = 00244 { 00245 {0, 1}, // vertices adjacent to node 4 00246 {2, 3} // vertices adjacent to node 5 00247 }; 00248 00249 00250 00251 std::pair<unsigned short int, unsigned short int> 00252 InfQuad6::second_order_child_vertex (const unsigned int n) const 00253 { 00254 libmesh_assert_greater_equal (n, this->n_vertices()); 00255 libmesh_assert_less (n, this->n_nodes()); 00256 00257 return std::pair<unsigned short int, unsigned short int> 00258 (0, 2*n-7); 00259 } 00260 00261 } // namespace libMesh 00262 00263 00264 00265 00266 #endif // ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS