--- /dev/null
+// ---------------------------------------------------------------------
+// $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
#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
#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>
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
--- /dev/null
+// ---------------------------------------------------------------------
+// $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
--- /dev/null
+// ---------------------------------------------------------------------
+// $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
+ \}
+ \}
+
+ }
+
#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 -------------------------------*/
# 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