From fb0ad72118683b01e342666787056f6735a9f03c Mon Sep 17 00:00:00 2001 From: bangerth Date: Thu, 10 Aug 2006 21:19:24 +0000 Subject: [PATCH] Implement face_interpolation and subface_interpolation matrices for discontinuous elements (which needs no such matrices at all, making this a rather simple exercise :-) git-svn-id: https://svn.dealii.org/trunk@13648 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/include/fe/fe_dgp.h | 67 +++++++++++++++++- deal.II/deal.II/include/fe/fe_dgp_monomial.h | 68 +++++++++++++++++- .../deal.II/include/fe/fe_dgp_nonparametric.h | 69 ++++++++++++++++++- deal.II/deal.II/include/fe/fe_dgq.h | 67 +++++++++++++++++- deal.II/deal.II/source/fe/fe_dgp.cc | 67 ++++++++++++++++++ deal.II/deal.II/source/fe/fe_dgp_monomial.cc | 66 ++++++++++++++++++ .../deal.II/source/fe/fe_dgp_nonparametric.cc | 66 ++++++++++++++++++ deal.II/deal.II/source/fe/fe_dgq.cc | 68 +++++++++++++++++- 8 files changed, 531 insertions(+), 7 deletions(-) diff --git a/deal.II/deal.II/include/fe/fe_dgp.h b/deal.II/deal.II/include/fe/fe_dgp.h index 3a8df6724a..da97d77997 100644 --- a/deal.II/deal.II/include/fe/fe_dgp.h +++ b/deal.II/deal.II/include/fe/fe_dgp.h @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2002, 2003, 2004, 2005 by the deal.II authors +// Copyright (C) 2002, 2003, 2004, 2005, 2006 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -59,7 +59,72 @@ class FE_DGP : public FE_Poly,dim> */ virtual std::string get_name () const; + /** + * Return whether this element + * implements its hanging node + * constraints in the new way, + * which has to be used to make + * elements "hp compatible". + * + * For the FE_DGP class the result is + * always true (independent of the degree + * of the element), as it has no hanging + * nodes (being a discontinuous element). + */ + virtual bool hp_constraints_are_implemented () const; + + /** + * Return the matrix + * interpolating from a face of + * of one element to the face of + * the neighboring element. + * The size of the matrix is + * then @p dofs_per_face times + * source.dofs_per_face. + * + * Derived elements will have to + * implement this function. They + * may only provide interpolation + * matrices for certain source + * finite elements, for example + * those from the same family. If + * they don't implement + * interpolation from a given + * element, then they must throw + * an exception of type + * FiniteElement::ExcInterpolationNotImplemented. + */ + virtual void + get_face_interpolation_matrix (const FiniteElement &source, + FullMatrix &matrix) const; + /** + * Return the matrix + * interpolating from a face of + * of one element to the face of + * the neighboring element. + * The size of the matrix is + * then @p dofs_per_face times + * source.dofs_per_face. + * + * Derived elements will have to + * implement this function. They + * may only provide interpolation + * matrices for certain source + * finite elements, for example + * those from the same family. If + * they don't implement + * interpolation from a given + * element, then they must throw + * an exception of type + * FiniteElement::ExcInterpolationNotImplemented. + */ + virtual void + get_subface_interpolation_matrix (const FiniteElement &source, + const unsigned int subface, + FullMatrix &matrix) const; + + /** * Check for non-zero values on a face. * * This function returns diff --git a/deal.II/deal.II/include/fe/fe_dgp_monomial.h b/deal.II/deal.II/include/fe/fe_dgp_monomial.h index 5698ce39fb..6e041c822d 100644 --- a/deal.II/deal.II/include/fe/fe_dgp_monomial.h +++ b/deal.II/deal.II/include/fe/fe_dgp_monomial.h @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2004, 2005 by the deal.II authors +// Copyright (C) 2004, 2005, 2006 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -55,6 +55,21 @@ class FE_DGPMonomial : public FE_Poly,dim> */ virtual std::string get_name () const; + /** + * Return whether this element + * implements its hanging node + * constraints in the new way, + * which has to be used to make + * elements "hp compatible". + * + * For the FE_DGPMonomial class the + * result is always true (independent of + * the degree of the element), as it has + * no hanging nodes (being a + * discontinuous element). + */ + virtual bool hp_constraints_are_implemented () const; + /** * Return the matrix * interpolating from the given @@ -75,6 +90,57 @@ class FE_DGPMonomial : public FE_Poly,dim> get_interpolation_matrix (const FiniteElement &source, FullMatrix &matrix) const; + /** + * Return the matrix + * interpolating from a face of + * of one element to the face of + * the neighboring element. + * The size of the matrix is + * then @p dofs_per_face times + * source.dofs_per_face. + * + * Derived elements will have to + * implement this function. They + * may only provide interpolation + * matrices for certain source + * finite elements, for example + * those from the same family. If + * they don't implement + * interpolation from a given + * element, then they must throw + * an exception of type + * FiniteElement::ExcInterpolationNotImplemented. + */ + virtual void + get_face_interpolation_matrix (const FiniteElement &source, + FullMatrix &matrix) const; + + /** + * Return the matrix + * interpolating from a face of + * of one element to the face of + * the neighboring element. + * The size of the matrix is + * then @p dofs_per_face times + * source.dofs_per_face. + * + * Derived elements will have to + * implement this function. They + * may only provide interpolation + * matrices for certain source + * finite elements, for example + * those from the same family. If + * they don't implement + * interpolation from a given + * element, then they must throw + * an exception of type + * FiniteElement::ExcInterpolationNotImplemented. + */ + virtual void + get_subface_interpolation_matrix (const FiniteElement &source, + const unsigned int subface, + FullMatrix &matrix) const; + /** * Check for non-zero values on a face. * diff --git a/deal.II/deal.II/include/fe/fe_dgp_nonparametric.h b/deal.II/deal.II/include/fe/fe_dgp_nonparametric.h index f2a489a86c..30f6c6727f 100644 --- a/deal.II/deal.II/include/fe/fe_dgp_nonparametric.h +++ b/deal.II/deal.II/include/fe/fe_dgp_nonparametric.h @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2002, 2003, 2004, 2005 by the deal.II authors +// Copyright (C) 2002, 2003, 2004, 2005, 2006 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -205,6 +205,72 @@ class FE_DGPNonparametric : public FiniteElement */ virtual unsigned int element_multiplicity (const unsigned int index) const; + /** + * Return the matrix + * interpolating from a face of + * of one element to the face of + * the neighboring element. + * The size of the matrix is + * then @p dofs_per_face times + * source.dofs_per_face. + * + * Derived elements will have to + * implement this function. They + * may only provide interpolation + * matrices for certain source + * finite elements, for example + * those from the same family. If + * they don't implement + * interpolation from a given + * element, then they must throw + * an exception of type + * FiniteElement::ExcInterpolationNotImplemented. + */ + virtual void + get_face_interpolation_matrix (const FiniteElement &source, + FullMatrix &matrix) const; + + /** + * Return the matrix + * interpolating from a face of + * of one element to the face of + * the neighboring element. + * The size of the matrix is + * then @p dofs_per_face times + * source.dofs_per_face. + * + * Derived elements will have to + * implement this function. They + * may only provide interpolation + * matrices for certain source + * finite elements, for example + * those from the same family. If + * they don't implement + * interpolation from a given + * element, then they must throw + * an exception of type + * FiniteElement::ExcInterpolationNotImplemented. + */ + virtual void + get_subface_interpolation_matrix (const FiniteElement &source, + const unsigned int subface, + FullMatrix &matrix) const; + + /** + * Return whether this element + * implements its hanging node + * constraints in the new way, + * which has to be used to make + * elements "hp compatible". + * + * For the FE_DGPNonparametric class the + * result is always true (independent of + * the degree of the element), as it has + * no hanging nodes (being a + * discontinuous element). + */ + virtual bool hp_constraints_are_implemented () const; + /** * Check for non-zero values on a face. * @@ -235,6 +301,7 @@ class FE_DGPNonparametric : public FiniteElement virtual unsigned int memory_consumption () const; + private: /** * Declare a nested class which * will hold static definitions of diff --git a/deal.II/deal.II/include/fe/fe_dgq.h b/deal.II/deal.II/include/fe/fe_dgq.h index f59435a9eb..2f3f252dc2 100644 --- a/deal.II/deal.II/include/fe/fe_dgq.h +++ b/deal.II/deal.II/include/fe/fe_dgq.h @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2001, 2002, 2003, 2004, 2005 by the deal.II authors +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -122,6 +122,71 @@ class FE_DGQ : public FE_Poly,dim> get_interpolation_matrix (const FiniteElement &source, FullMatrix &matrix) const; + /** + * Return the matrix + * interpolating from a face of + * of one element to the face of + * the neighboring element. + * The size of the matrix is + * then @p dofs_per_face times + * source.dofs_per_face. + * + * Derived elements will have to + * implement this function. They + * may only provide interpolation + * matrices for certain source + * finite elements, for example + * those from the same family. If + * they don't implement + * interpolation from a given + * element, then they must throw + * an exception of type + * FiniteElement::ExcInterpolationNotImplemented. + */ + virtual void + get_face_interpolation_matrix (const FiniteElement &source, + FullMatrix &matrix) const; + + /** + * Return the matrix + * interpolating from a face of + * of one element to the face of + * the neighboring element. + * The size of the matrix is + * then @p dofs_per_face times + * source.dofs_per_face. + * + * Derived elements will have to + * implement this function. They + * may only provide interpolation + * matrices for certain source + * finite elements, for example + * those from the same family. If + * they don't implement + * interpolation from a given + * element, then they must throw + * an exception of type + * FiniteElement::ExcInterpolationNotImplemented. + */ + virtual void + get_subface_interpolation_matrix (const FiniteElement &source, + const unsigned int subface, + FullMatrix &matrix) const; + + /** + * Return whether this element + * implements its hanging node + * constraints in the new way, + * which has to be used to make + * elements "hp compatible". + * + * For the FE_DGQ class the result is + * always true (independent of the degree + * of the element), as it has no hanging + * nodes (being a discontinuous element). + */ + virtual bool hp_constraints_are_implemented () const; + /** * Check for non-zero values on a face. * diff --git a/deal.II/deal.II/source/fe/fe_dgp.cc b/deal.II/deal.II/source/fe/fe_dgp.cc index 6cc154f601..e2a987bf95 100644 --- a/deal.II/deal.II/source/fe/fe_dgp.cc +++ b/deal.II/deal.II/source/fe/fe_dgp.cc @@ -88,6 +88,73 @@ FE_DGP::get_dpo_vector (const unsigned int deg) } + +template +void +FE_DGP:: +get_face_interpolation_matrix (const FiniteElement &x_source_fe, + FullMatrix &interpolation_matrix) const +{ + // this is only implemented, if the source + // FE is also a DGP element. in that case, + // both elements have no dofs on their + // faces and the face interpolation matrix + // is necessarily empty -- i.e. there isn't + // much we need to do here. + AssertThrow ((x_source_fe.get_name().find ("FE_DGP<") == 0) + || + (dynamic_cast*>(&x_source_fe) != 0), + typename FiniteElement:: + ExcInterpolationNotImplemented()); + + Assert (interpolation_matrix.m() == 0, + ExcDimensionMismatch (interpolation_matrix.m(), + 0)); + Assert (interpolation_matrix.n() == 0, + ExcDimensionMismatch (interpolation_matrix.m(), + 0)); +} + + + +template +void +FE_DGP:: +get_subface_interpolation_matrix (const FiniteElement &x_source_fe, + const unsigned int , + FullMatrix &interpolation_matrix) const +{ + // this is only implemented, if the source + // FE is also a DGP element. in that case, + // both elements have no dofs on their + // faces and the face interpolation matrix + // is necessarily empty -- i.e. there isn't + // much we need to do here. + AssertThrow ((x_source_fe.get_name().find ("FE_DGP<") == 0) + || + (dynamic_cast*>(&x_source_fe) != 0), + typename FiniteElement:: + ExcInterpolationNotImplemented()); + + Assert (interpolation_matrix.m() == 0, + ExcDimensionMismatch (interpolation_matrix.m(), + 0)); + Assert (interpolation_matrix.n() == 0, + ExcDimensionMismatch (interpolation_matrix.m(), + 0)); +} + + + +template +bool +FE_DGP::hp_constraints_are_implemented () const +{ + return true; +} + + + template bool FE_DGP::has_support_on_face (const unsigned int, diff --git a/deal.II/deal.II/source/fe/fe_dgp_monomial.cc b/deal.II/deal.II/source/fe/fe_dgp_monomial.cc index 841f588535..dc192ea696 100644 --- a/deal.II/deal.II/source/fe/fe_dgp_monomial.cc +++ b/deal.II/deal.II/source/fe/fe_dgp_monomial.cc @@ -250,6 +250,72 @@ FE_DGPMonomial::get_dpo_vector(unsigned int deg) } +template +void +FE_DGPMonomial:: +get_face_interpolation_matrix (const FiniteElement &x_source_fe, + FullMatrix &interpolation_matrix) const +{ + // this is only implemented, if the source + // FE is also a DGPMonomial element. in that case, + // both elements have no dofs on their + // faces and the face interpolation matrix + // is necessarily empty -- i.e. there isn't + // much we need to do here. + AssertThrow ((x_source_fe.get_name().find ("FE_DGPMonomial<") == 0) + || + (dynamic_cast*>(&x_source_fe) != 0), + typename FiniteElement:: + ExcInterpolationNotImplemented()); + + Assert (interpolation_matrix.m() == 0, + ExcDimensionMismatch (interpolation_matrix.m(), + 0)); + Assert (interpolation_matrix.n() == 0, + ExcDimensionMismatch (interpolation_matrix.m(), + 0)); +} + + + +template +void +FE_DGPMonomial:: +get_subface_interpolation_matrix (const FiniteElement &x_source_fe, + const unsigned int , + FullMatrix &interpolation_matrix) const +{ + // this is only implemented, if the source + // FE is also a DGPMonomial element. in that case, + // both elements have no dofs on their + // faces and the face interpolation matrix + // is necessarily empty -- i.e. there isn't + // much we need to do here. + AssertThrow ((x_source_fe.get_name().find ("FE_DGPMonomial<") == 0) + || + (dynamic_cast*>(&x_source_fe) != 0), + typename FiniteElement:: + ExcInterpolationNotImplemented()); + + Assert (interpolation_matrix.m() == 0, + ExcDimensionMismatch (interpolation_matrix.m(), + 0)); + Assert (interpolation_matrix.n() == 0, + ExcDimensionMismatch (interpolation_matrix.m(), + 0)); +} + + + +template +bool +FE_DGPMonomial::hp_constraints_are_implemented () const +{ + return true; +} + + + #if deal_II_dimension == 1 template <> diff --git a/deal.II/deal.II/source/fe/fe_dgp_nonparametric.cc b/deal.II/deal.II/source/fe/fe_dgp_nonparametric.cc index fe355eccc4..f1bc7cc882 100644 --- a/deal.II/deal.II/source/fe/fe_dgp_nonparametric.cc +++ b/deal.II/deal.II/source/fe/fe_dgp_nonparametric.cc @@ -419,6 +419,72 @@ FE_DGPNonparametric::element_multiplicity (const unsigned int index) const +template +void +FE_DGPNonparametric:: +get_face_interpolation_matrix (const FiniteElement &x_source_fe, + FullMatrix &interpolation_matrix) const +{ + // this is only implemented, if the source + // FE is also a DGPNonparametric element. in that case, + // both elements have no dofs on their + // faces and the face interpolation matrix + // is necessarily empty -- i.e. there isn't + // much we need to do here. + AssertThrow ((x_source_fe.get_name().find ("FE_DGPNonparametric<") == 0) + || + (dynamic_cast*>(&x_source_fe) != 0), + typename FiniteElement:: + ExcInterpolationNotImplemented()); + + Assert (interpolation_matrix.m() == 0, + ExcDimensionMismatch (interpolation_matrix.m(), + 0)); + Assert (interpolation_matrix.n() == 0, + ExcDimensionMismatch (interpolation_matrix.m(), + 0)); +} + + + +template +void +FE_DGPNonparametric:: +get_subface_interpolation_matrix (const FiniteElement &x_source_fe, + const unsigned int , + FullMatrix &interpolation_matrix) const +{ + // this is only implemented, if the source + // FE is also a DGPNonparametric element. in that case, + // both elements have no dofs on their + // faces and the face interpolation matrix + // is necessarily empty -- i.e. there isn't + // much we need to do here. + AssertThrow ((x_source_fe.get_name().find ("FE_DGPNonparametric<") == 0) + || + (dynamic_cast*>(&x_source_fe) != 0), + typename FiniteElement:: + ExcInterpolationNotImplemented()); + + Assert (interpolation_matrix.m() == 0, + ExcDimensionMismatch (interpolation_matrix.m(), + 0)); + Assert (interpolation_matrix.n() == 0, + ExcDimensionMismatch (interpolation_matrix.m(), + 0)); +} + + + +template +bool +FE_DGPNonparametric::hp_constraints_are_implemented () const +{ + return true; +} + + + template bool FE_DGPNonparametric::has_support_on_face (const unsigned int, diff --git a/deal.II/deal.II/source/fe/fe_dgq.cc b/deal.II/deal.II/source/fe/fe_dgq.cc index c7d9df570d..e14c20e524 100644 --- a/deal.II/deal.II/source/fe/fe_dgq.cc +++ b/deal.II/deal.II/source/fe/fe_dgq.cc @@ -426,9 +426,71 @@ get_interpolation_matrix (const FiniteElement &x_source_fe, -//--------------------------------------------------------------------------- -// Fill data of FEValues -//--------------------------------------------------------------------------- +template +void +FE_DGQ:: +get_face_interpolation_matrix (const FiniteElement &x_source_fe, + FullMatrix &interpolation_matrix) const +{ + // this is only implemented, if the source + // FE is also a DGQ element. in that case, + // both elements have no dofs on their + // faces and the face interpolation matrix + // is necessarily empty -- i.e. there isn't + // much we need to do here. + AssertThrow ((x_source_fe.get_name().find ("FE_DGQ<") == 0) + || + (dynamic_cast*>(&x_source_fe) != 0), + typename FiniteElement:: + ExcInterpolationNotImplemented()); + + Assert (interpolation_matrix.m() == 0, + ExcDimensionMismatch (interpolation_matrix.m(), + 0)); + Assert (interpolation_matrix.n() == 0, + ExcDimensionMismatch (interpolation_matrix.m(), + 0)); +} + + + +template +void +FE_DGQ:: +get_subface_interpolation_matrix (const FiniteElement &x_source_fe, + const unsigned int , + FullMatrix &interpolation_matrix) const +{ + // this is only implemented, if the source + // FE is also a DGQ element. in that case, + // both elements have no dofs on their + // faces and the face interpolation matrix + // is necessarily empty -- i.e. there isn't + // much we need to do here. + AssertThrow ((x_source_fe.get_name().find ("FE_DGQ<") == 0) + || + (dynamic_cast*>(&x_source_fe) != 0), + typename FiniteElement:: + ExcInterpolationNotImplemented()); + + Assert (interpolation_matrix.m() == 0, + ExcDimensionMismatch (interpolation_matrix.m(), + 0)); + Assert (interpolation_matrix.n() == 0, + ExcDimensionMismatch (interpolation_matrix.m(), + 0)); +} + + + +template +bool +FE_DGQ::hp_constraints_are_implemented () const +{ + return true; +} + + template bool -- 2.39.5