]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add CellAccessor::is_ghost_on_level() 12492/head
authorPeter Munch <peterrmuench@gmail.com>
Wed, 23 Jun 2021 21:00:44 +0000 (23:00 +0200)
committerPeter Munch <peterrmuench@gmail.com>
Wed, 23 Jun 2021 21:02:55 +0000 (23:02 +0200)
doc/news/changes/minor/20210623Munch [new file with mode: 0644]
include/deal.II/grid/tria_accessor.h
include/deal.II/grid/tria_accessor.templates.h

diff --git a/doc/news/changes/minor/20210623Munch b/doc/news/changes/minor/20210623Munch
new file mode 100644 (file)
index 0000000..374b899
--- /dev/null
@@ -0,0 +1,4 @@
+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)
index ece9c4c881848f7433128fc78218d8a953a00dd8..e2a2a1dd379159128aec2b9c79a06e9ed9d099e9 100644 (file)
@@ -3703,6 +3703,14 @@ public:
   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
index d857cc39845942ff4f3b38acad8dad2feb10634a..8f263b9870d974ce7ff753e63b06578d24106126 100644 (file)
@@ -3737,6 +3737,27 @@ CellAccessor<dim, spacedim>::is_ghost() const
 }
 
 
+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

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.