Skip to content

Commit 47a1375

Browse files
committed
Add NumericVector::is_effectively_ghosted()
I only need this for PetscVector, for several layers of reasons at this point, but I suppose it is the sort of thing that could be useful in general and from user code, so we'll make it public and leave it in the base class.
1 parent d452ed8 commit 47a1375

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

include/numerics/numeric_vector.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,19 @@ class NumericVector : public ReferenceCountedObject<NumericVector<T>>,
168168
bool is_effectively_serial() const
169169
{ return (this->n_processors()==1) || (_type == SERIAL); }
170170

171+
/**
172+
* \returns Whether the vector is effectively ghosted, i.e. whether
173+
* vector operations require handling of ghosted coefficients.
174+
*
175+
* This is true for GHOSTED vectors in parallel, but in serial
176+
* subclasses may return false here for GHOSTED vectors since every
177+
* ghosted vector is effectively serial and thus may be able to take
178+
* advantage of serial-specific code paths.
179+
*/
180+
181+
bool is_effectively_ghosted() const
182+
{ return (this->n_processors()!=1) && (_type == GHOSTED); }
183+
171184
/**
172185
* \returns The type (SERIAL, PARALLEL, GHOSTED) of the vector.
173186
*

0 commit comments

Comments
 (0)