libMesh
inf_fe_map_eval.C
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2017 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  libmesh_error_msg("We'll never get here!");
46  return 0.;
47 }
48 
49 
50 
51 Real infinite_map_eval_deriv(Real v, unsigned i)
52 {
53  libmesh_assert (-1.-1.e-5 <= v && v < 1.);
54 
55  switch (i)
56  {
57  case 0:
58  return -2./((1.-v)*(1.-v));
59  case 1:
60  return 2./((1.-v)*(1.-v));
61 
62  default:
63  libmesh_error_msg("bad index i = " << i);
64  }
65 
66  libmesh_error_msg("We'll never get here!");
67  return 0.;
68 }
69 
70 } // anonymous namespace
71 
72 
73  // Specialize the eval() 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(Real v, Order, unsigned i) { return infinite_map_eval(v, i); }
76 template <> Real InfFE<2,INFINITE_MAP,CARTESIAN>::eval(Real v, Order, unsigned i) { return infinite_map_eval(v, i); }
77 template <> Real InfFE<3,INFINITE_MAP,CARTESIAN>::eval(Real v, Order, unsigned i) { return infinite_map_eval(v, i); }
78 
79 // Specialize the eval_deriv() function for 1, 2, and 3 dimensions and the CARTESIAN mapping type
80 // to call the local helper function from the anonymous namespace.
81 template <> Real InfFE<1,INFINITE_MAP,CARTESIAN>::eval_deriv(Real v, Order, unsigned i) { return infinite_map_eval_deriv(v, i); }
82 template <> Real InfFE<2,INFINITE_MAP,CARTESIAN>::eval_deriv(Real v, Order, unsigned i) { return infinite_map_eval_deriv(v, i); }
83 template <> Real InfFE<3,INFINITE_MAP,CARTESIAN>::eval_deriv(Real v, Order, unsigned i) { return infinite_map_eval_deriv(v, i); }
84 
85 } // namespace libMesh
86 
87 #endif // LIBMESH_ENABLE_INFINITE_ELEMENTS
static Real eval_deriv(Real v, Order o_radial, unsigned int i)
The libMesh namespace provides an interface to certain functionality in the library.
libmesh_assert(j)
static Real eval(Real v, Order o_radial, unsigned int i)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Order
defines an enum for polynomial orders.
Definition: enum_order.h:32