libMesh
fe_macro.h
Go to the documentation of this file.
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 #ifndef LIBMESH_FE_MACRO_H
20 #define LIBMESH_FE_MACRO_H
21 
22 
23 
24 
25 // These macros help in instantiating specific versions
26 // of the \p FE class. Simply include this file, and
27 // instantiate at the end for the desired dimension(s).
28 #define INSTANTIATE_MAPS(_dim,_type) \
29  template LIBMESH_EXPORT Point FE<_dim, _type>::map(const Elem *, const Point &); \
30  template LIBMESH_EXPORT Point FE<_dim, _type>::map_xi(const Elem *, const Point &); \
31  template LIBMESH_EXPORT Point FE<_dim, _type>::map_eta(const Elem *, const Point &); \
32  template LIBMESH_EXPORT Point FE<_dim, _type>::map_zeta(const Elem *, const Point &); \
33  template LIBMESH_EXPORT void FE<_dim, _type>::inverse_map(const Elem *, const std::vector<Point> &, std::vector<Point> &, Real, bool); \
34  template LIBMESH_EXPORT Point FE<_dim, _type>::inverse_map(const Elem *, const Point &, Real, bool)
35 
36 #define INSTANTIATE_SUBDIVISION_MAPS \
37  template LIBMESH_EXPORT Point FE<2, SUBDIVISION>::map(const Elem *, const Point &); \
38  template LIBMESH_EXPORT Point FE<2, SUBDIVISION>::map_xi(const Elem *, const Point &); \
39  template LIBMESH_EXPORT Point FE<2, SUBDIVISION>::map_eta(const Elem *, const Point &); \
40  template LIBMESH_EXPORT Point FE<2, SUBDIVISION>::map_zeta(const Elem *, const Point &)
41 
42 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
43 
44 #define INSTANTIATE_SUBDIVISION_FE \
45  template LIBMESH_EXPORT FE<2,SUBDIVISION>::FE(const FEType & fet); \
46  template LIBMESH_EXPORT unsigned int FE<2,SUBDIVISION>::n_shape_functions () const; \
47  template LIBMESH_EXPORT void FE<2,SUBDIVISION>::attach_quadrature_rule (QBase *); \
48  template LIBMESH_EXPORT void FE<2,SUBDIVISION>::reinit(const Elem *,const std::vector<Point> * const,const std::vector<Real> * const); \
49  template LIBMESH_EXPORT void FE<2,SUBDIVISION>::init_base_shape_functions(const std::vector<Point> &, const Elem *); \
50  template LIBMESH_EXPORT void FE<2,SUBDIVISION>::init_shape_functions(const std::vector<Point> &, const Elem *); \
51  template LIBMESH_EXPORT void FE<2,SUBDIVISION>::init_dual_shape_functions(unsigned int, unsigned int); \
52  template LIBMESH_EXPORT void FE<2,SUBDIVISION>::default_all_shape_derivs (const Elem * elem, const Order o, const std::vector<Point> & p, std::vector<std::vector<Real>> * comps[3], const bool add_p_level); \
53  template LIBMESH_EXPORT void FE<2,SUBDIVISION>::default_side_nodal_soln(const Elem * elem, const Order o, const unsigned int side, const std::vector<Number> & elem_soln, std::vector<Number> & nodal_soln_on_side, bool add_p_level, const unsigned)
54 
55 #else // LIBMESH_ENABLE_INFINITE_ELEMENTS
56 
57 #define INSTANTIATE_SUBDIVISION_FE \
58  template LIBMESH_EXPORT FE<2,SUBDIVISION>::FE(const FEType & fet); \
59  template LIBMESH_EXPORT unsigned int FE<2,SUBDIVISION>::n_shape_functions () const; \
60  template LIBMESH_EXPORT void FE<2,SUBDIVISION>::attach_quadrature_rule (QBase *); \
61  template LIBMESH_EXPORT void FE<2,SUBDIVISION>::reinit(const Elem *,const std::vector<Point> * const,const std::vector<Real> * const); \
62  template LIBMESH_EXPORT void FE<2,SUBDIVISION>::init_shape_functions(const std::vector<Point> &, const Elem *); \
63  template LIBMESH_EXPORT void FE<2,SUBDIVISION>::init_dual_shape_functions(unsigned int, unsigned int); \
64  template LIBMESH_EXPORT void FE<2,SUBDIVISION>::default_all_shape_derivs (const Elem * elem, const Order o, const std::vector<Point> & p, std::vector<std::vector<Real>> * comps[3], const bool add_p_level); \
65  template LIBMESH_EXPORT void FE<2,SUBDIVISION>::default_side_nodal_soln(const Elem * elem, const Order o, const unsigned int side, const std::vector<Number> & elem_soln, std::vector<Number> & nodal_soln_on_side, bool add_p_level, const unsigned)
66 
67 #endif // LIBMESH_ENABLE_INFINITE_ELEMENTS
68 
69 
70 #ifndef LIBMESH_ENABLE_HIGHER_ORDER_SHAPES
71 
72 #define INSTANTIATE_FE(_dim) \
73  template class LIBMESH_EXPORT FE< (_dim), CLOUGH>; \
74  template class LIBMESH_EXPORT FE< (_dim), HERMITE>; \
75  template class LIBMESH_EXPORT FE< (_dim), HIERARCHIC>; \
76  template class LIBMESH_EXPORT FE< (_dim), HIERARCHIC_VEC>; \
77  template class LIBMESH_EXPORT FE< (_dim), L2_HIERARCHIC>; \
78  template class LIBMESH_EXPORT FE< (_dim), L2_HIERARCHIC_VEC>; \
79  template class LIBMESH_EXPORT FE< (_dim), LAGRANGE>; \
80  template class LIBMESH_EXPORT FE< (_dim), LAGRANGE_VEC>; \
81  template class LIBMESH_EXPORT FE< (_dim), L2_LAGRANGE>; \
82  template class LIBMESH_EXPORT FE< (_dim), L2_LAGRANGE_VEC>; \
83  template class LIBMESH_EXPORT FE< (_dim), MONOMIAL>; \
84  template class LIBMESH_EXPORT FE< (_dim), SCALAR>; \
85  template class LIBMESH_EXPORT FE< (_dim), SIDE_HIERARCHIC>; \
86  template class LIBMESH_EXPORT FE< (_dim), XYZ>; \
87  template class LIBMESH_EXPORT FE< (_dim), NEDELEC_ONE>; \
88  template class LIBMESH_EXPORT FE< (_dim), MONOMIAL_VEC>; \
89  template class LIBMESH_EXPORT FE< (_dim), RAVIART_THOMAS>; \
90  template class LIBMESH_EXPORT FE< (_dim), L2_RAVIART_THOMAS>
91 
92 #else //LIBMESH_ENABLE_HIGHER_ORDER_SHAPES
93 
94 #define INSTANTIATE_FE(_dim) \
95  template class LIBMESH_EXPORT FE< (_dim), CLOUGH>; \
96  template class LIBMESH_EXPORT FE< (_dim), HERMITE>; \
97  template class LIBMESH_EXPORT FE< (_dim), HIERARCHIC>; \
98  template class LIBMESH_EXPORT FE< (_dim), HIERARCHIC_VEC>; \
99  template class LIBMESH_EXPORT FE< (_dim), L2_HIERARCHIC>; \
100  template class LIBMESH_EXPORT FE< (_dim), L2_HIERARCHIC_VEC>; \
101  template class LIBMESH_EXPORT FE< (_dim), LAGRANGE>; \
102  template class LIBMESH_EXPORT FE< (_dim), LAGRANGE_VEC>; \
103  template class LIBMESH_EXPORT FE< (_dim), L2_LAGRANGE>; \
104  template class LIBMESH_EXPORT FE< (_dim), L2_LAGRANGE_VEC>; \
105  template class LIBMESH_EXPORT FE< (_dim), MONOMIAL>; \
106  template class LIBMESH_EXPORT FE< (_dim), SCALAR>; \
107  template class LIBMESH_EXPORT FE< (_dim), SIDE_HIERARCHIC>; \
108  template class LIBMESH_EXPORT FE< (_dim), BERNSTEIN>; \
109  template class LIBMESH_EXPORT FE< (_dim), SZABAB>; \
110  template class LIBMESH_EXPORT FE< (_dim), XYZ>; \
111  template class LIBMESH_EXPORT FE< (_dim), RATIONAL_BERNSTEIN>; \
112  template class LIBMESH_EXPORT FE< (_dim), NEDELEC_ONE>; \
113  template class LIBMESH_EXPORT FE< (_dim), MONOMIAL_VEC>; \
114  template class LIBMESH_EXPORT FE< (_dim), RAVIART_THOMAS>; \
115  template class LIBMESH_EXPORT FE< (_dim), L2_RAVIART_THOMAS>
116 
117 #endif //LIBMESH_ENABLE_HIGHER_ORDER_SHAPES
118 
119 #define UNPACK( ... ) __VA_ARGS__
120 
121 #define LIBMESH_FE_NODAL_SOLN_DIM(_fetype, _funcname, _dim) \
122 template <> \
123 void FE<_dim,_fetype>::nodal_soln(const Elem * elem, \
124  const Order order, \
125  const std::vector<Number> & elem_soln,\
126  std::vector<Number> & nodal_soln, \
127  const bool add_p_level, \
128  const unsigned) \
129 { UNPACK _funcname(elem, order, elem_soln, nodal_soln, add_p_level); }
130 
131 #define LIBMESH_FE_NODAL_SOLN(fetype, _funcname) \
132 LIBMESH_FE_NODAL_SOLN_DIM(fetype, (_funcname), 0) \
133 LIBMESH_FE_NODAL_SOLN_DIM(fetype, (_funcname), 1) \
134 LIBMESH_FE_NODAL_SOLN_DIM(fetype, (_funcname), 2) \
135 LIBMESH_FE_NODAL_SOLN_DIM(fetype, (_funcname), 3)
136 
137 
138 #define LIBMESH_FE_SIDE_NODAL_SOLN_DIM(_fetype, _dim) \
139 template <> \
140 void FE<_dim,_fetype>::side_nodal_soln(const Elem * elem, \
141  const Order order, \
142  const unsigned int side, \
143  const std::vector<Number> & elem_soln, \
144  std::vector<Number> & nodal_soln, \
145  const bool add_p_level, \
146  const unsigned vdim) \
147 { default_side_nodal_soln(elem, order, side, elem_soln, nodal_soln, add_p_level, vdim); }
148 
149 #define LIBMESH_FE_SIDE_NODAL_SOLN(fetype) \
150 LIBMESH_FE_SIDE_NODAL_SOLN_DIM(fetype, 0) \
151 LIBMESH_FE_SIDE_NODAL_SOLN_DIM(fetype, 1) \
152 LIBMESH_FE_SIDE_NODAL_SOLN_DIM(fetype, 2) \
153 LIBMESH_FE_SIDE_NODAL_SOLN_DIM(fetype, 3)
154 
155 
156 #endif // LIBMESH_FE_MACRO_H