fe_interface.h
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 
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/enum_elem_type.h"
26 #include "libmesh/vector_value.h"
27 #include "libmesh/enum_fe_family.h"
28 
29 // C++ includes
30 #include <map>
31 #include <vector>
32 
33 namespace libMesh
34 {
35 
36 
37 // forward declarations
38 class BoundaryInfo;
39 class DofConstraints;
40 class DofMap;
41 class Elem;
42 class FEType;
43 class FEComputeData;
44 class Point;
45 class MeshBase;
46 
47 #ifdef LIBMESH_ENABLE_PERIODIC
48 class PeriodicBoundaries;
49 class PointLocatorBase;
50 #endif
51 
61 // ------------------------------------------------------------
62 // FEInterface class definition
63 
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 
121  static unsigned int n_dofs_per_elem(const unsigned int dim,
122  const FEType& fe_t,
123  const ElemType t);
124 
132  static void dofs_on_side(const Elem* const elem,
133  const unsigned int dim,
134  const FEType& fe_t,
135  unsigned int s,
136  std::vector<unsigned int>& di);
137 
145  static void dofs_on_edge(const Elem* const elem,
146  const unsigned int dim,
147  const FEType& fe_t,
148  unsigned int e,
149  std::vector<unsigned int>& di);
150 
162  static void nodal_soln(const unsigned int dim,
163  const FEType& fe_t,
164  const Elem* elem,
165  const std::vector<Number>& elem_soln,
166  std::vector<Number>& nodal_soln);
167 
172  static Point map(unsigned int dim,
173  const FEType& fe_t,
174  const Elem* elem,
175  const Point& p);
176 
186  static Point inverse_map (const unsigned int dim,
187  const FEType& fe_t,
188  const Elem* elem,
189  const Point& p,
190  const Real tolerance = TOLERANCE,
191  const bool secure = true);
192 
204  static void inverse_map (const unsigned int dim,
205  const FEType& fe_t,
206  const Elem* elem,
207  const std::vector<Point>& physical_points,
208  std::vector<Point>& reference_points,
209  const Real tolerance = TOLERANCE,
210  const bool secure = true);
211 
220  static bool on_reference_element(const Point& p,
221  const ElemType t,
222  const Real eps=TOLERANCE);
231  static Real shape(const unsigned int dim,
232  const FEType& fe_t,
233  const ElemType t,
234  const unsigned int i,
235  const Point& p);
236 
245  static Real shape(const unsigned int dim,
246  const FEType& fe_t,
247  const Elem* elem,
248  const unsigned int i,
249  const Point& p);
250 
259  template< typename OutputType>
260  static void shape(const unsigned int dim,
261  const FEType& fe_t,
262  const ElemType t,
263  const unsigned int i,
264  const Point& p,
265  OutputType& phi);
266 
275  template< typename OutputType>
276  static void shape(const unsigned int dim,
277  const FEType& fe_t,
278  const Elem* elem,
279  const unsigned int i,
280  const Point& p,
281  OutputType& phi);
282 
292  static void compute_data(const unsigned int dim,
293  const FEType& fe_t,
294  const Elem* elem,
296 
297 #ifdef LIBMESH_ENABLE_AMR
298 
303  static void compute_constraints (DofConstraints &constraints,
304  DofMap &dof_map,
305  const unsigned int variable_number,
306  const Elem* elem);
307 #endif // #ifdef LIBMESH_ENABLE_AMR
308 
309 #ifdef LIBMESH_ENABLE_PERIODIC
310 
315  static void compute_periodic_constraints (DofConstraints &constraints,
316  DofMap &dof_map,
317  const PeriodicBoundaries &boundaries,
318  const MeshBase &mesh,
319  const PointLocatorBase* point_locator,
320  const unsigned int variable_number,
321  const Elem* elem);
322 #endif // #ifdef LIBMESH_ENABLE_PERIODIC
323 
328  static unsigned int max_order (const FEType& fe_t,
329  const ElemType& el_t);
330 
335  static bool extra_hanging_dofs (const FEType& fe_t);
336 
341  static FEFieldType field_type( const FEType& fe_type );
342 
347  static FEFieldType field_type( const FEFamily& fe_family );
348 
353  static unsigned int n_vec_dim( const MeshBase& mesh, const FEType& fe_type );
354 
355 private:
356 
357 
364  static bool is_InfFE_elem(const ElemType et);
365 
366 
367 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
368 
369  // ------------------------------------------------------------
370  /*
371  * All these private members do the same as their public
372  * counterparts, but for infinite elements. This dis-entangles
373  * the calls to \p FE and \p InfFE.
374  */
375 
376  static unsigned int ifem_n_shape_functions(const unsigned int dim,
377  const FEType& fe_t,
378  const ElemType t);
379 
380  static unsigned int ifem_n_dofs(const unsigned int dim,
381  const FEType& fe_t,
382  const ElemType t);
383 
384  static unsigned int ifem_n_dofs_at_node(const unsigned int dim,
385  const FEType& fe_t,
386  const ElemType t,
387  const unsigned int n);
388 
389  static unsigned int ifem_n_dofs_per_elem(const unsigned int dim,
390  const FEType& fe_t,
391  const ElemType t);
392 
393  static void ifem_nodal_soln(const unsigned int dim,
394  const FEType& fe_t,
395  const Elem* elem,
396  const std::vector<Number>& elem_soln,
397  std::vector<Number>& nodal_soln);
398 
399  static Point ifem_inverse_map (const unsigned int dim,
400  const FEType& fe_t,
401  const Elem* elem,
402  const Point& p,
403  const Real tolerance = TOLERANCE,
404  const bool secure = true);
405 
406  static void ifem_inverse_map (const unsigned int dim,
407  const FEType& fe_t,
408  const Elem* elem,
409  const std::vector<Point>& physical_points,
410  std::vector<Point>& reference_points,
411  const Real tolerance = TOLERANCE,
412  const bool secure = true);
413 
414 
415  static bool ifem_on_reference_element(const Point& p,
416  const ElemType t,
417  const Real eps);
418 
419  static Real ifem_shape(const unsigned int dim,
420  const FEType& fe_t,
421  const ElemType t,
422  const unsigned int i,
423  const Point& p);
424 
425  static Real ifem_shape(const unsigned int dim,
426  const FEType& fe_t,
427  const Elem* elem,
428  const unsigned int i,
429  const Point& p);
430 
431  static void ifem_compute_data(const unsigned int dim,
432  const FEType& fe_t,
433  const Elem* elem,
435 
436 #endif
437 
438 
439 };
440 
441 
442 
443 
444 
445 // ------------------------------------------------------------
446 // FEInterface class inline members
447 #ifndef LIBMESH_ENABLE_INFINITE_ELEMENTS
448 
450 {
451  return false;
452 }
453 
454 #else
455 
456 inline bool FEInterface::is_InfFE_elem(const ElemType et)
457 {
458 
459  switch (et)
460  {
461  case INFEDGE2:
462  case INFQUAD4:
463  case INFQUAD6:
464  case INFHEX8:
465  case INFHEX16:
466  case INFHEX18:
467  case INFPRISM6:
468  case INFPRISM12:
469  {
470  return true;
471  }
472 
473  default:
474  {
475  return false;
476  }
477  }
478 }
479 
480 #endif //ifndef LIBMESH_ENABLE_INFINITE_ELEMENTS
481 
482 
483 
484 } // namespace libMesh
485 
486 
487 
488 
489 #endif // LIBMESH_FE_INTERFACE_H

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

Hosted By:
SourceForge.net Logo