Reference documentation for deal.II version Git e051263625 2020-04-08 22:32:15 +0200
\(\newcommand{\vcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\vcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
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  {
102  template <int dim, int spacedim = dim>
104  : public ::parallel::TriangulationBase<dim, spacedim>
105  {
106  public:
107  using active_cell_iterator =
108  typename ::Triangulation<dim, spacedim>::active_cell_iterator;
109  using cell_iterator =
110  typename ::Triangulation<dim, spacedim>::cell_iterator;
111 
125  enum Settings
126  {
137 
142 
161 
166 
217 
227  };
228 
229 
240  MPI_Comm mpi_communicator,
241  const typename ::Triangulation<dim, spacedim>::MeshSmoothing =
243  const bool allow_artificial_cells = false,
245 
249  virtual ~Triangulation() override = default;
250 
259  virtual void
261 
268  virtual void
269  create_triangulation(const std::vector<Point<spacedim>> &vertices,
270  const std::vector<CellData<dim>> & cells,
271  const SubCellData &subcelldata) override;
272 
273  /*
274  * @copydoc Triangulation::create_triangulation()
275  *
276  * @note Not inmplemented yet.
277  */
278  virtual void
281  &construction_data) override;
282 
293  virtual void
295  const ::Triangulation<dim, spacedim> &other_tria) override;
296 
305  template <class Archive>
306  void
307  load(Archive &ar, const unsigned int version);
308 
317  const std::vector<types::subdomain_id> &
319 
328  const std::vector<types::subdomain_id> &
329  get_true_level_subdomain_ids_of_cells(const unsigned int level) const;
330 
335  bool
336  with_artificial_cells() const;
337 
338  protected:
343  virtual void
344  update_number_cache() override;
345 
346  private:
351 
356 
361  void
362  partition();
363 
376  std::vector<types::subdomain_id> true_subdomain_ids_of_cells;
377 
386  std::vector<std::vector<types::subdomain_id>>
388  };
389 
390  template <int dim, int spacedim>
391  template <class Archive>
392  void
393  Triangulation<dim, spacedim>::load(Archive &ar, const unsigned int version)
394  {
396  partition();
397  this->update_number_cache();
398  }
399  } // namespace shared
400 #else
401 
402  namespace shared
403  {
415  template <int dim, int spacedim = dim>
416  class Triangulation
417  : public ::parallel::TriangulationBase<dim, spacedim>
418  {
419  public:
424  Triangulation() = delete;
425 
429  const std::vector<types::subdomain_id> &
431 
435  const std::vector<types::subdomain_id> &
436  get_true_level_subdomain_ids_of_cells(const unsigned int level) const;
437 
441  bool
442  with_artificial_cells() const;
443 
444  private:
448  std::vector<types::subdomain_id> true_subdomain_ids_of_cells;
449 
453  std::vector<types::subdomain_id> true_level_subdomain_ids_of_cells;
454  };
455  } // namespace shared
456 
457 
458 #endif
459 } // namespace parallel
460 
461 DEAL_II_NAMESPACE_CLOSE
462 
463 #endif
std::vector< std::vector< types::subdomain_id > > true_level_subdomain_ids_of_cells
Definition: shared_tria.h:387
std::vector< Point< spacedim > > vertices
Definition: tria.h:3831
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:418
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:376
void load(Archive &ar, const unsigned int version)
Definition: shared_tria.h:393
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:398