* @ref GlossGhostedVector "vectors with ghost elements"
*/
bool has_ghost_elements() const;
+
+ /**
+ * This method copies the data in the locally owned range from another
+ * distributed vector @p src into the calling vector. As opposed to
+ * operator= that also includes ghost entries, this operation ignores
+ * the ghost range. The only prerequisite is that the local range on the
+ * calling vector and the given vector @p src are the same on all
+ * processors. It is explicitly allowed that the two vectors have
+ * different ghost elements that might or might not be related to each
+ * other.
+ *
+ * Since no data exchange is performed, make sure that neither @p src
+ * nor the calling vector have pending communications in order to obtain
+ * correct results.
+ */
+ template <typename Number2>
+ void copy_locally_owned_data_from(const Vector<Number2> &src);
+
//@}
/**
thread_loop_partitioner = c.thread_loop_partitioner;
- const size_type this_size = local_size();
+ const size_type this_size = partitioner->local_size();
if (this_size>0)
{
dealii::internal::VectorOperations::Vector_copy<Number,Number2> copier(c.values.get(), values.get());
+ template <typename Number>
+ template <typename Number2>
+ void
+ Vector<Number>::copy_locally_owned_data_from(const Vector<Number2> &src)
+ {
+ AssertDimension(partitioner->local_size(), src.partitioner->local_size());
+ if (partitioner->local_size() > 0)
+ {
+ dealii::internal::VectorOperations::Vector_copy<Number,Number2> copier(src.values.get(),
+ values.get());
+ internal::VectorOperations::parallel_for(copier, 0, partitioner->local_size(),
+ thread_loop_partitioner);
+ }
+ }
+
+
+
+
#ifdef DEAL_II_WITH_PETSC
namespace petsc_helpers
Vector<Number>::compress_finish (::dealii::VectorOperation::values operation)
{
#ifdef DEAL_II_WITH_MPI
+ vector_is_ghosted = false;
+
if (compress_requests.size() == 0)
return;
ArrayView<Number>(values.get(), partitioner->local_size()),
ArrayView<Number>(values.get() + partitioner->local_size(),partitioner->n_ghost_indices()),
compress_requests);
-
- vector_is_ghosted = false;
#else
(void)operation;
#endif
\{
template void Vector<S1>::reinit<S2> (const Vector<S2>&,
const bool);
+ template void Vector<S1>::copy_locally_owned_data_from<S2> (const Vector<S2>&);
template S1 Vector<S1>::inner_product_local<S2> (const Vector<S2>&) const;
\}
\}
\{
template void Vector<S1>::reinit<S2> (const Vector<S2>&,
const bool);
+ template void Vector<S1>::copy_locally_owned_data_from<S2> (const Vector<S2>&);
\}
\}
}