--- /dev/null
+Deprecated: All `LinearAlgebra::distributed::Vector::zero_out_ghosts()` has been deprecated.
+Use `LinearAlgebra::distributed::Vector::zero_out_ghost_values()` instead.
+<br>
+(Peter Munch, 2021/01/04)
data_out.write_vtu_with_pvtu_record(
"./", "solution", timestep_number, MPI_COMM_WORLD, 3);
- solution.zero_out_ghosts();
+ solution.zero_out_ghost_values();
}
FEEvaluation<dim, degree, degree + 1, dim + 2, Number> phi(data, 0, 1);
MatrixFreeOperators::CellwiseInverseMassMatrix<dim, degree, dim + 2, Number>
inverse(phi);
- solution.zero_out_ghosts();
+ solution.zero_out_ghost_values();
for (unsigned int cell = 0; cell < data.n_cell_batches(); ++cell)
{
phi.reinit(cell);
template <int dim>
void ParticleTracking<dim>::interpolate_function_to_field()
{
- velocity_field.zero_out_ghosts();
+ velocity_field.zero_out_ghost_values();
VectorTools::interpolate(mapping, fluid_dh, velocity, velocity_field);
velocity_field.update_ghost_values();
}
* LinearAlgebra::distributed::Vector allows writing into ghost elements.
* For a ghosted vector the interpolation step can be accomplished via
* @code
- * interpolated_solution.zero_out_ghosts();
+ * interpolated_solution.zero_out_ghost_values();
* soltrans.interpolate(interpolated_solution);
* interpolated_solution.update_ghost_values();
* @endcode
if (vec.in_local_range(idx))
vec(idx) = 0.;
}
- vec.zero_out_ghosts();
+ vec.zero_out_ghost_values();
}
#ifdef DEAL_II_COMPILER_CUDA_AWARE
Utilities::CUDA::free(constrained_local_dofs_device);
- vec.zero_out_ghosts();
+ vec.zero_out_ghost_values();
}
#endif
// TODO: the in vector might already have all elements. need to find a
// way to efficiently avoid the copy then
const_cast<LinearAlgebra::distributed::Vector<number> &>(vec)
- .zero_out_ghosts();
+ .zero_out_ghost_values();
output.reinit(locally_owned_elements,
needed_elements,
vec.get_mpi_communicator());
* After calling this method, read access to ghost elements of the
* vector is forbidden and an exception is thrown. Only write access to
* ghost elements is allowed in this state.
+ *
+ * @deprecated Use zero_out_ghost_values() instead.
*/
- void
+ DEAL_II_DEPRECATED_EARLY void
zero_out_ghosts() const;
+
+ /**
+ * This method zeros the entries on ghost dofs, but does not touch
+ * locally owned DoFs.
+ *
+ * After calling this method, read access to ghost elements of the
+ * vector is forbidden and an exception is thrown. Only write access to
+ * ghost elements is allowed in this state.
+ */
+ void
+ zero_out_ghost_values() const;
+
/**
* Return if this Vector contains ghost elements.
*/
template <typename Number>
void
BlockVector<Number>::zero_out_ghosts() const
+ {
+ this->zero_out_ghost_values();
+ }
+
+
+
+ template <typename Number>
+ void
+ BlockVector<Number>::zero_out_ghost_values() const
{
for (unsigned int block = 0; block < this->n_blocks(); ++block)
- this->block(block).zero_out_ghosts();
+ this->block(block).zero_out_ghost_values();
}
* This vector can take two different states with respect to ghost
* elements:
* <ul>
- * <li> After creation and whenever zero_out_ghosts() is called (or
+ * <li> After creation and whenever zero_out_ghost_values() is called (or
* <code>operator= (0.)</code>), the vector does only allow writing into
* ghost elements but not reading from ghost elements.
* <li> After a call to update_ghost_values(), the vector does not allow
* operation. However, global reduction operations like norms or the
* inner product will always ignore ghost elements in order to avoid
* counting the ghost data more than once. To allow writing to ghost
- * elements again, call zero_out_ghosts().
+ * elements again, call zero_out_ghost_values().
*
* @see
* @ref GlossGhostedVector "vectors with ghost elements"
* After calling this method, read access to ghost elements of the
* vector is forbidden and an exception is thrown. Only write access to
* ghost elements is allowed in this state.
+ *
+ * @deprecated Use zero_out_ghost_values() instead.
*/
- void
+ DEAL_II_DEPRECATED_EARLY void
zero_out_ghosts() const;
+ /**
+ * This method zeros the entries on ghost dofs, but does not touch
+ * locally owned DoFs.
+ *
+ * After calling this method, read access to ghost elements of the
+ * vector is forbidden and an exception is thrown. Only write access to
+ * ghost elements is allowed in this state.
+ */
+ void
+ zero_out_ghost_values() const;
+
/**
* Return whether the vector currently is in a state where ghost values
* can be read or not. This is the same functionality as other parallel
if (omit_zeroing_entries == false)
this->operator=(Number());
else
- zero_out_ghosts();
+ zero_out_ghost_values();
}
if (omit_zeroing_entries == false)
this->operator=(Number());
else
- zero_out_ghosts();
+ zero_out_ghost_values();
// do not reallocate import_data directly, but only upon request. It
// is only used as temporary storage for compress() and
if (must_update_ghost_values)
update_ghost_values();
else
- zero_out_ghosts();
+ zero_out_ghost_values();
return *this;
}
template <typename Number, typename MemorySpaceType>
void
Vector<Number, MemorySpaceType>::zero_out_ghosts() const
+ {
+ this->zero_out_ghost_values();
+ }
+
+
+
+ template <typename Number, typename MemorySpaceType>
+ void
+ Vector<Number, MemorySpaceType>::zero_out_ghost_values() const
{
if (data.values != nullptr)
std::fill_n(data.values.get() + partitioner->local_size(),
// if we call Vector::operator=0, we want to zero out all the entries
// plus ghosts.
if (s == Number())
- zero_out_ghosts();
+ zero_out_ghost_values();
return *this;
}
}
dst.compress(VectorOperation::add);
}
- src.zero_out_ghosts();
+ src.zero_out_ghost_values();
}
else
{
if (ghosts_were_set == true)
return;
- vec.zero_out_ghosts();
+ vec.zero_out_ghost_values();
}
// In this case, we can simply copy the local range. To avoid having
// stray data in ghost entries of the destination, make sure to clear
// them here.
- dst.zero_out_ghosts();
+ dst.zero_out_ghost_values();
AssertDimension(src[src.max_level()].local_size(), dst.local_size());
dst.copy_locally_owned_data_from(src[src.max_level()]);
return;
Assert(copy_indices_global_mine.back().empty(), ExcInternalError());
const LinearAlgebra::distributed::Vector<Number> &src_level =
src[src.max_level()];
- dst.zero_out_ghosts();
+ dst.zero_out_ghost_values();
for (unsigned int i = 0; i < copy_indices.back().n_cols(); ++i)
dst.local_element(i) =
src_level.local_element(copy_indices.back()(1, i));
// attention, since they belong to the coarse level, but have fine level
// basis functions
- dst.zero_out_ghosts();
+ dst.zero_out_ghost_values();
for (unsigned int level = src.min_level(); level <= src.max_level(); ++level)
{
// the ghosted vector should already have the correct local size (but
}
}
- this->vec_coarse.zero_out_ghosts(); // clear ghost values; else compress in
- // do_restrict_add does not work
+ this->vec_coarse.zero_out_ghost_values(); // clear ghost values; else compress
+ // in do_restrict_add does not work
if (schemes.size() > 0 && schemes.front().fine_element_is_continuous)
this->vec_fine.compress(VectorOperation::add);
dst.copy_locally_owned_data_from(this->ghosted_level_vector[to_level]);
if (src_inplace == true)
- src.zero_out_ghosts();
+ src.zero_out_ghost_values();
}
dst += dst_vec;
if (src_inplace == true)
- src.zero_out_ghosts();
+ src.zero_out_ghost_values();
}
if (myid == 0)
deallog << "w has ghost elements: " << w.has_ghost_elements() << std::endl;
- v.zero_out_ghosts();
+ v.zero_out_ghost_values();
w = v;
if (myid == 0)
deallog << "w has ghost elements: " << w.has_ghost_elements() << std::endl;
- w.zero_out_ghosts();
+ w.zero_out_ghost_values();
w = v;
if (myid == 0)
deallog << "w has ghost elements: " << w.has_ghost_elements() << std::endl;
if (myid == 0)
deallog << "x has ghost elements: " << x.has_ghost_elements() << std::endl;
- x.zero_out_ghosts();
+ x.zero_out_ghost_values();
if (myid == 0)
deallog << "x has ghost elements: " << x.has_ghost_elements() << std::endl;
v.update_ghost_values();
v.print(deallog.get_file_stream(), 12, false, false);
- v.zero_out_ghosts();
+ v.zero_out_ghost_values();
double * values_dev = v.get_values();
const auto &partitioner = v.get_partitioner();
set_value<<<1, 1>>>(values_dev,
<< std::endl;
// ghosts are set to zero
- v.zero_out_ghosts();
+ v.zero_out_ghost_values();
// minimize
v.compress(VectorOperation::min);
<< std::endl;
// set ghost dof on non-owning processors and minimize
- v.zero_out_ghosts();
+ v.zero_out_ghost_values();
if (myid == 0)
set_value<<<1, 1>>>(v.get_values(), partitioner->global_to_local(1), -1.);
v.compress(VectorOperation::min);
<< std::endl;
// set vector to 1, zeros in ghosts except on owner where -1. is set
- v.zero_out_ghosts();
+ v.zero_out_ghost_values();
v = 1.0;
if (myid == 0)
set_value<<<1, 1>>>(v.get_values(), partitioner->global_to_local(1), -1.);
// however, if the ghost value is set on all processors, the
// maximum is -1:
- v.zero_out_ghosts();
+ v.zero_out_ghost_values();
v = 1.0;
set_value<<<1, 1>>>(v.get_values(), partitioner->global_to_local(1), -1.);
v.compress(VectorOperation::max);
// what happens in case max is called two times and all values were smaller
// than zero
- v.zero_out_ghosts();
+ v.zero_out_ghost_values();
v = -1.0;
set_value<<<1, 1>>>(v.get_values(), partitioner->global_to_local(1), -1.);
v.compress(VectorOperation::max);
sparse_rhs.reinit(locally_owned_set, locally_relevant_set, MPI_COMM_WORLD);
rhs.reinit(locally_owned_set, locally_relevant_set, MPI_COMM_WORLD);
- sparse_rhs.zero_out_ghosts();
- rhs.zero_out_ghosts();
+ sparse_rhs.zero_out_ghost_values();
+ rhs.zero_out_ghost_values();
// assemble RHS which has a local support:
const std::function<double(const Point<dim> &)> rhs_func =
LinearAlgebra::distributed::Vector<number> &result) const
{
int dummy;
- result.zero_out_ghosts();
+ result.zero_out_ghost_values();
data.cell_loop(&LaplaceOperator::local_diagonal_by_cell,
this,
result,
matrix_free.n_inner_face_batches() +
matrix_free.n_boundary_face_batches()));
ref.compress(VectorOperation::add);
- in.zero_out_ghosts();
+ in.zero_out_ghost_values();
std::function<void(const MatrixFree<dim> &,
LinearAlgebra::distributed::Vector<double> &,
in,
std::make_pair(0U, matrix_free.n_cell_batches()));
ref.compress(VectorOperation::add);
- in.zero_out_ghosts();
+ in.zero_out_ghost_values();
matrix_free.cell_loop(cell_func, test, in, true);
test -= ref;
dst_copy = dst;
dst.swap(dst_copy);
}
- dst.zero_out_ghosts();
+ dst.zero_out_ghost_values();
data.loop(&LaplaceOperator::local_apply,
&LaplaceOperator::local_apply_face,
&LaplaceOperator::local_apply_boundary,
dst_copy = dst;
dst.swap(dst_copy);
}
- dst.zero_out_ghosts();
+ dst.zero_out_ghost_values();
data.loop(&LaplaceOperator::local_apply,
&LaplaceOperator::local_apply_face,
&LaplaceOperator::local_apply_boundary,
AssertDimension(i + 1, (unsigned int)w.block(i)(1));
// zero out ghosts, now all processors except processor 1 should have 0.
- w.zero_out_ghosts();
+ w.zero_out_ghost_values();
for (unsigned int i = 0; i < 3; ++i)
if (myid == 0)
{
AssertDimension(i + 1, (unsigned int)w.block(i)(1));
// zero out ghosts, now all processors except processor 1 should have 0.
- w.zero_out_ghosts();
+ w.zero_out_ghost_values();
for (unsigned int i = 0; i < n_blocks; ++i)
if (myid == 0)
{
if (myid == 0)
deallog << "w has ghost elements: " << w.has_ghost_elements() << std::endl;
- v.zero_out_ghosts();
+ v.zero_out_ghost_values();
w = v;
if (myid == 0)
deallog << "w has ghost elements: " << w.has_ghost_elements() << std::endl;
- w.zero_out_ghosts();
+ w.zero_out_ghost_values();
w = v;
if (myid == 0)
deallog << "w has ghost elements: " << w.has_ghost_elements() << std::endl;
if (myid == 0)
deallog << "x has ghost elements: " << x.has_ghost_elements() << std::endl;
- x.zero_out_ghosts();
+ x.zero_out_ghost_values();
if (myid == 0)
deallog << "x has ghost elements: " << x.has_ghost_elements() << std::endl;
Assert(v(min_index + 39) == min_index + 39, ExcInternalError());
Assert(v(min_index + 38) == min_index + 38, ExcInternalError());
- v.zero_out_ghosts();
+ v.zero_out_ghost_values();
v(min_index + 38) = min_index;
v(min_index + 39) = min_index * 2;
v(min_index + 41) = min_index + 7;
<< "ghost entry after max from owner: " << v(1) << std::endl;
// ghosts are set to zero
- v.zero_out_ghosts();
+ v.zero_out_ghost_values();
// minimize
v.compress(VectorOperation::min);
<< "ghost entry after min from zero: " << v(1) << std::endl;
// set ghost dof on non-owning processors and minimize
- v.zero_out_ghosts();
+ v.zero_out_ghost_values();
if (!myid)
v(1) = -1.;
v.compress(VectorOperation::min);
<< "ghost entry after min from : " << v(1) << std::endl;
// set vector to 1, zeros in ghosts except on owner where -1. is set
- v.zero_out_ghosts();
+ v.zero_out_ghost_values();
v = 1.0;
if (!myid)
v(1) = -1.0;
// however, if the ghost value is set on all processors, the
// maximum is -1:
- v.zero_out_ghosts();
+ v.zero_out_ghost_values();
v = 1.0;
v(1) = -1.0;
v.compress(VectorOperation::max);
// what happens in case max is called two times and all values were smaller
// than zero
- v.zero_out_ghosts();
+ v.zero_out_ghost_values();
v = -1.0;
v(1) = -1.0;
v.compress(VectorOperation::max);
for (unsigned int q = 0; q <= p + 2 - order_difference; ++q)
{
// project the function
- projection.zero_out_ghosts();
+ projection.zero_out_ghost_values();
VectorTools::project(dof_handler,
constraints,
QGauss<dim>(p + 2),