Reference documentation for deal.II version 9.4.1
\(\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\}}\)
Loading...
Searching...
No Matches
tria_base.h
Go to the documentation of this file.
1// ---------------------------------------------------------------------
2//
3// Copyright (C) 2008 - 2022 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_tria_base_h
17#define dealii_distributed_tria_base_h
18
19
20#include <deal.II/base/config.h>
21
22#include <deal.II/base/mpi.h>
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
38
39namespace parallel
40{
78 template <int dim, int spacedim = dim>
79 class TriangulationBase : public ::Triangulation<dim, spacedim>
80 {
81 public:
87 const typename ::Triangulation<dim, spacedim>::MeshSmoothing
89 const bool check_for_distorted_cells = false);
90
94 virtual ~TriangulationBase() override;
95
99 virtual MPI_Comm
100 get_communicator() const override;
101
105 virtual bool
107
116 virtual void
118 const ::Triangulation<dim, spacedim> &old_tria) override;
119
138 unsigned int
140
147 n_global_active_cells() const override;
148
152 virtual std::size_t
153 memory_consumption() const override;
154
155
163 virtual unsigned int
164 n_global_levels() const override;
165
173 locally_owned_subdomain() const override;
174
184 const std::set<types::subdomain_id> &
185 ghost_owners() const;
186
202 const std::set<types::subdomain_id> &
203 level_ghost_owners() const;
204
209 const std::weak_ptr<const Utilities::MPI::Partitioner>
211
216 const std::weak_ptr<const Utilities::MPI::Partitioner>
217 global_level_cell_index_partitioner(const unsigned int level) const;
218
225 virtual std::vector<types::boundary_id>
226 get_boundary_ids() const override;
227
234 virtual std::vector<types::manifold_id>
235 get_manifold_ids() const override;
236
289 void
291 const std::vector<bool> &vertex_locally_moved);
292
294 n_global_coarse_cells() const override;
295
296 protected:
303
309
314
320 {
325
331
336
342 unsigned int n_global_levels;
343
348 std::set<types::subdomain_id> ghost_owners;
349
354 std::set<types::subdomain_id> level_ghost_owners;
355
359 std::shared_ptr<const Utilities::MPI::Partitioner>
361
365 std::vector<std::shared_ptr<const Utilities::MPI::Partitioner>>
367
368 NumberCache();
369 };
370
372
376 virtual void
378
382 void
383 update_reference_cells() override;
384
388 void
390 };
391
392
393
439 template <int dim, int spacedim = dim>
441 : public ::parallel::TriangulationBase<dim, spacedim>
442 {
443 public:
449 const typename ::Triangulation<dim, spacedim>::MeshSmoothing
451 const bool check_for_distorted_cells = false);
452
459 virtual void
460 clear() override;
461
463 typename ::Triangulation<dim, spacedim>::cell_iterator;
464
466 typename ::Triangulation<dim, spacedim>::CellStatus;
467
483 virtual bool
484 has_hanging_nodes() const override;
485
493 virtual void
494 save(const std::string &filename) const = 0;
495
501 virtual void
502 load(const std::string &filename) = 0;
503
509 DEAL_II_DEPRECATED_EARLY
510 virtual void
511 load(const std::string &filename, const bool autopartition) = 0;
512
621 unsigned int
623 const std::function<std::vector<char>(const cell_iterator &,
624 const CellStatus)> &pack_callback,
625 const bool returns_variable_size_data);
626
675 void
677 const unsigned int handle,
678 const std::function<
679 void(const cell_iterator &,
680 const CellStatus,
681 const boost::iterator_range<std::vector<char>::const_iterator> &)>
682 &unpack_callback);
683
684 protected:
692 void
693 save_attached_data(const unsigned int global_first_cell,
694 const unsigned int global_num_cells,
695 const std::string &filename) const;
696
705 void
706 load_attached_data(const unsigned int global_first_cell,
707 const unsigned int global_num_cells,
708 const unsigned int local_num_cells,
709 const std::string &filename,
710 const unsigned int n_attached_deserialize_fixed,
711 const unsigned int n_attached_deserialize_variable);
712
723 virtual void
725
731 using cell_relation_t = typename std::pair<cell_iterator, CellStatus>;
732
738 std::vector<cell_relation_t> local_cell_relations;
739
746 {
752
758
759 using pack_callback_t = std::function<std::vector<char>(
760 typename ::Triangulation<dim, spacedim>::cell_iterator,
761 typename ::Triangulation<dim, spacedim>::CellStatus)>;
762
767 std::vector<pack_callback_t> pack_callbacks_fixed;
768 std::vector<pack_callback_t> pack_callbacks_variable;
769 };
770
772
781 {
782 public:
784
794 void
795 pack_data(const std::vector<cell_relation_t> &cell_relations,
796 const std::vector<typename CellAttachedData::pack_callback_t>
797 &pack_callbacks_fixed,
798 const std::vector<typename CellAttachedData::pack_callback_t>
799 &pack_callbacks_variable);
800
801
802
810 void
811 unpack_cell_status(std::vector<cell_relation_t> &cell_relations) const;
812
825 void
827 const std::vector<cell_relation_t> &cell_relations,
828 const unsigned int handle,
829 const std::function<void(
830 const typename ::Triangulation<dim, spacedim>::cell_iterator &,
831 const typename ::Triangulation<dim, spacedim>::CellStatus &,
832 const boost::iterator_range<std::vector<char>::const_iterator> &)>
833 &unpack_callback) const;
834
849 void
850 save(const unsigned int global_first_cell,
851 const unsigned int global_num_cells,
852 const std::string &filename) const;
853
872 void
873 load(const unsigned int global_first_cell,
874 const unsigned int global_num_cells,
875 const unsigned int local_num_cells,
876 const std::string &filename,
877 const unsigned int n_attached_deserialize_fixed,
878 const unsigned int n_attached_deserialize_variable);
879
886 void
887 clear();
888
893
904 std::vector<unsigned int> sizes_fixed_cumulative;
905
910 std::vector<char> src_data_fixed;
911 std::vector<char> dest_data_fixed;
912
917 std::vector<int> src_sizes_variable;
918 std::vector<int> dest_sizes_variable;
919 std::vector<char> src_data_variable;
920 std::vector<char> dest_data_variable;
921
922 private:
924 };
925
927 };
928
929} // namespace parallel
930
932
933#endif
const bool check_for_distorted_cells
Definition: tria.h:4191
MeshSmoothing smooth_grid
Definition: tria.h:3700
void pack_data(const std::vector< cell_relation_t > &cell_relations, const std::vector< typename CellAttachedData::pack_callback_t > &pack_callbacks_fixed, const std::vector< typename CellAttachedData::pack_callback_t > &pack_callbacks_variable)
Definition: tria_base.cc:852
void save(const unsigned int global_first_cell, const unsigned int global_num_cells, const std::string &filename) const
Definition: tria_base.cc:1395
void unpack_cell_status(std::vector< cell_relation_t > &cell_relations) const
Definition: tria_base.cc:1188
void unpack_data(const std::vector< cell_relation_t > &cell_relations, const unsigned int handle, const std::function< void(const typename ::Triangulation< dim, spacedim >::cell_iterator &, const typename ::Triangulation< dim, spacedim >::CellStatus &, const boost::iterator_range< std::vector< char >::const_iterator > &)> &unpack_callback) const
Definition: tria_base.cc:1224
std::vector< unsigned int > sizes_fixed_cumulative
Definition: tria_base.h:904
void load(const unsigned int global_first_cell, const unsigned int global_num_cells, const unsigned int local_num_cells, const std::string &filename, const unsigned int n_attached_deserialize_fixed, const unsigned int n_attached_deserialize_variable)
Definition: tria_base.cc:1576
virtual void clear() override
Definition: tria_base.cc:655
virtual void load(const std::string &filename)=0
virtual void load(const std::string &filename, const bool autopartition)=0
void save_attached_data(const unsigned int global_first_cell, const unsigned int global_num_cells, const std::string &filename) const
Definition: tria_base.cc:667
virtual bool has_hanging_nodes() const override
Definition: tria_base.cc:704
void notify_ready_to_unpack(const unsigned int handle, const std::function< void(const cell_iterator &, const CellStatus, const boost::iterator_range< std::vector< char >::const_iterator > &)> &unpack_callback)
Definition: tria_base.cc:798
typename ::Triangulation< dim, spacedim >::CellStatus CellStatus
Definition: tria_base.h:466
std::vector< cell_relation_t > local_cell_relations
Definition: tria_base.h:738
virtual void save(const std::string &filename) const =0
unsigned int register_data_attach(const std::function< std::vector< char >(const cell_iterator &, const CellStatus)> &pack_callback, const bool returns_variable_size_data)
Definition: tria_base.cc:768
typename ::Triangulation< dim, spacedim >::cell_iterator cell_iterator
Definition: tria_base.h:463
typename std::pair< cell_iterator, CellStatus > cell_relation_t
Definition: tria_base.h:731
void load_attached_data(const unsigned int global_first_cell, const unsigned int global_num_cells, const unsigned int local_num_cells, const std::string &filename, const unsigned int n_attached_deserialize_fixed, const unsigned int n_attached_deserialize_variable)
Definition: tria_base.cc:731
const std::set< types::subdomain_id > & level_ghost_owners() const
Definition: tria_base.cc:343
virtual std::size_t memory_consumption() const override
Definition: tria_base.cc:93
virtual types::global_cell_index n_global_active_cells() const override
Definition: tria_base.cc:137
void update_reference_cells() override
Definition: tria_base.cc:297
const std::set< types::subdomain_id > & ghost_owners() const
Definition: tria_base.cc:334
types::subdomain_id n_subdomains
Definition: tria_base.h:313
const std::weak_ptr< const Utilities::MPI::Partitioner > global_level_cell_index_partitioner(const unsigned int level) const
Definition: tria_base.cc:617
types::subdomain_id locally_owned_subdomain() const override
Definition: tria_base.cc:325
const MPI_Comm mpi_communicator
Definition: tria_base.h:302
virtual unsigned int n_global_levels() const override
Definition: tria_base.cc:130
virtual std::vector< types::boundary_id > get_boundary_ids() const override
Definition: tria_base.cc:352
unsigned int n_locally_owned_active_cells() const
Definition: tria_base.cc:123
virtual types::coarse_cell_id n_global_coarse_cells() const override
Definition: tria_base.cc:630
virtual bool is_multilevel_hierarchy_constructed() const =0
virtual void update_number_cache()
Definition: tria_base.cc:152
const std::weak_ptr< const Utilities::MPI::Partitioner > global_active_cell_index_partitioner() const
Definition: tria_base.cc:608
void communicate_locally_moved_vertices(const std::vector< bool > &vertex_locally_moved)
Definition: tria_base.cc:558
virtual MPI_Comm get_communicator() const override
Definition: tria_base.cc:144
types::subdomain_id my_subdomain
Definition: tria_base.h:308
virtual std::vector< types::manifold_id > get_manifold_ids() const override
Definition: tria_base.cc:363
virtual void copy_triangulation(const ::Triangulation< dim, spacedim > &old_tria) override
Definition: tria_base.cc:68
virtual ~TriangulationBase() override
Definition: tria_base.cc:106
#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
std::vector< pack_callback_t > pack_callbacks_fixed
Definition: tria_base.h:767
std::vector< pack_callback_t > pack_callbacks_variable
Definition: tria_base.h:768
std::function< std::vector< char >(typename ::Triangulation< dim, spacedim >::cell_iterator, typename ::Triangulation< dim, spacedim >::CellStatus)> pack_callback_t
Definition: tria_base.h:761
std::set< types::subdomain_id > level_ghost_owners
Definition: tria_base.h:354
types::global_cell_index n_global_active_cells
Definition: tria_base.h:330
std::set< types::subdomain_id > ghost_owners
Definition: tria_base.h:348
std::shared_ptr< const Utilities::MPI::Partitioner > active_cell_index_partitioner
Definition: tria_base.h:360
std::vector< std::shared_ptr< const Utilities::MPI::Partitioner > > level_cell_index_partitioners
Definition: tria_base.h:366
types::coarse_cell_id number_of_global_coarse_cells
Definition: tria_base.h:335