cell_inf_prism.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 #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 00078 // We'll never get here. 00079 libmesh_error(); 00080 return 0; 00081 } 00082 00083 00084 00085 AutoPtr<Elem> InfPrism::side (const unsigned int i) const 00086 { 00087 libmesh_assert_less (i, this->n_sides()); 00088 00089 switch (i) 00090 { 00091 case 0: // the triangular face at z=-1, base face 00092 { 00093 Elem* face = new Tri3; 00094 AutoPtr<Elem> ap_face(face); 00095 //AutoPtr<Elem> face(new Tri3); 00096 00097 // Note that for this face element, the normal points inward 00098 face->set_node(0) = this->get_node(0); 00099 face->set_node(1) = this->get_node(1); 00100 face->set_node(2) = this->get_node(2); 00101 00102 return ap_face; 00103 } 00104 00105 case 1: // the quad face at y=0 00106 { 00107 Elem* face = new InfQuad4; 00108 AutoPtr<Elem> ap_face(face); 00109 //AutoPtr<Elem> 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 return ap_face; 00117 } 00118 00119 case 2: // the other quad face 00120 { 00121 Elem* face = new InfQuad4; 00122 AutoPtr<Elem> ap_face(face); 00123 //AutoPtr<Elem> face(new InfQuad4); 00124 00125 face->set_node(0) = this->get_node(1); 00126 face->set_node(1) = this->get_node(2); 00127 face->set_node(2) = this->get_node(4); 00128 face->set_node(3) = this->get_node(5); 00129 00130 return ap_face; 00131 } 00132 00133 case 3: // the quad face at x=0 00134 { 00135 Elem* face = new InfQuad4; 00136 AutoPtr<Elem> ap_face(face); 00137 //AutoPtr<Elem> face(new InfQuad4); 00138 00139 face->set_node(0) = this->get_node(2); 00140 face->set_node(1) = this->get_node(0); 00141 face->set_node(2) = this->get_node(5); 00142 face->set_node(3) = this->get_node(3); 00143 00144 return ap_face; 00145 } 00146 00147 default: 00148 { 00149 libmesh_error(); 00150 AutoPtr<Elem> ap(NULL); return ap; 00151 } 00152 } 00153 00154 // We'll never get here. 00155 libmesh_error(); 00156 AutoPtr<Elem> ap(NULL); return ap; 00157 } 00158 00159 00160 00161 bool InfPrism::is_child_on_side(const unsigned int c, 00162 const unsigned int s) const 00163 { 00164 libmesh_assert_less (c, this->n_children()); 00165 libmesh_assert_less (s, this->n_sides()); 00166 00167 return (s == 0 || c+1 == s || c == s%3); 00168 } 00169 00170 00171 00172 bool InfPrism::is_edge_on_side (const unsigned int e, 00173 const unsigned int s) const 00174 { 00175 libmesh_assert_less (e, this->n_edges()); 00176 libmesh_assert_less (s, this->n_sides()); 00177 00178 return (is_node_on_side(InfPrism6::edge_nodes_map[e][0],s) && 00179 is_node_on_side(InfPrism6::edge_nodes_map[e][1],s)); 00180 } 00181 00182 00183 00184 } // namespace libMesh 00185 00186 00187 00188 #endif // ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
Site Created By: libMesh Developers
Last modified: February 05 2013 19:54:45 UTC
Hosted By: