17 #include <deal.II/base/std_cxx14/memory.h> 19 #include <deal.II/fe/fe_dgp_monomial.h> 20 #include <deal.II/fe/fe_nothing.h> 21 #include <deal.II/fe/fe_tools.h> 26 DEAL_II_NAMESPACE_OPEN
49 const unsigned int start_index2d[6] = {0, 1, 4, 10, 20, 35};
50 const double points2d[35][2] = {
51 {0, 0}, {0, 0}, {1, 0}, {0, 1}, {0, 0},
52 {1, 0}, {0, 1}, {1, 1}, {0.5, 0}, {0, 0.5},
53 {0, 0}, {1, 0}, {0, 1}, {1, 1}, {1. / 3., 0},
54 {2. / 3., 0}, {0, 1. / 3.}, {0, 2. / 3.}, {0.5, 1}, {1, 0.5},
55 {0, 0}, {1, 0}, {0, 1}, {1, 1}, {0.25, 0},
56 {0.5, 0}, {0.75, 0}, {0, 0.25}, {0, 0.5}, {0, 0.75},
57 {1. / 3., 1}, {2. / 3., 1}, {1, 1. / 3.}, {1, 2. / 3.}, {0.5, 0.5}};
65 const unsigned int start_index3d[6] = {0, 1, 5, 15 };
66 const double points3d[35][3] = {{0, 0, 0},
85 generate_unit_points(
const unsigned int, std::vector<
Point<dim>> &);
89 generate_unit_points(
const unsigned int k, std::vector<
Point<1>> &p)
92 const double h = 1. / k;
93 for (
unsigned int i = 0; i < p.size(); ++i)
99 generate_unit_points(
const unsigned int k, std::vector<
Point<2>> &p)
102 Assert(p.size() == start_index2d[k + 1] - start_index2d[k],
104 for (
unsigned int i = 0; i < p.size(); ++i)
106 p[i](0) = points2d[start_index2d[k] + i][0];
107 p[i](1) = points2d[start_index2d[k] + i][1];
113 generate_unit_points(
const unsigned int k, std::vector<
Point<3>> &p)
116 Assert(p.size() == start_index3d[k + 1] - start_index3d[k],
118 for (
unsigned int i = 0; i < p.size(); ++i)
120 p[i](0) = points3d[start_index3d[k] + i][0];
121 p[i](1) = points3d[start_index3d[k] + i][1];
122 p[i](2) = points3d[start_index3d[k] + i][2];
144 std::vector<bool>(1, true)))
175 std::ostringstream namebuf;
176 namebuf <<
"FE_DGPMonomial<" << dim <<
">(" << this->degree <<
")";
178 return namebuf.str();
184 std::unique_ptr<FiniteElement<dim, dim>>
187 return std_cxx14::make_unique<FE_DGPMonomial<dim>>(*this);
202 if (source_dgp_monomial)
207 const unsigned int m = interpolation_matrix.
m();
208 const unsigned int n = interpolation_matrix.
n();
211 Assert(m == this->dofs_per_cell,
216 const unsigned int min_mn =
217 interpolation_matrix.
m() < interpolation_matrix.
n() ?
218 interpolation_matrix.
m() :
219 interpolation_matrix.
n();
221 for (
unsigned int i = 0; i < min_mn; ++i)
222 interpolation_matrix(i, i) = 1.;
226 std::vector<Point<dim>> unit_points(this->dofs_per_cell);
227 internal::FE_DGPMonomial::generate_unit_points(this->degree, unit_points);
232 for (
unsigned int k = 0; k < unit_points.size(); ++k)
233 source_fe_matrix(k, j) = source_fe.
shape_value(j, unit_points[k]);
236 for (
unsigned int j = 0; j < this->dofs_per_cell; ++j)
237 for (
unsigned int k = 0; k < unit_points.size(); ++k)
238 this_matrix(k, j) = this->poly_space.compute_value(j, unit_points[k]);
242 this_matrix.
mmult(interpolation_matrix, source_fe_matrix);
262 std::vector<unsigned int>
265 std::vector<unsigned int> dpo(dim + 1, 0U);
267 for (
unsigned int i = 1; i < dim; ++i)
269 dpo[dim] *= deg + 1 + i;
288 (void)interpolation_matrix;
294 Assert(interpolation_matrix.
m() == 0,
296 Assert(interpolation_matrix.
n() == 0,
315 (void)interpolation_matrix;
321 Assert(interpolation_matrix.
m() == 0,
323 Assert(interpolation_matrix.
n() == 0,
339 std::vector<std::pair<unsigned int, unsigned int>>
346 return std::vector<std::pair<unsigned int, unsigned int>>();
350 return std::vector<std::pair<unsigned int, unsigned int>>();
357 std::vector<std::pair<unsigned int, unsigned int>>
364 return std::vector<std::pair<unsigned int, unsigned int>>();
368 return std::vector<std::pair<unsigned int, unsigned int>>();
375 std::vector<std::pair<unsigned int, unsigned int>>
382 return std::vector<std::pair<unsigned int, unsigned int>>();
386 return std::vector<std::pair<unsigned int, unsigned int>>();
395 const unsigned int codim)
const 412 if (this->degree < fe_monomial_other->degree)
414 else if (this->degree == fe_monomial_other->degree)
422 if (fe_nothing->is_dominating())
440 const unsigned int face_index)
const 442 return face_index == 1 || (face_index == 0 && this->degree == 0);
450 const unsigned int face_index)
const 452 bool support_on_face =
false;
453 if (face_index == 1 || face_index == 2)
454 support_on_face =
true;
457 const std::array<unsigned int, 2> degrees =
458 this->poly_space.directional_degrees(shape_index);
460 if ((face_index == 0 && degrees[1] == 0) ||
461 (face_index == 3 && degrees[0] == 0))
462 support_on_face =
true;
464 return support_on_face;
472 const unsigned int face_index)
const 474 bool support_on_face =
false;
475 if (face_index == 1 || face_index == 3 || face_index == 4)
476 support_on_face =
true;
479 const std::array<unsigned int, 3> degrees =
480 this->poly_space.directional_degrees(shape_index);
482 if ((face_index == 0 && degrees[1] == 0) ||
483 (face_index == 2 && degrees[2] == 0) ||
484 (face_index == 5 && degrees[0] == 0))
485 support_on_face =
true;
487 return support_on_face;
503 #include "fe_dgp_monomial.inst" 506 DEAL_II_NAMESPACE_CLOSE
virtual std::vector< std::pair< unsigned int, unsigned int > > hp_quad_dof_identities(const FiniteElement< dim > &fe_other) const override
static std::vector< unsigned int > get_dpo_vector(const unsigned int degree)
virtual void get_subface_interpolation_matrix(const FiniteElement< dim > &source, const unsigned int subface, FullMatrix< double > &matrix) const override
std::vector< std::vector< FullMatrix< double > > > restriction
FE_DGPMonomial(const unsigned int p)
const unsigned int degree
virtual std::size_t memory_consumption() const override
virtual void get_face_interpolation_matrix(const FiniteElement< dim > &source, FullMatrix< double > &matrix) const override
#define AssertThrow(cond, exc)
virtual std::vector< std::pair< unsigned int, unsigned int > > hp_line_dof_identities(const FiniteElement< dim > &fe_other) const override
virtual void get_interpolation_matrix(const FiniteElement< dim > &source, FullMatrix< double > &matrix) const override
virtual bool has_support_on_face(const unsigned int shape_index, const unsigned int face_index) const override
void initialize_restriction()
static ::ExceptionBase & ExcImpossibleInDim(int arg1)
std::vector< std::vector< FullMatrix< double > > > prolongation
#define Assert(cond, exc)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
virtual std::string get_name() const =0
const unsigned int dofs_per_cell
virtual bool hp_constraints_are_implemented() const override
void mmult(FullMatrix< number2 > &C, const FullMatrix< number2 > &B, const bool adding=false) const
virtual std::vector< std::pair< unsigned int, unsigned int > > hp_vertex_dof_identities(const FiniteElement< dim > &fe_other) const override
virtual double shape_value(const unsigned int i, const Point< dim > &p) const
void reinit_restriction_and_prolongation_matrices(const bool isotropic_restriction_only=false, const bool isotropic_prolongation_only=false)
static ::ExceptionBase & ExcNotImplemented()
virtual FiniteElementDomination::Domination compare_for_domination(const FiniteElement< dim > &fe_other, const unsigned int codim=0) const override final
PolynomialsP< dim > poly_space
virtual std::string get_name() const override
virtual std::unique_ptr< FiniteElement< dim, dim > > clone() const override
static ::ExceptionBase & ExcInternalError()