Reference documentation for deal.II version Git 3f1f337db3 2021-10-23 13:19:02 -0600
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
shared_tria.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2008 - 2021 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 
25 
27 
28 #include <deal.II/grid/tria.h>
29 
30 #include <functional>
31 #include <list>
32 #include <set>
33 #include <utility>
34 #include <vector>
35 
36 #ifdef DEAL_II_WITH_MPI
37 # include <mpi.h>
38 #endif
39 
40 
42 
43 namespace parallel
44 {
45 #ifdef DEAL_II_WITH_MPI
46 
47 
48  namespace shared
49  {
104  template <int dim, int spacedim = dim>
106  : public ::parallel::TriangulationBase<dim, spacedim>
107  {
108  public:
109  using active_cell_iterator =
110  typename ::Triangulation<dim, spacedim>::active_cell_iterator;
111  using cell_iterator =
112  typename ::Triangulation<dim, spacedim>::cell_iterator;
113 
127  enum Settings
128  {
139 
144 
163 
168 
219 
229  };
230 
231 
256  const MPI_Comm &mpi_communicator,
257  const typename ::Triangulation<dim, spacedim>::MeshSmoothing =
259  const bool allow_artificial_cells = false,
261 
265  virtual ~Triangulation() override = default;
266 
270  virtual bool
271  is_multilevel_hierarchy_constructed() const override;
272 
281  virtual void
283 
290  virtual void
291  create_triangulation(const std::vector<Point<spacedim>> &vertices,
292  const std::vector<CellData<dim>> & cells,
293  const SubCellData &subcelldata) override;
294 
300  virtual void
303  &construction_data) override;
304 
315  virtual void
317  const ::Triangulation<dim, spacedim> &other_tria) override;
318 
327  template <class Archive>
328  void
329  load(Archive &ar, const unsigned int version);
330 
339  const std::vector<types::subdomain_id> &
341 
350  const std::vector<types::subdomain_id> &
351  get_true_level_subdomain_ids_of_cells(const unsigned int level) const;
352 
357  bool
358  with_artificial_cells() const;
359 
360  private:
365 
370 
375  void
376  partition();
377 
390  std::vector<types::subdomain_id> true_subdomain_ids_of_cells;
391 
400  std::vector<std::vector<types::subdomain_id>>
402  };
403 
404  template <int dim, int spacedim>
405  template <class Archive>
406  void
407  Triangulation<dim, spacedim>::load(Archive &ar, const unsigned int version)
408  {
410  partition();
411  this->update_number_cache();
412  }
413  } // namespace shared
414 #else
415 
416  namespace shared
417  {
429  template <int dim, int spacedim = dim>
430  class Triangulation
431  : public ::parallel::TriangulationBase<dim, spacedim>
432  {
433  public:
438  Triangulation() = delete;
439 
443  virtual bool
444  is_multilevel_hierarchy_constructed() const override;
445 
449  const std::vector<types::subdomain_id> &
451 
455  const std::vector<types::subdomain_id> &
456  get_true_level_subdomain_ids_of_cells(const unsigned int level) const;
457 
461  bool
462  with_artificial_cells() const;
463 
464  private:
468  std::vector<types::subdomain_id> true_subdomain_ids_of_cells;
469 
473  std::vector<types::subdomain_id> true_level_subdomain_ids_of_cells;
474  };
475  } // namespace shared
476 
477 
478 #endif
479 } // namespace parallel
480 
481 
482 namespace internal
483 {
484  namespace parallel
485  {
486  namespace shared
487  {
506  template <int dim, int spacedim = dim>
508  {
509  public:
520 
528 
529  private:
533  const SmartPointer<
534  const ::parallel::shared::Triangulation<dim, spacedim>>
536 
542  std::vector<unsigned int> saved_subdomain_ids;
543  };
544  } // namespace shared
545  } // namespace parallel
546 } // namespace internal
547 
549 
550 #endif
std::vector< std::vector< types::subdomain_id > > true_level_subdomain_ids_of_cells
Definition: shared_tria.h:401
virtual bool is_multilevel_hierarchy_constructed() const override
Definition: shared_tria.cc:74
std::vector< Point< spacedim > > vertices
Definition: tria.h:3993
const std::vector< types::subdomain_id > & get_true_subdomain_ids_of_cells() const
Definition: shared_tria.cc:333
const ::Triangulation< dim, spacedim > & tria
virtual void execute_coarsening_and_refinement() override
Definition: shared_tria.cc:357
const std::vector< types::subdomain_id > & get_true_level_subdomain_ids_of_cells(const unsigned int level) const
Definition: shared_tria.cc:342
const SmartPointer< const ::parallel::shared::Triangulation< dim, spacedim > > shared_tria
Definition: shared_tria.h:535
typename ::Triangulation< dim, spacedim >::cell_iterator cell_iterator
Definition: shared_tria.h:112
Triangulation(const 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
void load(Archive &ar, const unsigned int version)
virtual ~Triangulation() override=default
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:401
unsigned int level
Definition: grid_out.cc:4589
const MPI_Comm mpi_communicator
Definition: tria_base.h:301
virtual void update_number_cache()
Definition: tria_base.cc:149
std::vector< types::subdomain_id > true_subdomain_ids_of_cells
Definition: shared_tria.h:390
typename ::Triangulation< dim, spacedim >::active_cell_iterator active_cell_iterator
Definition: shared_tria.h:110
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:400
void load(Archive &ar, const unsigned int version)
Definition: shared_tria.h:407
virtual void create_triangulation(const std::vector< Point< spacedim >> &vertices, const std::vector< CellData< dim >> &cells, const SubCellData &subcelldata) override
Definition: shared_tria.cc:368
virtual void copy_triangulation(const ::Triangulation< dim, spacedim > &other_tria) override
Definition: shared_tria.cc:407