fe_interface.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2018 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 
20 #ifndef LIBMESH_FE_INTERFACE_H
21 #define LIBMESH_FE_INTERFACE_H
22 
23 // Local includes
24 #include "libmesh/libmesh_common.h"
25 #include "libmesh/vector_value.h"
26 
27 // C++ includes
28 #include <map>
29 #include <vector>
30 
31 namespace libMesh
32 {
33 
34 
35 // forward declarations
36 class BoundaryInfo;
37 class DofConstraints;
38 class DofMap;
39 class Elem;
40 class FEType;
41 class FEComputeData;
42 class Point;
43 class MeshBase;
44 enum FEFamily : int;
45 enum Order : int;
46 enum FEFieldType : int;
47 enum ElemType : int;
48 
49 #ifdef LIBMESH_ENABLE_PERIODIC
50 class PeriodicBoundaries;
51 class PointLocatorBase;
52 #endif
53 
65 {
66 private:
67 
71  FEInterface();
72 
73 public:
74 
78  virtual ~FEInterface() {}
79 
87  static unsigned int n_shape_functions(const unsigned int dim,
88  const FEType & fe_t,
89  const ElemType t);
90 
98  static unsigned int n_dofs(const unsigned int dim,
99  const FEType & fe_t,
100  const ElemType t);
101 
109  static unsigned int n_dofs_at_node(const unsigned int dim,
110  const FEType & fe_t,
111  const ElemType t,
112  const unsigned int n);
113 
114  typedef unsigned int (*n_dofs_at_node_ptr) (const ElemType,
115  const Order,
116  const unsigned int);
117 
122  static n_dofs_at_node_ptr
123  n_dofs_at_node_function(const unsigned int dim,
124  const FEType & fe_t);
125 
133  static unsigned int n_dofs_per_elem(const unsigned int dim,
134  const FEType & fe_t,
135  const ElemType t);
136 
144  static void dofs_on_side(const Elem * const elem,
145  const unsigned int dim,
146  const FEType & fe_t,
147  unsigned int s,
148  std::vector<unsigned int> & di);
149 
157  static void dofs_on_edge(const Elem * const elem,
158  const unsigned int dim,
159  const FEType & fe_t,
160  unsigned int e,
161  std::vector<unsigned int> & di);
162 
174  static void nodal_soln(const unsigned int dim,
175  const FEType & fe_t,
176  const Elem * elem,
177  const std::vector<Number> & elem_soln,
178  std::vector<Number> & nodal_soln);
179 
184  static Point map(unsigned int dim,
185  const FEType & fe_t,
186  const Elem * elem,
187  const Point & p);
188 
198  static Point inverse_map (const unsigned int dim,
199  const FEType & fe_t,
200  const Elem * elem,
201  const Point & p,
202  const Real tolerance = TOLERANCE,
203  const bool secure = true);
204 
216  static void inverse_map (const unsigned int dim,
217  const FEType & fe_t,
218  const Elem * elem,
219  const std::vector<Point> & physical_points,
220  std::vector<Point> & reference_points,
221  const Real tolerance = TOLERANCE,
222  const bool secure = true);
223 
232  static bool on_reference_element(const Point & p,
233  const ElemType t,
234  const Real eps=TOLERANCE);
244  static Real shape(const unsigned int dim,
245  const FEType & fe_t,
246  const ElemType t,
247  const unsigned int i,
248  const Point & p);
249 
259  static Real shape(const unsigned int dim,
260  const FEType & fe_t,
261  const Elem * elem,
262  const unsigned int i,
263  const Point & p);
264 
274  template<typename OutputType>
275  static void shape(const unsigned int dim,
276  const FEType & fe_t,
277  const ElemType t,
278  const unsigned int i,
279  const Point & p,
280  OutputType & phi);
281 
291  template<typename OutputType>
292  static void shape(const unsigned int dim,
293  const FEType & fe_t,
294  const Elem * elem,
295  const unsigned int i,
296  const Point & p,
297  OutputType & phi);
298 
309  static void compute_data(const unsigned int dim,
310  const FEType & fe_t,
311  const Elem * elem,
312  FEComputeData & data);
313 
314 #ifdef LIBMESH_ENABLE_AMR
315 
320  static void compute_constraints (DofConstraints & constraints,
321  DofMap & dof_map,
322  const unsigned int variable_number,
323  const Elem * elem);
324 #endif // #ifdef LIBMESH_ENABLE_AMR
325 
326 #ifdef LIBMESH_ENABLE_PERIODIC
327 
332  static void compute_periodic_constraints (DofConstraints & constraints,
333  DofMap & dof_map,
334  const PeriodicBoundaries & boundaries,
335  const MeshBase & mesh,
336  const PointLocatorBase * point_locator,
337  const unsigned int variable_number,
338  const Elem * elem);
339 #endif // #ifdef LIBMESH_ENABLE_PERIODIC
340 
345  static unsigned int max_order (const FEType & fe_t,
346  const ElemType & el_t);
347 
352  static bool extra_hanging_dofs (const FEType & fe_t);
353 
358  static FEFieldType field_type (const FEType & fe_type);
359 
364  static FEFieldType field_type (const FEFamily & fe_family);
365 
370  static unsigned int n_vec_dim (const MeshBase & mesh,
371  const FEType & fe_type);
372 
373 private:
374 
375 
380  static bool is_InfFE_elem(const ElemType et);
381 
382 
383 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
384 
385  /*
386  * All these private members do the same as their public
387  * counterparts, except for infinite elements. This disentangles
388  * the calls to \p FE and \p InfFE.
389  */
390 
391  static unsigned int ifem_n_shape_functions(const unsigned int dim,
392  const FEType & fe_t,
393  const ElemType t);
394 
395  static unsigned int ifem_n_dofs(const unsigned int dim,
396  const FEType & fe_t,
397  const ElemType t);
398 
399  static unsigned int ifem_n_dofs_at_node(const unsigned int dim,
400  const FEType & fe_t,
401  const ElemType t,
402  const unsigned int n);
403 
404  static unsigned int ifem_n_dofs_per_elem(const unsigned int dim,
405  const FEType & fe_t,
406  const ElemType t);
407 
408  static void ifem_nodal_soln(const unsigned int dim,
409  const FEType & fe_t,
410  const Elem * elem,
411  const std::vector<Number> & elem_soln,
412  std::vector<Number> & nodal_soln);
413 
414  static Point ifem_map (const unsigned int dim,
415  const FEType & fe_t,
416  const Elem * elem,
417  const Point & p);
418 
419  static Point ifem_inverse_map (const unsigned int dim,
420  const FEType & fe_t,
421  const Elem * elem,
422  const Point & p,
423  const Real tolerance = TOLERANCE,
424  const bool secure = true);
425 
426  static void ifem_inverse_map (const unsigned int dim,
427  const FEType & fe_t,
428  const Elem * elem,
429  const std::vector<Point> & physical_points,
430  std::vector<Point> & reference_points,
431  const Real tolerance = TOLERANCE,
432  const bool secure = true);
433 
434 
435  static bool ifem_on_reference_element(const Point & p,
436  const ElemType t,
437  const Real eps);
438 
439  static Real ifem_shape(const unsigned int dim,
440  const FEType & fe_t,
441  const ElemType t,
442  const unsigned int i,
443  const Point & p);
444 
445  static Real ifem_shape(const unsigned int dim,
446  const FEType & fe_t,
447  const Elem * elem,
448  const unsigned int i,
449  const Point & p);
450 
451  static void ifem_compute_data(const unsigned int dim,
452  const FEType & fe_t,
453  const Elem * elem,
454  FEComputeData & data);
455 
456 #endif
457 
458 
459 };
460 
461 } // namespace libMesh
462 
463 #endif // LIBMESH_FE_INTERFACE_H
static unsigned int n_dofs_per_elem(const unsigned int dim, const FEType &fe_t, const ElemType t)
Definition: fe_interface.C:504
static void dofs_on_edge(const Elem *const elem, const unsigned int dim, const FEType &fe_t, unsigned int e, std::vector< unsigned int > &di)
Definition: fe_interface.C:536
Manages the family, order, etc. parameters for a given FE.
Definition: fe_type.h:179
static Point map(unsigned int dim, const FEType &fe_t, const Elem *elem, const Point &p)
Definition: fe_interface.C:574
static unsigned int n_dofs(const unsigned int dim, const FEType &fe_t, const ElemType t)
Definition: fe_interface.C:454
static unsigned int ifem_n_shape_functions(const unsigned int dim, const FEType &fe_t, const ElemType t)
static bool ifem_on_reference_element(const Point &p, const ElemType t, const Real eps)
static Real ifem_shape(const unsigned int dim, const FEType &fe_t, const ElemType t, const unsigned int i, const Point &p)
static void dofs_on_side(const Elem *const elem, const unsigned int dim, const FEType &fe_t, unsigned int s, std::vector< unsigned int > &di)
Definition: fe_interface.C:523
Helper class used with FEInterface::compute_data().
Maps between boundary ids and PeriodicBoundaryBase objects.
The base class for all geometric element types.
Definition: elem.h:100
MeshBase & mesh
static FEFieldType field_type(const FEType &fe_type)
static const Real TOLERANCE
static Point ifem_inverse_map(const unsigned int dim, const FEType &fe_t, const Elem *elem, const Point &p, const Real tolerance=TOLERANCE, const bool secure=true)
static unsigned int max_order(const FEType &fe_t, const ElemType &el_t)
Base class for Mesh.
Definition: mesh_base.h:77
static void compute_constraints(DofConstraints &constraints, DofMap &dof_map, const unsigned int variable_number, const Elem *elem)
Definition: fe_interface.C:873
Manages the degrees of freedom (DOFs) in a simulation.
Definition: dof_map.h:176
static void ifem_compute_data(const unsigned int dim, const FEType &fe_t, const Elem *elem, FEComputeData &data)
static bool extra_hanging_dofs(const FEType &fe_t)
static unsigned int n_shape_functions(const unsigned int dim, const FEType &fe_t, const ElemType t)
Definition: fe_interface.C:428
static Real shape(const unsigned int dim, const FEType &fe_t, const ElemType t, const unsigned int i, const Point &p)
Definition: fe_interface.C:657
static void compute_data(const unsigned int dim, const FEType &fe_t, const Elem *elem, FEComputeData &data)
Definition: fe_interface.C:837
static Point inverse_map(const unsigned int dim, const FEType &fe_t, const Elem *elem, const Point &p, const Real tolerance=TOLERANCE, const bool secure=true)
Definition: fe_interface.C:590
static Point ifem_map(const unsigned int dim, const FEType &fe_t, const Elem *elem, const Point &p)
static void ifem_nodal_soln(const unsigned int dim, const FEType &fe_t, const Elem *elem, const std::vector< Number > &elem_soln, std::vector< Number > &nodal_soln)
static bool on_reference_element(const Point &p, const ElemType t, const Real eps=TOLERANCE)
Definition: fe_interface.C:647
Interface class which provides access to FE functions.
Definition: fe_interface.h:64
static unsigned int ifem_n_dofs_per_elem(const unsigned int dim, const FEType &fe_t, const ElemType t)
static unsigned int n_vec_dim(const MeshBase &mesh, const FEType &fe_type)
static n_dofs_at_node_ptr n_dofs_at_node_function(const unsigned int dim, const FEType &fe_t)
Definition: fe_interface.C:493
static unsigned int n_dofs_at_node(const unsigned int dim, const FEType &fe_t, const ElemType t, const unsigned int n)
Definition: fe_interface.C:473
static unsigned int ifem_n_dofs(const unsigned int dim, const FEType &fe_t, const ElemType t)
unsigned int(* n_dofs_at_node_ptr)(const ElemType, const Order, const unsigned int)
Definition: fe_interface.h:114
virtual ~FEInterface()
Definition: fe_interface.h:78
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static bool is_InfFE_elem(const ElemType et)
Definition: fe_interface.C:45
static void nodal_soln(const unsigned int dim, const FEType &fe_t, const Elem *elem, const std::vector< Number > &elem_soln, std::vector< Number > &nodal_soln)
Definition: fe_interface.C:550
IterBase * data
static void compute_periodic_constraints(DofConstraints &constraints, DofMap &dof_map, const PeriodicBoundaries &boundaries, const MeshBase &mesh, const PointLocatorBase *point_locator, const unsigned int variable_number, const Elem *elem)
A geometric point in (x,y,z) space.
Definition: point.h:38
static unsigned int ifem_n_dofs_at_node(const unsigned int dim, const FEType &fe_t, const ElemType t, const unsigned int n)