Reference documentation for deal.II version 9.1.1
\(\newcommand{\dealcoloneq}{\mathrel{\vcenter{:}}=}\)
shared_tria.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2008 - 2018 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii_distributed_shared_tria_h
17 #define dealii_distributed_shared_tria_h
18 
19 
20 #include <deal.II/base/config.h>
21 
22 #include <deal.II/base/smartpointer.h>
23 #include <deal.II/base/subscriptor.h>
24 #include <deal.II/base/template_constraints.h>
25 
26 #include <deal.II/distributed/tria_base.h>
27 
28 #include <deal.II/grid/tria.h>
29 
30 #include <functional>
31 #include <list>
32 #include <set>
33 #include <tuple>
34 #include <utility>
35 #include <vector>
36 
37 #ifdef DEAL_II_WITH_MPI
38 # include <mpi.h>
39 #endif
40 
41 
42 DEAL_II_NAMESPACE_OPEN
43 
44 namespace parallel
45 {
46 #ifdef DEAL_II_WITH_MPI
47 
48 
49  namespace shared
50  {
101  template <int dim, int spacedim = dim>
102  class Triangulation : public ::parallel::Triangulation<dim, spacedim>
103  {
104  public:
105  using active_cell_iterator =
106  typename ::Triangulation<dim, spacedim>::active_cell_iterator;
107  using cell_iterator =
108  typename ::Triangulation<dim, spacedim>::cell_iterator;
109 
123  enum Settings
124  {
135 
140 
159 
164 
215 
225  };
226 
227 
238  MPI_Comm mpi_communicator,
239  const typename ::Triangulation<dim, spacedim>::MeshSmoothing =
241  const bool allow_artificial_cells = false,
243 
247  virtual ~Triangulation() override = default;
248 
257  virtual void
259 
266  virtual void
267  create_triangulation(const std::vector<Point<spacedim>> &vertices,
268  const std::vector<CellData<dim>> & cells,
269  const SubCellData &subcelldata) override;
270 
281  virtual void
283  const ::Triangulation<dim, spacedim> &other_tria) override;
284 
293  template <class Archive>
294  void
295  load(Archive &ar, const unsigned int version);
296 
305  const std::vector<types::subdomain_id> &
307 
316  const std::vector<types::subdomain_id> &
317  get_true_level_subdomain_ids_of_cells(const unsigned int level) const;
318 
323  bool
324  with_artificial_cells() const;
325 
326  protected:
331  virtual void
332  update_number_cache() override;
333 
334  private:
339 
344 
349  void
350  partition();
351 
364  std::vector<types::subdomain_id> true_subdomain_ids_of_cells;
365 
374  std::vector<std::vector<types::subdomain_id>>
376  };
377 
378  template <int dim, int spacedim>
379  template <class Archive>
380  void
381  Triangulation<dim, spacedim>::load(Archive &ar, const unsigned int version)
382  {
384  partition();
385  this->update_number_cache();
386  }
387  } // namespace shared
388 #else
389 
390  namespace shared
391  {
403  template <int dim, int spacedim = dim>
404  class Triangulation : public ::parallel::Triangulation<dim, spacedim>
405  {
406  public:
411  Triangulation() = delete;
412 
416  const std::vector<types::subdomain_id> &
418 
422  const std::vector<types::subdomain_id> &
423  get_true_level_subdomain_ids_of_cells(const unsigned int level) const;
424 
428  bool
429  with_artificial_cells() const;
430 
431  private:
435  std::vector<types::subdomain_id> true_subdomain_ids_of_cells;
436 
440  std::vector<types::subdomain_id> true_level_subdomain_ids_of_cells;
441  };
442  } // namespace shared
443 
444 
445 #endif
446 } // namespace parallel
447 
448 DEAL_II_NAMESPACE_CLOSE
449 
450 #endif
std::vector< std::vector< types::subdomain_id > > true_level_subdomain_ids_of_cells
Definition: shared_tria.h:375
std::vector< Point< spacedim > > vertices
Definition: tria.h:3963
const std::vector< types::subdomain_id > & get_true_subdomain_ids_of_cells() const
Definition: shared_tria.cc:324
Triangulation(MPI_Comm mpi_communicator, const typename ::Triangulation< dim, spacedim >::MeshSmoothing=(::Triangulation< dim, spacedim >::none), const bool allow_artificial_cells=false, const Settings settings=partition_auto)
Definition: shared_tria.cc:39
virtual void execute_coarsening_and_refinement() override
Definition: shared_tria.cc:348
const std::vector< types::subdomain_id > & get_true_level_subdomain_ids_of_cells(const unsigned int level) const
Definition: shared_tria.cc:333
virtual void update_number_cache() override
Definition: shared_tria.cc:405
void load(Archive &ar, const unsigned int version)
virtual ~Triangulation() override=default
std::vector< types::subdomain_id > true_subdomain_ids_of_cells
Definition: shared_tria.h:364
void load(Archive &ar, const unsigned int version)
Definition: shared_tria.h:381
virtual void create_triangulation(const std::vector< Point< spacedim >> &vertices, const std::vector< CellData< dim >> &cells, const SubCellData &subcelldata) override
Definition: shared_tria.cc:359
virtual void copy_triangulation(const ::Triangulation< dim, spacedim > &other_tria) override
Definition: shared_tria.cc:385