MFEM  v4.2.0 Finite element discretization library
fe.hpp
Go to the documentation of this file.
1 // Copyright (c) 2010-2020, Lawrence Livermore National Security, LLC. Produced
3 // LICENSE and NOTICE for details. LLNL-CODE-806117.
4 //
5 // This file is part of the MFEM library. For more information and source code
6 // availability visit https://mfem.org.
7 //
8 // MFEM is free software; you can redistribute it and/or modify it under the
9 // terms of the BSD-3 license. We welcome feedback and contributions, see file
10 // CONTRIBUTING.md for details.
11
12 #ifndef MFEM_FE
13 #define MFEM_FE
14
15 #include "../config/config.hpp"
16 #include "../general/array.hpp"
17 #include "../linalg/linalg.hpp"
18 #include "intrules.hpp"
19 #include "geom.hpp"
20
21 #include <map>
22
23 namespace mfem
24 {
25
26 /// Possible basis types. Note that not all elements can use all BasisType(s).
27 class BasisType
28 {
29 public:
30  enum
31  {
32  Invalid = -1,
33  GaussLegendre = 0, ///< Open type
34  GaussLobatto = 1, ///< Closed type
35  Positive = 2, ///< Bernstein polynomials
36  OpenUniform = 3, ///< Nodes: x_i = (i+1)/(n+1), i=0,...,n-1
37  ClosedUniform = 4, ///< Nodes: x_i = i/(n-1), i=0,...,n-1
38  OpenHalfUniform = 5, ///< Nodes: x_i = (i+1/2)/n, i=0,...,n-1
39  Serendipity = 6, ///< Serendipity basis (squares / cubes)
40  ClosedGL = 7, ///< Closed GaussLegendre
41  NumBasisTypes = 8 /**< Keep track of maximum types to prevent
42  hard-coding */
43  };
44  /** @brief If the input does not represents a valid BasisType, abort with an
45  error; otherwise return the input. */
46  static int Check(int b_type)
47  {
48  MFEM_VERIFY(0 <= b_type && b_type < NumBasisTypes,
49  "unknown BasisType: " << b_type);
50  return b_type;
51  }
52  /** @brief If the input does not represents a valid nodal BasisType, abort
53  with an error; otherwise return the input. */
54  static int CheckNodal(int b_type)
55  {
56  MFEM_VERIFY(Check(b_type) != Positive,
57  "invalid nodal BasisType: " << Name(b_type));
58  return b_type;
59  }
60  /** @brief Get the corresponding Quadrature1D constant, when that makes
61  sense; otherwise return Quadrature1D::Invalid. */
63  {
64  switch (b_type)
65  {
68  case Positive: return Quadrature1D::ClosedUniform; // <-----
74  }
76  }
77  /// Return the nodal BasisType corresponding to the Quadrature1D type.
78  static int GetNodalBasis(int qpt_type)
79  {
80  switch (qpt_type)
81  {
88  }
89  return Invalid;
90  }
91  /// Check and convert a BasisType constant to a string identifier.
92  static const char *Name(int b_type)
93  {
94  static const char *name[] =
95  {
96  "Gauss-Legendre", "Gauss-Lobatto", "Positive (Bernstein)",
97  "Open uniform", "Closed uniform", "Open half uniform"
98  };
99  return name[Check(b_type)];
100  }
101  /// Check and convert a BasisType constant to a char basis identifier.
102  static char GetChar(int b_type)
103  {
104  static const char ident[] = { 'g', 'G', 'P', 'u', 'U', 'o' };
105  return ident[Check(b_type)];
106  }
107  /// Convert char basis identifier to a BasisType constant.
108  static int GetType(char b_ident)
109  {
110  switch (b_ident)
111  {
112  case 'g': return GaussLegendre;
113  case 'G': return GaussLobatto;
114  case 'P': return Positive;
115  case 'u': return OpenUniform;
116  case 'U': return ClosedUniform;
117  case 'o': return OpenHalfUniform;
118  case 's': return GaussLobatto;
119  }
120  MFEM_ABORT("unknown BasisType identifier");
121  return -1;
122  }
123 };
124
125
126 /** @brief Structure representing the matrices/tensors needed to evaluate (in
127  reference space) the values, gradients, divergences, or curls of a
128  FiniteElement at a the quadrature points of a given IntegrationRule. */
129 /** Object of this type are typically created and owned by the respective
130  FiniteElement object. */
132 {
133 public:
134  /// The FiniteElement that created and owns this object.
135  /** This pointer is not owned. */
136  const class FiniteElement *FE;
137
138  /** @brief IntegrationRule that defines the quadrature points at which the
139  basis functions of the #FE are evaluated. */
140  /** This pointer is not owned. */
142
143  /// Type of data stored in the arrays #B, #Bt, #G, and #Gt.
144  enum Mode
145  {
146  /** @brief Full multidimensional representation which does not use tensor
147  product structure. The ordering of the degrees of freedom is as
148  defined by #FE */
150
151  /** @brief Tensor product representation using 1D matrices/tensors with
152  dimensions using 1D number of quadrature points and degrees of
153  freedom. */
154  /** When representing a vector-valued FiniteElement, two DofToQuad objects
155  are used to describe the "closed" and "open" 1D basis functions
156  (TODO). */
158  };
159
160  /// Describes the contents of the #B, #Bt, #G, and #Gt arrays, see #Mode.
162
163  /** @brief Number of degrees of freedom = number of basis functions. When
164  #mode is TENSOR, this is the 1D number. */
165  int ndof;
166
167  /** @brief Number of quadrature points. When #mode is TENSOR, this is the 1D
168  number. */
169  int nqpt;
170
171  /// Basis functions evaluated at quadrature points.
172  /** The storage layout is column-major with dimensions:
173  - #nqpt x #ndof, for scalar elements, or
174  - #nqpt x dim x #ndof, for vector elements, (TODO)
175
176  where
177
178  - dim = dimension of the finite element reference space when #mode is
179  FULL, and dim = 1 when #mode is TENSOR. */
181
182  /// Transpose of #B.
183  /** The storage layout is column-major with dimensions:
184  - #ndof x #nqpt, for scalar elements, or
185  - #ndof x #nqpt x dim, for vector elements (TODO). */
187
188  /** @brief Gradients/divergences/curls of basis functions evaluated at
190  /** The storage layout is column-major with dimensions:
191  - #nqpt x dim x #ndof, for scalar elements, or
192  - #nqpt x #ndof, for H(div) vector elements (TODO), or
193  - #nqpt x cdim x #ndof, for H(curl) vector elements (TODO),
194
195  where
196
197  - dim = dimension of the finite element reference space when #mode is
198  FULL, and 1 when #mode is TENSOR,
199  - cdim = 1/1/3 in 1D/2D/3D, respectively, when #mode is FULL, and cdim =
200  1 when #mode is TENSOR. */
202
203  /// Transpose of #G.
204  /** The storage layout is column-major with dimensions:
205  - #ndof x #nqpt x dim, for scalar elements, or
206  - #ndof x #nqpt, for H(div) vector elements (TODO), or
207  - #ndof x #nqpt x cdim, for H(curl) vector elements (TODO). */
209 };
210
211
212 /// Describes the function space on each element
214 {
215 public:
216  enum
217  {
218  Pk, ///< Polynomials of order k
219  Qk, ///< Tensor products of polynomials of order k
220  rQk ///< Refined tensor products of polynomials of order k
221  };
222 };
223
224 class ElementTransformation;
225 class Coefficient;
226 class VectorCoefficient;
227 class MatrixCoefficient;
228 class KnotVector;
229
230
231 // Base and derived classes for finite elements
232
233
234 /// Abstract class for all finite elements.
236 {
237 protected:
238  int dim; ///< Dimension of reference space
239  Geometry::Type geom_type; ///< Geometry::Type of the reference element
242  mutable
243  int dof, ///< Number of degrees of freedom
244  order; ///< Order/degree of the shape functions
245  mutable int orders[Geometry::MaxDim]; ///< Anisotropic orders
248  mutable DenseMatrix vshape; // Dof x Dim
249 #endif
250  /// Container for all DofToQuad objects created by the FiniteElement.
251  /** Multiple DofToQuad objects may be needed when different quadrature rules
252  or different DofToQuad::Mode are used. */
254
255 public:
256  /// Enumeration for range_type and deriv_range_type
258
259  /** @brief Enumeration for MapType: defines how reference functions are
260  mapped to physical space.
261
262  A reference function \f$\hat u(\hat x) \f$ can be mapped to a function
263  \f$u(x) \f$ on a general physical element in following ways:
264  - \f$x = T(\hat x) \f$ is the image of the reference point \f$\hat x \f$
265  - \f$J = J(\hat x) \f$ is the Jacobian matrix of the transformation T
266  - \f$w = w(\hat x) = det(J) \f$ is the transformation weight factor for square J
267  - \f$w = w(\hat x) = det(J^t J)^{1/2} \f$ is the transformation weight factor in general
268  */
269  enum MapType
270  {
271  VALUE, /**< For scalar fields; preserves point values
272  \f$u(x) = \hat u(\hat x) \f$ */
273  INTEGRAL, /**< For scalar fields; preserves volume integrals
274  \f$u(x) = (1/w) \hat u(\hat x) \f$ */
275  H_DIV, /**< For vector fields; preserves surface integrals of the
276  normal component \f$u(x) = (J/w) \hat u(\hat x) \f$ */
277  H_CURL /**< For vector fields; preserves line integrals of the
278  tangential component
279  \f$u(x) = J^{-t} \hat u(\hat x) \f$ (square J),
280  \f$u(x) = J(J^t J)^{-1} \hat u(\hat x) \f$ (general J) */
281  };
282
283  /** @brief Enumeration for DerivType: defines which derivative method
284  is implemented.
285
286  Each FiniteElement class implements up to one type of derivative. The
287  value returned by GetDerivType() indicates which derivative method is
288  implemented.
289  */
291  {
292  NONE, ///< No derivatives implemented
293  GRAD, ///< Implements CalcDShape methods
294  DIV, ///< Implements CalcDivShape methods
295  CURL ///< Implements CalcCurlShape methods
296  };
297
298  /** @brief Construct FiniteElement with given
299  @param D Reference space dimension
300  @param G Geometry type (of type Geometry::Type)
301  @param Do Number of degrees of freedom in the FiniteElement
302  @param O Order/degree of the FiniteElement
303  @param F FunctionSpace type of the FiniteElement
304  */
305  FiniteElement(int D, Geometry::Type G, int Do, int O,
306  int F = FunctionSpace::Pk);
307
308  /// Returns the reference space dimension for the finite element
309  int GetDim() const { return dim; }
310
311  /// Returns the Geometry::Type of the reference element
313
314  /// Returns the number of degrees of freedom in the finite element
315  int GetDof() const { return dof; }
316
317  /** @brief Returns the order of the finite element. In the case of
318  anisotropic orders, returns the maximum order. */
319  int GetOrder() const { return order; }
320
321  /** @brief Returns true if the FiniteElement basis *may be using* different
322  orders/degrees in different spatial directions. */
323  bool HasAnisotropicOrders() const { return orders[0] != -1; }
324
325  /// Returns an array containing the anisotropic orders/degrees.
326  const int *GetAnisotropicOrders() const { return orders; }
327
328  /// Returns the type of FunctionSpace on the element.
329  int Space() const { return func_space; }
330
331  /// Returns the FiniteElement::RangeType of the element, one of {SCALAR, VECTOR}.
332  int GetRangeType() const { return range_type; }
333
334  /** @brief Returns the FiniteElement::RangeType of the element derivative, either
335  SCALAR or VECTOR. */
336  int GetDerivRangeType() const { return deriv_range_type; }
337
338  /** @brief Returns the FiniteElement::MapType of the element describing how reference
339  functions are mapped to physical space, one of {VALUE, INTEGRAL
340  H_DIV, H_CURL}. */
341  int GetMapType() const { return map_type; }
342
343
344  /** @brief Returns the FiniteElement::DerivType of the element describing the
345  spatial derivative method implemented, one of {NONE, GRAD,
346  DIV, CURL}. */
347  int GetDerivType() const { return deriv_type; }
348
349  /** @brief Returns the FiniteElement::DerivType of the element describing how
350  reference function derivatives are mapped to physical space, one of {VALUE,
351  INTEGRAL, H_DIV, H_CURL}. */
352  int GetDerivMapType() const { return deriv_map_type; }
353
354  /** @brief Evaluate the values of all shape functions of a scalar finite
355  element in reference space at the given point @a ip. */
356  /** The size (#dof) of the result Vector @a shape must be set in advance. */
357  virtual void CalcShape(const IntegrationPoint &ip,
358  Vector &shape) const = 0;
359
360  /** @brief Evaluate the values of all shape functions of a scalar finite
361  element in physical space at the point described by @a Trans. */
362  /** The size (#dof) of the result Vector @a shape must be set in advance. */
363  void CalcPhysShape(ElementTransformation &Trans, Vector &shape) const;
364
365  /** @brief Evaluate the gradients of all shape functions of a scalar finite
366  element in reference space at the given point @a ip. */
367  /** Each row of the result DenseMatrix @a dshape contains the derivatives of
368  one shape function. The size (#dof x #dim) of @a dshape must be set in
370  virtual void CalcDShape(const IntegrationPoint &ip,
371  DenseMatrix &dshape) const = 0;
372
373  /** @brief Evaluate the gradients of all shape functions of a scalar finite
374  element in physical space at the point described by @a Trans. */
375  /** Each row of the result DenseMatrix @a dshape contains the derivatives of
376  one shape function. The size (#dof x SDim) of @a dshape must be set in
377  advance, where SDim >= #dim is the physical space dimension as described
378  by @a Trans. */
380
381  /// Get a const reference to the nodes of the element
382  const IntegrationRule & GetNodes() const { return Nodes; }
383
384  // virtual functions for finite elements on vector spaces
385
386  /** @brief Evaluate the values of all shape functions of a *vector* finite
387  element in reference space at the given point @a ip. */
388  /** Each row of the result DenseMatrix @a shape contains the components of
389  one vector shape function. The size (#dof x #dim) of @a shape must be set
391  virtual void CalcVShape(const IntegrationPoint &ip,
392  DenseMatrix &shape) const;
393
394  /** @brief Evaluate the values of all shape functions of a *vector* finite
395  element in physical space at the point described by @a Trans. */
396  /** Each row of the result DenseMatrix @a shape contains the components of
397  one vector shape function. The size (#dof x SDim) of @a shape must be set
398  in advance, where SDim >= #dim is the physical space dimension as
399  described by @a Trans. */
400  virtual void CalcVShape(ElementTransformation &Trans,
401  DenseMatrix &shape) const;
402
403  /// Equivalent to the CalcVShape() method with the same arguments.
405  { CalcVShape(Trans, shape); }
406
407  /** @brief Evaluate the divergence of all shape functions of a *vector*
408  finite element in reference space at the given point @a ip. */
409  /** The size (#dof) of the result Vector @a divshape must be set in advance.
410  */
411  virtual void CalcDivShape(const IntegrationPoint &ip,
412  Vector &divshape) const;
413
414  /** @brief Evaluate the divergence of all shape functions of a *vector*
415  finite element in physical space at the point described by @a Trans. */
416  /** The size (#dof) of the result Vector @a divshape must be set in advance.
417  */
418  void CalcPhysDivShape(ElementTransformation &Trans, Vector &divshape) const;
419
420  /** @brief Evaluate the curl of all shape functions of a *vector* finite
421  element in reference space at the given point @a ip. */
422  /** Each row of the result DenseMatrix @a curl_shape contains the components
423  of the curl of one vector shape function. The size (#dof x CDim) of
424  @a curl_shape must be set in advance, where CDim = 3 for #dim = 3 and
425  CDim = 1 for #dim = 2. */
426  virtual void CalcCurlShape(const IntegrationPoint &ip,
427  DenseMatrix &curl_shape) const;
428
429  /** @brief Evaluate the curl of all shape functions of a *vector* finite
430  element in physical space at the point described by @a Trans. */
431  /** Each row of the result DenseMatrix @a curl_shape contains the components
432  of the curl of one vector shape function. The size (#dof x CDim) of
433  @a curl_shape must be set in advance, where CDim = 3 for #dim = 3 and
434  CDim = 1 for #dim = 2. */
436  DenseMatrix &curl_shape) const;
437
438  /** @brief Get the dofs associated with the given @a face.
439  @a *dofs is set to an internal array of the local dofc on the
440  face, while *ndofs is set to the number of dofs on that face.
441  */
442  virtual void GetFaceDofs(int face, int **dofs, int *ndofs) const;
443
444  /** @brief Evaluate the Hessians of all shape functions of a scalar finite
445  element in reference space at the given point @a ip. */
446  /** Each row of the result DenseMatrix @a Hessian contains upper triangular
447  part of the Hessian of one shape function.
448  The order in 2D is {u_xx, u_xy, u_yy}.
449  The size (#dof x (#dim (#dim+1)/2) of @a Hessian must be set in advance.*/
450  virtual void CalcHessian (const IntegrationPoint &ip,
451  DenseMatrix &Hessian) const;
452
453  /** @brief Evaluate the Hessian of all shape functions of a scalar finite
454  element in reference space at the given point @a ip. */
455  /** The size (#dof, #dim*(#dim+1)/2) of @a Hessian must be set in advance. */
457  DenseMatrix& Hessian) const;
458
459  /** @brief Evaluate the Laplacian of all shape functions of a scalar finite
460  element in reference space at the given point @a ip. */
461  /** The size (#dof) of @a Laplacian must be set in advance. */
463  Vector& Laplacian) const;
464
466  Vector& Laplacian) const;
467
468  /** @brief Return the local interpolation matrix @a I (Dof x Dof) where the
469  fine element is the image of the base geometry under the given
470  transformation. */
472  DenseMatrix &I) const;
473
474  /** @brief Return a local restriction matrix @a R (Dof x Dof) mapping fine
475  dofs to coarse dofs.
476
477  The fine element is the image of the base geometry under the given
478  transformation, @a Trans.
479
480  The assumption in this method is that a subset of the coarse dofs can be
481  expressed only in terms of the dofs of the given fine element.
482
483  Rows in @a R corresponding to coarse dofs that cannot be expressed in
484  terms of the fine dofs will be marked as invalid by setting the first
485  entry (column 0) in the row to infinity().
486
487  This method assumes that the dimensions of @a R are set before it is
488  called. */
490  DenseMatrix &R) const;
491
492  /** @brief Return interpolation matrix, @a I, which maps dofs from a coarse
493  element, @a fe, to the fine dofs on @a this finite element. */
494  /** @a Trans represents the mapping from the reference element of @a this
495  element into a subset of the reference space of the element @a fe, thus
496  allowing the "coarse" FiniteElement to be different from the "fine"
497  FiniteElement as when h-refinement is combined with p-refinement or
498  p-derefinement. It is assumed that both finite elements use the same
499  FiniteElement::MapType. */
500  virtual void GetTransferMatrix(const FiniteElement &fe,
502  DenseMatrix &I) const;
503
504  /** @brief Given a coefficient and a transformation, compute its projection
505  (approximation) in the local finite dimensional space in terms
506  of the degrees of freedom. */
507  virtual void Project(Coefficient &coeff,
508  ElementTransformation &Trans, Vector &dofs) const;
509
510  /** @brief Given a vector coefficient and a transformation, compute its
511  projection (approximation) in the local finite dimensional space
512  in terms of the degrees of freedom. (VectorFiniteElements) */
513  virtual void Project(VectorCoefficient &vc,
514  ElementTransformation &Trans, Vector &dofs) const;
515
516  /** @brief Given a vector of values at the finite element nodes and a
517  transformation, compute its projection (approximation) in the local
518  finite dimensional space in terms of the degrees of freedom. Valid for
519  VectorFiniteElements. */
521  Vector &dofs) const;
522
523  /** @brief Given a matrix coefficient and a transformation, compute an
524  approximation ("projection") in the local finite dimensional space in
525  terms of the degrees of freedom. For VectorFiniteElements, the rows of
526  the coefficient are projected in the vector space. */
527  virtual void ProjectMatrixCoefficient(
528  MatrixCoefficient &mc, ElementTransformation &T, Vector &dofs) const;
529
530  /** @brief Project a delta function centered on the given @a vertex in
531  the local finite dimensional space represented by the @a dofs. */
532  virtual void ProjectDelta(int vertex, Vector &dofs) const;
533
534  /** @brief Compute the embedding/projection matrix from the given
535  FiniteElement onto 'this' FiniteElement. The ElementTransformation is
536  included to support cases when the projection depends on it. */
537  virtual void Project(const FiniteElement &fe, ElementTransformation &Trans,
538  DenseMatrix &I) const;
539
540  /** @brief Compute the discrete gradient matrix from the given FiniteElement
541  onto 'this' FiniteElement. The ElementTransformation is included to
542  support cases when the matrix depends on it. */
543  virtual void ProjectGrad(const FiniteElement &fe,
546
547  /** @brief Compute the discrete curl matrix from the given FiniteElement onto
548  'this' FiniteElement. The ElementTransformation is included to support
549  cases when the matrix depends on it. */
550  virtual void ProjectCurl(const FiniteElement &fe,
552  DenseMatrix &curl) const;
553
554  /** @brief Compute the discrete divergence matrix from the given
555  FiniteElement onto 'this' FiniteElement. The ElementTransformation is
556  included to support cases when the matrix depends on it. */
557  virtual void ProjectDiv(const FiniteElement &fe,
559  DenseMatrix &div) const;
560
561  /** @brief Return a DofToQuad structure corresponding to the given
562  IntegrationRule using the given DofToQuad::Mode. */
563  /** See the documentation for DofToQuad for more details. */
566  /// Deconstruct the FiniteElement
567  virtual ~FiniteElement();
568
569  /** @brief Return true if the BasisType of @a b_type is closed
570  (has Quadrature1D points on the boundary). */
571  static bool IsClosedType(int b_type)
572  {
573  const int q_type = BasisType::GetQuadrature1D(b_type);
574  return ((q_type != Quadrature1D::Invalid) &&
576  }
577
578  /** @brief Return true if the BasisType of @a b_type is open
579  (doesn't have Quadrature1D points on the boundary). */
580  static bool IsOpenType(int b_type)
581  {
582  const int q_type = BasisType::GetQuadrature1D(b_type);
583  return ((q_type != Quadrature1D::Invalid) &&
585  }
586
587  /** @brief Ensure that the BasisType of @a b_type is closed
588  (has Quadrature1D points on the boundary). */
589  static int VerifyClosed(int b_type)
590  {
591  MFEM_VERIFY(IsClosedType(b_type),
592  "invalid closed basis type: " << b_type);
593  return b_type;
594  }
595
596  /** @brief Ensure that the BasisType of @a b_type is open
597  (doesn't have Quadrature1D points on the boundary). */
598  static int VerifyOpen(int b_type)
599  {
600  MFEM_VERIFY(IsOpenType(b_type), "invalid open basis type: " << b_type);
601  return b_type;
602  }
603
604  /** @brief Ensure that the BasisType of @a b_type nodal
605  (satisfies the interpolation property). */
606  static int VerifyNodal(int b_type)
607  {
608  return BasisType::CheckNodal(b_type);
609  }
610 };
611
612
613 /** @brief Class for finite elements with basis functions
614  that return scalar values. */
616 {
617 protected:
619  mutable Vector c_shape;
620 #endif
621
623  {
624  if (fe.GetRangeType() != SCALAR)
625  { mfem_error("'fe' must be a ScalarFiniteElement"); }
626  return static_cast<const ScalarFiniteElement &>(fe);
627  }
628
630  const IntegrationRule &ir,
632
633 public:
634  /** @brief Construct ScalarFiniteElement with given
635  @param D Reference space dimension
636  @param G Geometry type (of type Geometry::Type)
637  @param Do Number of degrees of freedom in the FiniteElement
638  @param O Order/degree of the FiniteElement
639  @param F FunctionSpace type of the FiniteElement
640  */
642  int F = FunctionSpace::Pk)
644  : FiniteElement(D, G, Do, O, F)
646 #else
647  : FiniteElement(D, G, Do, O, F), c_shape(dof)
649 #endif
650
651  /** @brief Set the FiniteElement::MapType of the element to either VALUE or
652  INTEGRAL. Also sets the FiniteElement::DerivType to GRAD if the
653  FiniteElement::MapType is VALUE. */
654  void SetMapType(int M)
655  {
656  MFEM_VERIFY(M == VALUE || M == INTEGRAL, "unknown MapType");
657  map_type = M;
658  deriv_type = (M == VALUE) ? GRAD : NONE;
659  }
660
661
662  /** @brief Get the matrix @a I that defines nodal interpolation
663  @a between this element and the refined element @a fine_fe. */
665  DenseMatrix &I,
666  const ScalarFiniteElement &fine_fe) const;
667
668  /** @brief Get matrix @a I "Interpolation" defined through local
669  L2-projection in the space defined by the @a fine_fe. */
670  /** If the "fine" elements cannot represent all basis functions of the
671  "coarse" element, then boundary values from different sub-elements are
672  generally different. */
674  DenseMatrix &I,
675  const ScalarFiniteElement &fine_fe) const;
676
679 };
680
681
682 /// Class for standard nodal finite elements.
684 {
685 protected:
686  void ProjectCurl_2D(const FiniteElement &fe,
688  DenseMatrix &curl) const;
689
690 public:
691  /** @brief Construct NodalFiniteElement with given
692  @param D Reference space dimension
693  @param G Geometry type (of type Geometry::Type)
694  @param Do Number of degrees of freedom in the FiniteElement
695  @param O Order/degree of the FiniteElement
696  @param F FunctionSpace type of the FiniteElement
697  */
699  int F = FunctionSpace::Pk)
700  : ScalarFiniteElement(D, G, Do, O, F) { }
701
703  DenseMatrix &I) const
704  { NodalLocalInterpolation(Trans, I, *this); }
705
706  virtual void GetLocalRestriction(ElementTransformation &Trans,
707  DenseMatrix &R) const;
708
709  virtual void GetTransferMatrix(const FiniteElement &fe,
710  ElementTransformation &Trans,
711  DenseMatrix &I) const
712  { CheckScalarFE(fe).NodalLocalInterpolation(Trans, I, *this); }
713
714  virtual void Project (Coefficient &coeff,
715  ElementTransformation &Trans, Vector &dofs) const;
716
717  virtual void Project (VectorCoefficient &vc,
718  ElementTransformation &Trans, Vector &dofs) const;
719
720  // (mc.height x mc.width) @ DOFs -> (Dof x mc.width x mc.height) in dofs
721  virtual void ProjectMatrixCoefficient(
722  MatrixCoefficient &mc, ElementTransformation &T, Vector &dofs) const;
723
724  virtual void Project(const FiniteElement &fe, ElementTransformation &Trans,
725  DenseMatrix &I) const;
726
727  virtual void ProjectGrad(const FiniteElement &fe,
728  ElementTransformation &Trans,
730
731  virtual void ProjectDiv(const FiniteElement &fe,
732  ElementTransformation &Trans,
733  DenseMatrix &div) const;
734 };
735
736 /** @brief Class for finite elements utilizing the
737  always positive Bernstein basis. */
739 {
740 public:
741  /** @brief Construct PositiveFiniteElement with given
742  @param D Reference space dimension
743  @param G Geometry type (of type Geometry::Type)
744  @param Do Number of degrees of freedom in the FiniteElement
745  @param O Order/degree of the FiniteElement
746  @param F FunctionSpace type of the FiniteElement
747  */
749  int F = FunctionSpace::Pk) :
750  ScalarFiniteElement(D, G, Do, O, F)
751  { }
752
754  DenseMatrix &I) const
755  { ScalarLocalInterpolation(Trans, I, *this); }
756
757  virtual void GetTransferMatrix(const FiniteElement &fe,
759  DenseMatrix &I) const
760  { CheckScalarFE(fe).ScalarLocalInterpolation(Trans, I, *this); }
761
763
764  // Low-order monotone "projection" (actually it is not a projection): the
765  // dofs are set to be the Coefficient values at the nodes.
766  virtual void Project(Coefficient &coeff,
767  ElementTransformation &Trans, Vector &dofs) const;
768
769  virtual void Project (VectorCoefficient &vc,
770  ElementTransformation &Trans, Vector &dofs) const;
771
772  virtual void Project(const FiniteElement &fe, ElementTransformation &Trans,
773  DenseMatrix &I) const;
774 };
775
776 /** @brief Intermediate class for finite elements whose basis functions return
777  vector values. */
779 {
780  // Hide the scalar functions CalcShape and CalcDShape.
781 private:
782  /// Overrides the scalar CalcShape function to print an error.
783  virtual void CalcShape(const IntegrationPoint &ip,
784  Vector &shape) const;
785
786  /// Overrides the scalar CalcDShape function to print an error.
787  virtual void CalcDShape(const IntegrationPoint &ip,
788  DenseMatrix &dshape) const;
789
790 protected:
792  mutable DenseMatrix J, Jinv;
794 #endif
795  void SetDerivMembers();
796
798  DenseMatrix &shape) const;
799
801  DenseMatrix &shape) const;
802
803  void Project_RT(const double *nk, const Array<int> &d2n,
805  Vector &dofs) const;
806
807  /// Projects the vector of values given at FE nodes to RT space
808  void Project_RT(const double *nk, const Array<int> &d2n,
810  Vector &dofs) const;
811
812  /// Project the rows of the matrix coefficient in an RT space
814  const double *nk, const Array<int> &d2n,
815  MatrixCoefficient &mc, ElementTransformation &T, Vector &dofs) const;
816
817  void Project_RT(const double *nk, const Array<int> &d2n,
819  DenseMatrix &I) const;
820
821  // rotated gradient in 2D
822  void ProjectGrad_RT(const double *nk, const Array<int> &d2n,
825
826  // Compute the curl as a discrete operator from ND FE (fe) to ND FE (this).
827  // The natural FE for the range is RT, so this is an approximation.
828  void ProjectCurl_ND(const double *tk, const Array<int> &d2t,
830  DenseMatrix &curl) const;
831
832  void ProjectCurl_RT(const double *nk, const Array<int> &d2n,
834  DenseMatrix &curl) const;
835
836  void Project_ND(const double *tk, const Array<int> &d2t,
838  Vector &dofs) const;
839
840  /// Projects the vector of values given at FE nodes to ND space
841  void Project_ND(const double *tk, const Array<int> &d2t,
843  Vector &dofs) const;
844
845  /// Project the rows of the matrix coefficient in an ND space
847  const double *tk, const Array<int> &d2t,
848  MatrixCoefficient &mc, ElementTransformation &T, Vector &dofs) const;
849
850  void Project_ND(const double *tk, const Array<int> &d2t,
852  DenseMatrix &I) const;
853
854  void ProjectGrad_ND(const double *tk, const Array<int> &d2t,
857
859  const double *nk, const Array<int> &d2n,
861  DenseMatrix &I) const;
862
864  const double *tk, const Array<int> &d2t,
866  DenseMatrix &I) const;
867
868  void LocalRestriction_RT(const double *nk, const Array<int> &d2n,
870  DenseMatrix &R) const;
871
872  void LocalRestriction_ND(const double *tk, const Array<int> &d2t,
874  DenseMatrix &R) const;
875
877  {
878  if (fe.GetRangeType() != VECTOR)
879  { mfem_error("'fe' must be a VectorFiniteElement"); }
880  return static_cast<const VectorFiniteElement &>(fe);
881  }
882
883 public:
884  VectorFiniteElement (int D, Geometry::Type G, int Do, int O, int M,
885  int F = FunctionSpace::Pk) :
887  FiniteElement(D, G, Do, O, F)
889 #else
890  FiniteElement(D, G, Do, O, F), Jinv(D)
892 #endif
893 };
894
895 /// A 0D point finite element
897 {
898 public:
899  /// Construct the PointFiniteElement
901
902  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
903
904  virtual void CalcDShape(const IntegrationPoint &ip,
905  DenseMatrix &dshape) const;
906 };
907
908 /// A 1D linear element with nodes on the endpoints
910 {
911 public:
912  /// Construct the Linear1DFiniteElement
914
915  /** virtual function which evaluates the values of all
916  shape functions at a given point ip and stores
917  them in the vector shape of dimension Dof (2) */
918  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
919
920  /** virtual function which evaluates the derivatives of all
921  shape functions at a given point ip and stores them in
922  the matrix dshape (Dof x Dim) (2 x 1) so that each row
923  contains the derivative of one shape function */
924  virtual void CalcDShape(const IntegrationPoint &ip,
925  DenseMatrix &dshape) const;
926 };
927
928 /// A 2D linear element on triangle with nodes at the vertices of the triangle
930 {
931 public:
932  /// Construct the Linear2DFiniteElement
934
935  /** virtual function which evaluates the values of all
936  shape functions at a given point ip and stores
937  them in the vector shape of dimension Dof (3) */
938  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
939
940  /** virtual function which evaluates the values of all
941  partial derivatives of all shape functions at a given
942  point ip and stores them in the matrix dshape (Dof x Dim) (3 x 2)
943  so that each row contains the derivatives of one shape function */
944  virtual void CalcDShape(const IntegrationPoint &ip,
945  DenseMatrix &dshape) const;
946  virtual void ProjectDelta(int vertex, Vector &dofs) const
947  { dofs = 0.0; dofs(vertex) = 1.0; }
948 };
949
950 /// A 2D bi-linear element on a square with nodes at the vertices of the square
952 {
953 public:
954  /// Construct the BiLinear2DFiniteElement
956
957  /** virtual function which evaluates the values of all
958  shape functions at a given point ip and stores
959  them in the vector shape of dimension Dof (4) */
960  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
961
962  /** virtual function which evaluates the values of all
963  partial derivatives of all shape functions at a given
964  point ip and stores them in the matrix dshape (Dof x Dim) (4 x 2)
965  so that each row contains the derivatives of one shape function */
966  virtual void CalcDShape(const IntegrationPoint &ip,
967  DenseMatrix &dshape) const;
968  virtual void CalcHessian (const IntegrationPoint &ip,
969  DenseMatrix &h) const;
970  virtual void ProjectDelta(int vertex, Vector &dofs) const
971  { dofs = 0.0; dofs(vertex) = 1.0; } // { dofs = 1.0; }
972 };
973
974 /// A linear element on a triangle with nodes at the 3 "Gaussian" points
976 {
977 public:
978  /// Construct the GaussLinear2DFiniteElement
980  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
981  virtual void CalcDShape(const IntegrationPoint &ip,
982  DenseMatrix &dshape) const;
983  virtual void ProjectDelta(int vertex, Vector &dofs) const;
984 };
985
986 /// A 2D bi-linear element on a square with nodes at the "Gaussian" points
988 {
989 private:
990  static const double p[2];
991
992 public:
993  /// Construct the FiniteElement
995  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
996  virtual void CalcDShape(const IntegrationPoint &ip,
997  DenseMatrix &dshape) const;
998  virtual void ProjectDelta(int vertex, Vector &dofs) const;
999 };
1000
1001 /** @brief A 2D linear element on a square with 3 nodes at the
1002  vertices of the lower left triangle */
1004 {
1005 public:
1008  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
1009  virtual void CalcDShape(const IntegrationPoint &ip,
1010  DenseMatrix &dshape) const;
1011  virtual void ProjectDelta(int vertex, Vector &dofs) const
1012  { dofs = 1.0; }
1013 };
1014
1015 /// A 1D quadractic finite element with uniformly spaced nodes
1017 {
1018 public:
1021
1022  /** virtual function which evaluates the values of all
1023  shape functions at a given point ip and stores
1024  them in the vector shape of dimension Dof (3) */
1025  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
1026
1027  /** virtual function which evaluates the derivatives of all
1028  shape functions at a given point ip and stores them in
1029  the matrix dshape (Dof x Dim) (3 x 1) so that each row
1030  contains the derivative of one shape function */
1031  virtual void CalcDShape(const IntegrationPoint &ip,
1032  DenseMatrix &dshape) const;
1033 };
1034
1035 /// A 1D quadratic positive element utilizing the 2nd order Bernstein basis
1037 {
1038 public:
1041  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
1042  virtual void CalcDShape(const IntegrationPoint &ip,
1043  DenseMatrix &dshape) const;
1044 };
1045
1046 /** @brief A 2D quadratic element on triangle with nodes at the
1047  vertices and midpoints of the triangle. */
1049 {
1050 public:
1053
1054  /** virtual function which evaluates the values of all
1055  shape functions at a given point ip and stores
1056  them in the vector shape of dimension Dof (6) */
1057  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
1058
1059  /** virtual function which evaluates the values of all
1060  partial derivatives of all shape functions at a given
1061  point ip and stores them in the matrix dshape (Dof x Dim) (6 x 2)
1062  so that each row contains the derivatives of one shape function */
1063  virtual void CalcDShape(const IntegrationPoint &ip,
1064  DenseMatrix &dshape) const;
1065
1066  virtual void CalcHessian (const IntegrationPoint &ip,
1067  DenseMatrix &h) const;
1068  virtual void ProjectDelta(int vertex, Vector &dofs) const;
1069 };
1070
1071 /// A quadratic element on triangle with nodes at the "Gaussian" points
1073 {
1074 private:
1075  static const double p[2];
1076  DenseMatrix A;
1077  mutable DenseMatrix D;
1078  mutable Vector pol;
1079 public:
1082  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
1083  virtual void CalcDShape(const IntegrationPoint &ip,
1084  DenseMatrix &dshape) const;
1085  // virtual void ProjectDelta(int vertex, Vector &dofs) const;
1086 };
1087
1088 /// A 2D bi-quadratic element on a square with uniformly spaced nodes
1090 {
1091 public:
1094
1095  /** virtual function which evaluates the values of all
1096  shape functions at a given point ip and stores
1097  them in the vector shape of dimension Dof (9) */
1098  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
1099
1100  /** virtual function which evaluates the values of all
1101  partial derivatives of all shape functions at a given
1102  point ip and stores them in the matrix dshape (Dof x Dim) (9 x 2)
1103  so that each row contains the derivatives of one shape function */
1104  virtual void CalcDShape(const IntegrationPoint &ip,
1105  DenseMatrix &dshape) const;
1106  virtual void ProjectDelta(int vertex, Vector &dofs) const;
1107 };
1108
1109
1110 /// A 2D positive bi-quadratic element on a square utilizing the 2nd order
1111 /// Bernstein basis
1113 {
1114 public:
1117  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
1118  virtual void CalcDShape(const IntegrationPoint &ip,
1119  DenseMatrix &dshape) const;
1121  DenseMatrix &I) const;
1122  using FiniteElement::Project;
1123  virtual void Project(Coefficient &coeff, ElementTransformation &Trans,
1124  Vector &dofs) const;
1125  virtual void Project(VectorCoefficient &vc, ElementTransformation &Trans,
1126  Vector &dofs) const;
1127  virtual void ProjectDelta(int vertex, Vector &dofs) const
1128  { dofs = 0.; dofs(vertex) = 1.; }
1129 };
1130
1131 /// A 2D bi-quadratic element on a square with nodes at the 9 "Gaussian" points
1133 {
1134 public:
1137  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
1138  virtual void CalcDShape(const IntegrationPoint &ip,
1139  DenseMatrix &dshape) const;
1140  // virtual void ProjectDelta(int vertex, Vector &dofs) const { dofs = 1.; }
1141 };
1142
1143
1144 /// A 2D bi-cubic element on a square with uniformly spaces nodes
1146 {
1147 public:
1148  /// Construct the BiCubic2DFiniteElement
1150  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
1151  virtual void CalcDShape(const IntegrationPoint &ip,
1152  DenseMatrix &dshape) const;
1153
1154  /// Compute the Hessian of second order partial derivatives at @a ip.
1155  virtual void CalcHessian (const IntegrationPoint &ip,
1156  DenseMatrix &h) const;
1157 };
1158
1159 /// A 1D cubic element with uniformly spaced nodes
1161 {
1162 public:
1163  /// Construct the Cubic1DFiniteElement
1165
1166  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
1167
1168  virtual void CalcDShape(const IntegrationPoint &ip,
1169  DenseMatrix &dshape) const;
1170 };
1171
1172 /// A 2D cubic element on a triangle with uniformly spaced nodes
1174 {
1175 public:
1176  /// Construct the Cubic2DFiniteElement
1178
1179  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
1180
1181  virtual void CalcDShape(const IntegrationPoint &ip,
1182  DenseMatrix &dshape) const;
1183
1184  virtual void CalcHessian (const IntegrationPoint &ip,
1185  DenseMatrix &h) const;
1186 };
1187
1188 /// A 3D cubic element on a tetrahedron with 20 nodes at the thirds of the
1189 /// tetrahedron
1191 {
1192 public:
1193  /// Construct the Cubic3DFiniteElement
1195
1196  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
1197
1198  virtual void CalcDShape(const IntegrationPoint &ip,
1199  DenseMatrix &dshape) const;
1200 };
1201
1202 /// A 2D constant element on a triangle
1204 {
1205 public:
1206  /// Construct the P0TriangleFiniteElement
1208
1209  /// evaluate shape function - constant 1
1210  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
1211
1212  /// evaluate derivatives of shape function - constant 0
1213  virtual void CalcDShape(const IntegrationPoint &ip,
1214  DenseMatrix &dshape) const;
1215  virtual void ProjectDelta(int vertex, Vector &dofs) const
1216  { dofs(0) = 1.0; }
1217 };
1218
1219
1220 /// A 2D constant element on a square
1222 {
1223 public:
1226  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
1227  virtual void CalcDShape(const IntegrationPoint &ip,
1228  DenseMatrix &dshape) const;
1229  virtual void ProjectDelta(int vertex, Vector &dofs) const
1230  { dofs(0) = 1.0; }
1231 };
1232
1233
1234 /** @brief A 3D linear element on a tetrahedron with nodes at the
1235  vertices of the tetrahedron */
1237 {
1238 public:
1239  /// Construct the Linear3DFiniteElement
1241
1242  /** @brief virtual function which evaluates the values of all
1243  shape functions at a given point ip and stores
1244  them in the vector shape of dimension Dof (4) */
1245  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
1246
1247  /** @brief virtual function which evaluates the values of all
1248  partial derivatives of all shape functions at a given
1249  point ip and stores them in the matrix dshape (Dof x Dim) (4 x 3)
1250  so that each row contains the derivatives of one shape function */
1251  virtual void CalcDShape(const IntegrationPoint &ip,
1252  DenseMatrix &dshape) const;
1253
1254  virtual void ProjectDelta(int vertex, Vector &dofs) const
1255  { dofs = 0.0; dofs(vertex) = 1.0; }
1256
1257  /** @brief Get the dofs associated with the given @a face.
1258  @a *dofs is set to an internal array of the local dofc on the
1259  face, while *ndofs is set to the number of dofs on that face.
1260  */
1261  virtual void GetFaceDofs(int face, int **dofs, int *ndofs) const;
1262 };
1263
1264 /// A 3D quadratic element on a tetrahedron with uniformly spaced nodes
1266 {
1267 public:
1270
1271  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
1272
1273  virtual void CalcDShape(const IntegrationPoint &ip,
1274  DenseMatrix &dshape) const;
1275 };
1276
1277 /// A 3D tri-linear element on a cube with nodes at the vertices of the cube
1279 {
1280 public:
1281  /// Construct the TriLinear3DFiniteElement
1283
1284  /** virtual function which evaluates the values of all
1285  shape functions at a given point ip and stores
1286  them in the vector shape of dimension Dof (8) */
1287  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
1288
1289  /** virtual function which evaluates the values of all
1290  partial derivatives of all shape functions at a given
1291  point ip and stores them in the matrix dshape (Dof x Dim) (8 x 3)
1292  so that each row contains the derivatives of one shape function */
1293  virtual void CalcDShape(const IntegrationPoint &ip,
1294  DenseMatrix &dshape) const;
1295
1296  virtual void ProjectDelta(int vertex, Vector &dofs) const
1297  { dofs = 0.0; dofs(vertex) = 1.0; }
1298 };
1299
1300
1301 /// A 2D Crouzeix-Raviart element on triangle
1303 {
1304 public:
1305  /// Construct the CrouzeixRaviartFiniteElement
1307  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
1308  virtual void CalcDShape(const IntegrationPoint &ip,
1309  DenseMatrix &dshape) const;
1310  virtual void ProjectDelta(int vertex, Vector &dofs) const
1311  { dofs = 1.0; }
1312 };
1313
1314 /// A 2D Crouzeix-Raviart finite element on square
1316 {
1317 public:
1320  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
1321  virtual void CalcDShape(const IntegrationPoint &ip,
1322  DenseMatrix &dshape) const;
1323 };
1324
1325
1326 /// A 1D constant element on a segment
1328 {
1329 public:
1330  /// Construct the P0SegmentFiniteElement with dummy order @a Ord
1331  P0SegmentFiniteElement(int Ord = 0);
1332  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
1333  virtual void CalcDShape(const IntegrationPoint &ip,
1334  DenseMatrix &dshape) const;
1335 };
1336
1337 /** @brief A 2D 1st order Raviart-Thomas vector element on a triangle */
1339 {
1340 private:
1341  static const double nk[3][2];
1342
1343 public:
1344  /// Construct the RT0TriangleFiniteElement
1346
1347  virtual void CalcVShape(const IntegrationPoint &ip,
1348  DenseMatrix &shape) const;
1349
1351  DenseMatrix &shape) const
1352  { CalcVShape_RT(Trans, shape); }
1353
1354  virtual void CalcDivShape(const IntegrationPoint &ip,
1355  Vector &divshape) const;
1356
1358  DenseMatrix &I) const;
1359
1360  using FiniteElement::Project;
1361
1362  virtual void Project (VectorCoefficient &vc,
1363  ElementTransformation &Trans, Vector &dofs) const;
1364 };
1365
1366 /** @brief A 2D 1st order Raviart-Thomas vector element on a square*/
1368 {
1369 private:
1370  static const double nk[4][2];
1371
1372 public:
1375
1376  virtual void CalcVShape(const IntegrationPoint &ip,
1377  DenseMatrix &shape) const;
1378
1380  DenseMatrix &shape) const
1381  { CalcVShape_RT(Trans, shape); }
1382
1383  virtual void CalcDivShape(const IntegrationPoint &ip,
1384  Vector &divshape) const;
1385
1387  DenseMatrix &I) const;
1388
1389  using FiniteElement::Project;
1390
1391  virtual void Project (VectorCoefficient &vc,
1392  ElementTransformation &Trans, Vector &dofs) const;
1393 };
1394
1395 /** @brief A 2D 2nd order Raviart-Thomas vector element on a triangle */
1397 {
1398 private:
1399  static const double nk[8][2];
1400
1401 public:
1402  /// Construct the RT1TriangleFiniteElement
1404
1405  virtual void CalcVShape(const IntegrationPoint &ip,
1406  DenseMatrix &shape) const;
1407
1409  DenseMatrix &shape) const
1410  { CalcVShape_RT(Trans, shape); }
1411
1412  virtual void CalcDivShape(const IntegrationPoint &ip,
1413  Vector &divshape) const;
1414
1416  DenseMatrix &I) const;
1417
1418  using FiniteElement::Project;
1419
1420  virtual void Project (VectorCoefficient &vc,
1421  ElementTransformation &Trans, Vector &dofs) const;
1422 };
1423
1424 /** @brief A 2D 2nd order Raviart-Thomas vector element on a square */
1426 {
1427 private:
1428  static const double nk[12][2];
1429
1430 public:
1433
1434  virtual void CalcVShape(const IntegrationPoint &ip,
1435  DenseMatrix &shape) const;
1436
1438  DenseMatrix &shape) const
1439  { CalcVShape_RT(Trans, shape); }
1440
1441  virtual void CalcDivShape(const IntegrationPoint &ip,
1442  Vector &divshape) const;
1443
1445  DenseMatrix &I) const;
1446
1447  using FiniteElement::Project;
1448
1449  virtual void Project (VectorCoefficient &vc,
1450  ElementTransformation &Trans, Vector &dofs) const;
1451 };
1452
1453 /** @brief A 2D 3rd order Raviart-Thomas vector element on a triangle */
1455 {
1456 private:
1457  static const double M[15][15];
1458 public:
1459  /// Construct the RT2TriangleFiniteElement
1461
1462  virtual void CalcVShape(const IntegrationPoint &ip,
1463  DenseMatrix &shape) const;
1464
1466  DenseMatrix &shape) const
1467  { CalcVShape_RT(Trans, shape); }
1468
1469  virtual void CalcDivShape(const IntegrationPoint &ip,
1470  Vector &divshape) const;
1471 };
1472
1473 /** @brief A 2D 3rd order Raviart-Thomas vector element on a square */
1475 {
1476 private:
1477  static const double nk[24][2];
1478  static const double pt[4];
1479  static const double dpt[3];
1480
1481 public:
1484
1485  virtual void CalcVShape(const IntegrationPoint &ip,
1486  DenseMatrix &shape) const;
1487
1489  DenseMatrix &shape) const
1490  { CalcVShape_RT(Trans, shape); }
1491
1492  virtual void CalcDivShape(const IntegrationPoint &ip,
1493  Vector &divshape) const;
1494
1496  DenseMatrix &I) const;
1497
1498  using FiniteElement::Project;
1499
1500  virtual void Project (VectorCoefficient &vc,
1501  ElementTransformation &Trans, Vector &dofs) const;
1502 };
1503
1504 /// A 1D linear element with nodes at 1/3 and 2/3 (trace of RT1)
1506 {
1507 public:
1508  /// Construct the P1SegmentFiniteElement
1510  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
1511  virtual void CalcDShape(const IntegrationPoint &ip,
1512  DenseMatrix &dshape) const;
1513 };
1514
1515 /// A 1D quadratic element with nodes at the Gaussian points (trace of RT2)
1517 {
1518 public:
1519  /// Construct the P2SegmentFiniteElement
1521  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
1522  virtual void CalcDShape(const IntegrationPoint &ip,
1523  DenseMatrix &dshape) const;
1524 };
1525
1526 /// A 1D element with uniform nodes
1528 {
1529 private:
1530  Vector rwk;
1532  mutable Vector rxxk;
1533 #endif
1534 public:
1535  /// Construct the Lagrange1DFiniteElement with the provided @a degree
1536  Lagrange1DFiniteElement (int degree);
1537  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
1538  virtual void CalcDShape(const IntegrationPoint &ip,
1539  DenseMatrix &dshape) const;
1540 };
1541
1542 /// A 3D Crouzeix-Raviart element on the tetrahedron.
1544 {
1545 public:
1546  /// Construct the P1TetNonConfFiniteElement
1548  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
1549  virtual void CalcDShape(const IntegrationPoint &ip,
1550  DenseMatrix &dshape) const;
1551 };
1552
1553 /// A 3D constant element on a tetrahedron
1555 {
1556 public:
1557  /// Construct the P0TetFiniteElement
1558  P0TetFiniteElement ();
1559  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
1560  virtual void CalcDShape(const IntegrationPoint &ip,
1561  DenseMatrix &dshape) const;
1562  virtual void ProjectDelta(int vertex, Vector &dofs) const
1563  { dofs(0) = 1.0; }
1564 };
1565
1566 /// A 3D constant element on a cube
1568 {
1569 public:
1570  /// Construct the P0HexFiniteElement
1571  P0HexFiniteElement ();
1572  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
1573  virtual void CalcDShape(const IntegrationPoint &ip,
1574  DenseMatrix &dshape) const;
1575  virtual void ProjectDelta(int vertex, Vector &dofs) const
1576  { dofs(0) = 1.0; }
1577 };
1578
1579 /** @brief Tensor products of 1D Lagrange1DFiniteElement
1580  (only degree 2 is functional) */
1582 {
1583 private:
1584  Lagrange1DFiniteElement * fe1d;
1585  int dof1d;
1586  int *I, *J, *K;
1588  mutable Vector shape1dx, shape1dy, shape1dz;
1589  mutable DenseMatrix dshape1dx, dshape1dy, dshape1dz;
1590 #endif
1591
1592 public:
1593  /// Construct the LagrangeHexFiniteElement with the provided @a degree
1594  LagrangeHexFiniteElement (int degree);
1595  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
1596  virtual void CalcDShape(const IntegrationPoint &ip,
1597  DenseMatrix &dshape) const;
1599 };
1600
1601
1602 /// A 1D refined linear element
1604 {
1605 public:
1606  /// Construct the RefinedLinear1DFiniteElement
1608
1609  /** virtual function which evaluates the values of all
1610  shape functions at a given point ip and stores
1611  them in the vector shape of dimension Dof (3) */
1612  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
1613
1614  /** virtual function which evaluates the derivatives of all
1615  shape functions at a given point ip and stores them in
1616  the matrix dshape (Dof x Dim) (3 x 1) so that each row
1617  contains the derivative of one shape function */
1618  virtual void CalcDShape(const IntegrationPoint &ip,
1619  DenseMatrix &dshape) const;
1620 };
1621
1622 /// A 2D refined linear element on a triangle
1624 {
1625 public:
1626  /// Construct the RefinedLinear2DFiniteElement
1628
1629  /** virtual function which evaluates the values of all
1630  shape functions at a given point ip and stores
1631  them in the vector shape of dimension Dof (6) */
1632  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
1633
1634  /** virtual function which evaluates the values of all
1635  partial derivatives of all shape functions at a given
1636  point ip and stores them in the matrix dshape (Dof x Dim) (6 x 2)
1637  so that each row contains the derivatives of one shape function */
1638  virtual void CalcDShape(const IntegrationPoint &ip,
1639  DenseMatrix &dshape) const;
1640 };
1641
1642 /// A 2D refined linear element on a tetrahedron
1644 {
1645 public:
1646  /// Construct the RefinedLinear3DFiniteElement
1648
1649  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
1650
1651  virtual void CalcDShape(const IntegrationPoint &ip,
1652  DenseMatrix &dshape) const;
1653 };
1654
1655 /// A 2D refined bi-linear FE on a square
1657 {
1658 public:
1659  /// Construct the RefinedBiLinear2DFiniteElement
1661
1662  /** virtual function which evaluates the values of all
1663  shape functions at a given point ip and stores
1664  them in the vector shape of dimension Dof (9) */
1665  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
1666
1667  /** virtual function which evaluates the values of all
1668  partial derivatives of all shape functions at a given
1669  point ip and stores them in the matrix dshape (Dof x Dim) (9 x 2)
1670  so that each row contains the derivatives of one shape function */
1671  virtual void CalcDShape(const IntegrationPoint &ip,
1672  DenseMatrix &dshape) const;
1673 };
1674
1675 /// A 3D refined tri-linear element on a cube
1677 {
1678 public:
1679  /// Construct the RefinedTriLinear3DFiniteElement
1681
1682  /** virtual function which evaluates the values of all
1683  shape functions at a given point ip and stores
1684  them in the vector shape of dimension Dof (9) */
1685  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
1686
1687  /** virtual function which evaluates the values of all
1688  partial derivatives of all shape functions at a given
1689  point ip and stores them in the matrix dshape (Dof x Dim) (9 x 2)
1690  so that each row contains the derivatives of one shape function */
1691  virtual void CalcDShape(const IntegrationPoint &ip,
1692  DenseMatrix &dshape) const;
1693 };
1694
1695
1696 /// A 3D 1st order Nedelec element on a cube
1698 {
1699 private:
1700  static const double tk[12][3];
1701
1702 public:
1703  /// Construct the Nedelec1HexFiniteElement
1705  virtual void CalcVShape(const IntegrationPoint &ip,
1706  DenseMatrix &shape) const;
1708  DenseMatrix &shape) const
1709  { CalcVShape_ND(Trans, shape); }
1710  virtual void CalcCurlShape(const IntegrationPoint &ip,
1711  DenseMatrix &curl_shape) const;
1713  DenseMatrix &I) const;
1714  using FiniteElement::Project;
1715  virtual void Project (VectorCoefficient &vc,
1716  ElementTransformation &Trans, Vector &dofs) const;
1717 };
1718
1719
1720 /// A 3D 1st order Nedelec element on a tetrahedron
1722 {
1723 private:
1724  static const double tk[6][3];
1725
1726 public:
1727  /// Construct the Nedelec1TetFiniteElement
1729  virtual void CalcVShape(const IntegrationPoint &ip,
1730  DenseMatrix &shape) const;
1732  DenseMatrix &shape) const
1733  { CalcVShape_ND(Trans, shape); }
1734  virtual void CalcCurlShape(const IntegrationPoint &ip,
1735  DenseMatrix &curl_shape) const;
1737  DenseMatrix &I) const;
1738  using FiniteElement::Project;
1739  virtual void Project (VectorCoefficient &vc,
1740  ElementTransformation &Trans, Vector &dofs) const;
1741 };
1742
1743
1744 /// A 3D 0th order Raviert-Thomas element on a cube
1746 {
1747 private:
1748  static const double nk[6][3];
1749
1750 public:
1751  /// Construct the RT0HexFiniteElement
1753
1754  virtual void CalcVShape(const IntegrationPoint &ip,
1755  DenseMatrix &shape) const;
1756
1758  DenseMatrix &shape) const
1759  { CalcVShape_RT(Trans, shape); }
1760
1761  virtual void CalcDivShape(const IntegrationPoint &ip,
1762  Vector &divshape) const;
1763
1765  DenseMatrix &I) const;
1766
1767  using FiniteElement::Project;
1768
1769  virtual void Project (VectorCoefficient &vc,
1770  ElementTransformation &Trans, Vector &dofs) const;
1771 };
1772
1773
1774 /// A 3D 1st order Raviert-Thomas element on a cube
1776 {
1777 private:
1778  static const double nk[36][3];
1779
1780 public:
1781  /// Construct the RT1HexFiniteElement
1783
1784  virtual void CalcVShape(const IntegrationPoint &ip,
1785  DenseMatrix &shape) const;
1786
1788  DenseMatrix &shape) const
1789  { CalcVShape_RT(Trans, shape); }
1790
1791  virtual void CalcDivShape(const IntegrationPoint &ip,
1792  Vector &divshape) const;
1793
1795  DenseMatrix &I) const;
1796
1797  using FiniteElement::Project;
1798
1799  virtual void Project (VectorCoefficient &vc,
1800  ElementTransformation &Trans, Vector &dofs) const;
1801 };
1802
1803
1804 /// A 3D 0th order Raviert-Thomas element on a tetrahedron
1806 {
1807 private:
1808  static const double nk[4][3];
1809
1810 public:
1811  /// Construct the RT0TetFiniteElement
1813
1814  virtual void CalcVShape(const IntegrationPoint &ip,
1815  DenseMatrix &shape) const;
1816
1818  DenseMatrix &shape) const
1819  { CalcVShape_RT(Trans, shape); }
1820
1821  virtual void CalcDivShape(const IntegrationPoint &ip,
1822  Vector &divshape) const;
1823
1825  DenseMatrix &I) const;
1826
1827  using FiniteElement::Project;
1828
1829  virtual void Project (VectorCoefficient &vc,
1830  ElementTransformation &Trans, Vector &dofs) const;
1831 };
1832
1833
1835 {
1836 public:
1837  /// Construct the RotTriLinearHexFiniteElement
1839  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
1840  virtual void CalcDShape(const IntegrationPoint &ip,
1841  DenseMatrix &dshape) const;
1842 };
1843
1844
1845 /// Class for computing 1D special polynomials and their associated basis
1846 /// functions
1847 class Poly_1D
1848 {
1849 public:
1851  {
1852  ChangeOfBasis = 0, // Use change of basis, O(p^2) Evals
1853  Barycentric = 1, // Use barycentric Lagrangian interpolation, O(p) Evals
1854  Positive = 2, // Fast evaluation of Bernstein polynomials
1855  NumEvalTypes = 3 // Keep count of the number of eval types
1856  };
1857
1858  class Basis
1859  {
1860  private:
1861  int etype;
1862  DenseMatrixInverse Ai;
1863  mutable Vector x, w;
1864
1865  public:
1866  /// Create a nodal or positive (Bernstein) basis
1867  Basis(const int p, const double *nodes, EvalType etype = Barycentric);
1868  void Eval(const double x, Vector &u) const;
1869  void Eval(const double x, Vector &u, Vector &d) const;
1870  void Eval(const double x, Vector &u, Vector &d, Vector &d2) const;
1871  };
1872
1873 private:
1874  typedef std::map< int, Array<double*>* > PointsMap;
1875  typedef std::map< int, Array<Basis*>* > BasisMap;
1876
1877  MemoryType h_mt;
1878  PointsMap points_container;
1879  BasisMap bases_container;
1880
1881  static Array2D<int> binom;
1882
1883  static void CalcMono(const int p, const double x, double *u);
1884  static void CalcMono(const int p, const double x, double *u, double *d);
1885
1886  static void CalcChebyshev(const int p, const double x, double *u);
1887  static void CalcChebyshev(const int p, const double x, double *u, double *d);
1888  static void CalcChebyshev(const int p, const double x, double *u, double *d,
1889  double *dd);
1890
1892
1893 public:
1894  Poly_1D(): h_mt(MemoryType::HOST) { }
1895
1896  /** @brief Get a pointer to an array containing the binomial coefficients "p
1897  choose k" for k=0,...,p for the given p. */
1898  static const int *Binom(const int p);
1899
1900  /** @brief Get the coordinates of the points of the given BasisType,
1901  @a btype.
1902
1903  @param[in] p The polynomial degree; the number of points is p+1.
1904  @param[in] btype The BasisType.
1905
1906  @return A pointer to an array containing the p+1 coordinates of the
1907  points. Returns NULL if the BasisType has no associated set of
1908  points. */
1909  const double *GetPoints(const int p, const int btype);
1910
1911  /// Get coordinates of an open (GaussLegendre) set of points if degree @a p
1912  const double *OpenPoints(const int p,
1913  const int btype = BasisType::GaussLegendre)
1914  { return GetPoints(p, btype); }
1915
1916  /// Get coordinates of a closed (GaussLegendre) set of points if degree @a p
1917  const double *ClosedPoints(const int p,
1918  const int btype = BasisType::GaussLobatto)
1919  { return GetPoints(p, btype); }
1920
1921  /** @brief Get a Poly_1D::Basis object of the given degree and BasisType,
1922  @a btype.
1923
1924  @param[in] p The polynomial degree of the basis.
1925  @param[in] btype The BasisType.
1926
1927  @return A reference to an object of type Poly_1D::Basis that represents
1928  the requested basis type. */
1929  Basis &GetBasis(const int p, const int btype);
1930
1931  /** @brief Evaluate the values of a hierarchical 1D basis at point x
1932  hierarchical = k-th basis function is degree k polynomial */
1933  static void CalcBasis(const int p, const double x, double *u)
1934  // { CalcMono(p, x, u); }
1935  // Bernstein basis is not hierarchical --> does not work for triangles
1936  // and tetrahedra
1937  // { CalcBernstein(p, x, u); }
1938  // { CalcLegendre(p, x, u); }
1939  { CalcChebyshev(p, x, u); }
1940
1941  /// Evaluate the values and derivatives of a hierarchical 1D basis at point @a x
1942  static void CalcBasis(const int p, const double x, double *u, double *d)
1943  // { CalcMono(p, x, u, d); }
1944  // { CalcBernstein(p, x, u, d); }
1945  // { CalcLegendre(p, x, u, d); }
1946  { CalcChebyshev(p, x, u, d); }
1947
1948  /// Evaluate the values, derivatives and second derivatives of a hierarchical 1D basis at point x
1949  static void CalcBasis(const int p, const double x, double *u, double *d,
1950  double *dd)
1951  // { CalcMono(p, x, u, d); }
1952  // { CalcBernstein(p, x, u, d); }
1953  // { CalcLegendre(p, x, u, d); }
1954  { CalcChebyshev(p, x, u, d, dd); }
1955
1956  /// Evaluate a representation of a Delta function at point x
1957  static double CalcDelta(const int p, const double x)
1958  { return pow(x, (double) p); }
1959
1960  /** @brief Compute the points for the Chebyshev polynomials of order @a p
1961  and place them in the already allocated @a x array. */
1962  static void ChebyshevPoints(const int p, double *x);
1963
1964  /** @brief Compute the @a p terms in the expansion of the binomial (x + y)^p
1965  and store them in the already allocated @a u array. */
1966  static void CalcBinomTerms(const int p, const double x, const double y,
1967  double *u);
1968  /** @brief Compute the terms in the expansion of the binomial (x + y)^p and
1969  their derivatives with respect to x assuming that dy/dx = -1. Store the
1970  results in the already allocated @a u and @a d arrays.*/
1971  static void CalcBinomTerms(const int p, const double x, const double y,
1972  double *u, double *d);
1973  /** @brief Compute the derivatives (w.r.t. x) of the terms in the expansion
1974  of the binomial (x + y)^p assuming that dy/dx = -1. Store the results
1975  in the already allocated @a d array.*/
1976  static void CalcDBinomTerms(const int p, const double x, const double y,
1977  double *d);
1978
1979  /** @brief Compute the values of the Bernstein basis functions of order
1980  @a p at coordinate @a x and store the results in the already allocated
1981  @a u array. */
1982  static void CalcBernstein(const int p, const double x, double *u)
1983  { CalcBinomTerms(p, x, 1. - x, u); }
1984
1985  /** @brief Compute the values and derivatives of the Bernstein basis functions
1986  of order @a p at coordinate @a x and store the results in the already allocated
1987  @a u and @a d arrays. */
1988  static void CalcBernstein(const int p, const double x, double *u, double *d)
1989  { CalcBinomTerms(p, x, 1. - x, u, d); }
1990
1991  static void CalcLegendre(const int p, const double x, double *u);
1992  static void CalcLegendre(const int p, const double x, double *u, double *d);
1993
1994  ~Poly_1D();
1995 };
1996
1997 extern Poly_1D poly1d;
1998
1999
2000 /// An element defined as an ND tensor product of 1D elements on a segment,
2001 /// square, or cube
2003 {
2004 protected:
2005  int b_type;
2009
2010 public:
2012  {
2015  Sr_DOF_MAP = 2, // Sr = Serendipity
2016  };
2017
2018  TensorBasisElement(const int dims, const int p, const int btype,
2019  const DofMapType dmtype);
2020
2021  int GetBasisType() const { return b_type; }
2022
2023  const Poly_1D::Basis& GetBasis1D() const { return basis1d; }
2024
2025  /** @brief Get an Array<int> that maps lexicographically ordered indices to
2026  the indices of the respective nodes/dofs/basis functions. If the dofs are
2027  ordered lexicographically, i.e. the mapping is identity, the returned
2028  Array will be empty. */
2029  const Array<int> &GetDofMap() const { return dof_map; }
2030
2032  {
2033  switch (dim)
2034  {
2035  case 1: return Geometry::SEGMENT;
2036  case 2: return Geometry::SQUARE;
2037  case 3: return Geometry::CUBE;
2038  default:
2039  MFEM_ABORT("invalid dimension: " << dim);
2040  return Geometry::INVALID;
2041  }
2042  }
2043
2044  /// Return @a base raised to the power @a dim.
2045  static int Pow(int base, int dim)
2046  {
2047  switch (dim)
2048  {
2049  case 1: return base;
2050  case 2: return base*base;
2051  case 3: return base*base*base;
2052  default: MFEM_ABORT("invalid dimension: " << dim); return -1;
2053  }
2054  }
2055 };
2056
2058  public TensorBasisElement
2059 {
2060 public:
2061  NodalTensorFiniteElement(const int dims, const int p, const int btype,
2062  const DofMapType dmtype);
2063
2066  {
2067  return (mode == DofToQuad::FULL) ?
2070  }
2071 };
2072
2074  public TensorBasisElement
2075 {
2076 public:
2077  PositiveTensorFiniteElement(const int dims, const int p,
2078  const DofMapType dmtype);
2079
2082  {
2083  return (mode == DofToQuad::FULL) ?
2086  }
2087 };
2088
2090  public TensorBasisElement
2091 {
2092 private:
2094
2095 protected:
2097
2098 public:
2099  VectorTensorFiniteElement(const int dims, const int d, const int p,
2100  const int cbtype, const int obtype,
2101  const int M, const DofMapType dmtype);
2102
2105
2108
2111  const bool closed) const;
2112
2114 };
2115
2116 /// Arbitrary H1 elements in 1D
2118 {
2119 private:
2121  mutable Vector shape_x, dshape_x, d2shape_x;
2122 #endif
2123
2124 public:
2125  /// Construct the H1_SegmentElement of order @a p and BasisType @a btype
2126  H1_SegmentElement(const int p, const int btype = BasisType::GaussLobatto);
2127  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
2128  virtual void CalcDShape(const IntegrationPoint &ip,
2129  DenseMatrix &dshape) const;
2130  virtual void CalcHessian(const IntegrationPoint &ip,
2131  DenseMatrix &Hessian) const;
2132  virtual void ProjectDelta(int vertex, Vector &dofs) const;
2133 };
2134
2135
2136 /// Arbitrary H1 elements in 2D on a square
2138 {
2139 private:
2141  mutable Vector shape_x, shape_y, dshape_x, dshape_y, d2shape_x, d2shape_y;
2142 #endif
2143
2144 public:
2145  /// Construct the H1_QuadrilateralElement of order @a p and BasisType @a btype
2147  const int btype = BasisType::GaussLobatto);
2148  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
2149  virtual void CalcDShape(const IntegrationPoint &ip,
2150  DenseMatrix &dshape) const;
2151  virtual void CalcHessian(const IntegrationPoint &ip,
2152  DenseMatrix &Hessian) const;
2153  virtual void ProjectDelta(int vertex, Vector &dofs) const;
2154 };
2155
2156
2157 /// Arbitrary H1 elements in 3D on a cube
2159 {
2160 private:
2162  mutable Vector shape_x, shape_y, shape_z, dshape_x, dshape_y, dshape_z,
2163  d2shape_x, d2shape_y, d2shape_z;
2164 #endif
2165
2166 public:
2167  /// Construct the H1_HexahedronElement of order @a p and BasisType @a btype
2168  H1_HexahedronElement(const int p, const int btype = BasisType::GaussLobatto);
2169  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
2170  virtual void CalcDShape(const IntegrationPoint &ip,
2171  DenseMatrix &dshape) const;
2172  virtual void CalcHessian(const IntegrationPoint &ip,
2173  DenseMatrix &Hessian) const;
2174  virtual void ProjectDelta(int vertex, Vector &dofs) const;
2175 };
2176
2177 /// Arbitrary order H1 elements in 1D utilizing the Bernstein basis
2179 {
2180 private:
2182  // This is to share scratch space between invocations, which helps speed
2183  // things up, but with OpenMP, we need one copy per thread. Right now, we
2184  // solve this by allocating this space within each function call every time
2185  // we call it. Alternatively, we should do some sort thread private thing.
2186  // Brunner, Jan 2014
2187  mutable Vector shape_x, dshape_x;
2188 #endif
2189
2190 public:
2191  /// Construct the H1Pos_SegmentElement of order @a p
2192  H1Pos_SegmentElement(const int p);
2193  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
2194  virtual void CalcDShape(const IntegrationPoint &ip,
2195  DenseMatrix &dshape) const;
2196  virtual void ProjectDelta(int vertex, Vector &dofs) const;
2197 };
2198
2199
2200 /// Arbitrary order H1 elements in 2D utilizing the Bernstein basis on a square
2202 {
2203 private:
2205  // See comment in H1Pos_SegmentElement
2206  mutable Vector shape_x, shape_y, dshape_x, dshape_y;
2207 #endif
2208
2209 public:
2210  /// Construct the H1Pos_QuadrilateralElement of order @a p
2212  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
2213  virtual void CalcDShape(const IntegrationPoint &ip,
2214  DenseMatrix &dshape) const;
2215  virtual void ProjectDelta(int vertex, Vector &dofs) const;
2216 };
2217
2218
2219 /// Arbitrary order H1 serendipity elements in 2D on a quad
2221 {
2222 public:
2223  /// Construct the H1Ser_QuadrilateralElement of order @a p
2225  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
2226  virtual void CalcDShape(const IntegrationPoint &ip,
2227  DenseMatrix &dshape) const;
2229  DenseMatrix &I) const;
2230  using FiniteElement::Project;
2231 };
2232
2233 /// Arbitrary order H1 elements in 3D utilizing the Bernstein basis on a cube
2235 {
2236 private:
2238  // See comment in H1Pos_SegementElement.
2239  mutable Vector shape_x, shape_y, shape_z, dshape_x, dshape_y, dshape_z;
2240 #endif
2241
2242 public:
2243  /// Construct the H1Pos_HexahedronElement of order @a p
2244  H1Pos_HexahedronElement(const int p);
2245  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
2246  virtual void CalcDShape(const IntegrationPoint &ip,
2247  DenseMatrix &dshape) const;
2248  virtual void ProjectDelta(int vertex, Vector &dofs) const;
2249 };
2250
2251
2252 /// Arbitrary order H1 elements in 2D on a triangle
2254 {
2255 private:
2257  mutable Vector shape_x, shape_y, shape_l, dshape_x, dshape_y, dshape_l, u;
2258  mutable Vector ddshape_x, ddshape_y, ddshape_l;
2259  mutable DenseMatrix du, ddu;
2260 #endif
2261  DenseMatrixInverse Ti;
2262
2263 public:
2264  /// Construct the H1_TriangleElement of order @a p and BasisType @a btype
2265  H1_TriangleElement(const int p, const int btype = BasisType::GaussLobatto);
2266  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
2267  virtual void CalcDShape(const IntegrationPoint &ip,
2268  DenseMatrix &dshape) const;
2269  virtual void CalcHessian(const IntegrationPoint &ip,
2270  DenseMatrix &ddshape) const;
2271 };
2272
2273
2274 /// Arbitrary order H1 elements in 3D on a tetrahedron
2276 {
2277 private:
2279  mutable Vector shape_x, shape_y, shape_z, shape_l;
2280  mutable Vector dshape_x, dshape_y, dshape_z, dshape_l, u;
2281  mutable Vector ddshape_x, ddshape_y, ddshape_z, ddshape_l;
2282  mutable DenseMatrix du, ddu;
2283 #endif
2284  DenseMatrixInverse Ti;
2285
2286 public:
2287  /// Construct the H1_TetrahedronElement of order @a p and BasisType @a btype
2288  H1_TetrahedronElement(const int p,
2289  const int btype = BasisType::GaussLobatto);
2290  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
2291  virtual void CalcDShape(const IntegrationPoint &ip,
2292  DenseMatrix &dshape) const;
2293  virtual void CalcHessian(const IntegrationPoint &ip,
2294  DenseMatrix &ddshape) const;
2295 };
2296
2297
2298 /// Arbitrary order H1 elements in 2D utilizing the Bernstein basis on a triangle
2300 {
2301 protected:
2305 #endif
2307
2308 public:
2309  /// Construct the H1Pos_TriangleElement of order @a p
2310  H1Pos_TriangleElement(const int p);
2311
2312  // The size of shape is (p+1)(p+2)/2 (dof).
2313  static void CalcShape(const int p, const double x, const double y,
2314  double *shape);
2315
2316  // The size of dshape_1d is p+1; the size of dshape is (dof x dim).
2317  static void CalcDShape(const int p, const double x, const double y,
2318  double *dshape_1d, double *dshape);
2319
2320  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
2321  virtual void CalcDShape(const IntegrationPoint &ip,
2322  DenseMatrix &dshape) const;
2323 };
2324
2325
2326 /// Arbitrary order H1 elements in 3D utilizing the Bernstein basis on a
2327 /// tetrahedron
2329 {
2330 protected:
2334 #endif
2336
2337 public:
2338  /// Construct the H1Pos_TetrahedronElement of order @a p
2339  H1Pos_TetrahedronElement(const int p);
2340
2341  // The size of shape is (p+1)(p+2)(p+3)/6 (dof).
2342  static void CalcShape(const int p, const double x, const double y,
2343  const double z, double *shape);
2344
2345  // The size of dshape_1d is p+1; the size of dshape is (dof x dim).
2346  static void CalcDShape(const int p, const double x, const double y,
2347  const double z, double *dshape_1d, double *dshape);
2348
2349  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
2350  virtual void CalcDShape(const IntegrationPoint &ip,
2351  DenseMatrix &dshape) const;
2352 };
2353
2354
2355 /// Arbitrary order H1 elements in 3D on a wedge
2357 {
2358 private:
2360  mutable Vector t_shape, s_shape;
2361  mutable DenseMatrix t_dshape, s_dshape;
2362 #endif
2363  Array<int> t_dof, s_dof;
2364
2365  H1_TriangleElement TriangleFE;
2366  H1_SegmentElement SegmentFE;
2367
2368 public:
2369  /// Construct the H1_WedgeElement of order @a p and BasisType @a btype
2370  H1_WedgeElement(const int p,
2371  const int btype = BasisType::GaussLobatto);
2372  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
2373  virtual void CalcDShape(const IntegrationPoint &ip,
2374  DenseMatrix &dshape) const;
2375 };
2376
2377 /// Class for linear FE on wedge
2379 {
2380 public:
2381  /// Construct a linear FE on wedge
2383 };
2384
2385 /// Class for quadratic FE on wedge
2387 {
2388 public:
2389  /// Construct a quadratic FE on wedge
2391 };
2392
2393 /// Class for cubic FE on wedge
2395 {
2396 public:
2397  /// Construct a cubic FE on wedge
2399 };
2400
2401 /// Arbitrary order H1 elements in 3D utilizing the Bernstein basis on a wedge
2403 {
2404 protected:
2408 #endif
2410
2413
2414 public:
2415  /// Construct the H1Pos_WedgeElement of order @a p
2416  H1Pos_WedgeElement(const int p);
2417
2418  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
2419  virtual void CalcDShape(const IntegrationPoint &ip,
2420  DenseMatrix &dshape) const;
2421 };
2422
2423
2424 /// Arbitrary L2 elements in 1D on a segment
2426 {
2427 private:
2429  mutable Vector shape_x, dshape_x;
2430 #endif
2431
2432 public:
2433  /// Construct the L2_SegmentElement of order @a p and BasisType @a btype
2434  L2_SegmentElement(const int p, const int btype = BasisType::GaussLegendre);
2435  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
2436  virtual void CalcDShape(const IntegrationPoint &ip,
2437  DenseMatrix &dshape) const;
2438  virtual void ProjectDelta(int vertex, Vector &dofs) const;
2439 };
2440
2441 /// Arbitrary order L2 elements in 1D utilizing the Bernstein basis on a segment
2443 {
2444 private:
2446  mutable Vector shape_x, dshape_x;
2447 #endif
2448
2449 public:
2450  /// Construct the L2Pos_SegmentElement of order @a p
2451  L2Pos_SegmentElement(const int p);
2452  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
2453  virtual void CalcDShape(const IntegrationPoint &ip,
2454  DenseMatrix &dshape) const;
2455  virtual void ProjectDelta(int vertex, Vector &dofs) const;
2456 };
2457
2458
2459 /// Arbitrary order L2 elements in 2D on a square
2461 {
2462 private:
2464  mutable Vector shape_x, shape_y, dshape_x, dshape_y;
2465 #endif
2466
2467 public:
2468  /// Construct the L2_QuadrilateralElement of order @a p and BasisType @a btype
2470  const int btype = BasisType::GaussLegendre);
2471  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
2472  virtual void CalcDShape(const IntegrationPoint &ip,
2473  DenseMatrix &dshape) const;
2474  virtual void ProjectDelta(int vertex, Vector &dofs) const;
2475  virtual void ProjectCurl(const FiniteElement &fe,
2477  DenseMatrix &curl) const
2478  { ProjectCurl_2D(fe, Trans, curl); }
2479 };
2480
2481 /// Arbitrary order L2 elements in 2D utilizing the Bernstein basis on a square
2483 {
2484 private:
2486  mutable Vector shape_x, shape_y, dshape_x, dshape_y;
2487 #endif
2488
2489 public:
2490  /// Construct the L2Pos_QuadrilateralElement of order @a p
2492  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
2493  virtual void CalcDShape(const IntegrationPoint &ip,
2494  DenseMatrix &dshape) const;
2495  virtual void ProjectDelta(int vertex, Vector &dofs) const;
2496 };
2497
2498 /// Arbitrary order L2 elements in 3D on a cube
2500 {
2501 private:
2503  mutable Vector shape_x, shape_y, shape_z, dshape_x, dshape_y, dshape_z;
2504 #endif
2505
2506 public:
2507  /// Construct the L2_HexahedronElement of order @a p and BasisType @a btype
2508  L2_HexahedronElement(const int p,
2509  const int btype = BasisType::GaussLegendre);
2510  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
2511  virtual void CalcDShape(const IntegrationPoint &ip,
2512  DenseMatrix &dshape) const;
2513  virtual void ProjectDelta(int vertex, Vector &dofs) const;
2514 };
2515
2516
2517 /// Arbitrary order L2 elements in 3D utilizing the Bernstein basis on a cube
2519 {
2520 private:
2522  mutable Vector shape_x, shape_y, shape_z, dshape_x, dshape_y, dshape_z;
2523 #endif
2524
2525 public:
2526  /// Construct the L2Pos_HexahedronElement of order @a p
2527  L2Pos_HexahedronElement(const int p);
2528  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
2529  virtual void CalcDShape(const IntegrationPoint &ip,
2530  DenseMatrix &dshape) const;
2531  virtual void ProjectDelta(int vertex, Vector &dofs) const;
2532 };
2533
2534
2535 /// Arbitrary order L2 elements in 2D on a triangle
2537 {
2538 private:
2540  mutable Vector shape_x, shape_y, shape_l, dshape_x, dshape_y, dshape_l, u;
2541  mutable DenseMatrix du;
2542 #endif
2543  DenseMatrixInverse Ti;
2544
2545 public:
2546  /// Construct the L2_TriangleElement of order @a p and BasisType @a btype
2547  L2_TriangleElement(const int p,
2548  const int btype = BasisType::GaussLegendre);
2549  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
2550  virtual void CalcDShape(const IntegrationPoint &ip,
2551  DenseMatrix &dshape) const;
2552  virtual void ProjectDelta(int vertex, Vector &dofs) const;
2553  virtual void ProjectCurl(const FiniteElement &fe,
2555  DenseMatrix &curl) const
2556  { ProjectCurl_2D(fe, Trans, curl); }
2557 };
2558
2559 /// Arbitrary order L2 elements in 2D utilizing the Bernstein basis on a triangle
2561 {
2562 private:
2564  mutable Vector dshape_1d;
2565 #endif
2566
2567 public:
2568  /// Construct the L2Pos_TriangleElement of order @a p
2569  L2Pos_TriangleElement(const int p);
2570  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
2571  virtual void CalcDShape(const IntegrationPoint &ip,
2572  DenseMatrix &dshape) const;
2573  virtual void ProjectDelta(int vertex, Vector &dofs) const;
2574 };
2575
2576
2577 /// Arbitrary order L2 elements in 3D on a tetrahedron
2579 {
2580 private:
2582  mutable Vector shape_x, shape_y, shape_z, shape_l;
2583  mutable Vector dshape_x, dshape_y, dshape_z, dshape_l, u;
2584  mutable DenseMatrix du;
2585 #endif
2586  DenseMatrixInverse Ti;
2587
2588 public:
2589  /// Construct the L2_TetrahedronElement of order @a p and BasisType @a btype
2590  L2_TetrahedronElement(const int p,
2591  const int btype = BasisType::GaussLegendre);
2592  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
2593  virtual void CalcDShape(const IntegrationPoint &ip,
2594  DenseMatrix &dshape) const;
2595  virtual void ProjectDelta(int vertex, Vector &dofs) const;
2596 };
2597
2598
2599 /// Arbitrary order L2 elements in 3D utilizing the Bernstein basis on a
2600 /// tetrahedron
2602 {
2603 private:
2605  mutable Vector dshape_1d;
2606 #endif
2607
2608 public:
2609  /// Construct the L2Pos_TetrahedronElement of order @a p
2610  L2Pos_TetrahedronElement(const int p);
2611  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
2612  virtual void CalcDShape(const IntegrationPoint &ip,
2613  DenseMatrix &dshape) const;
2614  virtual void ProjectDelta(int vertex, Vector &dofs) const;
2615 };
2616
2617
2618 /// Arbitrary order L2 elements in 3D on a wedge
2620 {
2621 private:
2623  mutable Vector t_shape, s_shape;
2624  mutable DenseMatrix t_dshape, s_dshape;
2625 #endif
2626  Array<int> t_dof, s_dof;
2627
2628  L2_TriangleElement TriangleFE;
2629  L2_SegmentElement SegmentFE;
2630
2631 public:
2632  /// Construct the L2_WedgeElement of order @a p and BasisType @a btype
2633  L2_WedgeElement(const int p,
2634  const int btype = BasisType::GaussLegendre);
2635  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
2636  virtual void CalcDShape(const IntegrationPoint &ip,
2637  DenseMatrix &dshape) const;
2638 };
2639
2640 /// A 0th order L2 element on a Wedge
2642 {
2643 public:
2644  /// Construct the P0WedgeFiniteElement
2646 };
2647
2648 /// Arbitrary order L2 elements in 3D utilizing the Bernstein basis on a wedge
2650 {
2651 protected:
2655 #endif
2657
2660
2661 public:
2662  /// Construct the L2Pos_WedgeElement of order @a p
2663  L2Pos_WedgeElement(const int p);
2664
2665  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
2666  virtual void CalcDShape(const IntegrationPoint &ip,
2667  DenseMatrix &dshape) const;
2668 };
2669
2670 /// Arbitrary order Raviart-Thomas elements in 2D on a square
2672 {
2673 private:
2674  static const double nk[8];
2675
2677  mutable Vector shape_cx, shape_ox, shape_cy, shape_oy;
2678  mutable Vector dshape_cx, dshape_cy;
2679 #endif
2680  Array<int> dof2nk;
2681
2682 public:
2683  /** @brief Construct the RT_QuadrilateralElement of order @a p and closed and
2684  open BasisType @a cb_type and @a ob_type */
2686  const int cb_type = BasisType::GaussLobatto,
2687  const int ob_type = BasisType::GaussLegendre);
2688  virtual void CalcVShape(const IntegrationPoint &ip,
2689  DenseMatrix &shape) const;
2691  DenseMatrix &shape) const
2692  { CalcVShape_RT(Trans, shape); }
2693  virtual void CalcDivShape(const IntegrationPoint &ip,
2694  Vector &divshape) const;
2696  DenseMatrix &I) const
2697  { LocalInterpolation_RT(*this, nk, dof2nk, Trans, I); }
2699  DenseMatrix &R) const
2700  { LocalRestriction_RT(nk, dof2nk, Trans, R); }
2701  virtual void GetTransferMatrix(const FiniteElement &fe,
2703  DenseMatrix &I) const
2704  { LocalInterpolation_RT(CheckVectorFE(fe), nk, dof2nk, Trans, I); }
2705  using FiniteElement::Project;
2706  virtual void Project(VectorCoefficient &vc,
2707  ElementTransformation &Trans, Vector &dofs) const
2708  { Project_RT(nk, dof2nk, vc, Trans, dofs); }
2710  Vector &dofs) const
2711  { Project_RT(nk, dof2nk, vc, Trans, dofs); }
2713  MatrixCoefficient &mc, ElementTransformation &T, Vector &dofs) const
2714  { ProjectMatrixCoefficient_RT(nk, dof2nk, mc, T, dofs); }
2716  DenseMatrix &I) const
2717  { Project_RT(nk, dof2nk, fe, Trans, I); }
2718  // Gradient + rotation = Curl: H1 -> H(div)
2719  virtual void ProjectGrad(const FiniteElement &fe,
2723  // Curl = Gradient + rotation: H1 -> H(div)
2724  virtual void ProjectCurl(const FiniteElement &fe,
2726  DenseMatrix &curl) const
2727  { ProjectGrad_RT(nk, dof2nk, fe, Trans, curl); }
2728 };
2729
2730
2731 /// Arbitrary order Raviart-Thomas elements in 3D on a cube
2733 {
2734  static const double nk[18];
2735
2737  mutable Vector shape_cx, shape_ox, shape_cy, shape_oy, shape_cz, shape_oz;
2738  mutable Vector dshape_cx, dshape_cy, dshape_cz;
2739 #endif
2740  Array<int> dof2nk;
2741
2742 public:
2743  /** @brief Construct the RT_HexahedronElement of order @a p and closed and
2744  open BasisType @a cb_type and @a ob_type */
2745  RT_HexahedronElement(const int p,
2746  const int cb_type = BasisType::GaussLobatto,
2747  const int ob_type = BasisType::GaussLegendre);
2748
2749  virtual void CalcVShape(const IntegrationPoint &ip,
2750  DenseMatrix &shape) const;
2752  DenseMatrix &shape) const
2753  { CalcVShape_RT(Trans, shape); }
2754  virtual void CalcDivShape(const IntegrationPoint &ip,
2755  Vector &divshape) const;
2757  DenseMatrix &I) const
2758  { LocalInterpolation_RT(*this, nk, dof2nk, Trans, I); }
2760  DenseMatrix &R) const
2761  { LocalRestriction_RT(nk, dof2nk, Trans, R); }
2762  virtual void GetTransferMatrix(const FiniteElement &fe,
2764  DenseMatrix &I) const
2765  { LocalInterpolation_RT(CheckVectorFE(fe), nk, dof2nk, Trans, I); }
2766  using FiniteElement::Project;
2767  virtual void Project(VectorCoefficient &vc,
2768  ElementTransformation &Trans, Vector &dofs) const
2769  { Project_RT(nk, dof2nk, vc, Trans, dofs); }
2771  Vector &dofs) const
2772  { Project_RT(nk, dof2nk, vc, Trans, dofs); }
2774  MatrixCoefficient &mc, ElementTransformation &T, Vector &dofs) const
2775  { ProjectMatrixCoefficient_RT(nk, dof2nk, mc, T, dofs); }
2777  DenseMatrix &I) const
2778  { Project_RT(nk, dof2nk, fe, Trans, I); }
2779  virtual void ProjectCurl(const FiniteElement &fe,
2781  DenseMatrix &curl) const
2782  { ProjectCurl_RT(nk, dof2nk, fe, Trans, curl); }
2783 };
2784
2785
2786 /// Arbitrary order Raviart-Thomas elements in 2D on a triangle
2788 {
2789  static const double nk[6], c;
2790
2792  mutable Vector shape_x, shape_y, shape_l;
2793  mutable Vector dshape_x, dshape_y, dshape_l;
2794  mutable DenseMatrix u;
2795  mutable Vector divu;
2796 #endif
2797  Array<int> dof2nk;
2798  DenseMatrixInverse Ti;
2799
2800 public:
2801  /// Construct the RT_TriangleElement of order @a p
2802  RT_TriangleElement(const int p);
2803  virtual void CalcVShape(const IntegrationPoint &ip,
2804  DenseMatrix &shape) const;
2806  DenseMatrix &shape) const
2807  { CalcVShape_RT(Trans, shape); }
2808  virtual void CalcDivShape(const IntegrationPoint &ip,
2809  Vector &divshape) const;
2811  DenseMatrix &I) const
2812  { LocalInterpolation_RT(*this, nk, dof2nk, Trans, I); }
2814  DenseMatrix &R) const
2815  { LocalRestriction_RT(nk, dof2nk, Trans, R); }
2816  virtual void GetTransferMatrix(const FiniteElement &fe,
2818  DenseMatrix &I) const
2819  { LocalInterpolation_RT(CheckVectorFE(fe), nk, dof2nk, Trans, I); }
2820  using FiniteElement::Project;
2821  virtual void Project(VectorCoefficient &vc,
2822  ElementTransformation &Trans, Vector &dofs) const
2823  { Project_RT(nk, dof2nk, vc, Trans, dofs); }
2825  Vector &dofs) const
2826  { Project_RT(nk, dof2nk, vc, Trans, dofs); }
2828  MatrixCoefficient &mc, ElementTransformation &T, Vector &dofs) const
2829  { ProjectMatrixCoefficient_RT(nk, dof2nk, mc, T, dofs); }
2831  DenseMatrix &I) const
2832  { Project_RT(nk, dof2nk, fe, Trans, I); }
2833  // Gradient + rotation = Curl: H1 -> H(div)
2834  virtual void ProjectGrad(const FiniteElement &fe,
2838  // Curl = Gradient + rotation: H1 -> H(div)
2839  virtual void ProjectCurl(const FiniteElement &fe,
2841  DenseMatrix &curl) const
2842  { ProjectGrad_RT(nk, dof2nk, fe, Trans, curl); }
2843 };
2844
2845
2846 /// Arbitrary order Raviart-Thomas elements in 3D on a tetrahedron
2848 {
2849  static const double nk[12], c;
2850
2852  mutable Vector shape_x, shape_y, shape_z, shape_l;
2853  mutable Vector dshape_x, dshape_y, dshape_z, dshape_l;
2854  mutable DenseMatrix u;
2855  mutable Vector divu;
2856 #endif
2857  Array<int> dof2nk;
2858  DenseMatrixInverse Ti;
2859
2860 public:
2861  /// Construct the RT_TetrahedronElement of order @a p
2862  RT_TetrahedronElement(const int p);
2863  virtual void CalcVShape(const IntegrationPoint &ip,
2864  DenseMatrix &shape) const;
2866  DenseMatrix &shape) const
2867  { CalcVShape_RT(Trans, shape); }
2868  virtual void CalcDivShape(const IntegrationPoint &ip,
2869  Vector &divshape) const;
2871  DenseMatrix &I) const
2872  { LocalInterpolation_RT(*this, nk, dof2nk, Trans, I); }
2874  DenseMatrix &R) const
2875  { LocalRestriction_RT(nk, dof2nk, Trans, R); }
2876  virtual void GetTransferMatrix(const FiniteElement &fe,
2878  DenseMatrix &I) const
2879  { LocalInterpolation_RT(CheckVectorFE(fe), nk, dof2nk, Trans, I); }
2880  using FiniteElement::Project;
2881  virtual void Project(VectorCoefficient &vc,
2882  ElementTransformation &Trans, Vector &dofs) const
2883  { Project_RT(nk, dof2nk, vc, Trans, dofs); }
2885  Vector &dofs) const
2886  { Project_RT(nk, dof2nk, vc, Trans, dofs); }
2888  MatrixCoefficient &mc, ElementTransformation &T, Vector &dofs) const
2889  { ProjectMatrixCoefficient_RT(nk, dof2nk, mc, T, dofs); }
2891  DenseMatrix &I) const
2892  { Project_RT(nk, dof2nk, fe, Trans, I); }
2893  virtual void ProjectCurl(const FiniteElement &fe,
2895  DenseMatrix &curl) const
2896  { ProjectCurl_RT(nk, dof2nk, fe, Trans, curl); }
2897 };
2898
2899
2900 /// Arbitrary order Nedelec elements in 3D on a cube
2902 {
2903  static const double tk[18];
2905  mutable Vector shape_cx, shape_ox, shape_cy, shape_oy, shape_cz, shape_oz;
2906  mutable Vector dshape_cx, dshape_cy, dshape_cz;
2907 #endif
2908  Array<int> dof2tk;
2909
2910 public:
2911  /** @brief Construct the ND_HexahedronElement of order @a p and closed and
2912  open BasisType @a cb_type and @a ob_type */
2913  ND_HexahedronElement(const int p,
2914  const int cb_type = BasisType::GaussLobatto,
2915  const int ob_type = BasisType::GaussLegendre);
2916
2917  virtual void CalcVShape(const IntegrationPoint &ip,
2918  DenseMatrix &shape) const;
2919
2921  DenseMatrix &shape) const
2922  { CalcVShape_ND(Trans, shape); }
2923
2924  virtual void CalcCurlShape(const IntegrationPoint &ip,
2925  DenseMatrix &curl_shape) const;
2926
2928  DenseMatrix &I) const
2929  { LocalInterpolation_ND(*this, tk, dof2tk, Trans, I); }
2930
2932  DenseMatrix &R) const
2933  { LocalRestriction_ND(tk, dof2tk, Trans, R); }
2934
2935  virtual void GetTransferMatrix(const FiniteElement &fe,
2937  DenseMatrix &I) const
2938  { LocalInterpolation_ND(CheckVectorFE(fe), tk, dof2tk, Trans, I); }
2939
2940  using FiniteElement::Project;
2941
2942  virtual void Project(VectorCoefficient &vc,
2943  ElementTransformation &Trans, Vector &dofs) const
2944  { Project_ND(tk, dof2tk, vc, Trans, dofs); }
2945
2947  Vector &dofs) const
2948  { Project_ND(tk, dof2tk, vc, Trans, dofs); }
2949
2951  MatrixCoefficient &mc, ElementTransformation &T, Vector &dofs) const
2952  { ProjectMatrixCoefficient_ND(tk, dof2tk, mc, T, dofs); }
2953
2954  virtual void Project(const FiniteElement &fe,
2956  DenseMatrix &I) const
2957  { Project_ND(tk, dof2tk, fe, Trans, I); }
2958
2959  virtual void ProjectGrad(const FiniteElement &fe,
2963
2964  virtual void ProjectCurl(const FiniteElement &fe,
2966  DenseMatrix &curl) const
2967  { ProjectCurl_ND(tk, dof2tk, fe, Trans, curl); }
2968 };
2969
2970
2971 /// Arbitrary order Nedelec elements in 2D on a square
2973 {
2974  static const double tk[8];
2975
2977  mutable Vector shape_cx, shape_ox, shape_cy, shape_oy;
2978  mutable Vector dshape_cx, dshape_cy;
2979 #endif
2980  Array<int> dof2tk;
2981
2982 public:
2983  /** @brief Construct the ND_QuadrilateralElement of order @a p and closed and
2984  open BasisType @a cb_type and @a ob_type */
2986  const int cb_type = BasisType::GaussLobatto,
2987  const int ob_type = BasisType::GaussLegendre);
2988  virtual void CalcVShape(const IntegrationPoint &ip,
2989  DenseMatrix &shape) const;
2991  DenseMatrix &shape) const
2992  { CalcVShape_ND(Trans, shape); }
2993  virtual void CalcCurlShape(const IntegrationPoint &ip,
2994  DenseMatrix &curl_shape) const;
2996  DenseMatrix &I) const
2997  { LocalInterpolation_ND(*this, tk, dof2tk, Trans, I); }
2999  DenseMatrix &R) const
3000  { LocalRestriction_ND(tk, dof2tk, Trans, R); }
3001  virtual void GetTransferMatrix(const FiniteElement &fe,
3003  DenseMatrix &I) const
3004  { LocalInterpolation_ND(CheckVectorFE(fe), tk, dof2tk, Trans, I); }
3005  using FiniteElement::Project;
3006  virtual void Project(VectorCoefficient &vc,
3007  ElementTransformation &Trans, Vector &dofs) const
3008  { Project_ND(tk, dof2tk, vc, Trans, dofs); }
3010  Vector &dofs) const
3011  { Project_ND(tk, dof2tk, vc, Trans, dofs); }
3013  MatrixCoefficient &mc, ElementTransformation &T, Vector &dofs) const
3014  { ProjectMatrixCoefficient_ND(tk, dof2tk, mc, T, dofs); }
3015  virtual void Project(const FiniteElement &fe,
3017  DenseMatrix &I) const
3018  { Project_ND(tk, dof2tk, fe, Trans, I); }
3019  virtual void ProjectGrad(const FiniteElement &fe,
3023 };
3024
3025
3026 /// Arbitrary order Nedelec elements in 3D on a tetrahedron
3028 {
3029  static const double tk[18], c;
3030
3032  mutable Vector shape_x, shape_y, shape_z, shape_l;
3033  mutable Vector dshape_x, dshape_y, dshape_z, dshape_l;
3034  mutable DenseMatrix u;
3035 #endif
3036  Array<int> dof2tk;
3037  DenseMatrixInverse Ti;
3038
3039 public:
3040  /// Construct the ND_TetrahedronElement of order @a p
3041  ND_TetrahedronElement(const int p);
3042  virtual void CalcVShape(const IntegrationPoint &ip,
3043  DenseMatrix &shape) const;
3045  DenseMatrix &shape) const
3046  { CalcVShape_ND(Trans, shape); }
3047  virtual void CalcCurlShape(const IntegrationPoint &ip,
3048  DenseMatrix &curl_shape) const;
3050  DenseMatrix &I) const
3051  { LocalInterpolation_ND(*this, tk, dof2tk, Trans, I); }
3053  DenseMatrix &R) const
3054  { LocalRestriction_ND(tk, dof2tk, Trans, R); }
3055  virtual void GetTransferMatrix(const FiniteElement &fe,
3057  DenseMatrix &I) const
3058  { LocalInterpolation_ND(CheckVectorFE(fe), tk, dof2tk, Trans, I); }
3059  using FiniteElement::Project;
3060  virtual void Project(VectorCoefficient &vc,
3061  ElementTransformation &Trans, Vector &dofs) const
3062  { Project_ND(tk, dof2tk, vc, Trans, dofs); }
3064  Vector &dofs) const
3065  { Project_ND(tk, dof2tk, vc, Trans, dofs); }
3067  MatrixCoefficient &mc, ElementTransformation &T, Vector &dofs) const
3068  { ProjectMatrixCoefficient_ND(tk, dof2tk, mc, T, dofs); }
3069  virtual void Project(const FiniteElement &fe,
3071  DenseMatrix &I) const
3072  { Project_ND(tk, dof2tk, fe, Trans, I); }
3073  virtual void ProjectGrad(const FiniteElement &fe,
3077
3078  virtual void ProjectCurl(const FiniteElement &fe,
3080  DenseMatrix &curl) const
3081  { ProjectCurl_ND(tk, dof2tk, fe, Trans, curl); }
3082 };
3083
3084 /// Arbitrary order Nedelec elements in 2D on a triangle
3086 {
3087  static const double tk[8], c;
3088
3090  mutable Vector shape_x, shape_y, shape_l;
3091  mutable Vector dshape_x, dshape_y, dshape_l;
3092  mutable DenseMatrix u;
3093  mutable Vector curlu;
3094 #endif
3095  Array<int> dof2tk;
3096  DenseMatrixInverse Ti;
3097
3098 public:
3099  /// Construct the ND_TriangleElement of order @a p
3100  ND_TriangleElement(const int p);
3101  virtual void CalcVShape(const IntegrationPoint &ip,
3102  DenseMatrix &shape) const;
3104  DenseMatrix &shape) const
3105  { CalcVShape_ND(Trans, shape); }
3106  virtual void CalcCurlShape(const IntegrationPoint &ip,
3107  DenseMatrix &curl_shape) const;
3109  DenseMatrix &I) const
3110  { LocalInterpolation_ND(*this, tk, dof2tk, Trans, I); }
3112  DenseMatrix &R) const
3113  { LocalRestriction_ND(tk, dof2tk, Trans, R); }
3114  virtual void GetTransferMatrix(const FiniteElement &fe,
3116  DenseMatrix &I) const
3117  { LocalInterpolation_ND(CheckVectorFE(fe), tk, dof2tk, Trans, I); }
3118  using FiniteElement::Project;
3119  virtual void Project(VectorCoefficient &vc,
3120  ElementTransformation &Trans, Vector &dofs) const
3121  { Project_ND(tk, dof2tk, vc, Trans, dofs); }
3123  Vector &dofs) const
3124  { Project_ND(tk, dof2tk, vc, Trans, dofs); }
3126  MatrixCoefficient &mc, ElementTransformation &T, Vector &dofs) const
3127  { ProjectMatrixCoefficient_ND(tk, dof2tk, mc, T, dofs); }
3128  virtual void Project(const FiniteElement &fe,
3130  DenseMatrix &I) const
3131  { Project_ND(tk, dof2tk, fe, Trans, I); }
3132  virtual void ProjectGrad(const FiniteElement &fe,
3136 };
3137
3138
3139 /// Arbitrary order Nedelec elements in 1D on a segment
3141 {
3142  static const double tk[1];
3143
3144  Poly_1D::Basis &obasis1d;
3145  Array<int> dof2tk;
3146
3147 public:
3148  /** @brief Construct the ND_SegmentElement of order @a p and open
3149  BasisType @a ob_type */
3150  ND_SegmentElement(const int p, const int ob_type = BasisType::GaussLegendre);
3151  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
3152  { obasis1d.Eval(ip.x, shape); }
3153  virtual void CalcVShape(const IntegrationPoint &ip,
3154  DenseMatrix &shape) const;
3156  DenseMatrix &shape) const
3157  { CalcVShape_ND(Trans, shape); }
3158  // virtual void CalcCurlShape(const IntegrationPoint &ip,
3159  // DenseMatrix &curl_shape) const;
3161  DenseMatrix &I) const
3162  { LocalInterpolation_ND(*this, tk, dof2tk, Trans, I); }
3164  DenseMatrix &R) const
3165  { LocalRestriction_ND(tk, dof2tk, Trans, R); }
3166  virtual void GetTransferMatrix(const FiniteElement &fe,
3168  DenseMatrix &I) const
3169  { LocalInterpolation_ND(CheckVectorFE(fe), tk, dof2tk, Trans, I); }
3170  using FiniteElement::Project;
3171  virtual void Project(VectorCoefficient &vc,
3172  ElementTransformation &Trans, Vector &dofs) const
3173  { Project_ND(tk, dof2tk, vc, Trans, dofs); }
3175  MatrixCoefficient &mc, ElementTransformation &T, Vector &dofs) const
3176  { ProjectMatrixCoefficient_ND(tk, dof2tk, mc, T, dofs); }
3177  virtual void Project(const FiniteElement &fe,
3179  DenseMatrix &I) const
3180  { Project_ND(tk, dof2tk, fe, Trans, I); }
3181  virtual void ProjectGrad(const FiniteElement &fe,
3185 };
3186
3187
3188 /// An arbitrary order and dimension NURBS element
3190 {
3191 protected:
3193  mutable const int *ijk;
3194  mutable int patch, elem;
3195  mutable Vector weights;
3196
3197 public:
3198  /** @brief Construct NURBSFiniteElement with given
3199  @param D Reference space dimension
3200  @param G Geometry type (of type Geometry::Type)
3201  @param Do Number of degrees of freedom in the FiniteElement
3202  @param O Order/degree of the FiniteElement
3203  @param F FunctionSpace type of the FiniteElement
3204  */
3205  NURBSFiniteElement(int D, Geometry::Type G, int Do, int O, int F)
3206  : ScalarFiniteElement(D, G, Do, O, F)
3207  {
3208  ijk = NULL;
3209  patch = elem = -1;
3210  kv.SetSize(dim);
3211  weights.SetSize(dof);
3212  weights = 1.0;
3213  }
3214
3215  void Reset () const { patch = elem = -1; }
3216  void SetIJK (const int *IJK) const { ijk = IJK; }
3217  int GetPatch () const { return patch; }
3218  void SetPatch (int p) const { patch = p; }
3219  int GetElement () const { return elem; }
3220  void SetElement (int e) const { elem = e; }
3222  Vector &Weights () const { return weights; }
3223  /// Update the NURBSFiniteElement according to the currently set knot vectors
3224  virtual void SetOrder () const { }
3225 };
3226
3227
3228 /// An arbitrary order 1D NURBS element on a segment
3230 {
3231 protected:
3232  mutable Vector shape_x;
3233
3234 public:
3235  /// Construct the NURBS1DFiniteElement of order @a p
3237  : NURBSFiniteElement(1, Geometry::SEGMENT, p + 1, p, FunctionSpace::Qk),
3238  shape_x(p + 1) { }
3239
3240  virtual void SetOrder() const;
3241  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
3242  virtual void CalcDShape(const IntegrationPoint &ip,
3243  DenseMatrix &dshape) const;
3244  virtual void CalcHessian (const IntegrationPoint &ip,
3245  DenseMatrix &hessian) const;
3246 };
3247
3248 /// An arbitrary order 2D NURBS element on a square
3250 {
3251 protected:
3253  mutable DenseMatrix du;
3254
3255 public:
3256  /// Construct the NURBS2DFiniteElement of order @a p
3258  : NURBSFiniteElement(2, Geometry::SQUARE, (p + 1)*(p + 1), p,
3259  FunctionSpace::Qk),
3260  u(dof), shape_x(p + 1), shape_y(p + 1), dshape_x(p + 1),
3261  dshape_y(p + 1), d2shape_x(p + 1), d2shape_y(p + 1), du(dof,2)
3262  { orders[0] = orders[1] = p; }
3263
3264  /// Construct the NURBS2DFiniteElement with x-order @a px and y-order @a py
3265  NURBS2DFiniteElement(int px, int py)
3266  : NURBSFiniteElement(2, Geometry::SQUARE, (px + 1)*(py + 1),
3267  std::max(px, py), FunctionSpace::Qk),
3268  u(dof), shape_x(px + 1), shape_y(py + 1), dshape_x(px + 1),
3269  dshape_y(py + 1), d2shape_x(px + 1), d2shape_y(py + 1), du(dof,2)
3270  { orders[0] = px; orders[1] = py; }
3271
3272  virtual void SetOrder() const;
3273  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
3274  virtual void CalcDShape(const IntegrationPoint &ip,
3275  DenseMatrix &dshape) const;
3276  virtual void CalcHessian (const IntegrationPoint &ip,
3277  DenseMatrix &hessian) const;
3278 };
3279
3280 /// An arbitrary order 3D NURBS element on a cube
3282 {
3283 protected:
3287  mutable DenseMatrix du;
3288
3289 public:
3290  /// Construct the NURBS3DFiniteElement of order @a p
3292  : NURBSFiniteElement(3, Geometry::CUBE, (p + 1)*(p + 1)*(p + 1), p,
3293  FunctionSpace::Qk),
3294  u(dof), shape_x(p + 1), shape_y(p + 1), shape_z(p + 1),
3295  dshape_x(p + 1), dshape_y(p + 1), dshape_z(p + 1),
3296  d2shape_x(p + 1), d2shape_y(p + 1), d2shape_z(p + 1), du(dof,3)
3297  { orders[0] = orders[1] = orders[2] = p; }
3298
3299  /// Construct the NURBS3DFiniteElement with x-order @a px and y-order @a py
3300  /// and z-order @a pz
3301  NURBS3DFiniteElement(int px, int py, int pz)
3302  : NURBSFiniteElement(3, Geometry::CUBE, (px + 1)*(py + 1)*(pz + 1),
3303  std::max(std::max(px,py),pz), FunctionSpace::Qk),
3304  u(dof), shape_x(px + 1), shape_y(py + 1), shape_z(pz + 1),
3305  dshape_x(px + 1), dshape_y(py + 1), dshape_z(pz + 1),
3306  d2shape_x(px + 1), d2shape_y(py + 1), d2shape_z(pz + 1), du(dof,3)
3307  { orders[0] = px; orders[1] = py; orders[2] = pz; }
3308
3309  virtual void SetOrder() const;
3310  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
3311  virtual void CalcDShape(const IntegrationPoint &ip,
3312  DenseMatrix &dshape) const;
3313  virtual void CalcHessian (const IntegrationPoint &ip,
3314  DenseMatrix &hessian) const;
3315 };
3316
3317 } // namespace mfem
3318
3319 #endif
Abstract class for all finite elements.
Definition: fe.hpp:235
A 2D 2nd order Raviart-Thomas vector element on a triangle.
Definition: fe.hpp:1396
RefinedLinear3DFiniteElement()
Construct the RefinedLinear3DFiniteElement.
Definition: fe.cpp:4977
virtual void CalcVShape(ElementTransformation &Trans, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in physical space at the point ...
Definition: fe.hpp:1817
virtual void CalcHessian(const IntegrationPoint &ip, DenseMatrix &hessian) const
Evaluate the Hessians of all shape functions of a scalar finite element in reference space at the giv...
Definition: fe.cpp:12488
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Definition: fe.cpp:1862
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition: fe.cpp:9528
Arbitrary order L2 elements in 3D on a wedge.
Definition: fe.hpp:2619
Arbitrary order Nedelec elements in 1D on a segment.
Definition: fe.hpp:3140
RT0TriangleFiniteElement()
Construct the RT0TriangleFiniteElement.
Definition: fe.cpp:3322
ND_SegmentElement(const int p, const int ob_type=BasisType::GaussLegendre)
Construct the ND_SegmentElement of order p and open BasisType ob_type.
Definition: fe.cpp:12422
DenseMatrix curlshape_J
Definition: fe.hpp:793
virtual void ProjectFromNodes(Vector &vc, ElementTransformation &Trans, Vector &dofs) const
Given a vector of values at the finite element nodes and a transformation, compute its projection (ap...
Definition: fe.hpp:3063
virtual void Project(VectorCoefficient &vc, ElementTransformation &Trans, Vector &dofs) const
Given a vector coefficient and a transformation, compute its projection (approximation) in the local ...
Definition: fe.cpp:6776
virtual void Project(VectorCoefficient &vc, ElementTransformation &Trans, Vector &dofs) const
Given a vector coefficient and a transformation, compute its projection (approximation) in the local ...
Definition: fe.hpp:2767
RT2TriangleFiniteElement()
Construct the RT2TriangleFiniteElement.
Definition: fe.cpp:3927
int GetDim() const
Returns the reference space dimension for the finite element.
Definition: fe.hpp:309
Definition: fe.cpp:1780
virtual void ProjectDelta(int vertex, Vector &dofs) const
Project a delta function centered on the given vertex in the local finite dimensional space represent...
Definition: fe.cpp:8198
virtual void GetLocalInterpolation(ElementTransformation &Trans, DenseMatrix &I) const
Return the local interpolation matrix I (Dof x Dof) where the fine element is the image of the base g...
Definition: fe.cpp:3614
ScalarFiniteElement(int D, Geometry::Type G, int Do, int O, int F=FunctionSpace::Pk)
Construct ScalarFiniteElement with given.
Definition: fe.hpp:641
virtual void CalcVShape(ElementTransformation &Trans, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in physical space at the point ...
Definition: fe.hpp:1787
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition: fe.cpp:4555
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition: fe.cpp:1610
static void CalcBernstein(const int p, const double x, double *u, double *d)
Compute the values and derivatives of the Bernstein basis functions of order p at coordinate x and st...
Definition: fe.hpp:1988
A 2D 1st order Raviart-Thomas vector element on a square.
Definition: fe.hpp:1367
virtual void ProjectCurl(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &curl) const
Compute the discrete curl matrix from the given FiniteElement onto &#39;this&#39; FiniteElement. The ElementTransformation is included to support cases when the matrix depends on it.
Definition: fe.hpp:2724
Class for an integration rule - an Array of IntegrationPoint.
Definition: intrules.hpp:90
virtual void GetLocalInterpolation(ElementTransformation &Trans, DenseMatrix &I) const
Return the local interpolation matrix I (Dof x Dof) where the fine element is the image of the base g...
Definition: fe.cpp:2163
L2Pos_WedgeElement(const int p)
Construct the L2Pos_WedgeElement of order p.
Definition: fe.cpp:10399
A 1D constant element on a segment.
Definition: fe.hpp:1327
A 1D linear element with nodes at 1/3 and 2/3 (trace of RT1)
Definition: fe.hpp:1505
A 1D quadratic element with nodes at the Gaussian points (trace of RT2)
Definition: fe.hpp:1516
Definition: fe.cpp:3284
virtual void ProjectDelta(int vertex, Vector &dofs) const
Project a delta function centered on the given vertex in the local finite dimensional space represent...
Definition: fe.cpp:9918
P2SegmentFiniteElement()
Construct the P2SegmentFiniteElement.
Definition: fe.cpp:4346
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition: fe.cpp:12549
Linear3DFiniteElement()
Construct the Linear3DFiniteElement.
Definition: fe.cpp:3012
static int Check(int b_type)
If the input does not represents a valid BasisType, abort with an error; otherwise return the input...
Definition: fe.hpp:46
virtual void CalcPhysLinLaplacian(ElementTransformation &Trans, Vector &Laplacian) const
Definition: fe.cpp:254
static double CalcDelta(const int p, const double x)
Evaluate a representation of a Delta function at point x.
Definition: fe.hpp:1957
virtual void GetLocalInterpolation(ElementTransformation &Trans, DenseMatrix &I) const
Return the local interpolation matrix I (Dof x Dof) where the fine element is the image of the base g...
Definition: fe.cpp:3796
RT1TriangleFiniteElement()
Construct the RT1TriangleFiniteElement.
Definition: fe.cpp:3547
virtual void CalcVShape(ElementTransformation &Trans, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in physical space at the point ...
Definition: fe.hpp:2805
virtual void GetLocalInterpolation(ElementTransformation &Trans, DenseMatrix &I) const
Return the local interpolation matrix I (Dof x Dof) where the fine element is the image of the base g...
Definition: fe.hpp:2870
Arbitrary order L2 elements in 2D utilizing the Bernstein basis on a triangle.
Definition: fe.hpp:2560
virtual void ProjectDelta(int vertex, Vector &dofs) const
Project a delta function centered on the given vertex in the local finite dimensional space represent...
Definition: fe.cpp:9679
void ProjectMatrixCoefficient_RT(const double *nk, const Array< int > &d2n, MatrixCoefficient &mc, ElementTransformation &T, Vector &dofs) const
Project the rows of the matrix coefficient in an RT space.
Definition: fe.cpp:951
void ProjectMatrixCoefficient_ND(const double *tk, const Array< int > &d2t, MatrixCoefficient &mc, ElementTransformation &T, Vector &dofs) const
Project the rows of the matrix coefficient in an ND space.
Definition: fe.cpp:1140
virtual void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
Definition: fe.cpp:11269
virtual void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
Definition: fe.cpp:40
RefinedBiLinear2DFiniteElement()
Construct the RefinedBiLinear2DFiniteElement.
Definition: fe.cpp:5209
Return a DofToQuad structure corresponding to the given IntegrationRule using the given DofToQuad::Mo...
Definition: fe.cpp:11718
NodalTensorFiniteElement(const int dims, const int p, const int btype, const DofMapType dmtype)
Definition: fe.cpp:7680
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition: fe.cpp:2407
void LocalInterpolation_RT(const VectorFiniteElement &cfe, const double *nk, const Array< int > &d2n, ElementTransformation &Trans, DenseMatrix &I) const
Definition: fe.cpp:1234
L2Pos_TriangleElement(const int p)
Construct the L2Pos_TriangleElement of order p.
Definition: fe.cpp:10062
Compute the discrete gradient matrix from the given FiniteElement onto &#39;this&#39; FiniteElement. The ElementTransformation is included to support cases when the matrix depends on it.
Definition: fe.hpp:3019
virtual void CalcVShape(ElementTransformation &Trans, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in physical space at the point ...
Definition: fe.hpp:1350
H1Pos_SegmentElement(const int p)
Construct the H1Pos_SegmentElement of order p.
Definition: fe.cpp:8140
Basis(const int p, const double *nodes, EvalType etype=Barycentric)
Create a nodal or positive (Bernstein) basis.
Definition: fe.cpp:6881
virtual void GetLocalRestriction(ElementTransformation &Trans, DenseMatrix &R) const
Return a local restriction matrix R (Dof x Dof) mapping fine dofs to coarse dofs. ...
Definition: fe.hpp:3163
P0WedgeFiniteElement()
Construct the P0WedgeFiniteElement.
Definition: fe.hpp:2645
Tensor product representation using 1D matrices/tensors with dimensions using 1D number of quadrature...
Definition: fe.hpp:157
int GetPatch() const
Definition: fe.hpp:3217
A 3D 1st order Nedelec element on a tetrahedron.
Definition: fe.hpp:1721
virtual void ProjectCurl(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &curl) const
Compute the discrete curl matrix from the given FiniteElement onto &#39;this&#39; FiniteElement. The ElementTransformation is included to support cases when the matrix depends on it.
Definition: fe.hpp:2893
virtual void ProjectDiv(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &div) const
Compute the discrete divergence matrix from the given FiniteElement onto &#39;this&#39; FiniteElement. The ElementTransformation is included to support cases when the matrix depends on it.
Definition: fe.cpp:183
Arbitrary order L2 elements in 2D on a triangle.
Definition: fe.hpp:2536
Base class for vector Coefficients that optionally depend on time and space.
virtual void ProjectDelta(int vertex, Vector &dofs) const
Project a delta function centered on the given vertex in the local finite dimensional space represent...
Definition: fe.hpp:1229
static int GetNodalBasis(int qpt_type)
Return the nodal BasisType corresponding to the Quadrature1D type.
Definition: fe.hpp:78
virtual void CalcPhysHessian(ElementTransformation &Trans, DenseMatrix &Hessian) const
Evaluate the Hessian of all shape functions of a scalar finite element in reference space at the give...
Definition: fe.cpp:299
virtual void CalcCurlShape(const IntegrationPoint &ip, DenseMatrix &curl_shape) const
Evaluate the curl of all shape functions of a vector finite element in reference space at the given p...
Definition: fe.cpp:5821
virtual void Project(Coefficient &coeff, ElementTransformation &Trans, Vector &dofs) const
Given a coefficient and a transformation, compute its projection (approximation) in the local finite ...
Definition: fe.cpp:130
virtual void ProjectDelta(int vertex, Vector &dofs) const
Project a delta function centered on the given vertex in the local finite dimensional space represent...
Definition: fe.hpp:1127
Array< const KnotVector * > kv
Definition: fe.hpp:3192
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition: fe.cpp:3251
NURBS2DFiniteElement(int px, int py)
Construct the NURBS2DFiniteElement with x-order px and y-order py.
Definition: fe.hpp:3265
void CalcPhysDivShape(ElementTransformation &Trans, Vector &divshape) const
Evaluate the divergence of all shape functions of a vector finite element in physical space at the po...
Definition: fe.cpp:61
Array< const KnotVector * > & KnotVectors() const
Definition: fe.hpp:3221
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
virtual function which evaluates the values of all shape functions at a given point ip and stores the...
Definition: fe.cpp:3029
virtual void ProjectDelta(int vertex, Vector &dofs) const
Project a delta function centered on the given vertex in the local finite dimensional space represent...
Definition: fe.cpp:10101
virtual void ProjectCurl(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &curl) const
Compute the discrete curl matrix from the given FiniteElement onto &#39;this&#39; FiniteElement. The ElementTransformation is included to support cases when the matrix depends on it.
Definition: fe.hpp:3078
virtual void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
Definition: fe.cpp:3568
virtual void Project(VectorCoefficient &vc, ElementTransformation &Trans, Vector &dofs) const
Given a vector coefficient and a transformation, compute its projection (approximation) in the local ...
Definition: fe.cpp:3848
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition: fe.cpp:2203
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition: fe.cpp:8178
Arbitrary order L2 elements in 3D on a cube.
Definition: fe.hpp:2499
FiniteElement(D, G, Do, O, F)
PositiveTensorFiniteElement(const int dims, const int p, const DofMapType dmtype)
Definition: fe.cpp:7689
int GetDerivMapType() const
Returns the FiniteElement::DerivType of the element describing how reference function derivatives are...
Definition: fe.hpp:352
Class for finite elements utilizing the always positive Bernstein basis.
Definition: fe.hpp:738
L2Pos_TetrahedronElement(const int p)
Construct the L2Pos_TetrahedronElement of order p.
Definition: fe.cpp:10257
virtual void GetLocalRestriction(ElementTransformation &Trans, DenseMatrix &R) const
Return a local restriction matrix R (Dof x Dof) mapping fine dofs to coarse dofs. ...
Definition: fe.hpp:2698
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition: fe.cpp:9381
PointFiniteElement()
Construct the PointFiniteElement.
Definition: fe.cpp:1395
virtual void ProjectMatrixCoefficient(MatrixCoefficient &mc, ElementTransformation &T, Vector &dofs) const
Given a matrix coefficient and a transformation, compute an approximation (&quot;projection&quot;) in the local...
Definition: fe.cpp:660
virtual void CalcHessian(const IntegrationPoint &ip, DenseMatrix &Hessian) const
Evaluate the Hessians of all shape functions of a scalar finite element in reference space at the giv...
Definition: fe.cpp:8026
void CalcVShape_RT(ElementTransformation &Trans, DenseMatrix &shape) const
Definition: fe.cpp:891
void SetSize(int s)
Resize the vector to size s.
Definition: vector.hpp:459
virtual void CalcDivShape(const IntegrationPoint &ip, Vector &divshape) const
Evaluate the divergence of all shape functions of a vector finite element in reference space at the g...
Definition: fe.cpp:10651
virtual void GetLocalInterpolation(ElementTransformation &Trans, DenseMatrix &I) const
Return the local interpolation matrix I (Dof x Dof) where the fine element is the image of the base g...
Definition: fe.cpp:5883
virtual void CalcPhysLaplacian(ElementTransformation &Trans, Vector &Laplacian) const
Evaluate the Laplacian of all shape functions of a scalar finite element in reference space at the gi...
Definition: fe.cpp:212
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition: fe.cpp:4338
A 2D 3rd order Raviart-Thomas vector element on a square.
Definition: fe.hpp:1474
virtual void ProjectDelta(int vertex, Vector &dofs) const
Project a delta function centered on the given vertex in the local finite dimensional space represent...
Definition: fe.cpp:1531
virtual void Project(Coefficient &coeff, ElementTransformation &Trans, Vector &dofs) const
Given a coefficient and a transformation, compute its projection (approximation) in the local finite ...
Definition: fe.cpp:621
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition: fe.cpp:2227
virtual void CalcHessian(const IntegrationPoint &ip, DenseMatrix &h) const
Compute the Hessian of second order partial derivatives at ip.
Definition: fe.cpp:2585
virtual void ProjectCurl(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &curl) const
Compute the discrete curl matrix from the given FiniteElement onto &#39;this&#39; FiniteElement. The ElementTransformation is included to support cases when the matrix depends on it.
Definition: fe.hpp:2839
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition: fe.cpp:2496
virtual void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
Definition: fe.cpp:3333
FiniteElement(int D, Geometry::Type G, int Do, int O, int F=FunctionSpace::Pk)
Construct FiniteElement with given.
Definition: fe.cpp:25
virtual void GetLocalRestriction(ElementTransformation &Trans, DenseMatrix &R) const
Return a local restriction matrix R (Dof x Dof) mapping fine dofs to coarse dofs. ...
Definition: fe.hpp:3111
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
evaluate derivatives of shape function - constant 0
Definition: fe.cpp:2983
H1Pos_SegmentElement SegmentFE
Definition: fe.hpp:2412
virtual void CalcVShape(ElementTransformation &Trans, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in physical space at the point ...
Definition: fe.hpp:1731
Construct a quadratic FE on wedge.
Definition: fe.hpp:2390
Arbitrary order L2 elements in 1D utilizing the Bernstein basis on a segment.
Definition: fe.hpp:2442
virtual void CalcVShape(ElementTransformation &Trans, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in physical space at the point ...
Definition: fe.hpp:2920
Return a DofToQuad structure corresponding to the given IntegrationRule using the given DofToQuad::Mo...
Definition: fe.hpp:2080
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Definition: fe.cpp:1420
virtual void ProjectDelta(int vertex, Vector &dofs) const
Project a delta function centered on the given vertex in the local finite dimensional space represent...
Definition: fe.cpp:7785
virtual void ProjectFromNodes(Vector &vc, ElementTransformation &Trans, Vector &dofs) const
Given a vector of values at the finite element nodes and a transformation, compute its projection (ap...
Definition: fe.hpp:3122
H1Pos_TetrahedronElement(const int p)
Construct the H1Pos_TetrahedronElement of order p.
Definition: fe.cpp:8867
int dim
Dimension of reference space.
Definition: fe.hpp:238
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition: fe.cpp:12455
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition: fe.cpp:9547
virtual void GetLocalInterpolation(ElementTransformation &Trans, DenseMatrix &I) const
Return the local interpolation matrix I (Dof x Dof) where the fine element is the image of the base g...
Definition: fe.hpp:2695
LagrangeHexFiniteElement(int degree)
Construct the LagrangeHexFiniteElement with the provided degree.
Definition: fe.cpp:4607
TensorBasisElement(const int dims, const int p, const int btype, const DofMapType dmtype)
Definition: fe.cpp:7479
L2_SegmentElement(const int p, const int btype=BasisType::GaussLegendre)
Construct the L2_SegmentElement of order p and BasisType btype.
Definition: fe.cpp:9407
aka closed Newton-Cotes
Definition: intrules.hpp:296
Definition: fe.cpp:2180
int GetOrder() const
Returns the order of the finite element. In the case of anisotropic orders, returns the maximum order...
Definition: fe.hpp:319
Arbitrary H1 elements in 2D on a square.
Definition: fe.hpp:2137
virtual void CalcDivShape(const IntegrationPoint &ip, Vector &divshape) const
Evaluate the divergence of all shape functions of a vector finite element in reference space at the g...
Definition: fe.cpp:3346
virtual void ProjectFromNodes(Vector &vc, ElementTransformation &Trans, Vector &dofs) const
Given a vector of values at the finite element nodes and a transformation, compute its projection (ap...
Definition: fe.hpp:2884
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition: fe.cpp:1988
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition: fe.cpp:4461
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition: fe.cpp:4769
virtual void CalcVShape(ElementTransformation &Trans, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in physical space at the point ...
Definition: fe.hpp:2990
Data type dense matrix using column-major storage.
Definition: densemat.hpp:23
int nqpt
Number of quadrature points. When mode is TENSOR, this is the 1D number.
Definition: fe.hpp:169
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition: fe.cpp:4413
Definition: fe.cpp:2355
virtual void GetTransferMatrix(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &I) const
Return interpolation matrix, I, which maps dofs from a coarse element, fe, to the fine dofs on this f...
Definition: fe.hpp:2762
Array< double > Gt
Transpose of G.
Definition: fe.hpp:208
An arbitrary order and dimension NURBS element.
Definition: fe.hpp:3189
Compute the discrete gradient matrix from the given FiniteElement onto &#39;this&#39; FiniteElement. The ElementTransformation is included to support cases when the matrix depends on it.
Definition: fe.cpp:723
void Reset() const
Definition: fe.hpp:3215
virtual void Project(VectorCoefficient &vc, ElementTransformation &Trans, Vector &dofs) const
Given a vector coefficient and a transformation, compute its projection (approximation) in the local ...
Definition: fe.hpp:2821
virtual void GetTransferMatrix(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &I) const
Return interpolation matrix, I, which maps dofs from a coarse element, fe, to the fine dofs on this f...
Definition: fe.hpp:2876
A 2D quadratic element on triangle with nodes at the vertices and midpoints of the triangle...
Definition: fe.hpp:1048
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition: fe.cpp:12469
int ndof
Number of degrees of freedom = number of basis functions. When mode is TENSOR, this is the 1D number...
Definition: fe.hpp:165
A 0D point finite element.
Definition: fe.hpp:896
A 3D 0th order Raviert-Thomas element on a cube.
Definition: fe.hpp:1745
A 1D quadractic finite element with uniformly spaced nodes.
Definition: fe.hpp:1016
virtual void CalcVShape(ElementTransformation &Trans, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in physical space at the point ...
Definition: fe.hpp:2690
Get the corresponding Quadrature1D constant, when that makes sense; otherwise return Quadrature1D::In...
Definition: fe.hpp:62
virtual void CalcDivShape(const IntegrationPoint &ip, Vector &divshape) const
Evaluate the divergence of all shape functions of a vector finite element in reference space at the g...
Definition: fe.cpp:11125
VectorFiniteElement(int D, Geometry::Type G, int Do, int O, int M, int F=FunctionSpace::Pk)
Definition: fe.hpp:884
Arbitrary order Nedelec elements in 3D on a tetrahedron.
Definition: fe.hpp:3027
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition: fe.cpp:10461
MapType
Enumeration for MapType: defines how reference functions are mapped to physical space.
Definition: fe.hpp:269
virtual void ProjectFromNodes(Vector &vc, ElementTransformation &Trans, Vector &dofs) const
Given a vector of values at the finite element nodes and a transformation, compute its projection (ap...
Definition: fe.hpp:2709
Refined tensor products of polynomials of order k.
Definition: fe.hpp:220
virtual void GetLocalInterpolation(ElementTransformation &Trans, DenseMatrix &I) const
Return the local interpolation matrix I (Dof x Dof) where the fine element is the image of the base g...
Definition: fe.cpp:6049
void ProjectCurl_ND(const double *tk, const Array< int > &d2t, const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &curl) const
Definition: fe.cpp:1053
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition: fe.cpp:2998
int Space() const
Returns the type of FunctionSpace on the element.
Definition: fe.hpp:329
virtual void SetOrder() const
Update the NURBSFiniteElement according to the currently set knot vectors.
Definition: fe.cpp:12446
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition: fe.cpp:2656
virtual void GetLocalInterpolation(ElementTransformation &Trans, DenseMatrix &I) const
Return the local interpolation matrix I (Dof x Dof) where the fine element is the image of the base g...
Definition: fe.cpp:111
virtual void Project(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &I) const
Compute the embedding/projection matrix from the given FiniteElement onto &#39;this&#39; FiniteElement. The ElementTransformation is included to support cases when the projection depends on it.
Definition: fe.hpp:2776
RefinedTriLinear3DFiniteElement()
Construct the RefinedTriLinear3DFiniteElement.
Definition: fe.cpp:5356
DenseMatrix vshape
Definition: fe.hpp:248
Definition: fe.cpp:2991
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition: fe.cpp:4594
NURBS3DFiniteElement(int px, int py, int pz)
Definition: fe.hpp:3301
Definition: fe.cpp:3068
int GetMapType() const
Returns the FiniteElement::MapType of the element describing how reference functions are mapped to ph...
Definition: fe.hpp:341
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition: fe.cpp:9423
virtual void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
Definition: fe.cpp:6399
virtual void GetLocalInterpolation(ElementTransformation &Trans, DenseMatrix &I) const
Return the local interpolation matrix I (Dof x Dof) where the fine element is the image of the base g...
Definition: fe.cpp:6586
Geometry::Type geom_type
Geometry::Type of the reference element.
Definition: fe.hpp:239
virtual void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
Definition: fe.cpp:3445
aka open Newton-Cotes
Definition: intrules.hpp:295
A 3D constant element on a tetrahedron.
Definition: fe.hpp:1554
DerivType
Enumeration for DerivType: defines which derivative method is implemented.
Definition: fe.hpp:290
virtual void ProjectDelta(int vertex, Vector &dofs) const
Project a delta function centered on the given vertex in the local finite dimensional space represent...
Definition: fe.cpp:10221
Intermediate class for finite elements whose basis functions return vector values.
Definition: fe.hpp:778
static void CalcLegendre(const int p, const double x, double *u)
Definition: fe.cpp:7305
virtual void ProjectCurl(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &curl) const
Compute the discrete curl matrix from the given FiniteElement onto &#39;this&#39; FiniteElement. The ElementTransformation is included to support cases when the matrix depends on it.
Definition: fe.hpp:2964
void NodalLocalInterpolation(ElementTransformation &Trans, DenseMatrix &I, const ScalarFiniteElement &fine_fe) const
Get the matrix I that defines nodal interpolation between this element and the refined element fine_f...
Definition: fe.cpp:393
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition: fe.cpp:2708
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition: fe.cpp:10287
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition: fe.cpp:3276
A 3D Crouzeix-Raviart element on the tetrahedron.
Definition: fe.hpp:1543
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition: fe.cpp:3268
static const char * Name(int b_type)
Check and convert a BasisType constant to a string identifier.
Definition: fe.hpp:92
RT1HexFiniteElement()
Construct the RT1HexFiniteElement.
Definition: fe.cpp:6277
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition: fe.cpp:9485
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition: fe.cpp:7839
virtual void ProjectDelta(int vertex, Vector &dofs) const
Project a delta function centered on the given vertex in the local finite dimensional space represent...
Definition: fe.hpp:1575
A 2D bi-cubic element on a square with uniformly spaces nodes.
Definition: fe.hpp:1145
virtual void ProjectFromNodes(Vector &vc, ElementTransformation &Trans, Vector &dofs) const
Given a vector of values at the finite element nodes and a transformation, compute its projection (ap...
Definition: fe.hpp:2946
Class for cubic FE on wedge.
Definition: fe.hpp:2394
void ProjectCurl_RT(const double *nk, const Array< int > &d2n, const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &curl) const
Definition: fe.cpp:1091
H1Pos_HexahedronElement(const int p)
Construct the H1Pos_HexahedronElement of order p.
Definition: fe.cpp:8273
Definition: fe.cpp:3432
Compute the discrete gradient matrix from the given FiniteElement onto &#39;this&#39; FiniteElement. The ElementTransformation is included to support cases when the matrix depends on it.
Definition: fe.cpp:167
Definition: fe.cpp:3689
static void CalcShape(const int p, const double x, const double y, const double z, double *shape)
Definition: fe.cpp:8969
virtual void GetTransferMatrix(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &I) const
Return interpolation matrix, I, which maps dofs from a coarse element, fe, to the fine dofs on this f...
Definition: fe.hpp:709
Arbitrary order Nedelec elements in 2D on a triangle.
Definition: fe.hpp:3085
Definition: fe.cpp:11736
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition: fe.cpp:10163
virtual void CalcHessian(const IntegrationPoint &ip, DenseMatrix &h) const
Evaluate the Hessians of all shape functions of a scalar finite element in reference space at the giv...
Definition: fe.cpp:1492
Nodes: x_i = i/(n-1), i=0,...,n-1.
Definition: fe.hpp:37
static int GetType(char b_ident)
Convert char basis identifier to a BasisType constant.
Definition: fe.hpp:108
int GetElement() const
Definition: fe.hpp:3219
PositiveFiniteElement(int D, Geometry::Type G, int Do, int O, int F=FunctionSpace::Pk)
Construct PositiveFiniteElement with given.
Definition: fe.hpp:748
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition: fe.cpp:8245
Linear2DFiniteElement()
Construct the Linear2DFiniteElement.
Definition: fe.cpp:1434
const double * ClosedPoints(const int p, const int btype=BasisType::GaussLobatto)
Get coordinates of a closed (GaussLegendre) set of points if degree p.
Definition: fe.hpp:1917
virtual void Project(VectorCoefficient &vc, ElementTransformation &Trans, Vector &dofs) const
Given a vector coefficient and a transformation, compute its projection (approximation) in the local ...
Definition: fe.hpp:2706
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition: fe.cpp:3125
static int CheckNodal(int b_type)
If the input does not represents a valid nodal BasisType, abort with an error; otherwise return the i...
Definition: fe.hpp:54
virtual void ProjectMatrixCoefficient(MatrixCoefficient &mc, ElementTransformation &T, Vector &dofs) const
Given a matrix coefficient and a transformation, compute an approximation (&quot;projection&quot;) in the local...
Definition: fe.hpp:3125
A 2D refined bi-linear FE on a square.
Definition: fe.hpp:1656
Possible basis types. Note that not all elements can use all BasisType(s).
Definition: fe.hpp:27
virtual void GetLocalInterpolation(ElementTransformation &Trans, DenseMatrix &I) const
Return the local interpolation matrix I (Dof x Dof) where the fine element is the image of the base g...
Definition: fe.cpp:6721
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Definition: fe.cpp:5545
Cubic2DFiniteElement()
Construct the Cubic2DFiniteElement.
Definition: fe.cpp:2683
H1_HexahedronElement(const int p, const int btype=BasisType::GaussLobatto)
Construct the H1_HexahedronElement of order p and BasisType btype.
Definition: fe.cpp:7953
virtual void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
Definition: fe.cpp:12343
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition: fe.cpp:1401
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition: fe.cpp:2728
Nodes: x_i = (i+1/2)/n, i=0,...,n-1.
Definition: fe.hpp:38
void CalcPhysCurlShape(ElementTransformation &Trans, DenseMatrix &curl_shape) const
Evaluate the curl of all shape functions of a vector finite element in physical space at the point de...
Definition: fe.cpp:75
L2Pos_HexahedronElement(const int p)
Construct the L2Pos_HexahedronElement of order p.
Definition: fe.cpp:9846
ND_TriangleElement(const int p)
Construct the ND_TriangleElement of order p.
Definition: fe.cpp:12262
virtual void ProjectCurl(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &curl) const
Compute the discrete curl matrix from the given FiniteElement onto &#39;this&#39; FiniteElement. The ElementTransformation is included to support cases when the matrix depends on it.
Definition: fe.hpp:2553
virtual void CalcDivShape(const IntegrationPoint &ip, Vector &divshape) const
Evaluate the divergence of all shape functions of a vector finite element in reference space at the g...
Definition: fe.cpp:11305
virtual void GetTransferMatrix(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &I) const
Return interpolation matrix, I, which maps dofs from a coarse element, fe, to the fine dofs on this f...
Definition: fe.hpp:3166
static void CalcDShape(const int p, const double x, const double y, const double z, double *dshape_1d, double *dshape)
Definition: fe.cpp:9002
static void CalcBasis(const int p, const double x, double *u)
Evaluate the values of a hierarchical 1D basis at point x hierarchical = k-th basis function is degre...
Definition: fe.hpp:1933
virtual void CalcVShape(ElementTransformation &Trans, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in physical space at the point ...
Definition: fe.hpp:1379
virtual void ProjectFromNodes(Vector &vc, ElementTransformation &Trans, Vector &dofs) const
Given a vector of values at the finite element nodes and a transformation, compute its projection (ap...
Definition: fe.cpp:142
virtual void GetLocalRestriction(ElementTransformation &Trans, DenseMatrix &R) const
Return a local restriction matrix R (Dof x Dof) mapping fine dofs to coarse dofs. ...
Definition: fe.hpp:2873
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
evaluate shape function - constant 1
Definition: fe.cpp:2977
virtual void CalcHessian(const IntegrationPoint &ip, DenseMatrix &h) const
Evaluate the Hessians of all shape functions of a scalar finite element in reference space at the giv...
Definition: fe.cpp:2756
static void CalcBinomTerms(const int p, const double x, const double y, double *u)
Compute the p terms in the expansion of the binomial (x + y)^p and store them in the already allocate...
Definition: fe.cpp:7211
const double * GetPoints(const int p, const int btype)
Get the coordinates of the points of the given BasisType, btype.
Definition: fe.cpp:7404
H1Pos_TriangleElement(const int p)
Construct the H1Pos_TriangleElement of order p.
Definition: fe.cpp:8722
virtual void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
Definition: fe.cpp:4050
void SetMapType(int M)
Set the FiniteElement::MapType of the element to either VALUE or INTEGRAL. Also sets the FiniteElemen...
Definition: fe.hpp:654
Poly_1D::Basis & obasis1d
Definition: fe.hpp:2096
Cubic3DFiniteElement()
Construct the Cubic3DFiniteElement.
Definition: fe.cpp:2803
Linear1DFiniteElement()
Construct the Linear1DFiniteElement.
Definition: fe.cpp:1413
A 1D element with uniform nodes.
Definition: fe.hpp:1527
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Definition: fe.cpp:4918
virtual void CalcDivShape(const IntegrationPoint &ip, Vector &divshape) const
Evaluate the divergence of all shape functions of a vector finite element in reference space at the g...
Definition: fe.cpp:6709
RT0HexFiniteElement()
Construct the RT0HexFiniteElement.
Definition: fe.cpp:6123
virtual void GetLocalInterpolation(ElementTransformation &Trans, DenseMatrix &I) const
Return the local interpolation matrix I (Dof x Dof) where the fine element is the image of the base g...
Definition: fe.cpp:2276
virtual void ProjectCurl(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &curl) const
Compute the discrete curl matrix from the given FiniteElement onto &#39;this&#39; FiniteElement. The ElementTransformation is included to support cases when the matrix depends on it.
Definition: fe.cpp:175
Class for standard nodal finite elements.
Definition: fe.hpp:683
Geometry::Type GetGeomType() const
Returns the Geometry::Type of the reference element.
Definition: fe.hpp:312
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition: fe.cpp:1667
virtual void GetLocalInterpolation(ElementTransformation &Trans, DenseMatrix &I) const
Return the local interpolation matrix I (Dof x Dof) where the fine element is the image of the base g...
Definition: fe.hpp:2756
CrouzeixRaviartFiniteElement()
Construct the CrouzeixRaviartFiniteElement.
Definition: fe.cpp:3257
NURBS1DFiniteElement(int p)
Construct the NURBS1DFiniteElement of order p.
Definition: fe.hpp:3236
static void CalcShape(const int p, const double x, const double y, double *shape)
Definition: fe.cpp:8777
Polynomials of order k.
Definition: fe.hpp:218
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition: fe.cpp:3299
VectorTensorFiniteElement(const int dims, const int d, const int p, const int cbtype, const int obtype, const int M, const DofMapType dmtype)
Definition: fe.cpp:7696
Array< int > s_dof
Definition: fe.hpp:2656
Class for finite elements with basis functions that return scalar values.
Definition: fe.hpp:615
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition: fe.cpp:2896
static const ScalarFiniteElement & CheckScalarFE(const FiniteElement &fe)
Definition: fe.hpp:622
int GetBasisType() const
Definition: fe.hpp:2021
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition: fe.cpp:4356
virtual void ProjectDelta(int vertex, Vector &dofs) const
Project a delta function centered on the given vertex in the local finite dimensional space represent...
Definition: fe.hpp:1011
Arbitrary order L2 elements in 2D utilizing the Bernstein basis on a square.
Definition: fe.hpp:2482
A 2D bi-linear element on a square with nodes at the &quot;Gaussian&quot; points.
Definition: fe.hpp:987
A 1D refined linear element.
Definition: fe.hpp:1603
void SetIJK(const int *IJK) const
Definition: fe.hpp:3216
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition: fe.cpp:9429
A 2D refined linear element on a triangle.
Definition: fe.hpp:1623
virtual void GetLocalRestriction(ElementTransformation &Trans, DenseMatrix &R) const
Return a local restriction matrix R (Dof x Dof) mapping fine dofs to coarse dofs. ...
Definition: fe.hpp:2813
A 2D refined linear element on a tetrahedron.
Definition: fe.hpp:1643
Arbitrary L2 elements in 1D on a segment.
Definition: fe.hpp:2425
void SetPatch(int p) const
Definition: fe.hpp:3218
Return a DofToQuad structure corresponding to the given IntegrationRule using the given DofToQuad::Mo...
Definition: fe.hpp:2064
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Definition: fe.cpp:1627
Poly_1D::Basis & cbasis1d
Definition: fe.hpp:2096
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Definition: fe.cpp:1638
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Definition: fe.cpp:1886
A 2D constant element on a triangle.
Definition: fe.hpp:1203
Bernstein polynomials.
Definition: fe.hpp:35
Compute the discrete gradient matrix from the given FiniteElement onto &#39;this&#39; FiniteElement. The ElementTransformation is included to support cases when the matrix depends on it.
Definition: fe.hpp:3181
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition: fe.cpp:9238
RefinedLinear1DFiniteElement()
Construct the RefinedLinear1DFiniteElement.
Definition: fe.cpp:4807
virtual void ProjectDelta(int vertex, Vector &dofs) const
Project a delta function centered on the given vertex in the local finite dimensional space represent...
Definition: fe.cpp:8055
virtual void ProjectDelta(int vertex, Vector &dofs) const
Project a delta function centered on the given vertex in the local finite dimensional space represent...
Definition: fe.cpp:8266
virtual void ProjectMatrixCoefficient(MatrixCoefficient &mc, ElementTransformation &T, Vector &dofs) const
Given a matrix coefficient and a transformation, compute an approximation (&quot;projection&quot;) in the local...
Definition: fe.hpp:2773
ND_HexahedronElement(const int p, const int cb_type=BasisType::GaussLobatto, const int ob_type=BasisType::GaussLegendre)
Construct the ND_HexahedronElement of order p and closed and open BasisType cb_type and ob_type...
Definition: fe.cpp:11351
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition: fe.cpp:2380
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition: fe.cpp:10004
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition: fe.cpp:8418
Poly_1D::Basis & basis1d
Definition: fe.hpp:2007
virtual void ProjectCurl(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &curl) const
Compute the discrete curl matrix from the given FiniteElement onto &#39;this&#39; FiniteElement. The ElementTransformation is included to support cases when the matrix depends on it.
Definition: fe.hpp:2779
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Definition: fe.cpp:4834
void mfem_error(const char *msg)
Function called when an error is encountered. Used by the macros MFEM_ABORT, MFEM_ASSERT, MFEM_VERIFY.
Definition: error.cpp:153
virtual void CalcDivShape(const IntegrationPoint &ip, Vector &divshape) const
Evaluate the divergence of all shape functions of a vector finite element in reference space at the g...
Definition: fe.cpp:3989
static void ChebyshevPoints(const int p, double *x)
Compute the points for the Chebyshev polynomials of order p and place them in the already allocated x...
Definition: fe.cpp:7179
Closed GaussLegendre.
Definition: fe.hpp:40
Cubic1DFiniteElement()
Construct the Cubic1DFiniteElement.
Definition: fe.cpp:2647
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition: fe.cpp:6846
H1Pos_WedgeElement(const int p)
Construct the H1Pos_WedgeElement of order p.
Definition: fe.cpp:9264
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition: fe.cpp:4579
virtual void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
Definition: fe.cpp:6687
A 3D refined tri-linear element on a cube.
Definition: fe.hpp:1676
ND_TetrahedronElement(const int p)
Construct the ND_TetrahedronElement of order p.
Definition: fe.cpp:12000
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition: fe.cpp:10090
Array< int > t_dof
Definition: fe.hpp:2656
int deriv_range_type
Definition: fe.hpp:240
Nedelec1TetFiniteElement()
Construct the Nedelec1TetFiniteElement.
Definition: fe.cpp:5958
const int * GetAnisotropicOrders() const
Returns an array containing the anisotropic orders/degrees.
Definition: fe.hpp:326
Definition: fe.cpp:4013
A 3D quadratic element on a tetrahedron with uniformly spaced nodes.
Definition: fe.hpp:1265
Mode mode
Describes the contents of the B, Bt, G, and Gt arrays, see Mode.
Definition: fe.hpp:161
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const =0
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
H1_QuadrilateralElement(const int p, const int btype=BasisType::GaussLobatto)
Construct the H1_QuadrilateralElement of order p and BasisType btype.
Definition: fe.cpp:7813
virtual void CalcVShape(ElementTransformation &Trans, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in physical space at the point ...
Definition: fe.hpp:3044
GaussLinear2DFiniteElement()
Construct the GaussLinear2DFiniteElement.
Definition: fe.cpp:1502
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition: fe.cpp:1407
virtual void CalcVShape(ElementTransformation &Trans, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in physical space at the point ...
Definition: fe.hpp:2865
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition: fe.cpp:2671
class FiniteElement * FE
The FiniteElement that created and owns this object.
Definition: fe.hpp:136
virtual void ProjectFromNodes(Vector &vc, ElementTransformation &Trans, Vector &dofs) const
Given a vector of values at the finite element nodes and a transformation, compute its projection (ap...
Definition: fe.hpp:3009
virtual void GetLocalInterpolation(ElementTransformation &Trans, DenseMatrix &I) const
Return the local interpolation matrix I (Dof x Dof) where the fine element is the image of the base g...
Definition: fe.hpp:3049
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition: fe.cpp:2070
const IntegrationRule & GetNodes() const
Get a const reference to the nodes of the element.
Definition: fe.hpp:382
virtual void Project(VectorCoefficient &vc, ElementTransformation &Trans, Vector &dofs) const
Given a vector coefficient and a transformation, compute its projection (approximation) in the local ...
Definition: fe.cpp:5936
RangeType
Enumeration for range_type and deriv_range_type.
Definition: fe.hpp:257
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Definition: fe.cpp:1708
virtual void ProjectDelta(int vertex, Vector &dofs) const
Project a delta function centered on the given vertex in the local finite dimensional space represent...
Definition: fe.cpp:9761
static int VerifyOpen(int b_type)
Ensure that the BasisType of b_type is open (doesn&#39;t have Quadrature1D points on the boundary)...
Definition: fe.hpp:598
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition: fe.cpp:3103
Compute the discrete gradient matrix from the given FiniteElement onto &#39;this&#39; FiniteElement. The ElementTransformation is included to support cases when the matrix depends on it.
Definition: fe.hpp:2719
Construct the L2Pos_QuadrilateralElement of order p.
Definition: fe.cpp:9616
const int * ijk
Definition: fe.hpp:3193
P1TetNonConfFiniteElement()
Construct the P1TetNonConfFiniteElement.
Definition: fe.cpp:4522
P0SegmentFiniteElement(int Ord=0)
Construct the P0SegmentFiniteElement with dummy order Ord.
Definition: fe.cpp:3239
Arbitrary order H1 elements in 3D on a tetrahedron.
Definition: fe.hpp:2275
static void CalcDShape(const int p, const double x, const double y, double *dshape_1d, double *dshape)
Definition: fe.cpp:8803
int GetDerivRangeType() const
Returns the FiniteElement::RangeType of the element derivative, either SCALAR or VECTOR.
Definition: fe.hpp:336
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition: fe.cpp:10354
virtual void CalcDivShape(const IntegrationPoint &ip, Vector &divshape) const
Evaluate the divergence of all shape functions of a vector finite element in reference space at the g...
Definition: fe.cpp:3591
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition: fe.cpp:12667
DenseMatrix curlshape
Definition: fe.hpp:793
virtual void Project(VectorCoefficient &vc, ElementTransformation &Trans, Vector &dofs) const
Given a vector coefficient and a transformation, compute its projection (approximation) in the local ...
Definition: fe.hpp:3060
virtual void CalcVShape(ElementTransformation &Trans, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in physical space at the point ...
Definition: fe.hpp:1465
A 3D linear element on a tetrahedron with nodes at the vertices of the tetrahedron.
Definition: fe.hpp:1236
H1_SegmentElement(const int p, const int btype=BasisType::GaussLobatto)
Construct the H1_SegmentElement of order p and BasisType btype.
Definition: fe.cpp:7709
Nedelec1HexFiniteElement()
Construct the Nedelec1HexFiniteElement.
Definition: fe.cpp:5713
A 1D linear element with nodes on the endpoints.
Definition: fe.hpp:909
int orders[Geometry::MaxDim]
Anisotropic orders.
Definition: fe.hpp:245
virtual ~FiniteElement()
Deconstruct the FiniteElement.
Definition: fe.cpp:384
virtual void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
Definition: fe.cpp:10865
virtual void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
Definition: fe.cpp:5987
void CalcPhysDShape(ElementTransformation &Trans, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in physical space at the poi...
Definition: fe.cpp:201
A 2D Crouzeix-Raviart finite element on square.
Definition: fe.hpp:1315
A 2D linear element on triangle with nodes at the vertices of the triangle.
Definition: fe.hpp:929
A quadratic element on triangle with nodes at the &quot;Gaussian&quot; points.
Definition: fe.hpp:1072
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition: fe.cpp:9982
virtual void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
Definition: fe.cpp:10604
virtual void GetLocalInterpolation(ElementTransformation &Trans, DenseMatrix &I) const
Return the local interpolation matrix I (Dof x Dof) where the fine element is the image of the base g...
Definition: fe.hpp:3108
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition: fe.cpp:2535
L2_QuadrilateralElement(const int p, const int btype=BasisType::GaussLegendre)
Construct the L2_QuadrilateralElement of order p and BasisType btype.
Definition: fe.cpp:9509
NURBSFiniteElement(int D, Geometry::Type G, int Do, int O, int F)
Construct NURBSFiniteElement with given.
Definition: fe.hpp:3205
virtual void GetTransferMatrix(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &I) const
Return interpolation matrix, I, which maps dofs from a coarse element, fe, to the fine dofs on this f...
Definition: fe.hpp:3055
Arbitrary order H1 elements in 3D utilizing the Bernstein basis on a wedge.
Definition: fe.hpp:2402
virtual void GetLocalInterpolation(ElementTransformation &Trans, DenseMatrix &I) const
Return the local interpolation matrix I (Dof x Dof) where the fine element is the image of the base g...
Definition: fe.cpp:4248
Basis & GetBasis(const int p, const int btype)
Get a Poly_1D::Basis object of the given degree and BasisType, btype.
Definition: fe.cpp:7428
virtual void GetLocalInterpolation(ElementTransformation &Trans, DenseMatrix &I) const
Return the local interpolation matrix I (Dof x Dof) where the fine element is the image of the base g...
Definition: fe.hpp:2995
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Definition: fe.cpp:1483
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
virtual function which evaluates the values of all partial derivatives of all shape functions at a gi...
Definition: fe.cpp:3038
virtual void CalcDivShape(const IntegrationPoint &ip, Vector &divshape) const
Evaluate the divergence of all shape functions of a vector finite element in reference space at the g...
Definition: fe.cpp:10939
const double * OpenPoints(const int p, const int btype=BasisType::GaussLegendre)
Get coordinates of an open (GaussLegendre) set of points if degree p.
Definition: fe.hpp:1912
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition: fe.cpp:8618
static void CalcBasis(const int p, const double x, double *u, double *d, double *dd)
Evaluate the values, derivatives and second derivatives of a hierarchical 1D basis at point x...
Definition: fe.hpp:1949
virtual void ProjectMatrixCoefficient(MatrixCoefficient &mc, ElementTransformation &T, Vector &dofs) const
Given a matrix coefficient and a transformation, compute an approximation (&quot;projection&quot;) in the local...
Definition: fe.hpp:2827
virtual void CalcHessian(const IntegrationPoint &ip, DenseMatrix &h) const
Evaluate the Hessians of all shape functions of a scalar finite element in reference space at the giv...
Definition: fe.cpp:1732
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition: fe.cpp:9219
L2_WedgeElement(const int p, const int btype=BasisType::GaussLegendre)
Construct the L2_WedgeElement of order p and BasisType btype.
Definition: fe.cpp:10311
void ScalarLocalInterpolation(ElementTransformation &Trans, DenseMatrix &I, const ScalarFiniteElement &fine_fe) const
Get matrix I &quot;Interpolation&quot; defined through local L2-projection in the space defined by the fine_fe...
Definition: fe.cpp:427
void SetElement(int e) const
Definition: fe.hpp:3220
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition: fe.cpp:1810
void ProjectGrad_ND(const double *tk, const Array< int > &d2t, const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &grad) const
Definition: fe.cpp:1213
L2_TetrahedronElement(const int p, const int btype=BasisType::GaussLegendre)
Construct the L2_TetrahedronElement of order p and BasisType btype.
Definition: fe.cpp:10113
int deriv_map_type
Definition: fe.hpp:240
void CalcPhysVShape(ElementTransformation &Trans, DenseMatrix &shape) const
Equivalent to the CalcVShape() method with the same arguments.
Definition: fe.hpp:404
RT0TetFiniteElement()
Construct the RT0TetFiniteElement.
Definition: fe.cpp:6666
static const int MaxDim
Definition: geom.hpp:42
Array< int > t_dof
Definition: fe.hpp:2409
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition: fe.cpp:10084
virtual void Project(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &I) const
Compute the embedding/projection matrix from the given FiniteElement onto &#39;this&#39; FiniteElement. The ElementTransformation is included to support cases when the projection depends on it.
Definition: fe.hpp:2890
bool HasAnisotropicOrders() const
Returns true if the FiniteElement basis may be using different orders/degrees in different spatial di...
Definition: fe.hpp:323
virtual void CalcVShape(ElementTransformation &Trans, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in physical space at the point ...
Definition: fe.hpp:1408
virtual void ProjectCurl(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &curl) const
Compute the discrete curl matrix from the given FiniteElement onto &#39;this&#39; FiniteElement. The ElementTransformation is included to support cases when the matrix depends on it.
Definition: fe.hpp:2475
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition: fe.cpp:12691
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition: fe.cpp:1824
DenseMatrix m_dshape
Definition: fe.hpp:2304
virtual void CalcCurlShape(const IntegrationPoint &ip, DenseMatrix &curl_shape) const
Evaluate the curl of all shape functions of a vector finite element in reference space at the given p...
Definition: fe.cpp:11946
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition: fe.cpp:9640
IntegrationRule Nodes
Definition: fe.hpp:246
virtual void Project(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &I) const
Compute the embedding/projection matrix from the given FiniteElement onto &#39;this&#39; FiniteElement. The ElementTransformation is included to support cases when the projection depends on it.
Definition: fe.hpp:3177
Array< int > dof_map
Definition: fe.hpp:2006
Arbitrary order L2 elements in 3D on a tetrahedron.
Definition: fe.hpp:2578
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Definition: fe.cpp:1694
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition: fe.cpp:9873
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition: fe.cpp:8158
Array< double > Bt
Transpose of B.
Definition: fe.hpp:186
virtual void ProjectDelta(int vertex, Vector &dofs) const
Project a delta function centered on the given vertex in the local finite dimensional space represent...
Definition: fe.cpp:8340
virtual void ProjectFromNodes(Vector &vc, ElementTransformation &Trans, Vector &dofs) const
Given a vector of values at the finite element nodes and a transformation, compute its projection (ap...
Definition: fe.hpp:2824
virtual void Project(VectorCoefficient &vc, ElementTransformation &Trans, Vector &dofs) const
Given a vector coefficient and a transformation, compute its projection (approximation) in the local ...
Definition: fe.cpp:4300
P0HexFiniteElement()
Construct the P0HexFiniteElement.
Definition: fe.cpp:4586
A 2D 2nd order Raviart-Thomas vector element on a square.
Definition: fe.hpp:1425
virtual void CalcCurlShape(const IntegrationPoint &ip, DenseMatrix &curl_shape) const
Evaluate the curl of all shape functions of a vector finite element in reference space at the given p...
Definition: fe.cpp:12377
virtual void CalcDivShape(const IntegrationPoint &ip, Vector &divshape) const
Evaluate the divergence of all shape functions of a vector finite element in reference space at the g...
Definition: fe.cpp:3460
P1SegmentFiniteElement()
Construct the P1SegmentFiniteElement.
Definition: fe.cpp:4322
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Definition: fe.cpp:5232
void LocalInterpolation_ND(const VectorFiniteElement &cfe, const double *tk, const Array< int > &d2t, ElementTransformation &Trans, DenseMatrix &I) const
Definition: fe.cpp:1273
static int CheckClosed(int type)
If the Quadrature1D type is not closed return Invalid; otherwise return type.
Definition: intrules.cpp:849
Arbitrary order Raviart-Thomas elements in 3D on a tetrahedron.
Definition: fe.hpp:2847
virtual void CalcHessian(const IntegrationPoint &ip, DenseMatrix &ddshape) const
Evaluate the Hessians of all shape functions of a scalar finite element in reference space at the giv...
Definition: fe.cpp:8676
H1Pos_TriangleElement TriangleFE
Definition: fe.hpp:2411