From 85dd35ae5a3b4f236fc83654cd6b15ab399ce9ed Mon Sep 17 00:00:00 2001 From: Guido Kanschat Date: Sat, 16 Apr 2005 07:11:11 +0000 Subject: [PATCH] test for existence of restriction matrices added git-svn-id: https://svn.dealii.org/trunk@10508 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/include/fe/fe_base.h | 28 ++++++++++++++++++++++++++++ deal.II/deal.II/source/fe/fe.cc | 21 +++++++++++++++++++++ tests/bits/fe_tools_08.cc | 4 ++-- 3 files changed, 51 insertions(+), 2 deletions(-) diff --git a/deal.II/deal.II/include/fe/fe_base.h b/deal.II/deal.II/include/fe/fe_base.h index 2183916fac..2f266802d8 100644 --- a/deal.II/deal.II/include/fe/fe_base.h +++ b/deal.II/deal.II/include/fe/fe_base.h @@ -771,6 +771,34 @@ class FiniteElementBase : public Subscriptor, */ bool prolongation_is_implemented () const; + /** + * Return whether this element implements + * its restriction matrices. The return + * value also indicates whether a call to + * the @p get_restriction_matrix + * function will generate an error or + * not. + * + * This function is mostly here in order + * to allow us to write more efficient + * test programs which we run on all + * kinds of weird elements, and for which + * we simply need to exclude certain + * tests in case something is not + * implemented. It will in general + * probably not be a great help in + * applications, since there is not much + * one can do if one needs these features + * and they are not implemented. This + * function could be used to check + * whether a call to + * get_restriction_matrix() will + * succeed; however, one then still needs + * to cope with the lack of information + * this just expresses. + */ + bool restriction_is_implemented () const; + /** * Return a readonly reference to * the matrix which describes the diff --git a/deal.II/deal.II/source/fe/fe.cc b/deal.II/deal.II/source/fe/fe.cc index 008ecdbb2a..6dd0c2d3eb 100644 --- a/deal.II/deal.II/source/fe/fe.cc +++ b/deal.II/deal.II/source/fe/fe.cc @@ -278,6 +278,27 @@ FiniteElementBase::prolongation_is_implemented () const +template +bool +FiniteElementBase::restriction_is_implemented () const +{ + for (unsigned int c=0; c::children_per_cell; ++c) + { + Assert ((restriction[c].m() == this->dofs_per_cell) || + (restriction[c].m() == 0), + ExcInternalError()); + Assert ((restriction[c].n() == this->dofs_per_cell) || + (restriction[c].n() == 0), + ExcInternalError()); + if ((restriction[c].m() == 0) || + (restriction[c].n() == 0)) + return false; + } + return true; +} + + + template bool FiniteElementBase::constraints_are_implemented () const diff --git a/tests/bits/fe_tools_08.cc b/tests/bits/fe_tools_08.cc index f52ed12b6c..302c142f88 100644 --- a/tests/bits/fe_tools_08.cc +++ b/tests/bits/fe_tools_08.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2003, 2004 by the deal.II authors +// Copyright (C) 2003, 2004, 2005 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -43,7 +43,7 @@ check_this (const FiniteElement &fe1, return; // we need prolongation matrices in // fe2 - if (!fe2.prolongation_is_implemented()) + if (!fe2.restriction_is_implemented()) return; std::auto_ptr > tria(make_tria()); -- 2.39.5