]> https://gitweb.dealii.org/ - dealii.git/commitdiff
add block_to_base
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Fri, 10 Mar 2006 09:11:10 +0000 (09:11 +0000)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Fri, 10 Mar 2006 09:11:10 +0000 (09:11 +0000)
git-svn-id: https://svn.dealii.org/trunk@12574 0785d39b-7218-0410-832d-ea1e28bc413d

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

index b13e0534940437b39ef33d0a4d9fa7c8c96ead7e..f0330dc56f499d383ff593c6b7dfa114794d52ef 100644 (file)
@@ -1209,7 +1209,16 @@ class FiniteElement : public Subscriptor,
                                      */
     std::pair<unsigned int,unsigned int>
     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<unsigned int,unsigned int>
+    block_to_base (const unsigned int block) const;
+    
                                     /**
                                      * The vector block and the index
                                      * inside the block for this
@@ -2313,6 +2322,23 @@ FiniteElement<dim>::component_to_base (const unsigned int index) const
 }
 
 
+template <int dim>  
+inline
+std::pair<unsigned int,unsigned int>
+FiniteElement<dim>::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, unsigned int>((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 <int dim>  
 inline
 std::pair<unsigned int,unsigned int>

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.