<h3>Specific improvements</h3>
<ol>
+ <li> Fixed: Several functions in namespace GridTools were not instantiated
+ for parallel::distributed::Triangulation objects. This is now fixed.
+ <br>
+ (Denis Davydov, Wolfgang Bangerth, 2013/12/01)
+ </li>
+
<li> Improved: The methods ConstraintMatrix::distribute_local_to_global
now use scratch data that is private to each thread instead of allocating
it for every cell anew. This gives better performance, in particular in
return tria;
}
+ template<int dim, int spacedim>
+ const Triangulation<dim, spacedim> &
+ get_tria(const parallel::distributed::Triangulation<dim, spacedim> &tria)
+ {
+ return tria;
+ }
+
template<int dim, template<int, int> class Container, int spacedim>
const Triangulation<dim,spacedim> &
get_tria(const Container<dim,spacedim> &container)
return tria;
}
+ template<int dim, int spacedim>
+ Triangulation<dim, spacedim> &
+ get_tria(parallel::distributed::Triangulation<dim, spacedim> &tria)
+ {
+ return tria;
+ }
+
template<int dim, template<int, int> class Container, int spacedim>
const Triangulation<dim,spacedim> &
get_tria(Container<dim,spacedim> &container)
find_active_cell_around_point (const Container<dim,spacedim> &container,
const Point<spacedim> &p)
{
- return find_active_cell_around_point(StaticMappingQ1<dim,spacedim>::mapping,
- container, p).first;
+ return
+ find_active_cell_around_point<dim,Container,spacedim>
+ (StaticMappingQ1<dim,spacedim>::mapping,
+ container, p).first;
}
have_same_coarse_mesh (const Container &mesh_1,
const Container &mesh_2)
{
- return have_same_coarse_mesh (mesh_1.get_tria(),
- mesh_2.get_tria());
+ return have_same_coarse_mesh (get_tria(mesh_1),
+ get_tria(mesh_2));
}
}
+// now also instantiate these functions for parallel::distributed::Triangulation
+for (deal_II_dimension : DIMENSIONS ; deal_II_space_dimension : SPACE_DIMENSIONS)
+{
+
+#if deal_II_dimension <= deal_II_space_dimension
+ namespace GridTools \{
+
+ template
+ unsigned int
+ find_closest_vertex (const parallel::distributed::Triangulation<deal_II_dimension,deal_II_space_dimension> &,
+ const Point<deal_II_space_dimension> &);
+
+ template
+ std::vector<parallel::distributed::Triangulation<deal_II_dimension,deal_II_space_dimension>::active_cell_iterator>
+ find_cells_adjacent_to_vertex(const parallel::distributed::Triangulation<deal_II_dimension,deal_II_space_dimension> &,
+ const unsigned int);
+ template
+ parallel::distributed::Triangulation<deal_II_dimension,deal_II_space_dimension>::active_cell_iterator
+ find_active_cell_around_point (const parallel::distributed::Triangulation<deal_II_dimension,deal_II_space_dimension> &,
+ const Point<deal_II_space_dimension> &p);
+
+ template
+ std::pair<parallel::distributed::Triangulation<deal_II_dimension,deal_II_space_dimension>::active_cell_iterator, Point<deal_II_dimension> >
+ find_active_cell_around_point (const Mapping<deal_II_dimension, deal_II_space_dimension> &,
+ const parallel::distributed::Triangulation<deal_II_dimension,deal_II_space_dimension> &,
+ const Point<deal_II_space_dimension> &);
+
+ template
+ std::list<std::pair<parallel::distributed::Triangulation<deal_II_dimension,deal_II_space_dimension>::cell_iterator, parallel::distributed::Triangulation<deal_II_dimension,deal_II_space_dimension>::cell_iterator> >
+ get_finest_common_cells (const parallel::distributed::Triangulation<deal_II_dimension,deal_II_space_dimension> &mesh_1,
+ const parallel::distributed::Triangulation<deal_II_dimension,deal_II_space_dimension> &mesh_2);
+
+
+ template
+ bool
+ have_same_coarse_mesh (const parallel::distributed::Triangulation<deal_II_dimension,deal_II_space_dimension> &mesh_1,
+ const parallel::distributed::Triangulation<deal_II_dimension,deal_II_space_dimension> &mesh_2);
+
+ \}
+
+ #endif
+}
+
+
+
for (deal_II_space_dimension : SPACE_DIMENSIONS)
{
--- /dev/null
+// ---------------------------------------------------------------------
+// $Id$
+//
+// Copyright (C) 2009 - 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.
+//
+// ---------------------------------------------------------------------
+
+
+
+// make sure only one processor finds a locally-owned cell around a point
+
+#include "../tests.h"
+#include "coarse_grid_common.h"
+#include <deal.II/base/logstream.h>
+#include <deal.II/base/tensor.h>
+#include <deal.II/grid/tria.h>
+#include <deal.II/distributed/tria.h>
+#include <deal.II/grid/tria_accessor.h>
+#include <deal.II/grid/grid_generator.h>
+#include <deal.II/grid/grid_out.h>
+#include <deal.II/grid/grid_tools.h>
+#include <deal.II/base/utilities.h>
+
+
+#include <fstream>
+
+
+template<int dim>
+void test()
+{
+ unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD);
+
+ if (true)
+ {
+ if (Utilities::MPI::this_mpi_process (MPI_COMM_WORLD) == 0)
+ deallog << "hyper_cube" << std::endl;
+
+ parallel::distributed::Triangulation<dim> tr(MPI_COMM_WORLD);
+
+ GridGenerator::hyper_cube(tr);
+ tr.refine_global(2);
+
+ // choose a point that is guaranteed to lie in the domain but not
+ // at the interface between cells
+ Point<dim> p;
+ for (unsigned int d=0; d<dim; ++d)
+ p[d] = 1./3;
+
+ typename parallel::distributed::Triangulation<dim>::active_cell_iterator
+ cell = GridTools::find_active_cell_around_point (tr, p);
+
+ const unsigned int
+ n_locally_owned
+ = Utilities::MPI::sum (cell->is_locally_owned() ? 1 : 0,
+ MPI_COMM_WORLD);
+
+ const unsigned int
+ n_locally_owned_or_ghost
+ = Utilities::MPI::sum (!cell->is_artificial() ? 1 : 0,
+ MPI_COMM_WORLD);
+
+ if (myid == 0)
+ deallog << "Locally owned: "
+ << n_locally_owned
+ << std::endl
+ << "Locally owned or ghost: "
+ << n_locally_owned_or_ghost
+ << std::endl;
+ }
+}
+
+
+int main(int argc, char *argv[])
+{
+ Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
+
+ unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD);
+
+
+ deallog.push(Utilities::int_to_string(myid));
+
+ if (myid == 0)
+ {
+ std::ofstream logfile("output");
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+ deallog.threshold_double(1.e-10);
+
+ deallog.push("2d");
+ test<2>();
+ deallog.pop();
+ deallog.push("3d");
+ test<3>();
+ deallog.pop();
+ }
+ else
+ {
+ test<2>();
+ test<3>();
+ }
+}
--- /dev/null
+JobId linux-sh2g.site Wed Dec 4 08:36:59 2013
+DEAL:0:2d::hyper_cube
+DEAL:0:2d::Locally owned: 1
+DEAL:0:2d::Locally owned or ghost: 4
+DEAL:0:3d::hyper_cube
+DEAL:0:3d::Locally owned: 1
+DEAL:0:3d::Locally owned or ghost: 4