inf_fe_map_eval.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 // Local includes 00020 #include "libmesh/libmesh_config.h" 00021 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 00022 #include "libmesh/inf_fe.h" 00023 00024 namespace libMesh 00025 { 00026 00027 // Anonymous namespace for local helper functions 00028 namespace { 00029 00030 Real infinite_map_eval(Real v, unsigned i) 00031 { 00032 libmesh_assert (-1.-1.e-5 <= v && v < 1.); 00033 00034 switch (i) 00035 { 00036 case 0: 00037 return -2.*v/(1.-v); 00038 case 1: 00039 return (1.+v)/(1.-v); 00040 00041 default: 00042 libMesh::err << "bad index i = " << i << std::endl; 00043 libmesh_error(); 00044 00045 } 00046 00047 // we never end up here. 00048 libmesh_error(); 00049 return 0.; 00050 } 00051 00052 00053 00054 Real infinite_map_eval_deriv(Real v, unsigned i) 00055 { 00056 libmesh_assert (-1.-1.e-5 <= v && v < 1.); 00057 00058 switch (i) 00059 { 00060 case 0: 00061 return -2./((1.-v)*(1.-v)); 00062 case 1: 00063 return 2./((1.-v)*(1.-v)); 00064 00065 default: 00066 libMesh::err << "bad index i = " << i << std::endl; 00067 libmesh_error(); 00068 00069 } 00070 00071 // we never end up here. 00072 libmesh_error(); 00073 return 0.; 00074 } 00075 00076 } // anonymous namespace 00077 00078 00079 // Specialize the eval() function for 1, 2, and 3 dimensions and the CARTESIAN mapping type 00080 // to call the local helper function from the anonymous namespace. 00081 template <> Real InfFE<1,INFINITE_MAP,CARTESIAN>::eval(Real v, Order, unsigned i) { return infinite_map_eval(v, i); } 00082 template <> Real InfFE<2,INFINITE_MAP,CARTESIAN>::eval(Real v, Order, unsigned i) { return infinite_map_eval(v, i); } 00083 template <> Real InfFE<3,INFINITE_MAP,CARTESIAN>::eval(Real v, Order, unsigned i) { return infinite_map_eval(v, i); } 00084 00085 // Specialize the eval_deriv() function for 1, 2, and 3 dimensions and the CARTESIAN mapping type 00086 // to call the local helper function from the anonymous namespace. 00087 template <> Real InfFE<1,INFINITE_MAP,CARTESIAN>::eval_deriv(Real v, Order, unsigned i) { return infinite_map_eval_deriv(v, i); } 00088 template <> Real InfFE<2,INFINITE_MAP,CARTESIAN>::eval_deriv(Real v, Order, unsigned i) { return infinite_map_eval_deriv(v, i); } 00089 template <> Real InfFE<3,INFINITE_MAP,CARTESIAN>::eval_deriv(Real v, Order, unsigned i) { return infinite_map_eval_deriv(v, i); } 00090 00091 } // namespace libMesh 00092 00093 #endif // LIBMESH_ENABLE_INFINITE_ELEMENTS 00094
Site Created By: libMesh Developers
Last modified: February 05 2013 19:54:47 UTC
Hosted By: