$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/edge_edge4.h" 00022 00023 namespace libMesh 00024 { 00025 00026 #ifdef LIBMESH_ENABLE_AMR 00027 00028 const float Edge4::_embedding_matrix[2][4][4] = 00029 { 00030 // embedding matrix for child 0 00031 00032 { 00033 // 0 1 2 3 // Shape function index 00034 {1.0, 0.0, 0.0, 0.0}, // left, xi = -1 00035 {-0.0625, -0.0625, 0.5625, 0.5625}, // right, xi = 0 00036 {0.3125, 0.0625, 0.9375, -0.3125}, // middle left, xi = -2/3 00037 {0.0, 0.0, 1.0, 0.0} // middle right, xi = -1/3 00038 }, 00039 00040 // embedding matrix for child 1 00041 { 00042 // 0 1 2 3 // Shape function index 00043 {-0.0625, -0.0625, 0.5625, 0.5625}, // left, xi = 0 00044 {0.0, 1.0, 0.0, 0.0}, // right, xi = 1 00045 {0.0, 0.0, 0.0, 1.0}, // middle left, xi = 1/3 00046 {0.0625, 0.3125, -0.3125, 0.9375} // middle right, xi = 2/3 00047 } 00048 }; 00049 00050 #endif 00051 00052 bool Edge4::is_vertex(const unsigned int i) const 00053 { 00054 return (i==0) || (i==1); 00055 } 00056 00057 bool Edge4::is_edge(const unsigned int i) const 00058 { 00059 return (i==2) || (i==3); 00060 } 00061 00062 bool Edge4::is_face(const unsigned int ) const 00063 { 00064 return false; 00065 } 00066 00067 bool Edge4::is_node_on_side(const unsigned int n, 00068 const unsigned int s) const 00069 { 00070 libmesh_assert_less (s, 2); 00071 libmesh_assert_less (n, 4); 00072 return (s == n); 00073 } 00074 00075 bool Edge4::is_node_on_edge(const unsigned int, 00076 const unsigned int libmesh_dbg_var(e)) const 00077 { 00078 libmesh_assert_equal_to (e, 0); 00079 return true; 00080 } 00081 00082 00083 00084 bool Edge4::has_affine_map() const 00085 { 00086 if (!this->point(2).relative_fuzzy_equals 00087 ((this->point(0)*2. + this->point(1))/3.)) 00088 return false; 00089 if (!this->point(3).relative_fuzzy_equals 00090 ((this->point(0) + this->point(1)*2.)/3.)) 00091 return false; 00092 return true; 00093 } 00094 00095 00096 00097 void Edge4::connectivity(const unsigned int sc, 00098 const IOPackage iop, 00099 std::vector<dof_id_type>& conn) const 00100 { 00101 libmesh_assert_less_equal (sc, 2); 00102 libmesh_assert_less (sc, this->n_sub_elem()); 00103 libmesh_assert_not_equal_to (iop, INVALID_IO_PACKAGE); 00104 00105 // Create storage 00106 conn.resize(2); 00107 00108 switch(iop) 00109 { 00110 case TECPLOT: 00111 { 00112 switch (sc) 00113 { 00114 case 0: 00115 conn[0] = this->node(0)+1; 00116 conn[1] = this->node(2)+1; 00117 return; 00118 00119 case 1: 00120 conn[0] = this->node(2)+1; 00121 conn[1] = this->node(3)+1; 00122 return; 00123 00124 case 2: 00125 conn[0] = this->node(3)+1; 00126 conn[1] = this->node(1)+1; 00127 return; 00128 00129 default: 00130 libmesh_error_msg("Invalid sc = " << sc); 00131 } 00132 00133 } 00134 00135 case VTK: 00136 { 00137 00138 switch (sc) 00139 { 00140 case 0: 00141 conn[0] = this->node(0); 00142 conn[1] = this->node(2); 00143 return; 00144 00145 case 1: 00146 conn[0] = this->node(2); 00147 conn[1] = this->node(3); 00148 return; 00149 00150 case 2: 00151 conn[0] = this->node(3); 00152 conn[1] = this->node(1); 00153 return; 00154 00155 default: 00156 libmesh_error_msg("Invalid sc = " << sc); 00157 } 00158 } 00159 00160 default: 00161 libmesh_error_msg("Unsupported IO package " << iop); 00162 } 00163 } 00164 00165 } // namespace libMesh