From: Guido Kanschat Date: Fri, 10 Mar 2006 09:11:10 +0000 (+0000) Subject: add block_to_base X-Git-Tag: v8.0.0~12121 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a3db750bc9bf968fc1b9900950a893e465dd3e06;p=dealii.git add block_to_base git-svn-id: https://svn.dealii.org/trunk@12574 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 b13e053494..f0330dc56f 100644 --- a/deal.II/deal.II/include/fe/fe.h +++ b/deal.II/deal.II/include/fe/fe.h @@ -1209,7 +1209,16 @@ class FiniteElement : public Subscriptor, */ std::pair component_to_base (const unsigned int component) const; - + + + /** + * Return the base element for + * this block and the number of + * the copy of the base element. + */ + std::pair + block_to_base (const unsigned int block) const; + /** * The vector block and the index * inside the block for this @@ -2313,6 +2322,23 @@ FiniteElement::component_to_base (const unsigned int index) const } +template +inline +std::pair +FiniteElement::block_to_base (const unsigned int index) const +{ + Assert(index < this->n_blocks(), + ExcIndexRange(index, 0, this->n_blocks())); + + for (int i=first_block_of_base_table.size()-1; i>=0; --i) + if (first_block_of_base_table[i] <= index) + return std::pair((unsigned int) i, + index - first_block_of_base_table[i]); + return std::make_pair(deal_II_numbers::invalid_unsigned_int, + deal_II_numbers::invalid_unsigned_int); +} + + template inline std::pair