*/
std::size_t
memory_consumption() const;
+
+ /**
+ * This function exists for compatibility with the @p
+ * parallel vector classes (e.g., LinearAlgebra::distributed::Vector class).
+ * Always returns false since this implementation is serial.
+ */
+ bool
+ has_ghost_elements() const;
//@}
private:
{}
+template <typename Number>
+inline bool
+Vector<Number>::has_ghost_elements() const
+{
+ return false;
+}
template <typename Number>
inline void
if (vector_ptr->locally_owned_elements().is_element(i))
vec_ptr->operator[](i) = 1.;
- vec_ptr->compress(VectorOperation::insert);
+ if (vec_ptr->has_ghost_elements())
+ {
+ vec_ptr->update_ghost_values();
+ }
+ else
+ {
+ vec_ptr->compress(VectorOperation::insert);
+ }
Teuchos::RCP<VectorAdaptor> e = Teuchos::rcp(new VectorAdaptor(vec_ptr));
iterator++)
*iterator = f.apply(*iterator);
- vector_ptr->compress(VectorOperation::insert);
+ if (vector_ptr->has_ghost_elements())
+ {
+ vector_ptr->update_ghost_values();
+ }
+ else
+ {
+ vector_ptr->compress(VectorOperation::insert);
+ }
}
l_iterator++, r_iterator++)
*l_iterator = f.apply(*l_iterator, *r_iterator);
- vector_ptr->compress(VectorOperation::insert);
+ if (vector_ptr->has_ghost_elements())
+ {
+ vector_ptr->update_ghost_values();
+ }
+ else
+ {
+ vector_ptr->compress(VectorOperation::insert);
+ }
}
b.compress(VectorOperation::insert);
c.compress(VectorOperation::insert);
+ a.update_ghost_values();
+ b.update_ghost_values();
+ c.update_ghost_values();
+
Teuchos::RCP<VectorType> a_rcp(new VectorType(a));
Teuchos::RCP<VectorType> b_rcp(new VectorType(b));
Teuchos::RCP<VectorType> c_rcp(new VectorType(c));
+ a_rcp->update_ghost_values();
+ b_rcp->update_ghost_values();
+ c_rcp->update_ghost_values();
+
// --- Testing the constructor
Rol::VectorAdaptor<VectorType> a_rol(a_rcp);
Rol::VectorAdaptor<VectorType> b_rol(b_rcp);