From: wolf Date: Mon, 25 Nov 2002 17:30:05 +0000 (+0000) Subject: Add unit_support_point() and face_unit_support_point() for cases where not all suppor... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ee0d154360eff25823f3ba93b0c5f49171864bad;p=dealii-svn.git Add unit_support_point() and face_unit_support_point() for cases where not all support points are available, but some at least. Use it. git-svn-id: https://svn.dealii.org/trunk@6782 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/fe/fe_base.h b/deal.II/deal.II/include/fe/fe_base.h index 3f4ca77227..6d5f4db352 100644 --- a/deal.II/deal.II/include/fe/fe_base.h +++ b/deal.II/deal.II/include/fe/fe_base.h @@ -900,8 +900,57 @@ class FiniteElementBase : public Subscriptor, * then a call to the * @p{get_unit_support_points} * yields a non-empty array. + * + * The result may be false if an + * element is not defined by + * interpolating shape functions, + * for example by P-elements on + * quadrilaterals. It will + * usually only be true if the + * element constructs its shape + * functions by the requirement + * that they be one at a certain + * point and zero at all the + * points associated with the + * other shape functions. + * + * In composed elements (i.e. for + * the @ref{FESystem} class, the + * result will be true if all all + * the base elements have defined + * support points. */ bool has_support_points () const; + + /** + * Return the position of the + * support point of the + * @p{index}th shape function. If + * it does not exist, raise an + * exception. + * + * The default implementation + * simply returns the respective + * element from the array you get + * from + * @ref{get_unit_support_points}, + * but derived elements may + * overload this function. In + * particular, note that the + * @ref{FESystem} class overloads + * it so that it can return the + * support points of individual + * base elements, of not all the + * base elements define support + * points. In this way, you can + * still ask for certain support + * points, even if + * @p{get_unit_support_points} + * only returns an empty array. + */ + virtual + Point + unit_support_point (const unsigned int index) const; /** * Return the support points of @@ -969,9 +1018,24 @@ class FiniteElementBase : public Subscriptor, * is true, then a call to the * @p{get_unit_support_points} * yields a non-empty array. + * + * For more information, see the + * documentation for the + * @ref{has_support_points} + * function. */ bool has_face_support_points () const; + /** + * The function corresponding to + * the @p{unit_support_point} + * function, but for faces. See + * there for more information. + */ + virtual + Point + unit_face_support_point (const unsigned int index) const; + /** * Return in which of the vector * components of this finite diff --git a/deal.II/deal.II/include/fe/fe_system.h b/deal.II/deal.II/include/fe/fe_system.h index da53e2df54..06a9bcb701 100644 --- a/deal.II/deal.II/include/fe/fe_system.h +++ b/deal.II/deal.II/include/fe/fe_system.h @@ -312,7 +312,8 @@ class FESystem : public FiniteElement base_element (const unsigned int index) const; /** - * Check for non-zero values on a face. + * Check for non-zero values on a + * face. * * This function returns * @p{true}, if the shape @@ -327,6 +328,24 @@ class FESystem : public FiniteElement virtual bool has_support_on_face (const unsigned int shape_index, const unsigned int face_index) const; + /** + * Implementation of the + * respective function in the + * base class. + */ + virtual + Point + unit_support_point (const unsigned int index) const; + + /** + * Implementation of the + * respective function in the + * base class. + */ + virtual + Point + unit_face_support_point (const unsigned int index) const; + /** * Determine an estimate for the * memory consumption (in bytes) diff --git a/deal.II/deal.II/source/fe/fe.cc b/deal.II/deal.II/source/fe/fe.cc index 3029738e9f..366f43d06d 100644 --- a/deal.II/deal.II/source/fe/fe.cc +++ b/deal.II/deal.II/source/fe/fe.cc @@ -343,6 +343,19 @@ FiniteElementBase::has_support_points () const +template +Point +FiniteElementBase::unit_support_point (const unsigned index) const +{ + Assert (index < this->dofs_per_cell, + ExcIndexRange (index, 0, this->dofs_per_cell)); + Assert (unit_support_points.size() == this->dofs_per_cell, + ExcFEHasNoSupportPoints ()); + return unit_support_points[index]; +}; + + + template const std::vector > & FiniteElementBase::get_unit_face_support_points () const @@ -368,6 +381,19 @@ FiniteElementBase::has_face_support_points () const +template +Point +FiniteElementBase::unit_face_support_point (const unsigned index) const +{ + Assert (index < this->dofs_per_face, + ExcIndexRange (index, 0, this->dofs_per_face)); + Assert (unit_face_support_points.size() == this->dofs_per_face, + ExcFEHasNoSupportPoints ()); + return unit_face_support_points[index]; +}; + + + template unsigned int FiniteElementBase::memory_consumption () const diff --git a/deal.II/deal.II/source/fe/fe_system.cc b/deal.II/deal.II/source/fe/fe_system.cc index 0757665a42..b2272e8340 100644 --- a/deal.II/deal.II/source/fe/fe_system.cc +++ b/deal.II/deal.II/source/fe/fe_system.cc @@ -2229,6 +2229,54 @@ FESystem::has_support_on_face (const unsigned int shape_index, +template +Point +FESystem::unit_support_point (const unsigned index) const +{ + Assert (index < this->dofs_per_cell, + ExcIndexRange (index, 0, this->dofs_per_cell)); + Assert ((unit_support_points.size() == this->dofs_per_cell) || + (unit_support_points.size() == 0), + typename FiniteElementBase::ExcFEHasNoSupportPoints ()); + + // let's see whether we have the + // information pre-computed + if (this->unit_support_points.size() != 0) + return this->unit_support_points[index]; + else + // no. ask the base element + // whether it would like to + // provide this information + return (base_element(system_to_base_index(index).first.first) + .unit_support_point(system_to_base_index(index).second)); +}; + + + +template +Point +FESystem::unit_face_support_point (const unsigned index) const +{ + Assert (index < this->dofs_per_face, + ExcIndexRange (index, 0, this->dofs_per_face)); + Assert ((unit_face_support_points.size() == this->dofs_per_face) || + (unit_face_support_points.size() == 0), + typename FiniteElementBase::ExcFEHasNoSupportPoints ()); + + // let's see whether we have the + // information pre-computed + if (this->unit_face_support_points.size() != 0) + return this->unit_face_support_points[index]; + else + // no. ask the base element + // whether it would like to + // provide this information + return (base_element(face_system_to_base_index(index).first.first) + .unit_face_support_point(face_system_to_base_index(index).second)); +}; + + + template unsigned int diff --git a/deal.II/deal.II/source/numerics/vectors.cc b/deal.II/deal.II/source/numerics/vectors.cc index d4c4ae8a0d..16acb5cf98 100644 --- a/deal.II/deal.II/source/numerics/vectors.cc +++ b/deal.II/deal.II/source/numerics/vectors.cc @@ -764,11 +764,12 @@ VectorTools::interpolate_boundary_values (const Mapping<1> &mapping template void -VectorTools::interpolate_boundary_values (const Mapping &mapping, - const DoFHandler &dof, - const typename FunctionMap::type &function_map, - std::map &boundary_values, - const std::vector &component_mask_) +VectorTools:: +interpolate_boundary_values (const Mapping &mapping, + const DoFHandler &dof, + const typename FunctionMap::type &function_map, + std::map &boundary_values, + const std::vector &component_mask_) { // if for whatever reason we were // passed an empty map, return @@ -816,14 +817,36 @@ VectorTools::interpolate_boundary_values (const Mapping &mapping // support points. this wil be used // to obtain the quadrature points // on the real cell's face - const std::vector > - & unit_support_points = fe.get_unit_face_support_points(); + std::vector > + unit_support_points = fe.get_unit_face_support_points(); // check whether there are support - // points on the face, if not, then - // this FE does not allow to be - // used in this function - Assert (unit_support_points.size() != 0, ExcNonInterpolatingFE()); + // points on the face. if not, then + // we should try a more clever + // way. the idea is that a finite + // element may not offer support + // points for all its shape + // functions, but maybe only + // some. if it offers support + // points for the components we are + // interested in in this function, + // then that's fine. if not, the + // function we call in the finite + // element will raise an + // exception. the support points + // for the other shape functions + // are left uninitialized (well, + // initialized by the default + // constructor), since we don't + // need them anyway. + if (unit_support_points.size() == 0) + { + unit_support_points.resize (fe.dofs_per_face); + for (unsigned int i=0; i aux_quad (unit_support_points); FEFaceValues fe_values (mapping, fe, aux_quad, update_q_points); diff --git a/deal.II/doc/news/2002/c-3-4.html b/deal.II/doc/news/2002/c-3-4.html index 6b5393de42..dc5f074c5e 100644 --- a/deal.II/doc/news/2002/c-3-4.html +++ b/deal.II/doc/news/2002/c-3-4.html @@ -467,6 +467,19 @@ contributor's names are abbreviated by WB (Wolfgang Bangerth), GK

deal.II

    +
  1. + New: For finite element classes, the functions + unit_support_point and + unit_face_support_point return the position + of an individual support point. This is necessary when you want to get + information about the support points of certain components in a composed + finite element, where not all components provide support points, and the + composed element thus does not fill the array the + get_unit_support_points function returns. +
    + (WB 2002/11/23) +

    +
  2. Fixed: Vectors could not be given as input and output vectors to the SolutionTransfer class at the same time, but