]> https://gitweb.dealii.org/ - dealii.git/commitdiff
add component_to_block
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Thu, 26 Jan 2006 11:15:54 +0000 (11:15 +0000)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Thu, 26 Jan 2006 11:15:54 +0000 (11:15 +0000)
git-svn-id: https://svn.dealii.org/trunk@12178 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/fe/fe.h

index 933810375cc0ef779ceeb0acd054e956b31c37c0..b00f7c747c6af872ce64f51d35b24a2a592389db 100644 (file)
@@ -1218,6 +1218,13 @@ class FiniteElement : public Subscriptor,
     std::pair<unsigned int,unsigned int>
     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<dim>::system_to_block_index (const unsigned int index) const
 }
 
 
+template <int dim>  
+inline
+unsigned int
+FiniteElement<dim>::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<unsigned int, unsigned int>
+    base = component_to_base(index);
+  return first_block_of_base(base.first) + base.second;
+}
+
+
 template <int dim>
 inline
 bool

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.