$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 // Local includes 00019 #include "libmesh/libmesh_config.h" 00020 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 00021 00022 00023 // C++ includes 00024 // include <algorithm> 00025 00026 // Local includes cont'd 00027 #include "libmesh/cell_inf_prism.h" 00028 #include "libmesh/cell_inf_prism6.h" 00029 #include "libmesh/face_tri3.h" 00030 #include "libmesh/face_inf_quad4.h" 00031 00032 namespace libMesh 00033 { 00034 00035 00036 00037 00038 // ------------------------------------------------------------ 00039 // InfPrism class member functions 00040 dof_id_type InfPrism::key (const unsigned int s) const 00041 { 00042 libmesh_assert_less (s, this->n_sides()); 00043 00044 switch (s) 00045 { 00046 case 0: // the triangular face at z=-1, base face 00047 00048 return 00049 this->compute_key (this->node(0), 00050 this->node(2), 00051 this->node(1)); 00052 00053 case 1: // the quad face at y=0 00054 00055 return 00056 this->compute_key (this->node(0), 00057 this->node(1), 00058 this->node(4), 00059 this->node(3)); 00060 00061 case 2: // the other quad face 00062 00063 return 00064 this->compute_key (this->node(1), 00065 this->node(2), 00066 this->node(5), 00067 this->node(4)); 00068 00069 case 3: // the quad face at x=0 00070 00071 return 00072 this->compute_key (this->node(2), 00073 this->node(0), 00074 this->node(3), 00075 this->node(5)); 00076 00077 default: 00078 libmesh_error_msg("Invalid side s = " << s); 00079 } 00080 00081 libmesh_error_msg("We'll never get here!"); 00082 return 0; 00083 } 00084 00085 00086 00087 UniquePtr<Elem> InfPrism::side (const unsigned int i) const 00088 { 00089 libmesh_assert_less (i, this->n_sides()); 00090 00091 Elem* face = NULL; 00092 00093 switch (i) 00094 { 00095 case 0: // the triangular face at z=-1, base face 00096 { 00097 face = new Tri3; 00098 00099 // Note that for this face element, the normal points inward 00100 face->set_node(0) = this->get_node(0); 00101 face->set_node(1) = this->get_node(1); 00102 face->set_node(2) = this->get_node(2); 00103 00104 break; 00105 } 00106 00107 case 1: // the quad face at y=0 00108 { 00109 face = new InfQuad4; 00110 00111 face->set_node(0) = this->get_node(0); 00112 face->set_node(1) = this->get_node(1); 00113 face->set_node(2) = this->get_node(3); 00114 face->set_node(3) = this->get_node(4); 00115 00116 break; 00117 } 00118 00119 case 2: // the other quad face 00120 { 00121 face = new InfQuad4; 00122 00123 face->set_node(0) = this->get_node(1); 00124 face->set_node(1) = this->get_node(2); 00125 face->set_node(2) = this->get_node(4); 00126 face->set_node(3) = this->get_node(5); 00127 00128 break; 00129 } 00130 00131 case 3: // the quad face at x=0 00132 { 00133 face = new InfQuad4; 00134 00135 face->set_node(0) = this->get_node(2); 00136 face->set_node(1) = this->get_node(0); 00137 face->set_node(2) = this->get_node(5); 00138 face->set_node(3) = this->get_node(3); 00139 00140 break; 00141 } 00142 00143 default: 00144 libmesh_error_msg("Invalid side i = " << i); 00145 } 00146 00147 return UniquePtr<Elem>(face); 00148 } 00149 00150 00151 00152 bool InfPrism::is_child_on_side(const unsigned int c, 00153 const unsigned int s) const 00154 { 00155 libmesh_assert_less (c, this->n_children()); 00156 libmesh_assert_less (s, this->n_sides()); 00157 00158 return (s == 0 || c+1 == s || c == s%3); 00159 } 00160 00161 00162 00163 bool InfPrism::is_edge_on_side (const unsigned int e, 00164 const unsigned int s) const 00165 { 00166 libmesh_assert_less (e, this->n_edges()); 00167 libmesh_assert_less (s, this->n_sides()); 00168 00169 return (is_node_on_side(InfPrism6::edge_nodes_map[e][0],s) && 00170 is_node_on_side(InfPrism6::edge_nodes_map[e][1],s)); 00171 } 00172 00173 00174 00175 } // namespace libMesh 00176 00177 00178 00179 #endif // ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS