VectorDataExchange<dim, Number> &exchanger)
{
if (get_communication_block_size(vec) < vec.n_blocks())
- vec.update_ghost_values();
+ {
+ // don't forget to set ghosts_were_set, that otherwise happens
+ // inside VectorDataExchange::update_ghost_values_start()
+ exchanger.ghosts_were_set = vec.has_ghost_elements();
+ vec.update_ghost_values();
+ }
else
- for (unsigned int i = 0; i < vec.n_blocks(); ++i)
- update_ghost_values_start(vec.block(i), exchanger, channel + i);
+ {
+ for (unsigned int i = 0; i < vec.n_blocks(); ++i)
+ update_ghost_values_start(vec.block(i), exchanger, channel + i);
+ }
}
tria.refine_global(1);
typename Triangulation<dim>::active_cell_iterator cell = tria.begin_active(),
endc = tria.end();
- cell = tria.begin_active();
for (; cell != endc; ++cell)
if (cell->is_locally_owned())
if (cell->center().norm() < 0.2)
out.reinit(in);
ref.reinit(in);
+ // after initialization via MatrixFree we are in the write state for
+ // ghosts
+ AssertThrow(in.has_ghost_elements() == false, ExcInternalError());
+
// fill each block with random numbers and do the block-wise
// matrix-vector product for reference
for (unsigned int block = 0; block < n_blocks; ++block)
mf_ref.vmult(ref.block(block), in.block(block));
}
+ // explicitly update ghosts so that we can read them:
+ in.update_ghost_values();
+ AssertThrow(in.has_ghost_elements(), ExcInternalError());
+
deallog << "Norm of difference with " << n_blocks << " blocks:";
// run 10 times to make a possible error more
for (unsigned int run = 0; run < 10; ++run)
{
mf.vmult(out, in);
+
+ // since we made "in" ghosted, make sure it is still ghosted
+ AssertThrow(in.has_ghost_elements(), ExcInternalError());
+
out -= ref;
const double diff_norm = out.linfty_norm();
deallog << " " << diff_norm;