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();
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(),
</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