16 #ifndef dealii_distributed_tria_h 17 #define dealii_distributed_tria_h 20 #include <deal.II/base/config.h> 22 #include <deal.II/base/smartpointer.h> 23 #include <deal.II/base/subscriptor.h> 24 #include <deal.II/base/template_constraints.h> 26 #include <deal.II/distributed/p4est_wrappers.h> 27 #include <deal.II/distributed/tria_base.h> 29 #include <deal.II/grid/tria.h> 31 #include <boost/range/iterator_range.hpp> 37 #include <type_traits> 41 #ifdef DEAL_II_WITH_MPI 45 #ifdef DEAL_II_WITH_P4EST 47 # include <p4est_connectivity.h> 48 # include <p4est_ghost.h> 50 # include <p8est_connectivity.h> 51 # include <p8est_ghost.h> 55 DEAL_II_NAMESPACE_OPEN
57 #ifdef DEAL_II_WITH_P4EST 61 namespace DoFHandlerImplementation
75 template <
int,
int,
class>
76 class ExtrapolateImplementation;
83 template <
typename CellIterator>
247 template <
int dim,
int spacedim = dim>
269 typename ::Triangulation<dim, spacedim>::cell_iterator;
290 typename ::Triangulation<dim, spacedim>::active_cell_iterator;
293 typename ::Triangulation<dim, spacedim>::CellStatus;
364 const typename ::Triangulation<dim, spacedim>::MeshSmoothing
393 const ::Triangulation<dim, spacedim> &other_tria)
override;
547 const std::vector<bool> &vertex_locally_moved);
607 save(
const std::string &filename)
const;
628 load(
const std::string &filename,
const bool autopartition =
true);
741 const CellStatus)> &pack_callback,
742 const bool returns_variable_size_data);
794 const unsigned int handle,
795 const std::function<
void(
798 const boost::iterator_range<std::vector<char>::const_iterator> &)>
807 const std::vector<types::global_dof_index> &
815 const std::vector<types::global_dof_index> &
825 const typename ::internal::p4est::types<dim>::forest *
909 using pack_callback_t = std::function<std::vector<char>(
918 std::vector<pack_callback_t> pack_callbacks_variable;
930 typename ::internal::p4est::types<dim>::quadrant *,
981 const std::vector<quadrant_cell_relation_t> &quad_cell_relations,
982 const std::vector<typename CellAttachedData::pack_callback_t>
983 &pack_callbacks_fixed,
984 const std::vector<typename CellAttachedData::pack_callback_t>
985 &pack_callbacks_variable);
1001 const typename ::internal::p4est::types<dim>::forest
1003 const typename ::internal::p4est::types<dim>::gloidx
1004 *previous_global_first_quadrant);
1015 std::vector<quadrant_cell_relation_t> &quad_cell_relations)
const;
1031 const std::vector<quadrant_cell_relation_t> &quad_cell_relations,
1032 const unsigned int handle,
1033 const std::function<
void(
1034 const typename ::Triangulation<dim, spacedim>::cell_iterator
1036 const typename ::Triangulation<dim, spacedim>::CellStatus &,
1037 const boost::iterator_range<std::vector<char>::const_iterator> &)>
1038 &unpack_callback)
const;
1055 save(
const typename ::internal::p4est::types<dim>::forest
1057 const std::string &filename)
const;
1078 load(
const typename ::internal::p4est::types<dim>::forest
1080 const std::string &filename,
1081 const unsigned int n_attached_deserialize_fixed,
1082 const unsigned int n_attached_deserialize_variable);
1094 MPI_Comm mpi_communicator;
1118 std::vector<char> dest_data_fixed;
1125 std::vector<int> dest_sizes_variable;
1126 std::vector<char> src_data_variable;
1127 std::vector<char> dest_data_variable;
1145 std::vector<types::global_dof_index>
1147 std::vector<types::global_dof_index>
1148 p4est_tree_to_coarse_cell_permutation;
1154 typename ::internal::p4est::types<dim>::tree *
1155 init_tree(
const int dealii_coarse_cell_index)
const;
1195 std::vector<unsigned int>
1205 virtual std::map<unsigned int, std::set<::types::subdomain_id>>
1221 friend class ::internal::DoFHandlerImplementation::Policy::
1222 ParallelDistributed;
1224 template <
int,
int,
class>
1225 friend class ::FETools::internal::ExtrapolateImplementation;
1234 template <
int spacedim>
1255 const typename ::Triangulation<1, spacedim>::MeshSmoothing
1270 const std::vector<types::global_dof_index> &
1308 const std::vector<bool> &vertex_locally_moved);
1315 load(
const std::string &filename,
const bool autopartition =
true);
1322 save(
const std::string &filename)
const;
1330 const std::function<std::vector<char>(
1331 const typename ::Triangulation<1, spacedim>::cell_iterator &,
1332 const typename ::Triangulation<1, spacedim>::CellStatus)>
1334 const bool returns_variable_size_data);
1342 const unsigned int handle,
1343 const std::function<
void(
1344 const typename ::Triangulation<1, spacedim>::cell_iterator &,
1345 const typename ::Triangulation<1, spacedim>::CellStatus,
1346 const boost::iterator_range<std::vector<char>::const_iterator> &)>
1353 std::vector<types::global_dof_index>
1355 std::vector<types::global_dof_index>
1356 p4est_tree_to_coarse_cell_permutation;
1370 virtual std::map<unsigned int, std::set<::types::subdomain_id>>
1377 virtual std::map<unsigned int, std::set<::types::subdomain_id>>
1378 compute_level_vertices_with_ghost_neighbors(
1379 const unsigned int level)
const;
1385 virtual std::vector<bool>
1392 #else // DEAL_II_WITH_P4EST 1396 namespace distributed
1409 template <
int dim,
int spacedim = dim>
1426 DEAL_II_NAMESPACE_CLOSE
unsigned int register_data_attach(const std::function< std::vector< char >(const cell_iterator &, const CellStatus)> &pack_callback, const bool returns_variable_size_data)
typename ::internal::p4est::types< dim >::connectivity * connectivity
void load(const std::string &filename, const bool autopartition=true)
void save(const typename ::internal::p4est::types< dim >::forest *parallel_forest, const std::string &filename) const
void unpack_cell_status(std::vector< quadrant_cell_relation_t > &quad_cell_relations) const
std::vector< types::global_dof_index > coarse_cell_to_p4est_tree_permutation
void write_mesh_vtk(const std::string &file_basename) const
std::vector< Point< spacedim > > vertices
void update_quadrant_cell_relations()
bool triangulation_has_content
virtual bool has_hanging_nodes() const override
void pack_data(const std::vector< quadrant_cell_relation_t > &quad_cell_relations, const std::vector< typename CellAttachedData::pack_callback_t > &pack_callbacks_fixed, const std::vector< typename CellAttachedData::pack_callback_t > &pack_callbacks_variable)
typename std::tuple< typename ::internal::p4est::types< dim >::quadrant *, CellStatus, cell_iterator > quadrant_cell_relation_t
MPI_Comm mpi_communicator
void save(const std::string &filename) const
virtual std::size_t memory_consumption_p4est() const
virtual std::size_t memory_consumption() const override
const std::vector< types::global_dof_index > & get_p4est_tree_to_coarse_cell_permutation() const
std::vector< unsigned int > get_cell_weights() const
typename ::internal::p4est::types< dim >::ghost * parallel_ghost
typename ::internal::p4est::types< dim >::forest * parallel_forest
unsigned int n_attached_data_sets
virtual bool prepare_coarsening_and_refinement() override
std::vector< char > src_data_fixed
void load(const typename ::internal::p4est::types< dim >::forest *parallel_forest, const std::string &filename, const unsigned int n_attached_deserialize_fixed, const unsigned int n_attached_deserialize_variable)
const std::vector< types::global_dof_index > & get_coarse_cell_to_p4est_tree_permutation() const
void copy_new_triangulation_to_p4est(std::integral_constant< int, 2 >)
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)
typename ::internal::p4est::types< dim >::tree * init_tree(const int dealii_coarse_cell_index) const
std::vector< pack_callback_t > pack_callbacks_fixed
virtual void update_number_cache() override
std::vector< quadrant_cell_relation_t > local_quadrant_cell_relations
unsigned int n_attached_deserialize
void communicate_locally_moved_vertices(const std::vector< bool > &vertex_locally_moved)
void unpack_data(const std::vector< quadrant_cell_relation_t > &quad_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
bool variable_size_data_stored
virtual ~Triangulation() override
unsigned int get_checksum() const
std::vector< int > src_sizes_variable
MeshSmoothing smooth_grid
void setup_coarse_cell_to_p4est_tree_permutation()
void execute_transfer(const typename ::internal::p4est::types< dim >::forest *parallel_forest, const typename ::internal::p4est::types< dim >::gloidx *previous_global_first_quadrant)
virtual void copy_triangulation(const ::Triangulation< dim, spacedim > &other_tria) override
std::vector< unsigned int > sizes_fixed_cumulative
Triangulation(MPI_Comm mpi_communicator, const typename ::Triangulation< dim, spacedim >::MeshSmoothing smooth_grid=(::Triangulation< dim, spacedim >::none), const Settings settings=default_setting)
virtual void execute_coarsening_and_refinement() override
typename ::Triangulation< dim, spacedim >::cell_iterator cell_iterator
void copy_local_forest_to_triangulation()
virtual void create_triangulation(const std::vector< Point< spacedim >> &vertices, const std::vector< CellData< dim >> &cells, const SubCellData &subcelldata) override
std::vector< bool > mark_locally_active_vertices_on_level(const int level) const
const ::internal::p4est::types< dim >::forest * get_p4est() const
std::vector< types::global_dof_index > coarse_cell_to_p4est_tree_permutation
virtual void clear() override
virtual std::map< unsigned int, std::set<::types::subdomain_id > > compute_vertices_with_ghost_neighbors() const override
virtual void add_periodicity(const std::vector<::GridTools::PeriodicFacePair< cell_iterator >> &) override