Line data Source code
1 : // The libMesh Finite Element Library.
2 : // Copyright (C) 2002-2025 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 0 : Real InfFEMap::eval(Real v, Order, unsigned i)
28 : {
29 0 : libmesh_assert (-1.-1.e-5 <= v && v < 1.);
30 :
31 0 : switch (i)
32 : {
33 0 : case 0:
34 0 : return -2.*v/(1.-v);
35 0 : case 1:
36 0 : return (1.+v)/(1.-v);
37 :
38 0 : default:
39 0 : libmesh_error_msg("bad index i = " << i);
40 : }
41 : }
42 :
43 :
44 :
45 0 : Real InfFEMap::eval_deriv(Real v, Order, unsigned i)
46 : {
47 0 : libmesh_assert (-1.-1.e-5 <= v && v < 1.);
48 :
49 0 : switch (i)
50 : {
51 0 : case 0:
52 0 : return -2./((1.-v)*(1.-v));
53 0 : case 1:
54 0 : return 2./((1.-v)*(1.-v));
55 :
56 0 : default:
57 0 : 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 0 : template <> Real InfFE<1,INFINITE_MAP,CARTESIAN>::eval(Real v, Order o, unsigned i) { return InfFEMap::eval(v, o, i); }
64 0 : template <> Real InfFE<2,INFINITE_MAP,CARTESIAN>::eval(Real v, Order o, unsigned i) { return InfFEMap::eval(v, o, i); }
65 0 : 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 0 : template <> Real InfFE<1,INFINITE_MAP,CARTESIAN>::eval_deriv(Real v, Order o, unsigned i) { return InfFEMap::eval_deriv(v, o, i); }
70 0 : template <> Real InfFE<2,INFINITE_MAP,CARTESIAN>::eval_deriv(Real v, Order o, unsigned i) { return InfFEMap::eval_deriv(v, o, i); }
71 0 : 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
|