face_inf_quad4.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 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_quad4.h" 00027 #include "libmesh/fe_interface.h" 00028 #include "libmesh/fe_type.h" 00029 #include "libmesh/side.h" 00030 #include "libmesh/edge_edge2.h" 00031 #include "libmesh/edge_inf_edge2.h" 00032 00033 namespace libMesh 00034 { 00035 00036 00037 00038 // ------------------------------------------------------------ 00039 // InfQuad4 class static member initializations 00040 const unsigned int InfQuad4::side_nodes_map[3][2] = 00041 { 00042 {0, 1}, // Side 0 00043 {1, 3}, // Side 1 00044 {0, 2} // Side 2 00045 }; 00046 00047 00048 00049 #ifdef LIBMESH_ENABLE_AMR 00050 00051 const float InfQuad4::_embedding_matrix[2][4][4] = 00052 { 00053 // embedding matrix for child 0 00054 { 00055 // 0 1 2 3rd parent node 00056 {1.0, 0.0, 0.0, 0.0}, // 0th child node 00057 {0.5, 0.5, 0.0, 0.0}, // 1 00058 {0.0, 0.0, 1.0, 0.0}, // 2 00059 {0.0, 0.0, 0.5, 0.5} // 3 00060 }, 00061 00062 // embedding matrix for child 1 00063 { 00064 // 0 1 2 3 00065 {0.5, 0.5, 0.0, 0.0}, // 0 00066 {0.0, 1.0, 0.0, 0.0}, // 1 00067 {0.0, 0.0, 0.5, 0.5}, // 2 00068 {0.0, 0.0, 0.0, 1.0} // 3 00069 } 00070 }; 00071 00072 #endif 00073 00074 00075 // ------------------------------------------------------------ 00076 // InfQuad4 class member functions 00077 00078 bool InfQuad4::is_vertex(const unsigned int i) const 00079 { 00080 if (i < 2) 00081 return true; 00082 return false; 00083 } 00084 00085 bool InfQuad4::is_edge(const unsigned int i) const 00086 { 00087 if (i < 2) 00088 return false; 00089 return true; 00090 } 00091 00092 bool InfQuad4::is_face(const unsigned int) const 00093 { 00094 return false; 00095 } 00096 00097 bool InfQuad4::is_node_on_side(const unsigned int n, 00098 const unsigned int s) const 00099 { 00100 libmesh_assert_less (s, n_sides()); 00101 for (unsigned int i = 0; i != 2; ++i) 00102 if (side_nodes_map[s][i] == n) 00103 return true; 00104 return false; 00105 } 00106 00107 bool InfQuad4::contains_point (const Point& p, Real tol) const 00108 { 00109 /* 00110 * make use of the fact that infinite elements do not 00111 * live inside the envelope. Use a fast scheme to 00112 * check whether point \p p is inside or outside 00113 * our relevant part of the envelope. Note that 00114 * this is not exclusive: the point may be outside 00115 * the envelope, but contained in another infinite element. 00116 * Therefore, if the distance is greater, do fall back 00117 * to the scheme of using FEInterface::inverse_map(). 00118 */ 00119 const Point origin (this->origin()); 00120 00121 /* 00122 * determine the minimal distance of the base from the origin 00123 * use size_sq() instead of size(), it is slightly faster 00124 */ 00125 const Real min_distance_sq = std::min((Point(this->point(0)-origin)).size_sq(), 00126 (Point(this->point(1)-origin)).size_sq()); 00127 00128 /* 00129 * work with 1% allowable deviation. Can still fall 00130 * back to the InfFE::inverse_map() 00131 */ 00132 const Real conservative_p_dist_sq = 1.01 * (Point(p-origin).size_sq()); 00133 00134 if (conservative_p_dist_sq < min_distance_sq) 00135 { 00136 /* 00137 * the physical point is definitely not contained 00138 * in the element, return false. 00139 */ 00140 return false; 00141 } 00142 else 00143 { 00144 /* 00145 * cannot say anything, fall back to the FEInterface::inverse_map() 00146 * 00147 * Declare a basic FEType. Will use default in the base, 00148 * and something else (not important) in radial direction. 00149 */ 00150 FEType fe_type(default_order()); 00151 00152 const Point mapped_point = FEInterface::inverse_map(dim(), 00153 fe_type, 00154 this, 00155 p, 00156 tol, 00157 false); 00158 00159 return FEInterface::on_reference_element(mapped_point, this->type(), tol); 00160 } 00161 } 00162 00163 00164 00165 00166 AutoPtr<Elem> InfQuad4::build_side (const unsigned int i, 00167 bool proxy) const 00168 { 00169 // libmesh_assert_less (i, this->n_sides()); 00170 00171 if (proxy) 00172 { 00173 switch (i) 00174 { 00175 // base 00176 case 0: 00177 { 00178 AutoPtr<Elem> ap(new Side<Edge2,InfQuad4>(this,i)); 00179 return ap; 00180 } 00181 // ifem edges 00182 case 1: 00183 case 2: 00184 { 00185 AutoPtr<Elem> ap(new Side<InfEdge2,InfQuad4>(this,i)); 00186 return ap; 00187 } 00188 00189 default: 00190 libmesh_error(); 00191 } 00192 } 00193 00194 else 00195 { 00196 // FIXME: Find out how to return non-proxy side 00197 libmesh_error(); 00198 } 00199 00200 // How did we get here 00201 libmesh_error(); 00202 AutoPtr<Elem> ap(NULL); return ap; 00203 } 00204 00205 00206 void InfQuad4::connectivity(const unsigned int libmesh_dbg_var(sf), 00207 const IOPackage iop, 00208 std::vector<dof_id_type>& conn) const 00209 { 00210 libmesh_assert_less (sf, this->n_sub_elem()); 00211 libmesh_assert_not_equal_to (iop, INVALID_IO_PACKAGE); 00212 00213 conn.resize(4); 00214 00215 switch (iop) 00216 { 00217 case TECPLOT: 00218 { 00219 conn[0] = this->node(0)+1; 00220 conn[1] = this->node(1)+1; 00221 conn[2] = this->node(3)+1; 00222 conn[3] = this->node(2)+1; 00223 return; 00224 } 00225 case VTK: 00226 { 00227 conn[0] = this->node(0); 00228 conn[1] = this->node(1); 00229 conn[2] = this->node(3); 00230 conn[3] = this->node(2); 00231 } 00232 default: 00233 libmesh_error(); 00234 } 00235 00236 libmesh_error(); 00237 } 00238 00239 } // namespace libMesh 00240 00241 00242 #endif // ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 00243 00244
Site Created By: libMesh Developers
Last modified: February 05 2013 19:54:46 UTC
Hosted By: