From 2a8213f5e2535378440e6dc23098e9ac3d4fa006 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 8 Oct 2009 18:41:41 +0000 Subject: [PATCH] Patch by Joshua White: More pieces of the FE_Nothing puzzle. git-svn-id: https://svn.dealii.org/trunk@19771 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/include/fe/fe_nothing.h | 35 +++++++++++++++++++++++- deal.II/deal.II/source/dofs/dof_tools.cc | 34 +++++++++++++++++++++-- deal.II/deal.II/source/fe/fe_nothing.cc | 15 +++------- deal.II/deal.II/source/fe/fe_q.cc | 2 +- 4 files changed, 70 insertions(+), 16 deletions(-) diff --git a/deal.II/deal.II/include/fe/fe_nothing.h b/deal.II/deal.II/include/fe/fe_nothing.h index 799e6e6842..3cddf4c604 100644 --- a/deal.II/deal.II/include/fe/fe_nothing.h +++ b/deal.II/deal.II/include/fe/fe_nothing.h @@ -32,6 +32,39 @@ DEAL_II_NAMESPACE_OPEN * therefore assign no degrees of freedom to the FE_Nothing cells, and * this subregion is therefore implicitly deleted from the computation. * + * Note that some care must be taken that the resulting mesh topology + * continues to make sense when FE_Nothing elements are introduced. + * This is particularly true when dealing with hanging node constraints, + * because the library makes some basic assumptions about the nature + * of those constraints. The following geometries are acceptable: + * + * +---------+----+----+ + * | | 0 | | + * | 1 +----+----+ + * | | 0 | | + * +---------+----+----+ + * + * +---------+----+----+ + * | | 1 | | + * | 0 +----+----+ + * | | 1 | | + * +---------+----+----+ + * + * Here, 0 denotes an FE_Nothing cell, and 1 denotes some other + * element type. The library has no difficulty computing the necessary + * hanging node constraints in these cases (i.e. no constraint). + * However, the following geometry is NOT acceptable (at least + * in the current implementation): + * + * +---------+----+----+ + * | | 0 | | + * | 1 +----+----+ + * | | 1 | | + * +---------+----+----+ + * + * The distinction lies in the mixed nature of the child faces, + * a case we have not implemented as of yet. + * * @author Joshua White */ template @@ -269,7 +302,7 @@ class FE_Nothing : public FiniteElement * FiniteElementBase::Domination and in * particular the @ref hp_paper "hp paper". * - * In the current case, the other element + * In the current case, this element * is always assumed to dominate, unless * it is also of type FE_Nothing(). In * that situation, either element can diff --git a/deal.II/deal.II/source/dofs/dof_tools.cc b/deal.II/deal.II/source/dofs/dof_tools.cc index c171243a69..9bf8407d4f 100644 --- a/deal.II/deal.II/source/dofs/dof_tools.cc +++ b/deal.II/deal.II/source/dofs/dof_tools.cc @@ -2240,11 +2240,34 @@ namespace internal // on the face at all or no // anisotropic refinement if (cell->get_fe().dofs_per_face == 0) - continue; + continue; Assert(cell->face(face)->refinement_case()==RefinementCase::isotropic_refinement, ExcNotImplemented()); - + + // check to see if the child elements + // have no dofs on the + // shared face. if none of them do, we + // we can simply continue to the next face. + // if only some of them have dofs, while + // others do not, then we don't know + // what to do and throw an exception. + bool any_are_zero = false; + bool all_are_zero = true; + + for (unsigned int c=0; cface(face)->n_children(); ++c) + { + if(cell->neighbor_child_on_subface (face, c)->get_fe().dofs_per_face == 0) + any_are_zero = true; + else + all_are_zero = false; + } + + if(all_are_zero) + continue; + + Assert( all_are_zero || !any_are_zero, ExcNotImplemented() ); + // so now we've found a // face of an active // cell that has @@ -2696,7 +2719,12 @@ namespace internal cell->face(face)->get_dof_indices (slave_dofs, neighbor->active_fe_index ()); - + // break if the n_master_dofs == 0, + // because we are attempting to + // constrain to an element that has + // has no face dofs + if(master_dofs.size() == 0) break; + // make sure // the element // constraints diff --git a/deal.II/deal.II/source/fe/fe_nothing.cc b/deal.II/deal.II/source/fe/fe_nothing.cc index 78ea19564c..795e054e4c 100644 --- a/deal.II/deal.II/source/fe/fe_nothing.cc +++ b/deal.II/deal.II/source/fe/fe_nothing.cc @@ -182,15 +182,8 @@ compare_for_face_domination (const FiniteElement & fe_other) const { if(dynamic_cast*>(&fe_other) != 0) return FiniteElementDomination::either_element_can_dominate; - - // Question: Best to assume this element always dominates, - // since we will always no how to do deal with other elements - // regardless of type, or do we leave it up to the other - // element to handle the FENothing appropriately? Set - // to the second choice for now. else - return FiniteElementDomination::other_element_dominates; - //return FiniteElementDomination::this_element_dominates; + return FiniteElementDomination::this_element_dominates; } @@ -199,7 +192,7 @@ std::vector > FE_Nothing :: hp_vertex_dof_identities (const FiniteElement &/*fe_other*/) const { - // the FE_Nothing has no + // the FE_Nothing has no // degrees of freedom, so there // are no equivalencies to be // recorded @@ -212,7 +205,7 @@ std::vector > FE_Nothing :: hp_line_dof_identities (const FiniteElement &/*fe_other*/) const { - // the FE_Nothing has no + // the FE_Nothing has no // degrees of freedom, so there // are no equivalencies to be // recorded @@ -225,7 +218,7 @@ std::vector > FE_Nothing :: hp_quad_dof_identities (const FiniteElement &/*fe_other*/) const { - // the FE_Nothing has no + // the FE_Nothing has no // degrees of freedom, so there // are no equivalencies to be // recorded diff --git a/deal.II/deal.II/source/fe/fe_q.cc b/deal.II/deal.II/source/fe/fe_q.cc index fe0d0caebc..f3df8e23f8 100644 --- a/deal.II/deal.II/source/fe/fe_q.cc +++ b/deal.II/deal.II/source/fe/fe_q.cc @@ -1257,7 +1257,7 @@ compare_for_face_domination (const FiniteElement &fe_other) const // and rather allow the // function to be discontinuous // along the interface - return FiniteElementDomination::this_element_dominates; + return FiniteElementDomination::other_element_dominates; } Assert (false, ExcNotImplemented()); -- 2.39.5