GetFEM++  5.3
getfem_fem.h
Go to the documentation of this file.
1 /* -*- c++ -*- (enables emacs c++ mode) */
2 /*===========================================================================
3 
4  Copyright (C) 1999-2017 Yves Renard
5 
6  This file is a part of GetFEM++
7 
8  GetFEM++ is free software; you can redistribute it and/or modify it
9  under the terms of the GNU Lesser General Public License as published
10  by the Free Software Foundation; either version 3 of the License, or
11  (at your option) any later version along with the GCC Runtime Library
12  Exception either version 3.1 or (at your option) any later version.
13  This program is distributed in the hope that it will be useful, but
14  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15  or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
16  License and GCC Runtime Library Exception for more details.
17  You should have received a copy of the GNU Lesser General Public License
18  along with this program; if not, write to the Free Software Foundation,
19  Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
20 
21  As a special exception, you may use this file as it is a part of a free
22  software library without restriction. Specifically, if other files
23  instantiate templates or use macros or inline functions from this file,
24  or you compile this file and link it with other files to produce an
25  executable, this file does not by itself cause the resulting executable
26  to be covered by the GNU Lesser General Public License. This exception
27  does not however invalidate any other reasons why the executable file
28  might be covered by the GNU Lesser General Public License.
29 
30 ===========================================================================*/
31 
32 /**@file getfem_fem.h
33  @author Yves Renard <Yves.Renard@insa-lyon.fr>
34  @date December 21, 1999.
35  @brief Definition of the finite element methods.
36 
37  This file defines the getfem::virtual_fem class, which is the common
38  base class of all FEM.
39 
40  @section fem_list List of FEM known by getfem::fem_descriptor :
41 
42  - "FEM_PK(N,K)" : classical Lagrange element PK on a simplex.
43 
44  - "FEM_PK_DISCONTINUOUS(N,K,alpha)" : discontinuous Lagrange
45  element PK on a simplex.
46 
47  - "FEM_QK(N,K)" : classical Lagrange element QK on a parellepiped.
48 
49  - "FEM_QK_DISCONTINUOUS(N,K,alpha)" : discontinuous Lagrange
50  element QK on a parallelepiped.
51 
52  - "FEM_Q2_INCOMPLETE(N)" : incomplete Q2 elements with 8 and 20 dof
53  (serendipity Quad 8 and Hexa 20 elements)
54 
55  - "FEM_Q2_INCOMPLETE_DISCONTINUOUS(N)" : discontinuous incomplete Q2
56  elements with 8 and 20 dof (serendipity Quad 8 and Hexa 20 elements)
57 
58  - "FEM_PRISM_PK(N,K)" : classical Lagrange element PK on a prism.
59 
60  - "FEM_PRISM_PK_DISCONTINUOUS(N,K,alpha)" : classical discontinuous
61  Lagrange element PK on a prism.
62 
63  - "FEM_PRISM_INCOMPLETE_P2" : Incomplete Lagrange element on a
64  quadratic 3D prism (serendipity, 15-node wedge element). Can be connected
65  toa standard P2 Lagrange on its triangular faces and a Q2_INCOMPLETE
66  Lagrange element on its quadrangular faces.
67 
68  - "FEM_PK_WITH_CUBIC_BUBBLE(N,K)" : classical Lagrange element PK
69  on a simplex with an additional volumic bubble function.
70 
71  - "FEM_PRODUCT(FEM1,FEM2)" : tensorial product of two polynomial
72  elements
73 
74  - "FEM_P1_NONCONFORMING" : Nonconforming P1 method on a
75  triangle.
76 
77  - "FEM_P1_BUBBLE_FACE(N)" : P1 method on a simplex with an
78  additional bubble function on face 0.
79 
80  - "FEM_P1_BUBBLE_FACE_LAG" : P1 method on a simplex with an
81  additional lagrange dof on face 0.
82 
83  - "FEM_HERMITE(N)" : Hermite element P3 on dimension N (1, 2 por 3).
84 
85  - "FEM_ARGYRIS" : Argyris element on the triangle.
86 
87  - "FEM_HCT_TRIANGLE" : Hsieh-Clough-Tocher element on the triangle
88  (composite P3 element which is C^1, 12 dof).
89 
90  - "FEM_REDUCED_HCT_TRIANGLE" : Hsieh-Clough-Tocher element on the triangle
91  (composite P3 element which is C^1, 9 dof).
92 
93  - "FEM_QUADC1_COMPOSITE" : quadrilateral element, composite P3 element
94  and C^1 (16 dof).
95 
96  - "FEM_REDUCED_QUADC1_COMPOSITE" : quadrilateral element, composite
97  P3 element and C^1 (12 dof).
98 
99  - "FEM_PK_HIERARCHICAL(N,K)" : PK element with a hierarchical basis.
100 
101  - "FEM_QK_HIERARCHICAL(N,K)" : QK element with a hierarchical basis.
102 
103  - "FEM_PRISM_PK_HIERARCHICAL(N,K)" : PK element on a prism with a
104  hierarchical basis.
105 
106  - "FEM_STRUCTURED_COMPOSITE(FEM, K)" : Composite fem on a grid with
107  K divisions.
108 
109  - "FEM_PK_HIERARCHICAL_COMPOSITE(N,K,S)" : PK composite element on
110  a grid with S subdivisions and with a hierarchical basis.
111 
112  - "FEM_PK_FULL_HIERARCHICAL_COMPOSITE(N,K,S)" : PK composite
113  element with S subdivisions and a hierarchical basis on both degree
114  and subdivision.
115 
116  - "FEM_PYRAMID_QK(K)" : Lagrange element on a 3D pyramid of degree
117  K=0, 1 or 2. Can be connected to a standard P1/P2 Lagrange element on its
118  triangular faces and a standard Q1/Q2 Lagrange element on its quadrangular
119  face.
120 
121  - "FEM_PYRAMID_QK_DISCONTINUOUS(K)" : Discontinuous Lagrange element
122  on a 3D pyramid of degree K = 0, 1 or 2.
123 
124  - "FEM_PYRAMID_Q2_INCOMPLETE" : Incomplete Lagrange element on a
125  quadratic 3D pyramid (serendipity, 13-node element). Can be connected to
126  a standard P2 Lagrange element on its triangular faces and a Q2_INCOMPLETE
127  Lagrange element on its quadrangular face.
128 
129 */
130 
131 #ifndef GETFEM_FEM_H__
132 #define GETFEM_FEM_H__
133 
135 #include "bgeot_geometric_trans.h"
136 #include "bgeot_poly_composite.h"
137 #include "getfem_integration.h"
138 #include "dal_naming_system.h"
139 #include <deque>
140 
141 namespace getfem {
142 
143  /** @defgroup dofdescr Dof description
144  * This set of functions gives a pointer to dof descriptions and
145  * tests the compatibility between two dof descriptions.
146  * A dof description describes a type of dof (Lagrange type,
147  * Hermite type ...) in order to be able to say wether two dofs are
148  * to be identified or not. The construction of dof type with
149  * the tensorial product is taken into
150  * account, making the dof_description structure a little bit complex
151  * (this structure will probably evoluate in the future).
152  * @{
153  */
154 
155  struct dof_description;
156 
157  /// Type representing a pointer on a dof_description
158  typedef dof_description *pdof_description;
159 
160  /** @brief Description of a unique dof of lagrange type (value at the node).
161  * @param d the dimension of the reference element (2 for triangles, 3 for tetrahedrons ...)
162  */
163  pdof_description lagrange_dof(dim_type d);
164 
165  /** Description of a unique dof of derivative type.
166  * (a derivative at the node).
167  * @param d the dimension of the reference element.
168  * @param r corresponds to the variable number for which the derivative is taken (0 <= r < d)
169  */
170  pdof_description derivative_dof(dim_type d, dim_type r);
171 
172  /** Description of a unique dof of second derivative type.
173  * @param d the dimension of the reference element.
174  * @param num_der1 corresponds to the variable number for which the first derivative is taken (0 <= r < d)
175  * @param num_der2 corresponds to the variable number for which the second derivative is taken (0 <= r < d)
176  */
177  pdof_description second_derivative_dof(dim_type d,
178  dim_type num_der1,
179  dim_type num_der2);
180 
181  /** Description of a unique dof of normal derivative type
182  * (normal derivative at the node, regarding a face).
183  * @param d the dimension of the reference element.
184  */
185  pdof_description normal_derivative_dof(dim_type d);
186 
187  /** Description of a unique dof of mean value type.
188  * @param d the dimension of the reference element.
189  */
190  pdof_description mean_value_dof(dim_type d);
191 
192  pdof_description bubble1_dof(dim_type ct);
193 
194  /** Description of a global dof, i.e. a numbered dof having a global scope.
195  * @param d the dimension of the reference element.
196  */
197  pdof_description global_dof(dim_type d);
198 
199  /// Product description of the descriptions *pnd1 and *pnd2.
200  pdof_description product_dof(pdof_description pnd1, pdof_description pnd2);
201 
202  pdof_description to_coord_dof(pdof_description p, dim_type ct);
203 
204  /// Description of a special dof for Xfem
205  pdof_description xfem_dof(pdof_description p, size_type ind);
206 
207  /// Returns the xfem_index of dof (0 for normal dof)
208  size_type dof_xfem_index(pdof_description);
209 
210  size_type reserve_xfem_index();
211  dim_type coord_index_of_dof(pdof_description a);
212 
213  int dof_weak_compatibility(pdof_description a, pdof_description b);
214 
215  /** Gives a total order on the dof description compatible with the
216  * identification.
217  */
218  int dof_description_compare(pdof_description a, pdof_description b);
219 
220  /// Says if the dof is linkable.
221  bool dof_linkable(pdof_description);
222 
223  /// Says if the two dofs can be identified.
224  bool dof_compatibility(pdof_description, pdof_description);
225 
226 
227  /* @} */
228 
229  /* ******************************************************************** */
230  /* Classes for description of a finite element. */
231  /* ******************************************************************** */
232 
233  /** @defgroup pfem Finite element description
234  *
235  * @{
236  */
237 
238 
239  class virtual_fem;
240 
241  /** type of pointer on a fem description @see getfem::virtual_fem */
242  typedef std::shared_ptr<const getfem::virtual_fem> pfem;
243 
244  class fem_precomp_;
245  typedef std::shared_ptr<const getfem::fem_precomp_> pfem_precomp;
246 
248 
249  /** @brief Base class for finite element description */
250  class virtual_fem : virtual public dal::static_stored_object,
251  public std::enable_shared_from_this<const virtual_fem> {
252  public :
253  enum vec_type { VECTORIAL_NOTRANSFORM_TYPE, VECTORIAL_PRIMAL_TYPE,
254  VECTORIAL_DUAL_TYPE };
255 
256  protected :
257 
258  mutable std::vector<pdof_description> dof_types_;
259  /* this convex structure is "owned" by the virtual_fem
260  (a deep copy is made when virtual_fems are copied)
261  But cvs_node has to be a pointer, as bgeot::convex_structure
262  inherits from dal::static_stored_object
263  */
264  std::shared_ptr<bgeot::convex_structure> cvs_node;
265  std::vector<std::vector<short_type>> face_tab; // face list for each dof
266  bgeot::convex<base_node> cv_node;
267  mutable bgeot::pstored_point_tab pspt;
268  mutable bool pspt_valid;
269  bgeot::pconvex_ref cvr; // reference element.
270  dim_type ntarget_dim; // dimension of the target space
271  mutable dim_type dim_; // dimension of the reference element
272  bool is_equiv; // true if the FEM is equivalent
273  bool is_lag; // true if the FEM is of Lagrange type
274  bool is_pol; // true if the FEM is polynomial
275  bool is_polycomp; // true if the FEM is polynomial composite
276  bool real_element_defined;
277  bool is_standard_fem; // is_equiv && !real_element_defined && scalar
278  short_type es_degree; // estimated polynomial degree of the FEM
279  short_type hier_raff; // hierarchical refinement of the FEM
280  vec_type vtype; // for vectorial elements, type of transformation
281  // from the reference element.
282  std::string debug_name_;
283 
284  public :
285  /** Number of degrees of freedom.
286 
287  @param cv the convex number for this FEM. This information is
288  rarely used, but is needed by some "special" FEMs, such as
289  getfem::interpolated_fem.
290  */
291  virtual size_type nb_dof(size_type /*cv*/) const
292  { return dof_types_.size(); }
293  /// Number of basis functions.
294  virtual size_type nb_base(size_type cv) const
295  { return nb_dof(cv); }
296  /// Number of components (nb_dof() * dimension of the target space).
298  { return nb_base(cv) * ntarget_dim; }
299  size_type nb_components(size_type cv) const
300  { return nb_dof(cv) * ntarget_dim; }
301  /// Get the array of pointer on dof description.
302  const std::vector<pdof_description> &dof_types() const
303  { return dof_types_; }
304  short_type hierarchical_raff() const { return hier_raff; }
305  /// dimension of the reference element.
306  dim_type dim() const { return dim_; }
307  dim_type &dim() { return dim_; }
308  /// dimension of the target space.
309  dim_type target_dim() const { return ntarget_dim; }
310  /// Type of vectorial element.
311  vec_type vectorial_type() const { return vtype; }
312  /// Return the convex of the reference element.
313  virtual bgeot::pconvex_ref ref_convex(size_type) const { return cvr; }
314  /// @internal
315  bgeot::pconvex_ref &mref_convex() { return cvr; }
316  /// Gives the convex of the reference element.
318  { return ref_convex(cv)->structure(); }
319  /// Gives the convex representing the nodes on the reference element.
321  { return cv_node; }
322  /// Gives the convex structure of the reference element nodes.
324  { return node_convex(cv).structure(); }
325  const std::string &debug_name() const { return debug_name_; }
326  std::string &debug_name() { return debug_name_; }
327  virtual bgeot::pstored_point_tab node_tab(size_type) const {
328  if (!pspt_valid) {
329  pspt = bgeot::store_point_tab(cv_node.points());
330  pspt_valid = true;
331  }
332  return pspt;
333  }
334  /** Gives the node corresponding to the dof i.
335  @param cv the convex number for this FEM. This information is
336  rarely used, by is needed by some "special" FEMs, such as
337  getfem::interpolated_fem.
338  @param i the local dof number (<tt>i < nb_dof(cv)</tt>)
339  */
340  const base_node &node_of_dof(size_type cv, size_type i) const
341  { return (*(node_tab(cv)))[i];}
342  virtual const std::vector<short_type> &
343  faces_of_dof(size_type /*cv*/, size_type i) const;
344  bool is_on_real_element() const { return real_element_defined; }
345  bool is_equivalent() const { return is_equiv; }
346  bool need_G() const
347  { return !(is_equivalent()) || real_element_defined; }
348  /// true if the base functions are such that @f$ \varphi_i(\textrm{node\_of\_dof(j)}) = \delta_{ij} @f$
349  bool is_lagrange() const { return is_lag; }
350  /// true if the base functions are polynomials
351  bool is_polynomial() const { return is_pol; }
352  bool is_polynomialcomp() const { return is_polycomp; }
353  bool is_standard() const { return is_standard_fem; }
354  bool &is_polynomialcomp() { return is_polycomp; }
355  bool &is_equivalent() { return is_equiv; }
356  bool &is_lagrange() { return is_lag; }
357  bool &is_polynomial() { return is_pol; }
358  bool &is_standard() { return is_standard_fem; }
359  short_type estimated_degree() const { return es_degree; }
360  short_type &estimated_degree() { return es_degree; }
361 
362  virtual void mat_trans(base_matrix &, const base_matrix &,
364  { GMM_ASSERT1(false, "This function should not be called."); }
365  /** Interpolate at an arbitrary point x given on the reference
366  element.
367 
368  @param c the fem_interpolation_context, should have been
369  suitably initialized for the point of evaluation.
370 
371  @param coeff is the vector of coefficient relatively to
372  the base functions, its length should be @c Qdim*this->nb_dof().
373 
374  @param val contains the interpolated value, on output (its
375  size should be @c Qdim*this->target_dim()).
376 
377  @param Qdim is the optional Q dimension, if the FEM is
378  considered as a "vectorized" one.
379  */
380  template<typename CVEC, typename VVEC>
382  const CVEC& coeff, VVEC &val, dim_type Qdim) const;
383 
384  /** Build the interpolation matrix for the interpolation at a
385  fixed point x, given on the reference element.
386 
387  The matrix @c M is filled, such that for a given @c coeff
388  vector, the interpolation is given by @c M*coeff.
389  */
390  template <typename MAT>
392  MAT &M, dim_type Qdim) const;
393 
394  /** Interpolation of the gradient. The output is stored in the @f$
395  Q\times N@f$ matrix @c val.
396  */
397  template<typename CVEC, typename VMAT>
399  const CVEC& coeff, VMAT &val,
400  dim_type Qdim=1) const;
401 
402  /** Interpolation of the hessian. The output is stored in the @f$
403  Q\times (N^2)@f$ matrix @c val.
404  */
405  template<typename CVEC, typename VMAT>
407  const CVEC& coeff, VMAT &val,
408  dim_type Qdim) const;
409 
410  /** Interpolation of the divergence. The output is stored in the
411  scalar @c val.
412  */
413  template<typename CVEC>
415  (const fem_interpolation_context& c, const CVEC& coeff,
416  typename gmm::linalg_traits<CVEC>::value_type &val) const;
417 
418  /** Give the value of all components of the base functions at the
419  * point x of the reference element. Basic function used essentially
420  * by fem_precomp.
421  */
422  virtual void base_value(const base_node &x, base_tensor &t) const = 0;
423 
424  /** Give the value of all gradients (on ref. element) of the components
425  * of the base functions at the point x of the reference element.
426  * Basic function used essentially by fem_precomp.
427  */
428  virtual void grad_base_value(const base_node &x, base_tensor &t) const = 0;
429 
430  /** Give the value of all hessians (on ref. element) of the components
431  * of the base functions at the point x of the reference element.
432  * Basic function used essentially by fem_precomp.
433  */
434  virtual void hess_base_value(const base_node &x, base_tensor &t) const = 0;
435 
436  /** Give the value of all components of the base functions at the
437  current point of the fem_interpolation_context. Used by
438  elementary computations. if withM is false the matrix M for
439  non tau-equivalent elements is not taken into account.
440  */
441  virtual void real_base_value(const fem_interpolation_context &c,
442  base_tensor &t, bool withM = true) const;
443 
444  /** Give the gradient of all components of the base functions at the
445  current point of the fem_interpolation_context. Used by
446  elementary computations. if withM is false the matrix M for
447  non tau-equivalent elements is not taken into account.
448  */
449  virtual void real_grad_base_value(const fem_interpolation_context &c,
450  base_tensor &t, bool withM = true) const;
451 
452  /** Give the hessian of all components of the base functions at the
453  current point of the fem_interpolation_context. Used by
454  elementary computations. if withM is false the matrix M for
455  non tau-equivalent elements is not taken into account.
456  */
457  virtual void real_hess_base_value(const fem_interpolation_context &c,
458  base_tensor &t, bool withM = true) const;
459 
460  virtual size_type index_of_global_dof(size_type, size_type) const
461  { GMM_ASSERT1(false, "internal error."); }
462 
463  /** internal function adding a node to an element for the creation
464  * of a finite element method. Important : the faces should be the faces
465  * on which the corresponding base function is non zero.
466  */
467  void add_node(const pdof_description &d, const base_node &pt,
468  const dal::bit_vector &faces);
469  void add_node(const pdof_description &d, const base_node &pt);
470  void init_cvs_node();
471  void unfreeze_cvs_node();
472 
473  virtual_fem &operator =(const virtual_fem &f) {
474  copy(f); return *this;
475  }
476 
477  virtual_fem() {
478  DAL_STORED_OBJECT_DEBUG_CREATED(this, "Fem");
479  ntarget_dim = 1; dim_ = 1;
480  is_equiv = is_pol = is_polycomp = is_lag = is_standard_fem = false;
481  pspt_valid = false; hier_raff = 0; real_element_defined = false;
482  es_degree = 5;
483  vtype = VECTORIAL_NOTRANSFORM_TYPE;
484  cvs_node = bgeot::new_convex_structure();
485  }
486  virtual_fem(const virtual_fem& f)
488  std::enable_shared_from_this<const virtual_fem>()
489  { copy(f); DAL_STORED_OBJECT_DEBUG_CREATED(this, "Fem"); }
490  virtual ~virtual_fem() { DAL_STORED_OBJECT_DEBUG_DESTROYED(this, "Fem"); }
491  private:
492  void copy(const virtual_fem &f);
493  };
494 
495  /**
496  virtual_fem implementation as a vector of generic functions. The
497  class FUNC should provide "derivative" and "eval" member
498  functions (this is the case for bgeot::polynomial<T>).
499  */
500  template <class FUNC> class fem : public virtual_fem {
501  protected :
502  std::vector<FUNC> base_;
503  mutable std::vector<std::vector<FUNC>> grad_, hess_;
504  mutable bool grad_computed_;
505  mutable bool hess_computed_;
506 
507  void compute_grad_() const {
508  auto guard = getfem::omp_guard{};
509  if (grad_computed_) return;
511  dim_type n = dim();
512  grad_.resize(R);
513  for (size_type i = 0; i < R; ++i) {
514  grad_[i].resize(n);
515  for (dim_type j = 0; j < n; ++j) {
516  grad_[i][j] = base_[i]; grad_[i][j].derivative(j);
517  }
518  }
519  grad_computed_ = true;
520  }
521 
522  void compute_hess_() const {
523  auto guard = getfem::omp_guard{};
524  if (hess_computed_) return;
526  dim_type n = dim();
527  hess_.resize(R);
528  for (size_type i = 0; i < R; ++i) {
529  hess_[i].resize(n*n);
530  for (dim_type j = 0; j < n; ++j) {
531  for (dim_type k = 0; k < n; ++k) {
532  hess_[i][j+k*n] = base_[i];
533  hess_[i][j+k*n].derivative(j); hess_[i][j+k*n].derivative(k);
534  }
535  }
536  }
537  hess_computed_ = true;
538  }
539 
540  public :
541 
542  /// Gives the array of basic functions (components).
543  const std::vector<FUNC> &base() const { return base_; }
544  std::vector<FUNC> &base() { return base_; }
545  /** Evaluates at point x, all base functions and returns the result in
546  t(nb_base,target_dim) */
547  void base_value(const base_node &x, base_tensor &t) const {
548  bgeot::multi_index mi(2);
549  mi[1] = target_dim(); mi[0] = short_type(nb_base(0));
550  t.adjust_sizes(mi);
552  base_tensor::iterator it = t.begin();
553  for (size_type i = 0; i < R; ++i, ++it)
554  *it = bgeot::to_scalar(base_[i].eval(x.begin()));
555  }
556  /** Evaluates at point x, the gradient of all base functions w.r.t. the
557  reference element directions 0,..,dim-1 and returns the result in
558  t(nb_base,target_dim,dim) */
559  void grad_base_value(const base_node &x, base_tensor &t) const {
560  if (!grad_computed_) compute_grad_();
561  bgeot::multi_index mi(3);
562  dim_type n = dim();
563  mi[2] = n; mi[1] = target_dim(); mi[0] = short_type(nb_base(0));
564  t.adjust_sizes(mi);
566  base_tensor::iterator it = t.begin();
567  for (dim_type j = 0; j < n; ++j)
568  for (size_type i = 0; i < R; ++i, ++it)
569  *it = bgeot::to_scalar(grad_[i][j].eval(x.begin()));
570  }
571  /** Evaluates at point x, the hessian of all base functions w.r.t. the
572  reference element directions 0,..,dim-1 and returns the result in
573  t(nb_base,target_dim,dim,dim) */
574  void hess_base_value(const base_node &x, base_tensor &t) const {
575  if (!hess_computed_) compute_hess_();
576  bgeot::multi_index mi(4);
577  dim_type n = dim();
578  mi[3] = n; mi[2] = n; mi[1] = target_dim();
579  mi[0] = short_type(nb_base(0));
580  t.adjust_sizes(mi);
582  base_tensor::iterator it = t.begin();
583  for (dim_type k = 0; k < n; ++k)
584  for (dim_type j = 0; j < n; ++j)
585  for (size_type i = 0; i < R; ++i, ++it)
586  *it = bgeot::to_scalar(hess_[i][j+k*n].eval(x.begin()));
587  }
588 
589  fem() : grad_computed_(false), hess_computed_(false){}
590 
591  };
592 
593  /** Classical polynomial FEM. */
595  /** Polynomial composite FEM */
597  /** Rational fration FEM */
599 
600  /** Give a pointer on the structures describing the classical
601  polynomial fem of degree k on a given convex type.
602 
603  @param pgt the geometric transformation (which defines the convex type).
604  @param k the degree of the fem.
605  @param complete a flag which requests complete Langrange polynomial
606  elements even if the provided pgt is an incomplete one (e.g. 8-node
607  quadrilateral or 20-node hexahedral).
608  @return a ppolyfem.
609  */
611  bool complete=false);
612 
613  /** Give a pointer on the structures describing the classical
614  polynomial discontinuous fem of degree k on a given convex type.
615 
616  @param pgt the geometric transformation (which defines the convex type).
617 
618  @param k the degree of the fem.
619 
620  @param alpha the "inset" factor for the dof nodes: with alpha =
621  0, the nodes are located as usual (i.e. with node on the convex border),
622  and for 0 < alpha < 1, they converge to the center of gravity of the convex.
623 
624  @param complete a flag which requests complete Langrange polynomial
625  elements even if the provided pgt is an incomplete one (e.g. 8-node
626  quadrilateral or 20-node hexahedral).
627 
628  @return a ppolyfem.
629  */
631  scalar_type alpha=0, bool complete=false);
632 
633  /** get a fem descriptor from its string name. */
634  pfem fem_descriptor(const std::string &name);
635 
636  /** get the string name of a fem descriptor. */
637  std::string name_of_fem(pfem p);
638 
639  pfem PK_fem(size_type n, short_type k);
640  pfem QK_fem(size_type n, short_type k);
641  pfem PK_prism_fem(size_type n, short_type k);
642 
643  /**
644  Pre-computations on a fem (given a fixed set of points on the
645  reference convex, this object computes the value/gradient/hessian
646  of all base functions on this set of points and stores them.
647  */
648  class fem_precomp_ : virtual public dal::static_stored_object {
649  protected:
650  const pfem pf;
651  const bgeot::pstored_point_tab pspt;
652  mutable std::vector<base_tensor> c; // stored values of base functions
653  mutable std::vector<base_tensor> pc; // stored gradients of base functions
654  mutable std::vector<base_tensor> hpc; // stored hessians of base functions
655  public:
656  /// returns values of the base functions
657  inline const base_tensor &val(size_type i) const
658  { if (c.empty()) init_val(); return c[i]; }
659  /// returns gradients of the base functions
660  inline const base_tensor &grad(size_type i) const
661  { if (pc.empty()) init_grad(); return pc[i]; }
662  /// returns hessians of the base functions
663  inline const base_tensor &hess(size_type i) const
664  { if (hpc.empty()) init_hess(); return hpc[i]; }
665  inline pfem get_pfem() const { return pf; }
666  // inline const bgeot::stored_point_tab& get_point_tab() const
667  // { return *pspt; }
668  inline bgeot::pstored_point_tab get_ppoint_tab() const
669  { return pspt; }
670  fem_precomp_(const pfem, const bgeot::pstored_point_tab);
671  ~fem_precomp_() { DAL_STORED_OBJECT_DEBUG_DESTROYED(this, "Fem_precomp"); }
672  private:
673  void init_val() const;
674  void init_grad() const;
675  void init_hess() const;
676  };
677 
678 
679  /** @brief Handles precomputations for FEM. statically allocates a
680  fem-precomputation object, and returns a pointer to it. The
681  fem_precomp_ objects are "cached", i.e. they are stored in a
682  global pool and if this function is called two times with the
683  same arguments, a pointer to the same object will be returned.
684 
685  @param pf a pointer to the fem object. @param pspt a pointer to
686  a list of points in the reference convex.CAUTION: this array must
687  not be destroyed as long as the fem_precomp is used!!.
688 
689  Moreover pspt is supposed to identify uniquely the set of
690  points. This means that you should NOT alter its content at any
691  time after using this function.
692 
693  If you need a set of "temporary" getfem::fem_precomp_, create
694  them via a getfem::fem_precomp_pool structure. All memory will be
695  freed when this structure will be destroyed. */
696  pfem_precomp fem_precomp(pfem pf, bgeot::pstored_point_tab pspt,
697  dal::pstatic_stored_object dep);
698 
699  /** Request for the removal of a pfem_precomp */
700  inline void delete_fem_precomp(pfem_precomp pfp)
701  { dal::del_stored_object(pfp); }
702 
703 
704  /**
705  handle a pool (i.e. a set) of fem_precomp. The difference with
706  the global fem_precomp function is that these fem_precomp objects
707  are freed when the fem_precomp_pool is destroyed (they can eat
708  much memory). An example of use can be found in the
709  getfem::interpolation_solution functions of getfem_export.h
710  */
712  std::set<pfem_precomp> precomps;
713 
714  public :
715 
716  /** Request a pfem_precomp. If not already in the pool, the
717  pfem_precomp is computed, and added to the pool.
718 
719  @param pf a pointer to the fem object.
720  @param pspt a pointer to a list of points in the reference convex.CAUTION:
721  this array must not be destroyed as long as the fem_precomp is used!!
722 
723  Moreover pspt is supposed to identify uniquely the set of
724  points. This means that you should NOT alter its content until
725  the fem_precomp_pool is destroyed.
726  */
727  pfem_precomp operator()(pfem pf, bgeot::pstored_point_tab pspt) {
728  pfem_precomp p = fem_precomp(pf, pspt, 0);
729  precomps.insert(p);
730  return p;
731  }
732  void clear();
733  ~fem_precomp_pool() { clear(); }
734  };
735 
736 
737  /** structure passed as the argument of fem interpolation
738  functions. This structure can be partially filled (for example
739  the xreal will be computed if needed as long as pgp+ii is known).
740  */
743 
744  mutable base_matrix M_; // optional transformation matrix (for non tau-equivalent fems)
745  pfem pf_; // current fem
746  pfem_precomp pfp_; // optional fem_precomp_ (speed up the computations)
747  size_type convex_num_; // The element (convex) number
748  short_type face_num_; // Face number for boundary integration
749  int xfem_side_; // For the computation of a jump with fem_level_set only
750  public:
751  /// true if a fem_precomp_ has been supplied.
752  bool have_pfp() const { return pfp_ != 0; }
753  /// true if the pfem is available.
754  bool have_pf() const { return pf_ != 0; }
755  /// non tau-equivalent transformation matrix.
756  const base_matrix& M() const;
757  /** fill the tensor with the values of the base functions (taken
758  at point @c this->xref())
759  */
760  void base_value(base_tensor& t, bool withM = true) const;
761  // Optimized function for high level generic assembly
762  void pfp_base_value(base_tensor& t, const pfem_precomp &pfp__);
763  /** fill the tensor with the gradient of the base functions (taken
764  at point @c this->xref())
765  */
766  void grad_base_value(base_tensor& t, bool withM = true) const;
767  // Optimized function for high level generic assembly
768  void pfp_grad_base_value(base_tensor& t, const pfem_precomp &pfp__);
769  /** fill the tensor with the hessian of the base functions (taken
770  at point @c this->xref())
771  */
772  void hess_base_value(base_tensor& t, bool withM = true) const;
773  /** get the current FEM descriptor */
774  const pfem pf() const { return pf_; }
775  /** get the current convex number */
776  size_type convex_num() const;
777  bool is_convex_num_valid() const;
778  void invalid_convex_num() { convex_num_ = size_type(-1); }
779  /** set the current face number */
780  void set_face_num(short_type f) { face_num_ = f; }
781  /** get the current face number */
782  short_type face_num() const;
783  /** On a face ? */
784  bool is_on_face() const;
785  /** get the current fem_precomp_ */
786  pfem_precomp pfp() const { return pfp_; }
787  void set_pfp(pfem_precomp newpfp);
788  void set_pf(pfem newpf);
789  int xfem_side() const { return xfem_side_; }
790  void set_xfem_side(int side) { xfem_side_ = side; }
791  void change(bgeot::pgeotrans_precomp pgp__,
792  pfem_precomp pfp__, size_type ii__,
793  const base_matrix& G__, size_type convex_num__,
794  short_type face_num__ = short_type(-1)) {
795  bgeot::geotrans_interpolation_context::change(pgp__,ii__,G__);
796  convex_num_ = convex_num__; face_num_ = face_num__; xfem_side_ = 0;
797  set_pfp(pfp__);
798  }
799  void change(bgeot::pgeometric_trans pgt__,
800  pfem_precomp pfp__, size_type ii__,
801  const base_matrix& G__, size_type convex_num__,
802  short_type face_num__ = short_type(-1)) {
803  bgeot::geotrans_interpolation_context::change
804  (pgt__, pfp__->get_ppoint_tab(), ii__, G__);
805  convex_num_ = convex_num__; face_num_ = face_num__; xfem_side_ = 0;
806  set_pfp(pfp__);
807  }
808  void change(bgeot::pgeometric_trans pgt__,
809  pfem pf__, const base_node& xref__, const base_matrix& G__,
810  size_type convex_num__, short_type face_num__=short_type(-1)) {
811  bgeot::geotrans_interpolation_context::change(pgt__,xref__,G__);
812  pf_ = pf__; pfp_ = 0; convex_num_ = convex_num__; face_num_ = face_num__;
813  xfem_side_ = 0;
814  }
817  convex_num_(size_type(-1)), face_num_(short_type(-1)), xfem_side_(0) {}
818  fem_interpolation_context(bgeot::pgeotrans_precomp pgp__,
819  pfem_precomp pfp__, size_type ii__,
820  const base_matrix& G__,
821  size_type convex_num__,
822  short_type face_num__ = short_type(-1))
823  : bgeot::geotrans_interpolation_context(pgp__,ii__,G__),
824  convex_num_(convex_num__), face_num_(face_num__), xfem_side_(0)
825  { set_pfp(pfp__); }
827  pfem_precomp pfp__, size_type ii__,
828  const base_matrix& G__,
829  size_type convex_num__,
830  short_type face_num__ = short_type(-1))
831  : bgeot::geotrans_interpolation_context(pgt__,pfp__->get_ppoint_tab(),
832  ii__, G__),
833  convex_num_(convex_num__), face_num_(face_num__), xfem_side_(0)
834  { set_pfp(pfp__); }
836  pfem pf__,
837  const base_node& xref__,
838  const base_matrix& G__,
839  size_type convex_num__,
840  short_type face_num__ = short_type(-1))
841  : bgeot::geotrans_interpolation_context(pgt__,xref__,G__),
842  pf_(pf__), pfp_(0), convex_num_(convex_num__), face_num_(face_num__),
843  xfem_side_(0) {}
844  };
845 
846  // IN : coeff(Qmult,nb_dof)
847  // OUT: val(Qdim), Qdim=target_dim*Qmult
848  // AUX: Z(nb_dof,target_dim)
849  template <typename CVEC, typename VVEC>
851  const CVEC& coeff, VVEC &val,
852  dim_type Qdim) const {
853  size_type Qmult = size_type(Qdim) / target_dim();
854  size_type nbdof = nb_dof(c.convex_num());
855  GMM_ASSERT1(gmm::vect_size(val) == Qdim, "dimensions mismatch");
856  GMM_ASSERT1(gmm::vect_size(coeff) == nbdof*Qmult,
857  "Wrong size for coeff vector");
858 
859  gmm::clear(val);
860  base_tensor Z; real_base_value(c, Z);
861 
862  for (size_type j = 0; j < nbdof; ++j) {
863  for (size_type q = 0; q < Qmult; ++q) {
864  typename gmm::linalg_traits<CVEC>::value_type co = coeff[j*Qmult+q];
865  for (size_type r = 0; r < target_dim(); ++r)
866  val[r + q*target_dim()] += co * Z[j + r*nbdof];
867  }
868  }
869  }
870 
871  template <typename MAT>
873  MAT &M, dim_type Qdim) const {
874  size_type Qmult = size_type(Qdim) / target_dim();
875  size_type nbdof = nb_dof(c.convex_num());
876  GMM_ASSERT1(gmm::mat_nrows(M) == Qdim && gmm::mat_ncols(M) == nbdof*Qmult,
877  "dimensions mismatch");
878 
879  gmm::clear(M);
880  base_tensor Z; real_base_value(c, Z);
881  for (size_type j = 0; j < nbdof; ++j) {
882  for (size_type q = 0; q < Qmult; ++q) {
883  for (size_type r = 0; r < target_dim(); ++r)
884  M(r+q*target_dim(), j*Qmult+q) = Z[j + r*nbdof];
885  }
886  }
887  }
888 
889 
890  // IN : coeff(Qmult,nb_dof)
891  // OUT: val(Qdim,N), Qdim=target_dim*Qmult
892  // AUX: t(nb_dof,target_dim,N)
893  template<typename CVEC, typename VMAT>
895  const CVEC& coeff, VMAT &val,
896  dim_type Qdim) const {
897  size_type N = c.N();
898  size_type nbdof = nb_dof(c.convex_num());
899  size_type Qmult = gmm::vect_size(coeff) / nbdof;
900  GMM_ASSERT1(gmm::mat_ncols(val) == N &&
901  gmm::mat_nrows(val) == target_dim()*Qmult &&
902  gmm::vect_size(coeff) == nbdof*Qmult,
903  "dimensions mismatch");
904  GMM_ASSERT1(Qdim == target_dim()*Qmult, // Qdim seems to be superfluous input, could be removed in the future
905  "dimensions mismatch");
906  base_tensor t;
907  real_grad_base_value(c, t); // t(nbdof,target_dim,N)
908 
909  gmm::clear(val);
910  for (size_type q = 0; q < Qmult; ++q) {
911  base_tensor::const_iterator it = t.begin();
912  for (size_type k = 0; k < N; ++k)
913  for (size_type r = 0; r < target_dim(); ++r)
914  for (size_type j = 0; j < nbdof; ++j, ++it)
915  val(r + q*target_dim(), k) += coeff[j*Qmult+q] * (*it);
916  }
917  }
918 
919 
920  template<typename CVEC, typename VMAT>
922  const CVEC& coeff, VMAT &val,
923  dim_type Qdim) const {
924  size_type Qmult = size_type(Qdim) / target_dim();
925  size_type N = c.N();
926  GMM_ASSERT1(gmm::mat_ncols(val) == N*N &&
927  gmm::mat_nrows(val) == Qdim, "dimensions mismatch");
928 
929  base_tensor t;
930  size_type nbdof = nb_dof(c.convex_num());
931 
932  gmm::clear(val);
933  real_hess_base_value(c, t);
934  for (size_type q = 0; q < Qmult; ++q) {
935  base_tensor::const_iterator it = t.begin();
936  for (size_type k = 0; k < N*N; ++k)
937  for (size_type r = 0; r < target_dim(); ++r)
938  for (size_type j = 0; j < nbdof; ++j, ++it)
939  val(r + q*target_dim(), k) += coeff[j*Qmult+q] * (*it);
940  }
941  }
942 
943 
944  // IN : coeff(Qmult,nb_dof)
945  // OUT: val
946  // AUX: t(nb_dof,target_dim,N), Qmult*target_dim == N
947  template<typename CVEC>
949  (const fem_interpolation_context& c, const CVEC& coeff,
950  typename gmm::linalg_traits<CVEC>::value_type &val) const {
951  size_type N = c.N();
952  size_type nbdof = nb_dof(c.convex_num());
953  size_type Qmult = gmm::vect_size(coeff) / nbdof;
954  GMM_ASSERT1(gmm::vect_size(coeff) == nbdof*Qmult , "dimensions mismatch");
955  GMM_ASSERT1(target_dim()*Qmult == N &&
956  (Qmult == 1 || target_dim() == 1),
957  "Dimensions mismatch. Divergence operator requires fem qdim equal to dim.");
958  base_tensor t;
959  real_grad_base_value(c, t); // t(nbdof,target_dim,N)
960  // for Qmult == 1 this is sub-optimal since it evaluates all (:,i,j)
961  // gradients instead of only the diagonal ones(:,i,i)
962 
963  val = scalar_type(0);
964  base_tensor::const_iterator it = t.begin();
965  if (Qmult == 1)
966  for (size_type k = 0; k < N; ++k) {
967  if (k) it += (N*nbdof + 1);
968  for (size_type j = 0; j < nbdof; ++j) {
969  if (j) ++it;
970  val += coeff[j] * (*it);
971  }
972  }
973  else // if (target_dim() == 1)
974  for (size_type k = 0; k < N; ++k) {
975  if (k) ++it;
976  for (size_type j = 0; j < nbdof; ++j) {
977  if (j) ++it;
978  val += coeff[j*N+k] * (*it);
979  }
980  }
981  }
982 
983 
984 
985  /* Functions allowing the add of a finite element method outside
986  of getfem_fem.cc */
987 
988  typedef dal::naming_system<virtual_fem>::param_list fem_param_list;
989 
990  void inline read_poly(bgeot::base_poly &p, int d, const char *s)
991  { p = bgeot::read_base_poly(short_type(d), s); }
992 
993  void add_fem_name(std::string name,
995 
996 
997  /* @} */
998 
999 } /* end of namespace getfem. */
1000 
1001 
1002 #endif
virtual size_type nb_base(size_type cv) const
Number of basis functions.
Definition: getfem_fem.h:294
Geometric transformations on convexes.
dof_description * pdof_description
Type representing a pointer on a dof_description.
Definition: getfem_fem.h:155
base_poly read_base_poly(short_type n, std::istream &f)
read a base_poly on the stream ist.
Definition: bgeot_poly.cc:210
void grad_base_value(const base_node &x, base_tensor &t) const
Evaluates at point x, the gradient of all base functions w.r.t.
Definition: getfem_fem.h:559
base class for static stored objects
Handle composite polynomials.
Stores interdependent getfem objects.
virtual size_type nb_dof(size_type) const
Number of degrees of freedom.
Definition: getfem_fem.h:291
vec_type vectorial_type() const
Type of vectorial element.
Definition: getfem_fem.h:311
virtual void hess_base_value(const base_node &x, base_tensor &t) const =0
Give the value of all hessians (on ref.
size_type convex_num() const
get the current convex number
Definition: getfem_fem.cc:52
Pre-computations on a fem (given a fixed set of points on the reference convex, this object computes ...
Definition: getfem_fem.h:648
Base class for finite element description.
Definition: getfem_fem.h:250
dim_type dim() const
dimension of the reference element.
Definition: getfem_fem.h:306
pfem fem_descriptor(const std::string &name)
get a fem descriptor from its string name.
Definition: getfem_fem.cc:3950
void interpolation(const fem_interpolation_context &c, const CVEC &coeff, VVEC &val, dim_type Qdim) const
Interpolate at an arbitrary point x given on the reference element.
Definition: getfem_fem.h:850
const std::vector< FUNC > & base() const
Gives the array of basic functions (components).
Definition: getfem_fem.h:543
bool have_pfp() const
true if a fem_precomp_ has been supplied.
Definition: getfem_fem.h:752
const base_tensor & val(size_type i) const
returns values of the base functions
Definition: getfem_fem.h:657
virtual bgeot::pconvex_ref ref_convex(size_type) const
Return the convex of the reference element.
Definition: getfem_fem.h:313
pfem classical_discontinuous_fem(bgeot::pgeometric_trans pg, short_type k, scalar_type alpha=0, bool complete=false)
Give a pointer on the structures describing the classical polynomial discontinuous fem of degree k on...
Definition: getfem_fem.cc:3872
virtual void real_grad_base_value(const fem_interpolation_context &c, base_tensor &t, bool withM=true) const
Give the gradient of all components of the base functions at the current point of the fem_interpolati...
Definition: getfem_fem.cc:313
bgeot::pconvex_structure basic_structure(size_type cv) const
Gives the convex of the reference element.
Definition: getfem_fem.h:317
the geotrans_interpolation_context structure is passed as the argument of geometric transformation in...
void hess_base_value(const base_node &x, base_tensor &t) const
Evaluates at point x, the hessian of all base functions w.r.t.
Definition: getfem_fem.h:574
void del_stored_object(const pstatic_stored_object &o, bool ignore_unstored)
Delete an object and the object which depend on it.
Integration methods (exact and approximated) on convexes.
virtual_fem implementation as a vector of generic functions.
Definition: getfem_fem.h:500
pfem_precomp operator()(pfem pf, bgeot::pstored_point_tab pspt)
Request a pfem_precomp.
Definition: getfem_fem.h:727
virtual const bgeot::convex< base_node > & node_convex(size_type) const
Gives the convex representing the nodes on the reference element.
Definition: getfem_fem.h:320
void interpolation_diverg(const fem_interpolation_context &c, const CVEC &coeff, typename gmm::linalg_traits< CVEC >::value_type &val) const
Interpolation of the divergence.
Definition: getfem_fem.h:949
pdof_description product_dof(pdof_description pnd1, pdof_description pnd2)
Product description of the descriptions *pnd1 and *pnd2.
Definition: getfem_fem.cc:531
size_type nb_base_components(size_type cv) const
Number of components (nb_dof() * dimension of the target space).
Definition: getfem_fem.h:297
pdof_description second_derivative_dof(dim_type d, dim_type num_der1, dim_type num_der2)
Description of a unique dof of second derivative type.
Definition: getfem_fem.cc:475
Associate a name to a method descriptor and store method descriptors.
std::shared_ptr< const convex_structure > pconvex_structure
Pointer on a convex structure description.
size_t size_type
used as the common size type in the library
Definition: bgeot_poly.h:49
bool dof_compatibility(pdof_description, pdof_description)
Says if the two dofs can be identified.
Definition: getfem_fem.cc:597
bgeot::pconvex_structure structure(size_type cv) const
Gives the convex structure of the reference element nodes.
Definition: getfem_fem.h:323
pdof_description derivative_dof(dim_type d, dim_type r)
Description of a unique dof of derivative type.
Definition: getfem_fem.cc:466
std::string name_of_fem(pfem p)
get the string name of a fem descriptor.
Definition: getfem_fem.cc:3959
handle a pool (i.e.
Definition: getfem_fem.h:711
structure passed as the argument of fem interpolation functions.
Definition: getfem_fem.h:741
void interpolation_hess(const fem_interpolation_context &c, const CVEC &coeff, VMAT &val, dim_type Qdim) const
Interpolation of the hessian.
Definition: getfem_fem.h:921
dim_type target_dim() const
dimension of the target space.
Definition: getfem_fem.h:309
Naming system.
void add_node(const pdof_description &d, const base_node &pt, const dal::bit_vector &faces)
internal function adding a node to an element for the creation of a finite element method...
Definition: getfem_fem.cc:627
const fem< bgeot::base_poly > * ppolyfem
Classical polynomial FEM.
Definition: getfem_fem.h:594
GEneric Tool for Finite Element Methods.
virtual void real_base_value(const fem_interpolation_context &c, base_tensor &t, bool withM=true) const
Give the value of all components of the base functions at the current point of the fem_interpolation_...
Definition: getfem_fem.cc:309
pdof_description lagrange_dof(dim_type d)
Description of a unique dof of lagrange type (value at the node).
Definition: getfem_fem.cc:385
pfem_precomp pfp() const
get the current fem_precomp_
Definition: getfem_fem.h:786
std::shared_ptr< const getfem::virtual_fem > pfem
type of pointer on a fem description
Definition: getfem_fem.h:239
bool dof_linkable(pdof_description)
Says if the dof is linkable.
Definition: getfem_fem.cc:594
bool is_lagrange() const
true if the base functions are such that
Definition: getfem_fem.h:349
const fem< bgeot::polynomial_composite > * ppolycompfem
Polynomial composite FEM.
Definition: getfem_fem.h:596
gmm::uint16_type short_type
used as the common short type integer in the library
Definition: bgeot_config.h:79
pdof_description mean_value_dof(dim_type d)
Description of a unique dof of mean value type.
Definition: getfem_fem.cc:513
pdof_description normal_derivative_dof(dim_type d)
Description of a unique dof of normal derivative type (normal derivative at the node, regarding a face).
Definition: getfem_fem.cc:486
virtual void base_value(const base_node &x, base_tensor &t) const =0
Give the value of all components of the base functions at the point x of the reference element...
pfem_precomp fem_precomp(pfem pf, bgeot::pstored_point_tab pspt, dal::pstatic_stored_object dep)
Handles precomputations for FEM.
Definition: getfem_fem.cc:4051
void delete_fem_precomp(pfem_precomp pfp)
Request for the removal of a pfem_precomp.
Definition: getfem_fem.h:700
void set_face_num(short_type f)
set the current face number
Definition: getfem_fem.h:780
pfem classical_fem(bgeot::pgeometric_trans pgt, short_type k, bool complete=false)
Give a pointer on the structures describing the classical polynomial fem of degree k on a given conve...
Definition: getfem_fem.cc:3867
const pfem pf() const
get the current FEM descriptor
Definition: getfem_fem.h:774
size_type dof_xfem_index(pdof_description)
Returns the xfem_index of dof (0 for normal dof)
Definition: getfem_fem.cc:600
virtual void grad_base_value(const base_node &x, base_tensor &t) const =0
Give the value of all gradients (on ref.
const fem< bgeot::base_rational_fraction > * prationalfracfem
Rational fration FEM.
Definition: getfem_fem.h:598
bool have_pf() const
true if the pfem is available.
Definition: getfem_fem.h:754
const base_node & node_of_dof(size_type cv, size_type i) const
Gives the node corresponding to the dof i.
Definition: getfem_fem.h:340
pdof_description xfem_dof(pdof_description p, size_type ind)
Description of a special dof for Xfem.
Definition: getfem_fem.cc:428
void base_value(const base_node &x, base_tensor &t) const
Evaluates at point x, all base functions and returns the result in t(nb_base,target_dim) ...
Definition: getfem_fem.h:547
pdof_description global_dof(dim_type d)
Description of a global dof, i.e.
Definition: getfem_fem.cc:521
const std::vector< pdof_description > & dof_types() const
Get the array of pointer on dof description.
Definition: getfem_fem.h:302
virtual void real_hess_base_value(const fem_interpolation_context &c, base_tensor &t, bool withM=true) const
Give the hessian of all components of the base functions at the current point of the fem_interpolatio...
Definition: getfem_fem.cc:317
std::shared_ptr< const bgeot::geometric_trans > pgeometric_trans
pointer type for a geometric transformation
bool is_polynomial() const
true if the base functions are polynomials
Definition: getfem_fem.h:351
const base_tensor & grad(size_type i) const
returns gradients of the base functions
Definition: getfem_fem.h:660
const base_tensor & hess(size_type i) const
returns hessians of the base functions
Definition: getfem_fem.h:663
void interpolation_grad(const fem_interpolation_context &c, const CVEC &coeff, VMAT &val, dim_type Qdim=1) const
Interpolation of the gradient.
Definition: getfem_fem.h:894
int dof_description_compare(pdof_description a, pdof_description b)
Gives a total order on the dof description compatible with the identification.
Definition: getfem_fem.cc:585