Reference documentation for deal.II version 9.1.1

#include <deal.II/distributed/cell_weights.h>
Public Member Functions  
CellWeights (const ::hp::DoFHandler< dim, spacedim > &dof_handler)  
~CellWeights ()  
void  register_constant_weighting (const unsigned int factor=1000) 
void  register_ndofs_weighting (const unsigned int factor=1000) 
void  register_ndofs_squared_weighting (const unsigned int factor=1000) 
void  register_custom_weighting (const std::function< unsigned int(const FiniteElement< dim, spacedim > &, const typename hp::DoFHandler< dim, spacedim >::cell_iterator &)> custom_function) 
Private Member Functions  
unsigned int  weight_callback (const typename Triangulation< dim, spacedim >::cell_iterator &cell, const typename Triangulation< dim, spacedim >::CellStatus status) 
Private Attributes  
SmartPointer< const ::hp::DoFHandler< dim, spacedim >, CellWeights >  dof_handler 
SmartPointer< const parallel::Triangulation< dim, spacedim >, CellWeights >  triangulation 
std::function< unsigned int(const FiniteElement< dim, spacedim > &, const typename hp::DoFHandler< dim, spacedim >::cell_iterator &)>  weighting_function 
boost::signals2::connection  tria_listener 
Anytime a parallel::Triangulation is repartitioned, either upon request or by refinement/coarsening, cells will be distributed amongst all subdomains to achieve an equally balanced workload. If the workload per cell varies, which is in general the case for hp::DoFHandler objects, we can take that into account by introducing individual weights for different cells.
This class allows computing these weights for load balancing by consulting the FiniteElement that is associated with each cell of a hp::DoFHandler. One can choose from predefined weighting algorithms provided by this class or provide a custom one. The chosen weighting function will be connected to the corresponding signal of the linked parallel::Triangulation via callback.
An object of this class needs to exist for every DoFHandler associated with the Triangulation we work on to achieve satisfying work balancing results.
A small code snippet follows explaining how to achieve each cell being weighted by its current number of degrees of freedom.
The weighting function can be changed anytime. Even more ambitious approaches are possible by submitting customized functions, e.g.
The returned value has to be an unsigned integer and is thus limited by some large number. It is interpreted as the additional computational load of each cell. See Triangulation::Signals::cell_weight for a discussion on this topic.
Definition at line 81 of file cell_weights.h.
parallel::CellWeights< dim, spacedim >::CellWeights  (  const ::hp::DoFHandler< dim, spacedim > &  dof_handler  ) 
Constructor.
[in]  dof_handler  The hp::DoFHandler which will be used to determine each cell's finite element. 
Definition at line 27 of file cell_weights.cc.
parallel::CellWeights< dim, spacedim >::~CellWeights  (  ) 
Destructor.
Definition at line 57 of file cell_weights.cc.
void parallel::CellWeights< dim, spacedim >::register_constant_weighting  (  const unsigned int  factor = 1000  ) 
Choose a constant weight factor
on each cell.
Definition at line 66 of file cell_weights.cc.
void parallel::CellWeights< dim, spacedim >::register_ndofs_weighting  (  const unsigned int  factor = 1000  ) 
Choose a weight for each cell that is proportional to its number of degrees of freedom with a factor factor
.
Definition at line 78 of file cell_weights.cc.
void parallel::CellWeights< dim, spacedim >::register_ndofs_squared_weighting  (  const unsigned int  factor = 1000  ) 
Choose a weight for each cell that is proportional to its number of degrees of freedom squared with a factor factor
.
Definition at line 90 of file cell_weights.cc.
void parallel::CellWeights< dim, spacedim >::register_custom_weighting  (  const std::function< unsigned int(const FiniteElement< dim, spacedim > &, const typename hp::DoFHandler< dim, spacedim >::cell_iterator &)>  custom_function  ) 
Register a custom weight for each cell by providing a function as a parameter.
[in]  custom_function  The custom weighting function returning the weight of each cell as an unsigned integer. It is required to have two arguments, namely the FiniteElement that will be active on the particular cell, and the cell itself of type hp::DoFHandler::cell_iterator. We require both to make sure to get the right active FiniteElement on each cell in case that we coarsen the Triangulation. 
Definition at line 104 of file cell_weights.cc.

private 
A callback function that will be attached to the cell_weight signal of the Triangulation, that is a member of the DoFHandler. Ultimately returns the weight for each cell, determined by the weighting_function member.
Definition at line 117 of file cell_weights.cc.

private 
Pointer to the degree of freedom handler.
Definition at line 141 of file cell_weights.h.

private 
Pointer to the Triangulation associated with the degree of freedom handler.
We store both to make sure to always work on the correct combination of both.
Definition at line 151 of file cell_weights.h.

private 
Function that will determine each cell's weight.
Can be set using the register_constant_weighting(), register_ndofs_weighting(), register_ndofs_squared_weighting(), and register_custom_weighting() member functions.
The function requires the active FiniteElement object on each cell as an argument, as well as the cell itself of type hp::DoFHandler::cell_iterator.
Definition at line 167 of file cell_weights.h.

private 
A connection to the Triangulation of the DoFHandler.
Definition at line 172 of file cell_weights.h.