]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
output block structure and sort by component
authorguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 14 Jun 2006 15:59:51 +0000 (15:59 +0000)
committerguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 14 Jun 2006 15:59:51 +0000 (15:59 +0000)
git-svn-id: https://svn.dealii.org/trunk@13250 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/examples/doxygen/compressed_block_sparsity_pattern.cc

index dc55dba606b62f6dcdd6c06efc709c2d411ce4ca..2f86cccabcabb5df8174f9edb32f8d40d51bba1e 100644 (file)
@@ -22,6 +22,7 @@
 #include <fe/fe_system.h>
 #include <dofs/dof_handler.h>
 #include <dofs/dof_constraints.h>
+#include <dofs/dof_renumbering.h>
 #include <dofs/dof_tools.h>
 
 #include <iostream>
@@ -39,6 +40,9 @@ int main()
   
   DoFHandler<2> dof(tr);
   dof.distribute_dofs(fe);
+  DoFRenumbering::Cuthill_McKee(dof);
+  DoFRenumbering::component_wise(dof);
+  
   ConstraintMatrix constraints;
   DoFTools::make_hanging_node_constraints(dof, constraints);
   constraints.close();
@@ -57,15 +61,18 @@ int main()
 
   BlockSparsityPattern sparsity;
   sparsity.copy_from(c_sparsity);
-  
-//   for (unsigned int i=0;i<fe.n_blocks();++i)
-//     for (unsigned int j=0;j<fe.n_blocks();++j)
-//       {
-//     std::cout << "   Block " << i << ' ' << j << std::endl;
-//     sparsity.block(i,j).print(std::cout);
-//       }
-  for (unsigned int i=0; i<sparsity.n_rows(); ++i)
-    for (unsigned int j=0; j<sparsity.n_cols(); ++j)
-      if (sparsity.exists(i,j))
-       std::cout << i << ' ' << j << std::endl;
+
+  unsigned int ig = 0;
+  for (unsigned int ib=0;ib<fe.n_blocks();++ib)
+    for (unsigned int i=0;i<dofs_per_block[ib];++i,++ig)
+      {
+       unsigned int jg = 0;
+       for (unsigned int jb=0;jb<fe.n_blocks();++jb)
+         for (unsigned int j=0;j<dofs_per_block[jb];++j,++jg)
+           {
+             if (sparsity.exists(ig,jg))
+               std::cout << ig << ' ' << jg
+                         << '\t' << ib << jb << std::endl;
+           }
+      }
 }

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.