1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2020 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii_simplex_fe_lib_h
17 #define dealii_simplex_fe_lib_h
18 
19 #include <deal.II/base/config.h>
20 
21 #include <deal.II/fe/fe_poly.h>
22 
23 #include <deal.II/simplex/polynomials.h>
24 
25 DEAL_II_NAMESPACE_OPEN
26 
27 namespace Simplex
28 {
29   /**
30    * Base class of FE_P and FE_DGP.
31    *
32    * @note Only implemented for 2D and 3D.
33    *
34    * @ingroup simplex
35    */
36   template <int dim, int spacedim = dim>
37   class FE_Poly : public dealii::FE_Poly<dim, spacedim>
38   {
39   public:
40     /**
41      * Constructor.
42      */
43     FE_Poly(const unsigned int               degree,
44             const std::vector<unsigned int> &dpo_vector);
45 
46   private:
47     /**
48      * @copydoc dealii::FiniteElement::convert_generalized_support_point_values_to_dof_values()
49      */
50     void
51     convert_generalized_support_point_values_to_dof_values(
52       const std::vector<Vector<double>> &support_point_values,
53       std::vector<double> &              nodal_values) const override;
54   };
55 
56 
57 
58   /**
59    * Implementation of a scalar Lagrange finite element Pp that yields
60    * the finite element space of continuous, piecewise polynomials of
61    * degree p.
62    *
63    * @ingroup simplex
64    */
65   template <int dim, int spacedim = dim>
66   class FE_P : public FE_Poly<dim, spacedim>
67   {
68   public:
69     /**
70      * Constructor.
71      */
72     FE_P(const unsigned int degree);
73 
74     /**
75      * @copydoc dealii::FiniteElement::clone()
76      */
77     std::unique_ptr<FiniteElement<dim, spacedim>>
78     clone() const override;
79 
80     /**
81      * Return a string that uniquely identifies a finite element. This class
82      * returns <tt>Simplex::FE_P<dim>(degree)</tt>, with @p dim and @p degree
83      * replaced by appropriate values.
84      */
85     std::string
86     get_name() const override;
87   };
88 
89 
90 
91   /**
92    * Implementation of a scalar Lagrange finite element Pp that yields
93    * the finite element space of discontinuous, piecewise polynomials of
94    * degree p.
95    *
96    * @ingroup simplex
97    */
98   template <int dim, int spacedim = dim>
99   class FE_DGP : public FE_Poly<dim, spacedim>
100   {
101   public:
102     /**
103      * Constructor.
104      */
105     FE_DGP(const unsigned int degree);
106 
107     /**
108      * @copydoc dealii::FiniteElement::clone()
109      */
110     std::unique_ptr<FiniteElement<dim, spacedim>>
111     clone() const override;
112 
113     /**
114      * Return a string that uniquely identifies a finite element. This class
115      * returns <tt>Simplex::FE_DGP<dim>(degree)</tt>, with @p dim and @p degree
116      * replaced by appropriate values.
117      */
118     std::string
119     get_name() const override;
120   };
121 
122 } // namespace Simplex
123 
124 DEAL_II_NAMESPACE_CLOSE
125 
126 #endif
127