From: wolf Date: Wed, 18 Sep 2002 15:02:39 +0000 (+0000) Subject: Fix several bugs with non-primitive and other elements. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=618cc60eb332bed25278ca1f2237c07eb4d7eed0;p=dealii-svn.git Fix several bugs with non-primitive and other elements. git-svn-id: https://svn.dealii.org/trunk@6455 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/source/fe/fe_system.cc b/deal.II/deal.II/source/fe/fe_system.cc index 76dec94c69..a890debab6 100644 --- a/deal.II/deal.II/source/fe/fe_system.cc +++ b/deal.II/deal.II/source/fe/fe_system.cc @@ -267,14 +267,19 @@ FESystem::shape_value_component (const unsigned int i, Assert (idofs_per_cell, ExcIndexRange(i, 0, this->dofs_per_cell)); Assert (component < this->n_components(), ExcIndexRange (component, 0, this->n_components())); + + // if this value is supposed to be + // zero, then return right away... + if (nonzero_components[i][component] == false) + return 0; - // first find out to which of the - // base elements this desired - // component belongs, and which - // component within this base + // ...otherwise: first find out to + // which of the base elements this + // desired component belongs, and + // which component within this base // element it is - const unsigned int base = this->component_to_base(i).first; - const unsigned int component_in_base = this->component_to_base(i).second; + const unsigned int base = this->component_to_base(component).first; + const unsigned int component_in_base = this->component_to_base(component).second; // then get value from base // element. note that that will @@ -315,13 +320,18 @@ FESystem::shape_grad_component (const unsigned int i, Assert (component < this->n_components(), ExcIndexRange (component, 0, this->n_components())); - // first find out to which of the - // base elements this desired - // component belongs, and which - // component within this base - // element it is - const unsigned int base = this->component_to_base(i).first; - const unsigned int component_in_base = this->component_to_base(i).second; + // if this value is supposed to be + // zero, then return right away... + if (nonzero_components[i][component] == false) + return Tensor<1,dim>(); + + // ...otherwise: first find out to + // which of the base elements this + // desired component belongs, and + // which component within this base + // element it is + const unsigned int base = this->component_to_base(component).first; + const unsigned int component_in_base = this->component_to_base(component).second; // then get value from base // element. note that that will @@ -362,13 +372,18 @@ FESystem::shape_grad_grad_component (const unsigned int i, Assert (component < this->n_components(), ExcIndexRange (component, 0, this->n_components())); - // first find out to which of the - // base elements this desired - // component belongs, and which - // component within this base + // if this value is supposed to be + // zero, then return right away... + if (nonzero_components[i][component] == false) + return Tensor<2,dim>(); + + // ...otherwise: first find out to + // which of the base elements this + // desired component belongs, and + // which component within this base // element it is - const unsigned int base = this->component_to_base(i).first; - const unsigned int component_in_base = this->component_to_base(i).second; + const unsigned int base = this->component_to_base(component).first; + const unsigned int component_in_base = this->component_to_base(component).second; // then get value from base // element. note that that will