libMesh
inf_fe_map_eval.C
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2024 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 Real InfFEMap::eval(Real v, Order, unsigned i)
28 {
29  libmesh_assert (-1.-1.e-5 <= v && v < 1.);
30 
31  switch (i)
32  {
33  case 0:
34  return -2.*v/(1.-v);
35  case 1:
36  return (1.+v)/(1.-v);
37 
38  default:
39  libmesh_error_msg("bad index i = " << i);
40  }
41 }
42 
43 
44 
46 {
47  libmesh_assert (-1.-1.e-5 <= v && v < 1.);
48 
49  switch (i)
50  {
51  case 0:
52  return -2./((1.-v)*(1.-v));
53  case 1:
54  return 2./((1.-v)*(1.-v));
55 
56  default:
57  libmesh_error_msg("bad index i = " << i);
58  }
59 }
60 
61 // Specialize the eval() function for 1, 2, and 3 dimensions and the CARTESIAN mapping type
62 // to call the local helper function from the anonymous namespace.
63 template <> Real InfFE<1,INFINITE_MAP,CARTESIAN>::eval(Real v, Order o, unsigned i) { return InfFEMap::eval(v, o, i); }
64 template <> Real InfFE<2,INFINITE_MAP,CARTESIAN>::eval(Real v, Order o, unsigned i) { return InfFEMap::eval(v, o, i); }
65 template <> Real InfFE<3,INFINITE_MAP,CARTESIAN>::eval(Real v, Order o, unsigned i) { return InfFEMap::eval(v, o, i); }
66 
67 // Specialize the eval_deriv() 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_deriv(Real v, Order o, unsigned i) { return InfFEMap::eval_deriv(v, o, i); }
70 template <> Real InfFE<2,INFINITE_MAP,CARTESIAN>::eval_deriv(Real v, Order o, unsigned i) { return InfFEMap::eval_deriv(v, o, i); }
71 template <> Real InfFE<3,INFINITE_MAP,CARTESIAN>::eval_deriv(Real v, Order o, unsigned i) { return InfFEMap::eval_deriv(v, o, i); }
72 
73 
74 } // namespace libMesh
75 
76 #endif // LIBMESH_ENABLE_INFINITE_ELEMENTS
Order
defines an enum for polynomial orders.
Definition: enum_order.h:40
static Real eval_deriv(Real v, Order o_radial, unsigned int i)
static Real eval(Real v, Order o, unsigned int i)
The libMesh namespace provides an interface to certain functionality in the library.
libmesh_assert(ctx)
static Real eval(Real v, Order o_radial, unsigned int i)
static Real eval_deriv(Real v, Order o, unsigned int i)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real