Reference documentation for deal.II version GIT 4e92747666 2022-12-02 08:40:02+00:00
\(\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 
22 #include <deal.II/base/mpi_stub.h>
26 
28 
29 #include <deal.II/grid/tria.h>
30 
31 #include <functional>
32 #include <list>
33 #include <utility>
34 #include <vector>
35 
37 
38 namespace parallel
39 {
40 #ifdef DEAL_II_WITH_MPI
41 
42 
43  namespace shared
44  {
105  template <int dim, int spacedim = dim>
107  : public ::parallel::TriangulationBase<dim, spacedim>
108  {
109  public:
111  typename ::Triangulation<dim, spacedim>::active_cell_iterator;
113  typename ::Triangulation<dim, spacedim>::cell_iterator;
114 
128  enum Settings
129  {
140 
145 
164 
169 
220 
230  };
231 
232 
257  const MPI_Comm &mpi_communicator,
258  const typename ::Triangulation<dim, spacedim>::MeshSmoothing =
260  const bool allow_artificial_cells = false,
262 
266  virtual ~Triangulation() override = default;
267 
271  virtual bool
272  is_multilevel_hierarchy_constructed() const override;
273 
282  virtual void
284 
291  virtual void
292  create_triangulation(const std::vector<Point<spacedim>> &vertices,
293  const std::vector<CellData<dim>> & cells,
294  const SubCellData &subcelldata) override;
295 
301  virtual void
304  &construction_data) override;
305 
316  virtual void
318  const ::Triangulation<dim, spacedim> &other_tria) override;
319 
328  template <class Archive>
329  void
330  load(Archive &ar, const unsigned int version);
331 
340  const std::vector<types::subdomain_id> &
342 
351  const std::vector<types::subdomain_id> &
352  get_true_level_subdomain_ids_of_cells(const unsigned int level) const;
353 
358  bool
359  with_artificial_cells() const;
360 
361  private:
366 
371 
376  void
377  partition();
378 
391  std::vector<types::subdomain_id> true_subdomain_ids_of_cells;
392 
401  std::vector<std::vector<types::subdomain_id>>
403  };
404 
405  template <int dim, int spacedim>
406  template <class Archive>
407  void
408  Triangulation<dim, spacedim>::load(Archive &ar, const unsigned int version)
409  {
411  partition();
412  this->update_number_cache();
413  }
414  } // namespace shared
415 #else
416 
417  namespace shared
418  {
430  template <int dim, int spacedim = dim>
431  class Triangulation
432  : public ::parallel::TriangulationBase<dim, spacedim>
433  {
434  public:
439  Triangulation() = delete;
440 
444  virtual bool
445  is_multilevel_hierarchy_constructed() const override;
446 
450  const std::vector<types::subdomain_id> &
452 
456  const std::vector<types::subdomain_id> &
457  get_true_level_subdomain_ids_of_cells(const unsigned int level) const;
458 
462  bool
463  with_artificial_cells() const;
464 
465  private:
469  std::vector<types::subdomain_id> true_subdomain_ids_of_cells;
470 
474  std::vector<types::subdomain_id> true_level_subdomain_ids_of_cells;
475  };
476  } // namespace shared
477 
478 
479 #endif
480 } // namespace parallel
481 
482 
483 namespace internal
484 {
485  namespace parallel
486  {
487  namespace shared
488  {
508  template <int dim, int spacedim = dim>
510  {
511  public:
522 
530 
531  private:
535  const SmartPointer<
536  const ::parallel::shared::Triangulation<dim, spacedim>>
538 
544  std::vector<unsigned int> saved_subdomain_ids;
545  };
546  } // namespace shared
547  } // namespace parallel
548 } // namespace internal
549 
551 
552 #endif
std::vector< Point< spacedim > > vertices
Definition: tria.h:4196
void load(Archive &ar, const unsigned int version)
const SmartPointer< const ::parallel::shared::Triangulation< dim, spacedim > > shared_tria
Definition: shared_tria.h:537
TemporarilyRestoreSubdomainIds(const Triangulation< dim, spacedim > &tria)
Definition: shared_tria.cc:538
virtual void execute_coarsening_and_refinement() override
Definition: shared_tria.cc:355
std::vector< types::subdomain_id > true_subdomain_ids_of_cells
Definition: shared_tria.h:391
typename ::Triangulation< dim, spacedim >::active_cell_iterator active_cell_iterator
Definition: shared_tria.h:111
virtual void copy_triangulation(const ::Triangulation< dim, spacedim > &other_tria) override
Definition: shared_tria.cc:465
const std::vector< types::subdomain_id > & get_true_subdomain_ids_of_cells() const
Definition: shared_tria.cc:331
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:42
std::vector< std::vector< types::subdomain_id > > true_level_subdomain_ids_of_cells
Definition: shared_tria.h:402
typename ::Triangulation< dim, spacedim >::cell_iterator cell_iterator
Definition: shared_tria.h:113
const std::vector< types::subdomain_id > & get_true_level_subdomain_ids_of_cells(const unsigned int level) const
Definition: shared_tria.cc:340
virtual ~Triangulation() override=default
virtual void create_triangulation(const std::vector< Point< spacedim >> &vertices, const std::vector< CellData< dim >> &cells, const SubCellData &subcelldata) override
Definition: shared_tria.cc:426
virtual bool is_multilevel_hierarchy_constructed() const override
Definition: shared_tria.cc:77
void load(Archive &ar, const unsigned int version)
Definition: shared_tria.h:408
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:458
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:459
unsigned int level
Definition: grid_out.cc:4608
void partition(const SparsityPattern &sparsity_pattern, const unsigned int n_partitions, std::vector< unsigned int > &partition_indices, const Partitioner partitioner=Partitioner::metis)
const ::Triangulation< dim, spacedim > & tria