$extrastylesheet
inf_fe_base_radial.C
Go to the documentation of this file.
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 #include "libmesh/inf_fe.h"
00024 #include "libmesh/inf_fe_macro.h"
00025 #include "libmesh/fe.h"
00026 #include "libmesh/elem.h"
00027 
00028 namespace libMesh
00029 {
00030 
00031 
00032 
00033 // ------------------------------------------------------------
00034 // InfFE::Base class members
00035 template <unsigned int Dim, FEFamily T_radial, InfMapType T_base>
00036 Elem* InfFE<Dim,T_radial,T_base>::Base::build_elem (const Elem* inf_elem)
00037 {
00038   UniquePtr<Elem> ape(inf_elem->build_side(0));
00039   return ape.release();
00040 }
00041 
00042 
00043 
00044 
00045 template <unsigned int Dim, FEFamily T_radial, InfMapType T_base>
00046 ElemType InfFE<Dim,T_radial,T_base>::Base::get_elem_type (const ElemType type)
00047 {
00048   switch (type)
00049     {
00050       // 3D infinite elements:
00051       // with Dim=3 -> infinite elements on their own
00052     case INFHEX8:
00053       return QUAD4;
00054 
00055     case INFHEX16:
00056       return QUAD8;
00057 
00058     case INFHEX18:
00059       return QUAD9;
00060 
00061     case INFPRISM6:
00062       return TRI3;
00063 
00064     case INFPRISM12:
00065       return TRI6;
00066 
00067       // 2D infinite elements:
00068       // with Dim=3 -> used as boundary condition,
00069       // with Dim=2 -> infinite elements on their own
00070     case INFQUAD4:
00071       return EDGE2;
00072 
00073     case INFQUAD6:
00074       return EDGE3;
00075 
00076       // 1D infinite elements:
00077       // with Dim=2 -> used as boundary condition,
00078       // with Dim=1 -> infinite elements on their own,
00079       //               but no base element!
00080     case INFEDGE2:
00081       return INVALID_ELEM;
00082 
00083     default:
00084       libmesh_error_msg("ERROR: Unsupported element type!: " << type);
00085     }
00086 
00087   libmesh_error_msg("We'll never get here!");
00088   return INVALID_ELEM;
00089 }
00090 
00091 
00092 
00093 
00094 
00095 template <unsigned int Dim, FEFamily T_radial, InfMapType T_base>
00096 unsigned int InfFE<Dim,T_radial,T_base>::Base::n_base_mapping_sf (const ElemType base_elem_type,
00097                                                                   const Order base_mapping_order)
00098 {
00099   if (Dim == 1)
00100     return 1;
00101 
00102   else if (Dim == 2)
00103     return FE<1,LAGRANGE>::n_shape_functions (base_elem_type,
00104                                               base_mapping_order);
00105   else if (Dim == 3)
00106     return FE<2,LAGRANGE>::n_shape_functions (base_elem_type,
00107                                               base_mapping_order);
00108   else
00109     {
00110       libmesh_error_msg("Unsupported Dim = " << Dim);
00111       return 0;
00112     }
00113 }
00114 
00115 
00116 
00117 
00118 
00119 // ------------------------------------------------------------
00120 // InfFE::Radial class members
00121 template <unsigned int Dim, FEFamily T_radial, InfMapType T_map>
00122 unsigned int InfFE<Dim,T_radial,T_map>::Radial::n_dofs_at_node (const Order o_radial,
00123                                                                 const unsigned int n_onion)
00124 {
00125   libmesh_assert_less (n_onion, 2);
00126 
00127   if (n_onion == 0)
00128     /*
00129      * in the base, no matter what, we have 1 node associated
00130      * with radial direction
00131      */
00132     return 1;
00133   else
00134     /*
00135      * this works, since for Order o_radial=CONST=0, we still
00136      * have the (1-v)/2 mode, associated to the base
00137      */
00138     return static_cast<unsigned int>(o_radial);
00139 }
00140 
00141 
00142 
00143 
00144 
00145 
00146 //--------------------------------------------------------------
00147 // Explicit instantiations
00148 INSTANTIATE_INF_FE_MBRF(1,CARTESIAN,Elem*,Base::build_elem(const Elem*));
00149 INSTANTIATE_INF_FE_MBRF(2,CARTESIAN,Elem*,Base::build_elem(const Elem*));
00150 INSTANTIATE_INF_FE_MBRF(3,CARTESIAN,Elem*,Base::build_elem(const Elem*));
00151 INSTANTIATE_INF_FE_MBRF(1,CARTESIAN,ElemType,Base::get_elem_type(const ElemType type));
00152 INSTANTIATE_INF_FE_MBRF(2,CARTESIAN,ElemType,Base::get_elem_type(const ElemType type));
00153 INSTANTIATE_INF_FE_MBRF(3,CARTESIAN,ElemType,Base::get_elem_type(const ElemType type));
00154 INSTANTIATE_INF_FE_MBRF(1,CARTESIAN,unsigned int,Base::n_base_mapping_sf(const ElemType,const Order));
00155 INSTANTIATE_INF_FE_MBRF(2,CARTESIAN,unsigned int,Base::n_base_mapping_sf(const ElemType,const Order));
00156 INSTANTIATE_INF_FE_MBRF(3,CARTESIAN,unsigned int,Base::n_base_mapping_sf(const ElemType,const Order));
00157 INSTANTIATE_INF_FE_MBRF(1,CARTESIAN,unsigned int,Radial::n_dofs_at_node (const Order,const unsigned int));
00158 INSTANTIATE_INF_FE_MBRF(2,CARTESIAN,unsigned int,Radial::n_dofs_at_node (const Order,const unsigned int));
00159 INSTANTIATE_INF_FE_MBRF(3,CARTESIAN,unsigned int,Radial::n_dofs_at_node (const Order,const unsigned int));
00160 
00161 } // namespace libMesh
00162 
00163 #endif //ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS