MGLevelObject<Vector<number> > &dst,
const BlockVector<number2> &src) const
{
- MGTools::reinit_vector_by_blocks(mg_dof_handler, dst, selected, sizes);
+ MGTools::reinit_vector_by_blocks(mg_dof_handler, dst, selected_block, sizes);
// For MGTransferBlockSelect, the
// multilevel block is always the
- // first, since only one block is selected.
- for (unsigned int level=0;level<mg_dof_handler.get_tria().n_levels();++level)
- for (IT i= copy_indices[selected_block][level].begin();i!= copy_indices[selected_block][level].end();++i)
- dst[level](i->second) = src.block(selected_block)(i->first);
+ // first, since only one block is
+ // selected.
+ bool first = true;
+ for (unsigned int level=mg_dof_handler.get_tria().n_levels();level != 0;)
+ {
+ --level;
+ for (IT i= copy_indices[selected_block][level].begin();
+ i != copy_indices[selected_block][level].end();++i)
+ dst[level](i->second) = src.block(selected_block)(i->first);
+ if (!first)
+ restrict_and_add (level+1, dst[level], dst[level+1]);
+ first = false;
+ }
}
MGLevelObject<Vector<number> > &dst,
const Vector<number2> &src) const
{
- MGTools::reinit_vector_by_blocks(mg_dof_handler, dst, selected, sizes);
+ MGTools::reinit_vector_by_blocks(mg_dof_handler, dst, selected_block, sizes);
// For MGTransferBlockSelect, the
// multilevel block is always the
// first, since only one block is selected.
- for (unsigned int level=0;level<mg_dof_handler.get_tria().n_levels();++level)
- for (IT i= copy_indices[selected_block][level].begin();
- i != copy_indices[selected_block][level].end();++i)
- dst[level](i->second) = src(i->first);
+ bool first = true;
+ for (unsigned int level=mg_dof_handler.get_tria().n_levels();level != 0;)
+ {
+ --level;
+ for (IT i= copy_indices[selected_block][level].begin();
+ i != copy_indices[selected_block][level].end();++i)
+ dst[level](i->second) = src(i->first);
+ if (!first)
+ restrict_and_add (level+1, dst[level], dst[level+1]);
+ first = false;
+ }
}
const BlockVector<number2>& src) const
{
MGTools::reinit_vector_by_blocks(mg_dof_handler, dst, selected, sizes);
- for (unsigned int block=0;block<selected.size();++block)
- if (selected[block])
- for (unsigned int level=0;level<mg_dof_handler.get_tria().n_levels();++level)
- for (IT i= copy_indices[block][level].begin();
- i != copy_indices[block][level].end();++i)
- dst[level].block(mg_block[block])(i->second) = src.block(block)(i->first);
+ bool first = true;
+ for (unsigned int level=mg_dof_handler.get_tria().n_levels();level != 0;)
+ {
+ --level;
+ for (unsigned int block=0;block<selected.size();++block)
+ if (selected[block])
+ for (IT i= copy_indices[block][level].begin();
+ i != copy_indices[block][level].end();++i)
+ dst[level].block(mg_block[block])(i->second) = src.block(block)(i->first);
+ if (!first)
+ restrict_and_add (level+1, dst[level], dst[level+1]);
+ first = false;
+ }
}