17 #include <deal.II/fe/fe_face.h> 18 #include <deal.II/fe/fe_poly_face.templates.h> 19 #include <deal.II/fe/fe_nothing.h> 20 #include <deal.II/fe/fe_tools.h> 21 #include <deal.II/base/quadrature_lib.h> 22 #include <deal.II/lac/householder.h> 25 #include <deal.II/base/std_cxx14/memory.h> 27 DEAL_II_NAMESPACE_OPEN
32 namespace FE_FaceQImplementation
36 std::vector<Point<1> >
37 get_QGaussLobatto_points (
const unsigned int degree)
42 return std::vector<Point<1> >(1,
Point<1>(0.5));
48 template <
int dim,
int spacedim>
54 std::vector<bool>(1,true))
57 const unsigned int codim = dim-1;
60 if (this->degree == 0)
61 for (
unsigned int d=0; d<codim; ++d)
65 std::vector<Point<1> > points = internal::FE_FaceQImplementation::get_QGaussLobatto_points(
degree);
68 for (
unsigned int iz=0; iz <= ((codim>2) ? this->degree : 0) ; ++iz)
69 for (
unsigned int iy=0; iy <= ((codim>1) ? this->degree : 0) ; ++iy)
70 for (
unsigned int ix=0; ix<=this->
degree; ++ix)
90 for (
unsigned int i=0; i<n_face_dofs; ++i)
91 for (
unsigned int d=0; d<dim; ++d)
93 for (
unsigned int e=0, c=0; e<dim; ++e)
97 unsigned int renumber = i;
98 if (dim == 3 && d == 1)
112 template <
int dim,
int spacedim>
113 std::unique_ptr<FiniteElement<dim,spacedim> >
116 return std_cxx14::make_unique<FE_FaceQ<dim,spacedim>>(this->degree);
121 template <
int dim,
int spacedim>
128 std::ostringstream namebuf;
129 namebuf <<
"FE_FaceQ<" 131 <<
">(" << this->degree <<
")";
133 return namebuf.str();
138 template <
int dim,
int spacedim>
145 interpolation_matrix);
150 template <
int dim,
int spacedim>
154 const unsigned int subface,
159 Assert (interpolation_matrix.
n() == this->dofs_per_face,
161 this->dofs_per_face));
176 Assert (this->dofs_per_face <= source_fe->dofs_per_face,
178 ExcInterpolationNotImplemented ()));
181 const Quadrature<dim-1> face_quadrature (source_fe->get_unit_face_support_points ());
186 const double eps = 2e-13*(this->degree+1)*(dim-1);
190 for (
unsigned int i=0; i<source_fe->dofs_per_face; ++i)
192 const Point<dim-1> p =
195 face_quadrature.point(i)
200 for (
unsigned int j=0; j<this->dofs_per_face; ++j)
202 double matrix_entry = this->poly_space.compute_value (j, p);
207 if (std::fabs (matrix_entry - 1.0) < eps)
209 if (std::fabs (matrix_entry) < eps)
212 interpolation_matrix(i,j) = matrix_entry;
218 for (
unsigned int j=0; j<source_fe->dofs_per_face; ++j)
222 for (
unsigned int i=0; i<this->dofs_per_face; ++i)
223 sum += interpolation_matrix(j,i);
228 else if (
dynamic_cast<const FE_Nothing<dim> *
>(&x_source_fe) !=
nullptr)
234 ExcInterpolationNotImplemented()));
239 template <
int dim,
int spacedim>
242 const unsigned int shape_index,
243 const unsigned int face_index)
const 245 return (face_index == (shape_index/this->dofs_per_face));
250 template <
int dim,
int spacedim>
251 std::vector<unsigned int>
254 std::vector<unsigned int> dpo(dim+1, 0U);
256 for (
unsigned int i=1; i<dim-1; ++i)
263 template <
int dim,
int spacedim>
272 template <
int dim,
int spacedim>
273 std::vector<std::pair<unsigned int, unsigned int> >
279 std::vector<std::pair<unsigned int, unsigned int> > ();
284 template <
int dim,
int spacedim>
285 std::vector<std::pair<unsigned int, unsigned int> >
294 std::vector<std::pair<unsigned int, unsigned int> > ();
307 const unsigned int p = this->degree;
308 const unsigned int q = fe_q_other->degree;
310 std::vector<std::pair<unsigned int, unsigned int> > identities;
312 const std::vector<unsigned int> &index_map_inverse=
313 this->poly_space.get_numbering_inverse();
314 const std::vector<unsigned int> &index_map_inverse_other=
315 fe_q_other->poly_space.get_numbering_inverse();
317 for (
unsigned int i=0; i<p+1; ++i)
318 for (
unsigned int j=0; j<q+1; ++j)
319 if (std::fabs(this->unit_support_points[index_map_inverse[i]][dim-1]-
320 fe_q_other->unit_support_points[index_map_inverse_other[j]][dim-1])
322 identities.emplace_back (i, j);
330 return std::vector<std::pair<unsigned int, unsigned int> > ();
341 return std::vector<std::pair<unsigned int, unsigned int> > ();
346 return std::vector<std::pair<unsigned int, unsigned int> > ();
353 template <
int dim,
int spacedim>
354 std::vector<std::pair<unsigned int, unsigned int> >
363 std::vector<std::pair<unsigned int, unsigned int> > ();
375 const unsigned int p = this->degree;
376 const unsigned int q = fe_q_other->degree;
378 std::vector<std::pair<unsigned int, unsigned int> > identities;
380 const std::vector<unsigned int> &index_map_inverse=
381 this->poly_space.get_numbering_inverse();
382 const std::vector<unsigned int> &index_map_inverse_other=
383 fe_q_other->poly_space.get_numbering_inverse();
385 std::vector<std::pair<unsigned int, unsigned int> > identities_1d;
387 for (
unsigned int i=0; i<p+1; ++i)
388 for (
unsigned int j=0; j<q+1; ++j)
389 if (std::fabs(this->unit_support_points[index_map_inverse[i]][dim-2]-
390 fe_q_other->unit_support_points[index_map_inverse_other[j]][dim-2])
392 identities_1d.emplace_back (i, j);
394 for (
unsigned int n1=0; n1<identities_1d.size(); ++n1)
395 for (
unsigned int n2=0; n2<identities_1d.size(); ++n2)
396 identities.emplace_back (identities_1d[n1].first*(p+1)+identities_1d[n2].first,
397 identities_1d[n1].second*(q+1)+identities_1d[n2].second);
405 return std::vector<std::pair<unsigned int, unsigned int> > ();
416 return std::vector<std::pair<unsigned int, unsigned int> > ();
421 return std::vector<std::pair<unsigned int, unsigned int> > ();
428 template <
int dim,
int spacedim>
436 if (this->degree < fe_q_other->degree)
438 else if (this->degree == fe_q_other->degree)
445 if (fe_nothing->is_dominating())
463 template <
int dim,
int spacedim>
464 std::pair<Table<2,bool>, std::vector<unsigned int> >
468 for (
unsigned int i=0; i<this->dofs_per_cell; ++i)
469 constant_modes(0,i) =
true;
470 return std::pair<Table<2,bool>, std::vector<unsigned int> >
471 (constant_modes, std::vector<unsigned int>(1, 0));
474 template <
int dim,
int spacedim>
478 std::vector<double> &nodal_values)
const 481 this->get_unit_support_points().size());
483 nodal_values.size());
485 nodal_values.size());
487 for (
unsigned int i=0; i<this->dofs_per_cell; ++i)
491 nodal_values[i] = support_point_values[i](0);
497 template <
int spacedim>
501 std::vector<bool>(1,true),
514 template <
int spacedim>
515 std::unique_ptr<FiniteElement<1,spacedim>>
518 return std_cxx14::make_unique<FE_FaceQ<1,spacedim>>(this->
degree);
523 template <
int spacedim>
530 std::ostringstream namebuf;
531 namebuf <<
"FE_FaceQ<" 533 <<
">(" << this->
degree <<
")";
535 return namebuf.str();
540 template <
int spacedim>
547 interpolation_matrix);
552 template <
int spacedim>
566 interpolation_matrix(0,0) = 1.;
571 template <
int spacedim>
574 const unsigned int shape_index,
575 const unsigned int face_index)
const 578 return (face_index == shape_index);
583 template <
int spacedim>
584 std::vector<unsigned int>
587 std::vector<unsigned int> dpo(2, 0U);
594 template <
int spacedim>
601 template <
int spacedim>
602 std::vector<std::pair<unsigned int, unsigned int> >
608 std::vector<std::pair<unsigned int, unsigned int> > (1,std::make_pair(0U,0U));
613 template <
int spacedim>
614 std::vector<std::pair<unsigned int, unsigned int> >
620 std::vector<std::pair<unsigned int, unsigned int> > ();
625 template <
int spacedim>
626 std::vector<std::pair<unsigned int, unsigned int> >
632 std::vector<std::pair<unsigned int, unsigned int> > ();
637 template <
int spacedim>
647 template <
int spacedim>
648 std::pair<Table<2,bool>, std::vector<unsigned int> >
653 constant_modes(0,i) =
true;
654 return std::pair<Table<2,bool>, std::vector<unsigned int> >
655 (constant_modes, std::vector<unsigned int>(1,0));
660 template <
int spacedim>
676 template <
int spacedim>
684 const ::internal::FEValuesImplementation::MappingRelatedData<1, spacedim> &,
693 template <
int spacedim>
697 const unsigned int face,
701 const ::internal::FEValuesImplementation::MappingRelatedData<1, spacedim> &,
705 const unsigned int foffset = face;
715 template <
int spacedim>
724 const ::internal::FEValuesImplementation::MappingRelatedData<1, spacedim> &,
735 template <
int dim,
int spacedim>
741 std::vector<bool>(1,true))
746 template <
int dim,
int spacedim>
747 std::unique_ptr<FiniteElement<dim,spacedim> >
750 return std_cxx14::make_unique<FE_FaceP<dim,spacedim>>(this->degree);
755 template <
int dim,
int spacedim>
762 std::ostringstream namebuf;
763 namebuf <<
"FE_FaceP<" 765 <<
">(" << this->degree <<
")";
767 return namebuf.str();
772 template <
int dim,
int spacedim>
775 const unsigned int shape_index,
776 const unsigned int face_index)
const 778 return (face_index == (shape_index/this->dofs_per_face));
783 template <
int dim,
int spacedim>
784 std::vector<unsigned int>
787 std::vector<unsigned int> dpo(dim+1, 0U);
789 for (
unsigned int i=1; i<dim-1; ++i)
791 dpo[dim-1] *= deg+1+i;
799 template <
int dim,
int spacedim>
808 template <
int dim,
int spacedim>
816 if (this->degree < fe_q_other->degree)
818 else if (this->degree == fe_q_other->degree)
825 if (fe_nothing->is_dominating())
844 template <
int dim,
int spacedim>
851 interpolation_matrix);
856 template <
int dim,
int spacedim>
860 const unsigned int subface,
865 Assert (interpolation_matrix.
n() == this->dofs_per_face,
867 this->dofs_per_face));
881 Assert (this->dofs_per_face <= source_fe->dofs_per_face,
883 ExcInterpolationNotImplemented ()));
888 const QGauss<dim-1> face_quadrature (source_fe->degree+1);
893 const double eps = 2e-13*(this->degree+1)*(dim-1);
897 for (
unsigned int k = 0; k < face_quadrature.size(); ++k)
899 const Point<dim-1> p =
901 face_quadrature.point(k) :
905 for (
unsigned int j = 0; j < source_fe->dofs_per_face; ++j)
906 mass (k, j) = source_fe->poly_space.compute_value(j, p);
916 for (
unsigned int i=0; i<this->dofs_per_face; ++i)
918 for (
unsigned int k = 0; k < face_quadrature.size(); ++k)
921 face_quadrature.point(k) :
924 v_in(k) = this->poly_space.compute_value(i, p);
930 for (
unsigned int j = 0; j < source_fe->dofs_per_face; ++j)
932 double matrix_entry = v_out(j);
937 if (std::fabs (matrix_entry - 1.0) < eps)
939 if (std::fabs (matrix_entry) < eps)
942 interpolation_matrix(j,i) = matrix_entry;
946 else if (
dynamic_cast<const FE_Nothing<dim> *
>(&x_source_fe) !=
nullptr)
952 ExcInterpolationNotImplemented()));
957 template <
int dim,
int spacedim>
958 std::pair<Table<2,bool>, std::vector<unsigned int> >
962 for (
unsigned int face=0; face<GeometryInfo<dim>::faces_per_cell; ++face)
963 constant_modes(0, face*this->dofs_per_face) =
true;
964 return std::pair<Table<2,bool>, std::vector<unsigned int> >
965 (constant_modes, std::vector<unsigned int>(1, 0));
970 template <
int spacedim>
978 template <
int spacedim>
985 std::ostringstream namebuf;
986 namebuf <<
"FE_FaceP<" 988 <<
">(" << this->
degree <<
")";
990 return namebuf.str();
996 #include "fe_face.inst" 999 DEAL_II_NAMESPACE_CLOSE
static Point< dim > child_to_cell_coordinates(const Point< dim > &p, const unsigned int child_index, const RefinementCase< dim > refine_case=RefinementCase< dim >::isotropic_refinement)
virtual bool has_support_on_face(const unsigned int shape_index, const unsigned int face_index) const
Transformed quadrature weights.
static const unsigned int invalid_unsigned_int
static ::ExceptionBase & ExcLeastSquaresError(double arg1)
#define AssertDimension(dim1, dim2)
virtual std::unique_ptr< FiniteElement< dim, spacedim > > clone() const
#define AssertIndexRange(index, range)
const unsigned int degree
virtual FiniteElementDomination::Domination compare_for_face_domination(const FiniteElement< dim, spacedim > &fe_other) const
virtual void get_face_interpolation_matrix(const FiniteElement< dim, spacedim > &source, FullMatrix< double > &matrix) const
#define AssertThrow(cond, exc)
virtual std::vector< std::pair< unsigned int, unsigned int > > hp_quad_dof_identities(const FiniteElement< dim, spacedim > &fe_other) const
virtual void get_subface_interpolation_matrix(const FiniteElement< dim, spacedim > &source, const unsigned int subface, FullMatrix< double > &matrix) const
virtual UpdateFlags requires_update_flags(const UpdateFlags update_flags) const
std::vector< Point< dim > > unit_support_points
static ::ExceptionBase & ExcMessage(std::string arg1)
#define Assert(cond, exc)
virtual std::pair< Table< 2, bool >, std::vector< unsigned int > > get_constant_modes() const
virtual std::string get_name() const
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
Abstract base class for mapping classes.
std::vector< Point< dim-1 > > unit_face_support_points
virtual bool hp_constraints_are_implemented() const
FE_FaceQ(const unsigned int p)
virtual void convert_generalized_support_point_values_to_dof_values(const std::vector< Vector< double > > &support_point_values, std::vector< double > &nodal_values) const
static std::vector< unsigned int > get_dpo_vector(const unsigned int deg)
virtual bool has_support_on_face(const unsigned int shape_index, const unsigned int face_index) const
Second derivatives of shape functions.
std::string dim_string(const int dim, const int spacedim)
virtual void get_subface_interpolation_matrix(const FiniteElement< dim, spacedim > &source, const unsigned int subface, FullMatrix< double > &matrix) const
virtual std::vector< std::pair< unsigned int, unsigned int > > hp_vertex_dof_identities(const FiniteElement< dim, spacedim > &fe_other) const
SymmetricTensor< rank, dim, Number > sum(const SymmetricTensor< rank, dim, Number > &local, const MPI_Comm &mpi_communicator)
const unsigned int dofs_per_cell
virtual void get_face_interpolation_matrix(const FiniteElement< dim, spacedim > &source, FullMatrix< double > &matrix) const
virtual std::unique_ptr< FiniteElement< dim, spacedim > > clone() const
Shape function gradients.
static std::vector< unsigned int > get_dpo_vector(const unsigned int deg)
const unsigned int dofs_per_face
double least_squares(Vector< number2 > &dst, const Vector< number2 > &src) const
static ::ExceptionBase & ExcNotImplemented()
virtual std::string get_name() const
virtual std::pair< Table< 2, bool >, std::vector< unsigned int > > get_constant_modes() const
Covariant transformation.
virtual FiniteElementDomination::Domination compare_for_face_domination(const FiniteElement< dim, spacedim > &fe_other) const
virtual std::vector< std::pair< unsigned int, unsigned int > > hp_line_dof_identities(const FiniteElement< dim, spacedim > &fe_other) const
static ::ExceptionBase & ExcInternalError()
virtual bool hp_constraints_are_implemented() const