deal.II version GIT relicensing-6809-ge913b9bb34 2026-09-25 17:20:01+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\}}\)
Loading...
Searching...
No Matches
tria_description.h
Go to the documentation of this file.
1// -----------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
4// Copyright (C) 2020 - 2026 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Detailed license information governing the source code and contributions
9// can be found in LICENSE.md and CONTRIBUTING.md at the top level directory.
10//
11// -----------------------------------------------------------------------------
12
13#ifndef dealii_grid_tria_description_h
14#define dealii_grid_tria_description_h
15
16#include <deal.II/base/config.h>
17
21
25#include <deal.II/grid/tria.h>
26
27
29#ifndef DOXYGEN
30namespace LinearAlgebra
31{
32 namespace distributed
33 {
34 template <typename Number, typename MemorySpace>
35 class Vector;
36 }
37} // namespace LinearAlgebra
38#endif
39
40/*------------------------------------------------------------------------*/
41
42
58{
76
93 template <int dim>
94 struct CellData
95 {
99 CellData();
100
106 template <class Archive>
107 void
108 serialize(Archive &ar, const unsigned int /*version*/);
109
113 bool
114 operator==(const CellData<dim> &other) const;
115
120
125
130
135
140
146 std::array<types::manifold_id, GeometryInfo<dim>::lines_per_cell>
148
154 std::array<types::manifold_id,
155 dim == 1 ? 1 : GeometryInfo<3>::quads_per_cell>
157
163 ReferenceCells::max_n_faces<dim>()>
165 };
166
167
174 template <int dim, int spacedim = dim>
176 {
180 Description();
181
187 template <class Archive>
188 void
189 serialize(Archive &ar, const unsigned int /*version*/);
190
194 bool
195 operator==(const Description<dim, spacedim> &other) const;
196
200 std::vector<::CellData<dim>> coarse_cells;
201
205 std::vector<Point<spacedim>> coarse_cell_vertices;
206
212 std::vector<types::coarse_cell_id> coarse_cell_index_to_coarse_cell_id;
213
219 std::vector<std::vector<CellData<dim>>> cell_infos;
220
231
236
241 };
242
243
247 namespace Utilities
248 {
335 template <int dim, int spacedim = dim>
338 const ::Triangulation<dim, spacedim> &tria,
339 const MPI_Comm comm,
342 const unsigned int my_rank_in = numbers::invalid_unsigned_int);
343
373 template <int dim, int spacedim>
378 &partition,
381
389 template <int dim, int spacedim>
394 &partition,
395 const std::vector<
397 &mg_partitions,
400
459 template <int dim, int spacedim = dim>
462 const std::function<void(::Triangulation<dim, spacedim> &)>
463 &serial_grid_generator,
464 const std::function<void(::Triangulation<dim, spacedim> &,
465 const MPI_Comm,
466 const unsigned int)> &serial_grid_partitioner,
467 const MPI_Comm comm,
468 const int group_size = 1,
469 const typename Triangulation<dim, spacedim>::MeshSmoothing smoothing =
473
474 } // namespace Utilities
475
476
477
478 template <int dim>
480 : subdomain_id(numbers::invalid_subdomain_id)
481 , level_subdomain_id(numbers::invalid_subdomain_id)
482 , material_id(0)
483 , manifold_id(numbers::flat_manifold_id)
484 {
485 std::fill(id.begin(), id.end(), numbers::invalid_unsigned_int);
486 std::fill(manifold_line_ids.begin(),
487 manifold_line_ids.end(),
489 std::fill(manifold_quad_ids.begin(),
490 manifold_quad_ids.end(),
492 }
493
494
495
496 template <int dim>
497 template <class Archive>
498 void
499 CellData<dim>::serialize(Archive &ar, const unsigned int /*version*/)
500 {
501 ar &id;
502 ar &subdomain_id;
503 ar &level_subdomain_id;
504 ar &material_id;
505 ar &manifold_id;
506 if (dim >= 2)
507 ar &manifold_line_ids;
508 if (dim >= 3)
509 ar &manifold_quad_ids;
510 ar &boundary_ids;
511 }
512
513
514
515 template <int dim, int spacedim>
517 : comm(MPI_COMM_NULL)
518 , settings(Settings::default_setting)
519 , smoothing(Triangulation<dim, spacedim>::MeshSmoothing::none)
520 {}
521
522
523
524 template <int dim, int spacedim>
525 template <class Archive>
526 void
528 const unsigned int /*version*/)
529 {
530 ar &coarse_cells;
533 ar &cell_infos;
534 ar &settings;
535 ar &smoothing;
536 }
537
538
539
540 template <int dim>
541 bool
543 {
544 if (this->id != other.id)
545 return false;
546 if (this->subdomain_id != other.subdomain_id)
547 return false;
548 if (this->level_subdomain_id != other.level_subdomain_id)
549 return false;
550 if (this->material_id != other.material_id)
551 return false;
552 if (this->manifold_id != other.manifold_id)
553 return false;
554 if (dim >= 2 && this->manifold_line_ids != other.manifold_line_ids)
555 return false;
556 if (dim >= 3 && this->manifold_quad_ids != other.manifold_quad_ids)
557 return false;
558 if (this->boundary_ids != other.boundary_ids)
559 return false;
560
561 return true;
562 }
563
564
565
566 template <int dim, int spacedim>
567 bool
569 const Description<dim, spacedim> &other) const
570 {
571 if (this->coarse_cells != other.coarse_cells)
572 return false;
574 return false;
577 return false;
578 if (this->cell_infos != other.cell_infos)
579 return false;
580 if (this->settings != other.settings)
581 return false;
582 if (this->smoothing != other.smoothing)
583 return false;
584
585 return true;
586 }
587} // namespace TriangulationDescription
588
589
591
592#endif
*  iterator end()
*  *  iterator begin()
std::array< std::uint64_t, 3 > binary_type
Definition cell_id.h:71
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:38
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:39
const MPI_Comm comm
Definition mpi.cc:912
Description< dim, spacedim > create_description_from_triangulation(const ::Triangulation< dim, spacedim > &tria, const MPI_Comm comm, const TriangulationDescription::Settings settings=TriangulationDescription::Settings::default_setting, const unsigned int my_rank_in=numbers::invalid_unsigned_int)
Description< dim, spacedim > create_description_from_triangulation_in_groups(const std::function< void(::Triangulation< dim, spacedim > &)> &serial_grid_generator, const std::function< void(::Triangulation< dim, spacedim > &, const MPI_Comm, const unsigned int)> &serial_grid_partitioner, const MPI_Comm comm, const int group_size=1, const typename Triangulation< dim, spacedim >::MeshSmoothing smoothing=::Triangulation< dim, spacedim >::none, const TriangulationDescription::Settings setting=TriangulationDescription::Settings::default_setting)
constexpr unsigned int invalid_unsigned_int
Definition types.h:228
constexpr types::manifold_id flat_manifold_id
Definition types.h:332
unsigned int manifold_id
Definition types.h:171
std::array< types::manifold_id, dim==1 ? 1 :GeometryInfo< 3 >::quads_per_cell > manifold_quad_ids
std::array< types::manifold_id, GeometryInfo< dim >::lines_per_cell > manifold_line_ids
void serialize(Archive &ar, const unsigned int)
std_cxx26::inplace_vector< std::pair< unsigned int, types::boundary_id >, ReferenceCells::max_n_faces< dim >()> boundary_ids
bool operator==(const CellData< dim > &other) const
std::vector< std::vector< CellData< dim > > > cell_infos
Triangulation< dim, spacedim >::MeshSmoothing smoothing
void serialize(Archive &ar, const unsigned int)
std::vector<::CellData< dim > > coarse_cells
bool operator==(const Description< dim, spacedim > &other) const
std::vector< Point< spacedim > > coarse_cell_vertices
std::vector< types::coarse_cell_id > coarse_cell_index_to_coarse_cell_id
std::vector< std::pair< unsigned int, Point< spacedim > > > coarse_cell_vertices
std::vector< types::coarse_cell_id > coarse_cell_index_to_coarse_cell_id
std::vector< std::vector< CellData< dim > > > cell_infos
std::vector<::CellData< dim > > coarse_cells