--- /dev/null
+New: The new function CellAccessor::is_ghost_on_level() allows to
+check if a cell is a ghost cell on a multigrid level.
+<br>
+(Peter Munch, 2021/06/23)
bool
is_ghost() const;
+ /**
+ * Return true if either the Triangulation is not distributed or if the
+ * cell is not artificial and the level_subdomain_id() is not equal to the id
+ * of the current processor.
+ */
+ bool
+ is_ghost_on_level() const;
+
/**
* Return whether this cell is artificial, i.e. it isn't one of the cells
* owned by the current processor, and it also doesn't border on one. As a
}
+template <int dim, int spacedim>
+inline bool
+CellAccessor<dim, spacedim>::is_ghost_on_level() const
+{
+#ifndef DEAL_II_WITH_MPI
+ return true;
+#else
+
+ // Serial triangulations report invalid_subdomain_id as their locally owned
+ // subdomain, so the first condition checks whether we have a serial
+ // triangulation, in which case all cells are locally owned. The second
+ // condition compares the subdomain id in the parallel case.
+ return (
+ this->tria->locally_owned_subdomain() == numbers::invalid_subdomain_id ||
+ (this->level_subdomain_id() != this->tria->locally_owned_subdomain() &&
+ this->level_subdomain_id() != numbers::artificial_subdomain_id));
+
+#endif
+}
+
+
template <int dim, int spacedim>
inline bool