]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add a print function to log the whole block info
authorkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 12 Oct 2010 14:40:06 +0000 (14:40 +0000)
committerkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 12 Oct 2010 14:40:06 +0000 (14:40 +0000)
git-svn-id: https://svn.dealii.org/trunk@22301 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/dofs/block_info.h

index 3cde99c2597d05a555cf488d561721cc8c9ccdd4..8d6fed91ff3c8c40b2505b4ee205edf3481f1ca5 100644 (file)
@@ -17,6 +17,8 @@
 #include <base/memory_consumption.h>
 #include <lac/block_indices.h>
 
+#include <iomanip>
+
 DEAL_II_NAMESPACE_OPEN
 
 // Forward declarations
@@ -172,6 +174,14 @@ class BlockInfo : public Subscriptor
                                      */
     unsigned int base_element(unsigned int i) const;
 
+                                    /**
+                                     * Write a summary of the block
+                                     * structure to the stream. 
+                                     */
+    template <class OS>
+    void
+    print(OS& stream) const;
+    
                                     /**
                                      * Determine an estimate for the
                                      * memory consumption (in bytes)
@@ -270,6 +280,38 @@ BlockInfo::n_base_elements() const
 
 
 
+template <class OS>
+inline
+void
+BlockInfo::print (OS& os) const
+{
+  os << "global   dofs " << std::setw(5) << global().total_size() << " blocks";
+  for (unsigned int i=0;i<global().size();++i)
+    os << ' ' << std::setw(5) << global().block_size(i);
+  os << std::endl;
+
+  if (local().size() == 0)
+    {
+      os << "local dofs not initialized" << std::endl;
+    }
+  else
+    {
+      os << "local    dofs " << std::setw(5) << local().total_size() << " blocks";
+      for (unsigned int i=0;i<local().size();++i)
+       os << ' '  << std::setw(5) << local().block_size(i);
+      os << std::endl;
+    }
+  
+  for (unsigned int l=0;l<levels.size();++l)
+    {
+      os << "level " << std::setw(2) << l << " dofs " << std::setw(5) << level(l).total_size() << " blocks";
+      for (unsigned int i=0;i<level(l).size();++i)
+       os << ' '  << std::setw(5) << level(l).block_size(i);
+      os << std::endl;
+    }
+}
+
+
 inline
 unsigned int
 BlockInfo::memory_consumption () const

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.