Reference documentation for deal.II version 9.4.0
\(\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
43namespace 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:
110 typename ::Triangulation<dim, spacedim>::active_cell_iterator;
112 typename ::Triangulation<dim, spacedim>::cell_iterator;
113
128 {
139
144
163
168
219
229 };
230
231
257 const typename ::Triangulation<dim, spacedim>::MeshSmoothing =
259 const bool allow_artificial_cells = false,
261
265 virtual ~Triangulation() override = default;
266
270 virtual bool
272
281 virtual void
283
290 virtual void
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
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
482namespace internal
483{
484 namespace parallel
485 {
486 namespace shared
487 {
507 template <int dim, int spacedim = dim>
509 {
510 public:
521
529
530 private:
534 const SmartPointer<
535 const ::parallel::shared::Triangulation<dim, spacedim>>
537
543 std::vector<unsigned int> saved_subdomain_ids;
544 };
545 } // namespace shared
546 } // namespace parallel
547} // namespace internal
548
550
551#endif
std::vector< Point< spacedim > > vertices
Definition: tria.h:4167
void load(Archive &ar, const unsigned int version)
const SmartPointer< const ::parallel::shared::Triangulation< dim, spacedim > > shared_tria
Definition: shared_tria.h:536
TemporarilyRestoreSubdomainIds(const Triangulation< dim, spacedim > &tria)
Definition: shared_tria.cc:475
virtual void execute_coarsening_and_refinement() override
Definition: shared_tria.cc:352
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
virtual void copy_triangulation(const ::Triangulation< dim, spacedim > &other_tria) override
Definition: shared_tria.cc:402
const std::vector< types::subdomain_id > & get_true_subdomain_ids_of_cells() const
Definition: shared_tria.cc:328
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
std::vector< std::vector< types::subdomain_id > > true_level_subdomain_ids_of_cells
Definition: shared_tria.h:401
typename ::Triangulation< dim, spacedim >::cell_iterator cell_iterator
Definition: shared_tria.h:112
const std::vector< types::subdomain_id > & get_true_level_subdomain_ids_of_cells(const unsigned int level) const
Definition: shared_tria.cc:337
virtual ~Triangulation() override=default
virtual bool is_multilevel_hierarchy_constructed() const override
Definition: shared_tria.cc:74
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:363
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:442
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:443
unsigned int level
Definition: grid_out.cc:4606
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