]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Associate DoFs on interfaces between subdomains pseudo-randomly with the subdomains...
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 2 Nov 2008 23:21:38 +0000 (23:21 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 2 Nov 2008 23:21:38 +0000 (23:21 +0000)
git-svn-id: https://svn.dealii.org/trunk@17457 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/source/dofs/dof_tools.cc
deal.II/doc/news/changes.h

index 710cf479708932a26e4ebc94042c6723043e6b80..f1189af9a526b9926e9fe720d2e809859aeedb38 100644 (file)
@@ -3710,11 +3710,17 @@ DoFTools::get_subdomain_association (const DH                  &dof_handler,
 
   std::vector<unsigned int> local_dof_indices;
   local_dof_indices.reserve (max_dofs_per_cell(dof_handler));
-  
-                                  // this function is similar to the
-                                  // make_sparsity_pattern function,
-                                  // see there for more information
 
+                                  // pseudo-randomly assign variables
+                                  // which lie on the interface
+                                  // between subdomains to each of
+                                  // the two or more
+  bool coin_flip = true;
+  
+                                  // loop over all cells and record
+                                  // which subdomain a DoF belongs
+                                  // to. toss a coin in case it is on
+                                  // an interface
   typename DH::active_cell_iterator
     cell = dof_handler.begin_active(),
     endc = dof_handler.end();
@@ -3725,13 +3731,27 @@ DoFTools::get_subdomain_association (const DH                  &dof_handler,
       local_dof_indices.resize (dofs_per_cell);
       cell->get_dof_indices (local_dof_indices);
 
-                                       // set subdomain ids. if dofs already
-                                       // have their values set then they must
-                                       // be on partition interfaces. don't
-                                       // worry about that, just overwrite it
+                                       // set subdomain ids. if dofs
+                                       // already have their values
+                                       // set then they must be on
+                                       // partition interfaces. in
+                                       // that case randomly assign
+                                       // them to either the previous
+                                       // association or the current
+                                       // one, where we take "random"
+                                       // to be "once this way once
+                                       // that way"
       for (unsigned int i=0; i<dofs_per_cell; ++i)
-        subdomain_association[local_dof_indices[i]] = subdomain_id;
-    };
+       if (subdomain_association[local_dof_indices[i]] ==
+           numbers::invalid_unsigned_int)
+         subdomain_association[local_dof_indices[i]] = subdomain_id;
+       else
+         {
+           if (coin_flip == true)
+             subdomain_association[local_dof_indices[i]] = subdomain_id;
+           coin_flip = !coin_flip;
+         }
+    }
 
   Assert (std::find (subdomain_association.begin(),
                      subdomain_association.end(),
index dd81efaa7ebc109beed741c449d47a52573e0f77..0b0fcb4bf23a36b9a32872bfc0757fb90ef97c81 100644 (file)
@@ -30,6 +30,21 @@ inconvenience this causes.
 </p>
 
 <ol>
+  <li>
+  <p> 
+  Changed: The function DoFTools::get_subdomain_association function used
+  to assign degrees of freedom to the subdomain of the last cell on which
+  the degree of freedom is a part. This introduced a bias for degrees of
+  freedom's subdomains located on boundaries of subdomains, and
+  consequently to unequal numbers of DoFs per subdomain even if the
+  number of cells is roughly equal across subdomains. This behavior has
+  been changed by assigning degrees of freedom pseudo-randomly to any of
+  the subdomains on which they are located. This is a deviation from
+  previous behavior, however.
+  <br>
+  (Timo Heister, WB 2008/11/02)
+  </p>
+
   <li>
   <p> 
   Changed: The way we set up threads in the Threads::spawn functions

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.