inf_fe.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_INF_FE_H
21 #define LIBMESH_INF_FE_H
22 
23 #include "libmesh/libmesh_config.h"
24 
25 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
26 
27 // Local includes
28 #include "libmesh/fe_base.h"
29 
30 // C++ includes
31 #include <cstddef>
32 
33 namespace libMesh
34 {
35 
36 
37 // forward declarations
38 class Elem;
39 class FEComputeData;
40 
41 
42 
74 //-------------------------------------------------------------
75 // InfFE class definition
76 template <unsigned int Dim, FEFamily T_radial, InfMapType T_map>
77 class InfFE : public FEBase
78 {
79 
80 /*
81  * Protect the nested class
82  */
83 protected:
84 
95  //-------------------------------------------------------------
96  // InfFE::Radial class definition
97  class Radial
98  {
99  private:
100 
104  Radial() {}
105 
106  public:
107 
112  static Real decay (const Real v);
113 
118  static Real decay_deriv (const Real) { return -.5; }
119 
124  static Real D (const Real v) { return (1.-v)*(1.-v)/4.; }
125 
129  static Real D_deriv (const Real v) { return (v-1.)/2.; }
130 
135  static Order mapping_order() { return FIRST; }
136 
149  static unsigned int n_dofs (const Order o_radial)
150  { return static_cast<unsigned int>(o_radial)+1; }
151 
161  static unsigned int n_dofs_at_node (const Order o_radial,
162  const unsigned int n_onion);
163 
171  static unsigned int n_dofs_per_elem (const Order o_radial)
172  { return static_cast<unsigned int>(o_radial)+1; }
173 
174  };
175 
176 
177 
186  //-------------------------------------------------------------
187  // InfFE::Base class definition
188  class Base
189  {
190  private:
191 
195  Base() {}
196 
197  public:
198 
204  static Elem* build_elem (const Elem* inf_elem);
205 
211  static ElemType get_elem_type (const ElemType type);
212 
218  static unsigned int n_base_mapping_sf (const ElemType base_elem_type,
219  const Order base_mapping_order);
220 
221  };
222 
223 
224 
225 
226 
227 
228 
229 public:
230 
231  //-------------------------------------------------------------
232  // InfFE continued
233 
247  explicit
248  InfFE(const FEType& fet);
249 
253  ~InfFE();
254 
255 
256 
257 
258 
259  //-------------------------------------------------------------
260  // The static public members for access from FEInterface etc
272  static Real shape(const FEType& fet,
273  const ElemType t,
274  const unsigned int i,
275  const Point& p);
276 
288  static Real shape(const FEType& fet,
289  const Elem* elem,
290  const unsigned int i,
291  const Point& p);
292 
302  static void compute_data(const FEType& fe_t,
303  const Elem* inf_elem,
305 
310  static unsigned int n_shape_functions (const FEType& fet,
311  const ElemType t)
312  { return n_dofs(fet, t); }
313 
319  static unsigned int n_dofs(const FEType& fet,
320  const ElemType inf_elem_type);
321 
326  static unsigned int n_dofs_at_node(const FEType& fet,
327  const ElemType inf_elem_type,
328  const unsigned int n);
329 
334  static unsigned int n_dofs_per_elem(const FEType& fet,
335  const ElemType inf_elem_type);
336 
340  virtual FEContinuity get_continuity() const
341  { return C_ZERO; } // FIXME - is this true??
342 
347  virtual bool is_hierarchic() const
348  { return false; } // FIXME - Inf FEs don't handle p elevation yet
349 
357  static void nodal_soln(const FEType& fet,
358  const Elem* elem,
359  const std::vector<Number>& elem_soln,
360  std::vector<Number>& nodal_soln);
361 
377  static Point inverse_map (const Elem* elem,
378  const Point& p,
379  const Real tolerance = TOLERANCE,
380  const bool secure = true,
381  const bool interpolated = true);
382 
383 
390  static void inverse_map (const Elem* elem,
391  const std::vector<Point>& physical_points,
392  std::vector<Point>& reference_points,
393  const Real tolerance = TOLERANCE,
394  const bool secure = true);
395 
396 
397  //-------------------------------------------------------------
398  // The work-horses of InfFE. These are often used during matrix assembly
405  virtual void reinit (const Elem* elem,
406  const std::vector<Point>* const pts = NULL,
407  const std::vector<Real>* const weights = NULL);
408 
414  virtual void reinit (const Elem* elem,
415  const unsigned int side,
416  const Real tolerance = TOLERANCE,
417  const std::vector<Point>* const pts = NULL,
418  const std::vector<Real>* const weights = NULL);
419 
425  virtual void edge_reinit (const Elem* elem,
426  const unsigned int edge,
427  const Real tolerance = TOLERANCE,
428  const std::vector<Point>* const pts = NULL,
429  const std::vector<Real>* const weights = NULL);
430 
435  virtual void side_map (const Elem* /* elem */,
436  const Elem* /* side */,
437  const unsigned int /* s */,
438  const std::vector<Point>& /* reference_side_points */,
439  std::vector<Point>& /* reference_points */)
440  {
441  libmesh_not_implemented();
442  }
443 
455  virtual void attach_quadrature_rule (QBase* q);
456 
461  virtual unsigned int n_shape_functions () const
462  { return _n_total_approx_sf; }
463 
469  virtual unsigned int n_quadrature_points () const
471 
472 
473 protected:
474 
475  //-------------------------------------------------------------
476  // static members used by the "work-horses"
477 
494  static Real eval(Real v,
495  Order o_radial,
496  unsigned int i);
497 
503  static Real eval_deriv(Real v,
504  Order o_radial,
505  unsigned int i);
506 
507 
508 
509  //-------------------------------------------------------------
510  // Non-static members used by the "work-horses"
515  void update_base_elem (const Elem* inf_elem);
516 
520  virtual void init_base_shape_functions(const std::vector<Point>&,
521  const Elem*)
522  { libmesh_error(); }
523 
529  void init_radial_shape_functions(const Elem* inf_elem);
530 
537  void init_shape_functions(const Elem* inf_elem);
538 
543  void init_face_shape_functions (const std::vector<Point>& qp,
544  const Elem* side);
545 
554  void combine_base_radial(const Elem* inf_elem);
555 
567  virtual void compute_shape_functions(const Elem*, const std::vector<Point>&);
568 
569 
570 
571  //-------------------------------------------------------------
572  // Miscellaneous static members
573 
578  static Point map (const Elem* inf_elem,
579  const Point& reference_point);
580 
587  static void compute_node_indices (const ElemType inf_elem_type,
588  const unsigned int outer_node_index,
589  unsigned int& base_node,
590  unsigned int& radial_node);
591 
600  static void compute_node_indices_fast (const ElemType inf_elem_type,
601  const unsigned int outer_node_index,
602  unsigned int& base_node,
603  unsigned int& radial_node);
604 
611  static void compute_shape_indices (const FEType& fet,
612  const ElemType inf_elem_type,
613  const unsigned int i,
614  unsigned int& base_shape,
615  unsigned int& radial_shape);
616 
617  //--------------------------------------------------------------
618  // protected members, which are not to be accessed from outside
622  std::vector<Real> dist;
623 
630  std::vector<Real> dweightdv;
631 
638  std::vector<Real> som;
643  std::vector<Real> dsomdv;
644 
649  std::vector<std::vector<Real> > mode;
650 
655  std::vector<std::vector<Real> > dmodedv;
656 
660  std::vector<std::vector<Real> > radial_map;
661 
662 
666  std::vector<std::vector<Real> > dradialdv_map;
667 
673  std::vector<Real> dphasedxi;
674 
680  std::vector<Real> dphasedeta;
681 
687  std::vector<Real> dphasedzeta;
688 
689 
690 
691 
692  //--------------------------------------------------------------
693  // numbering scheme maps
694 
703  std::vector<unsigned int> _radial_node_index;
704 
713  std::vector<unsigned int> _base_node_index;
714 
723  std::vector<unsigned int> _radial_shape_index;
724 
733  std::vector<unsigned int> _base_shape_index;
734 
735 
736 
737 
738  //--------------------------------------------------------------
739  // some more protected members
740 
745  unsigned int _n_total_approx_sf;
746 
751  unsigned int _n_total_qp;
752 
757  std::vector<Real> _total_qrule_weights;
758 
764 
770 
776 
784 
793 
794 
795 private:
796 
800  virtual bool shapes_need_reinit() const;
801 
810 
811 
812 #ifdef DEBUG
813 
818  static bool _warned_for_shape;
819 
820 #endif
821 
827  template <unsigned int friend_Dim, FEFamily friend_T_radial, InfMapType friend_T_map>
828  friend class InfFE;
829 
830 };
831 
832 
833 
834 
835 // ------------------------------------------------------------
836 // InfFE class inline members
837 
838 
839 
840 
841 // ------------------------------------------------------------
842 // InfFE::Radial class inline members
843 
844 template <unsigned int Dim, FEFamily T_radial, InfMapType T_map>
845 inline
847 {
848  switch (Dim)
849  //TODO:[DD] What decay do i have in 2D and 1D?
850  {
851  case 3:
852  return (1.-v)/2.;
853 
854  case 2:
855  return 0.;
856 
857  case 1:
858  return 0.;
859 
860  default:
861  libmesh_error();
862  return 0.;
863  }
864 }
865 
866 
867 
868 // ------------------------------------------------------------
869 // InfFE::Base class inline members
870 
871 
872 } // namespace libMesh
873 
874 
875 #endif // ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
876 
877 
878 #endif // LIBMESH_INF_FE_H

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

Hosted By:
SourceForge.net Logo