*/
bool in_local_range (const unsigned int index) const;
+ /**
+ * Return if the vector contains ghost
+ * elements.
+ */
+ bool has_ghost_elements() const;
+
/**
* Return the scalar (inner)
* product of two vectors. The
return ((index >= range.first) && (index < range.second));
}
+
+ inline
+ bool
+ VectorBase::has_ghost_elements() const
+ {
+ return vector->Map().UniqueGIDs()==false;
+ }
+
+
inline
internal::VectorReference
VectorBase::operator () (const unsigned int index)
}
-
+
inline
void
VectorBase::reinit (const VectorBase &v,
{
// if we have ghost values, do not allow
// writing to this vector at all.
- Assert (vector->Map().UniqueGIDs()==true,
- ExcGhostsPresent());
+ Assert (!has_ghost_elements(), ExcGhostsPresent());
if (last_action == Add)
vector->GlobalAssemble(Add);
{
// if we have ghost values, do not allow
// writing to this vector at all.
- Assert (vector->Map().UniqueGIDs()==true,
- ExcGhostsPresent());
+ Assert (!has_ghost_elements(), ExcGhostsPresent());
if (last_action != Add)
{
{
Assert (vector->Map().SameAs(vec.vector->Map()),
ExcDifferentParallelPartitioning());
- Assert (vector->Map().UniqueGIDs()==true,
- ExcGhostsPresent());
+ Assert (!has_ghost_elements(), ExcGhostsPresent());
TrilinosScalar result;
TrilinosScalar
VectorBase::mean_value () const
{
- Assert (vector->Map().UniqueGIDs()==true, ExcGhostsPresent());
+ Assert (!has_ghost_elements(), ExcGhostsPresent());
TrilinosScalar mean;
const int ierr = vector->MeanValue (&mean);
VectorBase::real_type
VectorBase::l1_norm () const
{
- Assert (vector->Map().UniqueGIDs()==true,
- ExcGhostsPresent());
+ Assert (!has_ghost_elements(), ExcGhostsPresent());
TrilinosScalar d;
const int ierr = vector->Norm1 (&d);
VectorBase::real_type
VectorBase::l2_norm () const
{
- Assert (vector->Map().UniqueGIDs()==true,
- ExcGhostsPresent());
+ Assert (!has_ghost_elements(), ExcGhostsPresent());
TrilinosScalar d;
const int ierr = vector->Norm2 (&d);
VectorBase::real_type
VectorBase::lp_norm (const TrilinosScalar p) const
{
- Assert (vector->Map().UniqueGIDs()==true,
- ExcGhostsPresent());
+ Assert (!has_ghost_elements(), ExcGhostsPresent());
TrilinosScalar norm = 0;
TrilinosScalar sum=0;