]> https://gitweb.dealii.org/ - dealii.git/commitdiff
implement custom partitioning for shared::Tria
authorTimo Heister <timo.heister@gmail.com>
Fri, 27 Jan 2017 19:24:19 +0000 (14:24 -0500)
committerTimo Heister <timo.heister@gmail.com>
Fri, 27 Jan 2017 19:24:19 +0000 (14:24 -0500)
include/deal.II/distributed/shared_tria.h
source/distributed/shared_tria.cc

index 22f671bc75aac6590627dd846f82fdf534aaa32b..582c7d69142e2182e2268bcaaa25e0c0f95e60db 100644 (file)
@@ -71,6 +71,37 @@ namespace parallel
       typedef typename dealii::Triangulation<dim,spacedim>::active_cell_iterator active_cell_iterator;
       typedef typename dealii::Triangulation<dim,spacedim>::cell_iterator        cell_iterator;
 
+      /**
+       * Configuration flags for distributed Triangulations to be set in the
+       * constructor. Settings can be combined using bitwise OR.
+       */
+      enum Settings
+      {
+        /**
+         * Default settings, other options are disabled.
+         */
+        partition_metis = 0x0,
+
+        /**
+         *
+         */
+        partition_zorder = 0x1,
+
+        /**
+         *
+         */
+        partition_custom_signal = 0x2,
+
+        /**
+         * This flags needs to be set to use the geometric multigrid
+         * functionality. This option requires additional computation and
+         * communication. Note: geometric multigrid is still a work in
+         * progress.
+         */
+        construct_multigrid_hierarchy = 0x8,
+      };
+
+
       /**
        * Constructor.
        *
@@ -83,7 +114,8 @@ namespace parallel
       Triangulation (MPI_Comm mpi_communicator,
                      const typename dealii::Triangulation<dim,spacedim>::MeshSmoothing =
                        (dealii::Triangulation<dim,spacedim>::none),
-                     const bool allow_artificial_cells = false);
+                     const bool allow_artificial_cells = false,
+                     const Settings settings = partition_metis);
 
       /**
        * Destructor.
@@ -150,6 +182,12 @@ namespace parallel
       bool with_artificial_cells() const;
 
     private:
+
+      /**
+       * Settings
+       */
+      Settings settings;
+
       /**
        * A flag to decide whether or not artificial cells are allowed.
        */
index 409539f5f5191eef18cf9d3ecacd54003c198282..e010eb2fcc9f812dafe7daadd73cdb225d9903f9 100644 (file)
@@ -36,9 +36,11 @@ namespace parallel
     template <int dim, int spacedim>
     Triangulation<dim,spacedim>::Triangulation (MPI_Comm mpi_communicator,
                                                 const typename dealii::Triangulation<dim,spacedim>::MeshSmoothing smooth_grid,
-                                                const bool allow_artificial_cells):
+                                                const bool allow_artificial_cells,
+                                                const Settings settings):
       dealii::parallel::Triangulation<dim,spacedim>(mpi_communicator,smooth_grid,false),
-      allow_artificial_cells(allow_artificial_cells)
+      allow_artificial_cells(allow_artificial_cells),
+      settings (settings)
     {}
 
 
@@ -46,7 +48,22 @@ namespace parallel
     template <int dim, int spacedim>
     void Triangulation<dim,spacedim>::partition()
     {
-      dealii::GridTools::partition_triangulation (this->n_subdomains, *this);
+      if (settings & partition_metis)
+        {
+          dealii::GridTools::partition_triangulation (this->n_subdomains, *this);
+          if (settings & construct_multigrid_hierarchy)
+            dealii::GridTools::partition_multigrid_levels(...);
+        }
+      else if (settings & partition_zorder)
+        {
+          dealii::GridTools::partition_triangulation_zorder (this->n_subdomains, *this);
+          if (settings & construct_multigrid_hierarchy)
+            dealii::GridTools::partition_multigrid_levels(...);
+        }
+      else
+        {
+          // signal thing
+        }
 
       true_subdomain_ids_of_cells.resize(this->n_active_cells());
 

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.