inf_fe_map_eval.C
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2014 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::err << "bad index i = " << i << std::endl;
43  libmesh_error();
44 
45  }
46 
47  // we never end up here.
48  libmesh_error();
49  return 0.;
50  }
51 
52 
53 
54  Real infinite_map_eval_deriv(Real v, unsigned i)
55  {
56  libmesh_assert (-1.-1.e-5 <= v && v < 1.);
57 
58  switch (i)
59  {
60  case 0:
61  return -2./((1.-v)*(1.-v));
62  case 1:
63  return 2./((1.-v)*(1.-v));
64 
65  default:
66  libMesh::err << "bad index i = " << i << std::endl;
67  libmesh_error();
68 
69  }
70 
71  // we never end up here.
72  libmesh_error();
73  return 0.;
74  }
75 
76  } // anonymous namespace
77 
78 
79  // Specialize the eval() 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(Real v, Order, unsigned i) { return infinite_map_eval(v, i); }
82  template <> Real InfFE<2,INFINITE_MAP,CARTESIAN>::eval(Real v, Order, unsigned i) { return infinite_map_eval(v, i); }
83  template <> Real InfFE<3,INFINITE_MAP,CARTESIAN>::eval(Real v, Order, unsigned i) { return infinite_map_eval(v, i); }
84 
85  // Specialize the eval_deriv() function for 1, 2, and 3 dimensions and the CARTESIAN mapping type
86  // to call the local helper function from the anonymous namespace.
87  template <> Real InfFE<1,INFINITE_MAP,CARTESIAN>::eval_deriv(Real v, Order, unsigned i) { return infinite_map_eval_deriv(v, i); }
88  template <> Real InfFE<2,INFINITE_MAP,CARTESIAN>::eval_deriv(Real v, Order, unsigned i) { return infinite_map_eval_deriv(v, i); }
89  template <> Real InfFE<3,INFINITE_MAP,CARTESIAN>::eval_deriv(Real v, Order, unsigned i) { return infinite_map_eval_deriv(v, i); }
90 
91 } // namespace libMesh
92 
93 #endif // LIBMESH_ENABLE_INFINITE_ELEMENTS

Site Created By: libMesh Developers
Last modified: February 07 2014 16:57:05 UTC

Hosted By:
SourceForge.net Logo