From 7c7e551bc7b01233acc7af72ecf401d6d57b313b Mon Sep 17 00:00:00 2001 From: Guido Kanschat Date: Thu, 26 Jan 2006 11:15:54 +0000 Subject: [PATCH] add component_to_block git-svn-id: https://svn.dealii.org/trunk@12178 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/include/fe/fe.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/deal.II/deal.II/include/fe/fe.h b/deal.II/deal.II/include/fe/fe.h index 933810375c..b00f7c747c 100644 --- a/deal.II/deal.II/include/fe/fe.h +++ b/deal.II/deal.II/include/fe/fe.h @@ -1218,6 +1218,13 @@ class FiniteElement : public Subscriptor, std::pair system_to_block_index (const unsigned int component) const; + /** + * The vector block for this + * component. + */ + unsigned int + component_to_block (const unsigned int component) const; + //@} /** @@ -2323,6 +2330,22 @@ FiniteElement::system_to_block_index (const unsigned int index) const } +template +inline +unsigned int +FiniteElement::component_to_block (const unsigned int index) const +{ + Assert (index < this->n_components(), + ExcIndexRange(index, 0, this->n_components())); + // The block is computed simply as + // first block of this base plus + // the index within the base blocks + const std::pair + base = component_to_base(index); + return first_block_of_base(base.first) + base.second; +} + + template inline bool -- 2.39.5