]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
move shared_tria into separate files
authorheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 25 Apr 2014 21:14:12 +0000 (21:14 +0000)
committerheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 25 Apr 2014 21:14:12 +0000 (21:14 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_sharedtria@32834 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/distributed/shared_tria.h [new file with mode: 0644]
deal.II/include/deal.II/distributed/tria.h
deal.II/include/deal.II/grid/tria_accessor.templates.h
deal.II/source/distributed/CMakeLists.txt
deal.II/source/distributed/shared_tria.cc [new file with mode: 0644]
deal.II/source/distributed/shared_tria.inst.in [new file with mode: 0644]
deal.II/source/distributed/tria.cc
deal.II/source/distributed/tria.inst.in

diff --git a/deal.II/include/deal.II/distributed/shared_tria.h b/deal.II/include/deal.II/distributed/shared_tria.h
new file mode 100644 (file)
index 0000000..2ae1949
--- /dev/null
@@ -0,0 +1,112 @@
+// ---------------------------------------------------------------------
+// $Id: tria.h 32739 2014-04-08 16:39:47Z denis.davydov $
+//
+// Copyright (C) 2008 - 2013 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+#ifndef __deal2__distributed__shared_tria_h
+#define __deal2__distributed__shared_tria_h
+
+
+#include <deal.II/base/config.h>
+#include <deal.II/base/subscriptor.h>
+#include <deal.II/base/smartpointer.h>
+#include <deal.II/base/template_constraints.h>
+#include <deal.II/grid/tria.h>
+
+#include <deal.II/base/std_cxx1x/function.h>
+#include <deal.II/base/std_cxx1x/tuple.h>
+
+#include <set>
+#include <vector>
+#include <list>
+#include <utility>
+
+#ifdef DEAL_II_WITH_MPI
+#  include <mpi.h>
+#endif
+
+
+DEAL_II_NAMESPACE_OPEN
+
+template <int, int> class Triangulation;
+
+namespace parallel
+{
+  namespace shared
+  {
+
+   /**
+    * This is an extension of dealii::Triangulation class to automatically
+    * partition trianguation using MPI.
+    */
+    template <int dim, int spacedim = dim>
+    class Triangulation : public dealii::Triangulation<dim,spacedim>
+    {
+    public:
+      typedef typename dealii::Triangulation<dim,spacedim>::active_cell_iterator active_cell_iterator;
+      typedef typename dealii::Triangulation<dim,spacedim>::cell_iterator        cell_iterator;
+
+      /**
+       * Constructor.
+       */
+      Triangulation (MPI_Comm mpi_communicator);
+
+      /**
+       * Destructor.
+       */
+      virtual ~Triangulation ();
+
+      /**
+       * Return locally owned subdomain id,
+       * which is equivalent to the rank of the current mpi process in
+       * communicator provided to class constructor.
+       */
+      types::subdomain_id locally_owned_subdomain () const;
+
+      /**
+       * Return MPI communicator used by this triangulation.
+       */
+      MPI_Comm get_communicator () const;
+      
+      /**
+       * Coarsen and refine the mesh according to refinement and
+       * coarsening flags set.
+       *
+       * This step is equivalent to the dealii::Triangulation class
+       * with an addition of calling dealii::GridTools::partition_triangulation() at the end.
+       */
+      virtual void execute_coarsening_and_refinement ();
+      
+      /**
+        * Create a triangulation.
+        *
+        * This function also partitions triangulation based on the
+        * MPI communicator provided to constructor.
+        */
+      virtual void     create_triangulation (const std::vector< Point< spacedim > > &vertices, 
+                                                                         const std::vector< CellData< dim > > &cells, 
+                                                                         const SubCellData &subcelldata);
+      
+      
+    private:
+      MPI_Comm mpi_communicator;
+      types::subdomain_id my_subdomain;
+      types::subdomain_id num_subdomains;
+    };
+  }
+}
+
+DEAL_II_NAMESPACE_CLOSE
+
+#endif
index 6a465589dc15f03049485a156c96d7f9ea42ca22..b00a01b224483e5e2cbe0825ded255754a79cc50 100644 (file)
@@ -931,71 +931,6 @@ namespace parallel
 
 #endif
 
-namespace parallel
-{
-  namespace shared
-  {
-
-   /**
-    * This is an extension of dealii::Triangulation class to automatically
-    * partition trianguation using MPI.
-    */
-    template <int dim, int spacedim = dim>
-    class Triangulation : public dealii::Triangulation<dim,spacedim>
-    {
-    public:
-      typedef typename dealii::Triangulation<dim,spacedim>::active_cell_iterator active_cell_iterator;
-      typedef typename dealii::Triangulation<dim,spacedim>::cell_iterator        cell_iterator;
-
-      /**
-       * Constructor.
-       */
-      Triangulation (MPI_Comm mpi_communicator);
-
-      /**
-       * Destructor.
-       */
-      virtual ~Triangulation ();
-
-      /**
-       * Return locally owned subdomain id,
-       * which is equivalent to the rank of the current mpi process in
-       * communicator provided to class constructor.
-       */
-      types::subdomain_id locally_owned_subdomain () const;
-
-      /**
-       * Return MPI communicator used by this triangulation.
-       */
-      MPI_Comm get_communicator () const;
-      
-      /**
-       * Coarsen and refine the mesh according to refinement and
-       * coarsening flags set.
-       *
-       * This step is equivalent to the dealii::Triangulation class
-       * with an addition of calling dealii::GridTools::partition_triangulation() at the end.
-       */
-      virtual void execute_coarsening_and_refinement ();
-      
-      /**
-        * Create a triangulation.
-        *
-        * This function also partitions triangulation based on the
-        * MPI communicator provided to constructor.
-        */
-      virtual void     create_triangulation (const std::vector< Point< spacedim > > &vertices, 
-                                                                         const std::vector< CellData< dim > > &cells, 
-                                                                         const SubCellData &subcelldata);
-      
-      
-    private:
-      MPI_Comm mpi_communicator;
-      types::subdomain_id my_subdomain;
-      types::subdomain_id num_subdomains;
-    };
-  }
-}
 
 DEAL_II_NAMESPACE_CLOSE
 
index 1bf410ee647dd3f917adabe715343275b21c2858..16b0be58409069523d9fe7137afe01b029d149c7 100644 (file)
@@ -28,6 +28,7 @@
 #include <deal.II/grid/tria_accessor.h>
 #include <deal.II/grid/tria_iterator.templates.h>
 #include <deal.II/distributed/tria.h>
+#include <deal.II/distributed/shared_tria.h>
 
 #include <cmath>
 
index 4bb6e252cde28656c7f7ac6b7c4b566c0eba3e87..53069c9bb2caecba78efb089e40ffe375fbf1d76 100644 (file)
@@ -20,12 +20,14 @@ SET(_src
   grid_refinement.cc
   solution_transfer.cc
   tria.cc
+  shared_tria.cc
   )
 
 SET(_inst
   grid_refinement.inst.in
   solution_transfer.inst.in
   tria.inst.in
+  shared_tria.inst.in
   )
 
 FILE(GLOB _header
diff --git a/deal.II/source/distributed/shared_tria.cc b/deal.II/source/distributed/shared_tria.cc
new file mode 100644 (file)
index 0000000..e016364
--- /dev/null
@@ -0,0 +1,112 @@
+// ---------------------------------------------------------------------
+// $Id: tria.cc 32807 2014-04-22 15:01:57Z heister $
+//
+// Copyright (C) 2008 - 2013 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+
+#include <deal.II/base/utilities.h>
+#include <deal.II/base/memory_consumption.h>
+#include <deal.II/base/logstream.h>
+#include <deal.II/lac/sparsity_tools.h>
+#include <deal.II/lac/sparsity_pattern.h>
+#include <deal.II/grid/tria.h>
+#include <deal.II/grid/tria_accessor.h>
+#include <deal.II/grid/tria_iterator.h>
+#include <deal.II/grid/grid_tools.h>
+#include <deal.II/distributed/tria.h>
+
+
+#include <algorithm>
+#include <numeric>
+#include <iostream>
+#include <fstream>
+
+
+DEAL_II_NAMESPACE_OPEN
+
+
+namespace parallel
+{
+  namespace shared
+  {
+    template <int dim, int spacedim>
+    Triangulation<dim,spacedim>::Triangulation (MPI_Comm mpi_communicator):
+        dealii::Triangulation<dim,spacedim>(),
+       mpi_communicator (Utilities::MPI::
+                          duplicate_communicator(mpi_communicator)),
+        my_subdomain (Utilities::MPI::this_mpi_process (this->mpi_communicator)),
+        num_subdomains(Utilities::MPI::n_mpi_processes(mpi_communicator))
+    {
+
+    }
+
+
+    template <int dim, int spacedim>
+    Triangulation<dim,spacedim>::~Triangulation ()
+    {
+
+    }
+
+
+
+    template <int dim, int spacedim>
+    types::subdomain_id
+    Triangulation<dim,spacedim>::locally_owned_subdomain () const
+    {
+      return my_subdomain;
+    }
+    
+    template <int dim, int spacedim>
+    void 
+    Triangulation<dim,spacedim>::execute_coarsening_and_refinement () {
+         dealii::Triangulation<dim,spacedim>::execute_coarsening_and_refinement ();
+         dealii::GridTools::partition_triangulation (num_subdomains, *this);
+    }
+    
+    template <int dim, int spacedim>
+    void       
+    Triangulation<dim,spacedim>::create_triangulation (const std::vector< Point< spacedim > > &vertices, 
+                                                                                                  const std::vector< CellData< dim > > &cells, 
+                                                                                                  const SubCellData &subcelldata) {                                                                                               
+      try
+        {
+          dealii::Triangulation<dim,spacedim>::
+          create_triangulation (vertices, cells, subcelldata);
+        }
+      catch (const typename dealii::Triangulation<dim,spacedim>::DistortedCellList &)
+        {
+          // the underlying triangulation should not be checking for distorted
+          // cells
+          AssertThrow (false, ExcInternalError());
+        }
+      dealii::GridTools::partition_triangulation (num_subdomains, *this);
+    }
+
+
+    template <int dim, int spacedim>
+    MPI_Comm
+    Triangulation<dim,spacedim>::get_communicator () const
+    {
+      return mpi_communicator;
+    }
+
+  }
+}
+
+
+/*-------------- Explicit Instantiations -------------------------------*/
+#include "shared_tria.inst"
+
+
+DEAL_II_NAMESPACE_CLOSE
diff --git a/deal.II/source/distributed/shared_tria.inst.in b/deal.II/source/distributed/shared_tria.inst.in
new file mode 100644 (file)
index 0000000..f6a863a
--- /dev/null
@@ -0,0 +1,36 @@
+// ---------------------------------------------------------------------
+// $Id: tria.inst.in 32674 2014-03-20 16:57:24Z denis.davydov $
+//
+// Copyright (C) 2010 - 2013 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+
+
+for (deal_II_dimension : DIMENSIONS)
+  {
+    namespace parallel
+    \{
+      namespace shared
+      \{
+        template class Triangulation<deal_II_dimension>;
+#       if deal_II_dimension < 3
+        template class Triangulation<deal_II_dimension, deal_II_dimension+1>;
+#       endif
+#       if deal_II_dimension < 2
+        template class Triangulation<deal_II_dimension, deal_II_dimension+2>;
+#       endif
+      \}
+    \}
+
+  }
+
index 7fa42b2373202670e884449ecf375a7ce6c41884..6a22f877f596ce437f6191281bd9a6e42a3ef01e 100644 (file)
@@ -3973,73 +3973,6 @@ namespace parallel
 #endif // DEAL_II_WITH_P4EST
 
 
-namespace parallel
-{
-  namespace shared
-  {
-    template <int dim, int spacedim>
-    Triangulation<dim,spacedim>::Triangulation (MPI_Comm mpi_communicator):
-        dealii::Triangulation<dim,spacedim>(),
-       mpi_communicator (Utilities::MPI::
-                          duplicate_communicator(mpi_communicator)),
-        my_subdomain (Utilities::MPI::this_mpi_process (this->mpi_communicator)),
-        num_subdomains(Utilities::MPI::n_mpi_processes(mpi_communicator))
-    {
-
-    }
-
-
-    template <int dim, int spacedim>
-    Triangulation<dim,spacedim>::~Triangulation ()
-    {
-
-    }
-
-
-
-    template <int dim, int spacedim>
-    types::subdomain_id
-    Triangulation<dim,spacedim>::locally_owned_subdomain () const
-    {
-      return my_subdomain;
-    }
-    
-    template <int dim, int spacedim>
-    void 
-    Triangulation<dim,spacedim>::execute_coarsening_and_refinement () {
-         dealii::Triangulation<dim,spacedim>::execute_coarsening_and_refinement ();
-         dealii::GridTools::partition_triangulation (num_subdomains, *this);
-    }
-    
-    template <int dim, int spacedim>
-    void       
-    Triangulation<dim,spacedim>::create_triangulation (const std::vector< Point< spacedim > > &vertices, 
-                                                                                                  const std::vector< CellData< dim > > &cells, 
-                                                                                                  const SubCellData &subcelldata) {                                                                                               
-      try
-        {
-          dealii::Triangulation<dim,spacedim>::
-          create_triangulation (vertices, cells, subcelldata);
-        }
-      catch (const typename dealii::Triangulation<dim,spacedim>::DistortedCellList &)
-        {
-          // the underlying triangulation should not be checking for distorted
-          // cells
-          AssertThrow (false, ExcInternalError());
-        }
-      dealii::GridTools::partition_triangulation (num_subdomains, *this);
-    }
-
-
-    template <int dim, int spacedim>
-    MPI_Comm
-    Triangulation<dim,spacedim>::get_communicator () const
-    {
-      return mpi_communicator;
-    }
-
-  }
-}
 
 
 /*-------------- Explicit Instantiations -------------------------------*/
index 3b80440cb58dac00c8d891501a255c53e98e7478..b5199699f313c3042d6c45c4d93bd97daea2d829 100644 (file)
@@ -61,17 +61,6 @@ for (deal_II_dimension : DIMENSIONS)
 #       if deal_II_dimension < 3
         template class Triangulation<deal_II_dimension, deal_II_dimension+1>;
 #       endif
-#       if deal_II_dimension < 2
-        template class Triangulation<deal_II_dimension, deal_II_dimension+2>;
-#       endif
-      \}
-      
-      namespace shared
-      \{
-        template class Triangulation<deal_II_dimension>;
-#       if deal_II_dimension < 3
-        template class Triangulation<deal_II_dimension, deal_II_dimension+1>;
-#       endif
 #       if deal_II_dimension < 2
         template class Triangulation<deal_II_dimension, deal_II_dimension+2>;
 #       endif

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.