17 #include <deal.II/base/qprojector.h> 18 #include <deal.II/base/quadrature.h> 19 #include <deal.II/base/quadrature_lib.h> 20 #include <deal.II/base/std_cxx14/memory.h> 21 #include <deal.II/base/template_constraints.h> 23 #include <deal.II/dofs/dof_accessor.h> 25 #include <deal.II/fe/fe_dgq.h> 26 #include <deal.II/fe/fe_nothing.h> 27 #include <deal.II/fe/fe_q_dg0.h> 32 DEAL_II_NAMESPACE_OPEN
35 template <
int dim,
int spacedim>
45 get_riaf_vector(degree))
48 ExcMessage(
"This element can only be used for polynomial degrees " 49 "greater than zero"));
55 for (
unsigned int d = 0; d < dim; ++d)
63 template <
int dim,
int spacedim>
67 Polynomials::generate_complete_Lagrange_basis(points.get_points())),
72 get_riaf_vector(points.size() - 1))
78 ExcMessage(
"This element can only be used for polynomial degrees " 85 for (
unsigned int d = 0; d < dim; ++d)
93 template <
int dim,
int spacedim>
101 std::ostringstream namebuf;
103 const unsigned int n_points = this->degree + 1;
104 std::vector<double> points(n_points);
105 const unsigned int dofs_per_cell = this->dofs_per_cell;
106 const std::vector<Point<dim>> &unit_support_points =
107 this->unit_support_points;
108 unsigned int index = 0;
111 for (
unsigned int j = 0; j < dofs_per_cell; j++)
113 if ((dim > 1) ? (unit_support_points[j](1) == 0 &&
114 ((dim > 2) ? unit_support_points[j](2) == 0 :
true)) :
118 points[index] = unit_support_points[j](0);
120 points[n_points - 1] = unit_support_points[j](0);
122 points[index - 1] = unit_support_points[j](0);
128 Assert(index == n_points || (dim == 1 && index == n_points + 1),
130 "Could not decode support points in one coordinate direction."));
133 for (
unsigned int j = 0; j < n_points; j++)
134 if (std::fabs(points[j] - static_cast<double>(j) / this->degree) > 1e-15)
142 if (this->degree > 2)
144 <<
">(QIterated(QTrapez()," << this->degree <<
"))";
147 << this->degree <<
")";
154 for (
unsigned int j = 0; j < n_points; j++)
155 if (points[j] != points_gl.
point(j)(0))
162 << this->degree <<
")";
165 <<
">(QUnknownNodes(" << this->degree <<
"))";
167 return namebuf.str();
172 template <
int dim,
int spacedim>
173 std::unique_ptr<FiniteElement<dim, spacedim>>
176 return std_cxx14::make_unique<FE_Q_DG0<dim, spacedim>>(*this);
181 template <
int dim,
int spacedim>
185 std::vector<double> & nodal_dofs)
const 187 Assert(support_point_values.size() == this->unit_support_points.size(),
189 this->unit_support_points.size()));
190 Assert(nodal_dofs.size() == this->dofs_per_cell,
196 for (
unsigned int i = 0; i < this->dofs_per_cell - 1; ++i)
198 const std::pair<unsigned int, unsigned int> index =
199 this->system_to_component_index(i);
200 nodal_dofs[i] = support_point_values[i](index.first);
204 nodal_dofs[nodal_dofs.size() - 1] = 0.;
209 template <
int dim,
int spacedim>
219 (x_source_fe.
get_name().find(
"FE_Q_DG0<") == 0) ||
220 (dynamic_cast<const FEQDG0 *>(&x_source_fe) !=
nullptr),
223 Assert(interpolation_matrix.
m() == this->dofs_per_cell,
230 get_interpolation_matrix(x_source_fe, interpolation_matrix);
235 template <
int dim,
int spacedim>
239 std::vector<bool> riaf(Utilities::fixed_power<dim>(deg + 1) + 1,
false);
240 riaf[riaf.size() - 1] =
true;
246 template <
int dim,
int spacedim>
247 std::vector<unsigned int>
250 std::vector<unsigned int> dpo(dim + 1, 1U);
251 for (
unsigned int i = 1; i < dpo.size(); ++i)
252 dpo[i] = dpo[i - 1] * (deg - 1);
260 template <
int dim,
int spacedim>
263 const unsigned int shape_index,
264 const unsigned int face_index)
const 267 if (shape_index == this->dofs_per_cell - 1)
271 has_support_on_face(shape_index, face_index);
276 template <
int dim,
int spacedim>
277 std::pair<Table<2, bool>, std::vector<unsigned int>>
283 for (
unsigned int i = 0; i < this->dofs_per_cell - 1; ++i)
284 constant_modes(0, i) =
true;
287 constant_modes(1, this->dofs_per_cell - 1) =
true;
289 return std::pair<Table<2, bool>, std::vector<unsigned int>>(
290 constant_modes, std::vector<unsigned int>(2, 0));
295 template <
int dim,
int spacedim>
299 const unsigned int codim)
const 318 if (this->degree < fe_dg0_other->degree)
320 else if (this->degree == fe_dg0_other->degree)
328 if (fe_nothing->is_dominating())
343 #include "fe_q_dg0.inst" 345 DEAL_II_NAMESPACE_CLOSE
#define AssertDimension(dim1, dim2)
const std::vector< Point< dim > > & get_points() const
const unsigned int degree
const Point< dim > & point(const unsigned int i) const
#define AssertThrow(cond, exc)
virtual std::pair< Table< 2, bool >, std::vector< unsigned int > > get_constant_modes() const override
std::vector< Point< dim > > unit_support_points
static ::ExceptionBase & ExcMessage(std::string arg1)
static ::ExceptionBase & ExcImpossibleInDim(int arg1)
virtual FiniteElementDomination::Domination compare_for_domination(const FiniteElement< dim, spacedim > &fe_other, const unsigned int codim=0) const override final
#define Assert(cond, exc)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
virtual std::string get_name() const =0
std::string dim_string(const int dim, const int spacedim)
unsigned int size() const
const unsigned int dofs_per_cell
static std::vector< bool > get_riaf_vector(const unsigned int degree)
void initialize(const std::vector< Point< 1 >> &support_points_1d)
FE_Q_DG0(const unsigned int p)
virtual std::unique_ptr< FiniteElement< dim, spacedim > > clone() const override
static ::ExceptionBase & ExcNotImplemented()
virtual bool has_support_on_face(const unsigned int shape_index, const unsigned int face_index) const override
virtual void get_interpolation_matrix(const FiniteElement< dim, spacedim > &source, FullMatrix< double > &matrix) const override
unsigned int n_components(const DoFHandler< dim, spacedim > &dh)
virtual std::string get_name() const override
virtual void convert_generalized_support_point_values_to_dof_values(const std::vector< Vector< double >> &support_point_values, std::vector< double > &nodal_values) const override
static std::vector< unsigned int > get_dpo_vector(const unsigned int degree)