inf_fe_map_eval.C
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2018 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 // Local includes
20 #include "libmesh/libmesh_config.h"
21 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
22 #include "libmesh/inf_fe.h"
23 
24 namespace libMesh
25 {
26 
27 // Anonymous namespace for local helper functions
28 namespace {
29 
30 Real infinite_map_eval(Real v, unsigned i)
31 {
32  libmesh_assert (-1.-1.e-5 <= v && v < 1.);
33 
34  switch (i)
35  {
36  case 0:
37  return -2.*v/(1.-v);
38  case 1:
39  return (1.+v)/(1.-v);
40 
41  default:
42  libmesh_error_msg("bad index i = " << i);
43  }
44 }
45 
46 
47 
48 Real infinite_map_eval_deriv(Real v, unsigned i)
49 {
50  libmesh_assert (-1.-1.e-5 <= v && v < 1.);
51 
52  switch (i)
53  {
54  case 0:
55  return -2./((1.-v)*(1.-v));
56  case 1:
57  return 2./((1.-v)*(1.-v));
58 
59  default:
60  libmesh_error_msg("bad index i = " << i);
61  }
62 }
63 
64 } // anonymous namespace
65 
66 
67  // Specialize the eval() function for 1, 2, and 3 dimensions and the CARTESIAN mapping type
68  // to call the local helper function from the anonymous namespace.
69 template <> Real InfFE<1,INFINITE_MAP,CARTESIAN>::eval(Real v, Order, unsigned i) { return infinite_map_eval(v, i); }
70 template <> Real InfFE<2,INFINITE_MAP,CARTESIAN>::eval(Real v, Order, unsigned i) { return infinite_map_eval(v, i); }
71 template <> Real InfFE<3,INFINITE_MAP,CARTESIAN>::eval(Real v, Order, unsigned i) { return infinite_map_eval(v, i); }
72 
73 // Specialize the eval_deriv() function for 1, 2, and 3 dimensions and the CARTESIAN mapping type
74 // to call the local helper function from the anonymous namespace.
75 template <> Real InfFE<1,INFINITE_MAP,CARTESIAN>::eval_deriv(Real v, Order, unsigned i) { return infinite_map_eval_deriv(v, i); }
76 template <> Real InfFE<2,INFINITE_MAP,CARTESIAN>::eval_deriv(Real v, Order, unsigned i) { return infinite_map_eval_deriv(v, i); }
77 template <> Real InfFE<3,INFINITE_MAP,CARTESIAN>::eval_deriv(Real v, Order, unsigned i) { return infinite_map_eval_deriv(v, i); }
78 
79 } // namespace libMesh
80 
81 #endif // LIBMESH_ENABLE_INFINITE_ELEMENTS
static Real eval_deriv(Real v, Order o_radial, unsigned int i)
static Real eval(Real v, Order o_radial, unsigned int i)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real