From: Guido Kanschat Date: Tue, 4 Dec 2001 07:35:53 +0000 (+0000) Subject: find out which function is non-zero on a face X-Git-Tag: v8.0.0~18514 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c0beb69adab70bf9f9b1ab8e917d46370d1882e3;p=dealii.git find out which function is non-zero on a face git-svn-id: https://svn.dealii.org/trunk@5321 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/fe/fe.h b/deal.II/deal.II/include/fe/fe.h index 224ad33bc1..84312afbbb 100644 --- a/deal.II/deal.II/include/fe/fe.h +++ b/deal.II/deal.II/include/fe/fe.h @@ -102,6 +102,18 @@ class FiniteElement : public FiniteElementBase */ virtual const FiniteElement & base_element (const unsigned int index) const = 0; + /** + * Check for non-zero values on a face. + * + * This function returns + * @p{true}, if the shape + * function @p{shape_index} has + * non-zero values on the face + * @p{face_index}. + */ + virtual bool has_support_on_face (const unsigned int shape_index, + const unsigned int face_index) const = 0; + /** * Determine an estimate for the * memory consumption (in bytes) diff --git a/deal.II/deal.II/include/fe/fe_dgq.h b/deal.II/deal.II/include/fe/fe_dgq.h index a1643fca7c..268fe7bfc4 100644 --- a/deal.II/deal.II/include/fe/fe_dgq.h +++ b/deal.II/deal.II/include/fe/fe_dgq.h @@ -104,6 +104,22 @@ class FE_DGQ : public FiniteElement */ virtual const FiniteElement & base_element (const unsigned int index) const; + /** + * Check for non-zero values on a face. + * + * This function returns + * @p{true}, if the shape + * function @p{shape_index} has + * non-zero values on the face + * @p{face_index}. + * + * Implementation of the + * interface in + * @ref{FiniteElement} + */ + virtual bool has_support_on_face (const unsigned int shape_index, + const unsigned int face_index) const; + /** * Determine an estimate for the * memory consumption (in bytes) diff --git a/deal.II/deal.II/include/fe/fe_q.h b/deal.II/deal.II/include/fe/fe_q.h index 4fddd9ca73..ad19d21db3 100644 --- a/deal.II/deal.II/include/fe/fe_q.h +++ b/deal.II/deal.II/include/fe/fe_q.h @@ -309,6 +309,22 @@ class FE_Q : public FiniteElement */ virtual const FiniteElement & base_element (const unsigned int index) const; + /** + * Check for non-zero values on a face. + * + * This function returns + * @p{true}, if the shape + * function @p{shape_index} has + * non-zero values on the face + * @p{face_index}. + * + * Implementation of the + * interface in + * @ref{FiniteElement} + */ + virtual bool has_support_on_face (const unsigned int shape_index, + const unsigned int face_index) const; + /** * Determine an estimate for the * memory consumption (in bytes) diff --git a/deal.II/deal.II/include/fe/fe_system.h b/deal.II/deal.II/include/fe/fe_system.h index 36cd73799a..6f3413f5fa 100644 --- a/deal.II/deal.II/include/fe/fe_system.h +++ b/deal.II/deal.II/include/fe/fe_system.h @@ -217,6 +217,22 @@ class FESystem : public FiniteElement */ virtual const FiniteElement & base_element (const unsigned int index) const; + /** + * Check for non-zero values on a face. + * + * This function returns + * @p{true}, if the shape + * function @p{shape_index} has + * non-zero values on the face + * @p{face_index}. + * + * Implementation of the + * interface in + * @ref{FiniteElement} + */ + virtual bool has_support_on_face (const unsigned int shape_index, + const unsigned int face_index) const; + /** * Determine an estimate for the * memory consumption (in bytes) diff --git a/deal.II/deal.II/source/fe/fe_dgq.cc b/deal.II/deal.II/source/fe/fe_dgq.cc index 77b6340ab7..f27602159a 100644 --- a/deal.II/deal.II/source/fe/fe_dgq.cc +++ b/deal.II/deal.II/source/fe/fe_dgq.cc @@ -583,6 +583,86 @@ FE_DGQ::base_element (const unsigned int index) const +template +bool +FE_DGQ::has_support_on_face (unsigned int shape_index, + const unsigned int face_index) const +{ + if (dim==1) + return true; + const unsigned int cell_start = (dim==2) + ? first_quad_index + : first_hex_index; + const unsigned int face_start = (dim==2) + ? first_line_index + : first_quad_index; + + // Interior degrees of + // freedom correspond to + // shape functions with + // support inside the cell. + if (shape_index >= cell_start) + return false; + // Shape functions are sorted + // by face. If we dived by + // the number of shapes per + // face, the result must be + // equal to the face index. + if (shape_index >= face_start) + { + shape_index -= first_line_index; + shape_index /= dofs_per_face; + return (shape_index == face_index); + } + // Only degrees of freedom on + // a vertex are left. + shape_index /= dofs_per_vertex; + // Use a table to figure out + // which face is neighbor to + // which vertex. + switch (100*dim+10*face_index+shape_index) + { + case 200: + case 230: + case 201: + case 211: + case 212: + case 222: + case 223: + case 233: + case 300: + case 320: + case 350: + case 301: + case 321: + case 331: + case 302: + case 332: + case 342: + case 303: + case 343: + case 353: + case 314: + case 324: + case 354: + case 315: + case 325: + case 335: + case 316: + case 336: + case 346: + case 317: + case 347: + case 357: + return true; + default: + return false; + } + return true; +} + + + template unsigned int FE_DGQ::memory_consumption () const diff --git a/deal.II/deal.II/source/fe/fe_q.cc b/deal.II/deal.II/source/fe/fe_q.cc index 8de210c466..60b473c449 100644 --- a/deal.II/deal.II/source/fe/fe_q.cc +++ b/deal.II/deal.II/source/fe/fe_q.cc @@ -1210,6 +1210,86 @@ FE_Q::base_element (const unsigned int index) const +template +bool +FE_Q::has_support_on_face (unsigned int shape_index, + const unsigned int face_index) const +{ + if (dim==1) + return true; + const unsigned int cell_start = (dim==2) + ? first_quad_index + : first_hex_index; + const unsigned int face_start = (dim==2) + ? first_line_index + : first_quad_index; + + // Interior degrees of + // freedom correspond to + // shape functions with + // support inside the cell. + if (shape_index >= cell_start) + return false; + // Shape functions are sorted + // by face. If we dived by + // the number of shapes per + // face, the result must be + // equal to the face index. + if (shape_index >= face_start) + { + shape_index -= first_line_index; + shape_index /= dofs_per_face; + return (shape_index == face_index); + } + // Only degrees of freedom on + // a vertex are left. + shape_index /= dofs_per_vertex; + // Use a table to figure out + // which face is neighbor to + // which vertex. + switch (100*dim+10*face_index+shape_index) + { + case 200: + case 230: + case 201: + case 211: + case 212: + case 222: + case 223: + case 233: + case 300: + case 320: + case 350: + case 301: + case 321: + case 331: + case 302: + case 332: + case 342: + case 303: + case 343: + case 353: + case 314: + case 324: + case 354: + case 315: + case 325: + case 335: + case 316: + case 336: + case 346: + case 317: + case 347: + case 357: + return true; + default: + return false; + } + return true; +} + + + template unsigned int FE_Q::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 3e69faa4b7..82ad6d2a91 100644 --- a/deal.II/deal.II/source/fe/fe_system.cc +++ b/deal.II/deal.II/source/fe/fe_system.cc @@ -1438,6 +1438,20 @@ FESystem::n_base_elements () const }; +template +bool +FESystem::has_support_on_face (const unsigned int shape_index, + const unsigned int face_index) const +{ + const pair component + = system_to_component_index(shape_index); + const unsigned int base = component_to_base(component.first); + return base_element(base).has_support_on_face(component.second, + face_index); +} + + + template unsigned int