deal.II version GIT relicensing-2287-g6548a49e0a 2024-12-20 18:30:00+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: LGPL-2.1-or-later
4// Copyright (C) 2020 - 2024 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Part of the source code is dual licensed under Apache-2.0 WITH
9// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10// governing the source code and code contributions can be found in
11// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12//
13// ------------------------------------------------------------------------
14
15#ifndef dealii_grid_construction_utilities_h
16#define dealii_grid_construction_utilities_h
17
18#include <deal.II/base/config.h>
19
22
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
77template <int structdim>
79{
99 std::vector<unsigned int> vertices;
100
108 union
109 {
119
130 };
131
141
159 CellData(const unsigned int n_vertices =
160 ReferenceCells::get_hypercube<structdim>().n_vertices());
161
165 bool
166 operator==(const CellData<structdim> &other) const;
167
173 template <class Archive>
174 void
175 serialize(Archive &ar, const unsigned int version);
176
177 static_assert(structdim > 0,
178 "The class CellData can only be used for structdim>0.");
179};
180
181
182
238{
246 std::vector<CellData<1>> boundary_lines;
247
262 std::vector<CellData<2>> boundary_quads;
263
272 bool
273 check_consistency(const unsigned int dim) const;
274};
275
276
277template <int structdim>
278template <class Archive>
279void
280CellData<structdim>::serialize(Archive &ar, const unsigned int /*version*/)
281{
282 ar &vertices;
283 ar &material_id;
284 ar &boundary_id;
285 ar &manifold_id;
286}
287
303{
321
338 template <int dim>
339 struct CellData
340 {
344 CellData();
345
351 template <class Archive>
352 void
353 serialize(Archive &ar, const unsigned int /*version*/);
354
358 bool
359 operator==(const CellData<dim> &other) const;
360
365
370
375
380
386 std::array<types::manifold_id, GeometryInfo<dim>::lines_per_cell>
388
394 std::array<types::manifold_id,
395 dim == 1 ? 1 : GeometryInfo<3>::quads_per_cell>
397
402 std::vector<std::pair<unsigned int, types::boundary_id>> boundary_ids;
403 };
404
405
412 template <int dim, int spacedim = dim>
414 {
418 Description();
419
425 template <class Archive>
426 void
427 serialize(Archive &ar, const unsigned int /*version*/);
428
432 bool
433 operator==(const Description<dim, spacedim> &other) const;
434
438 std::vector<::CellData<dim>> coarse_cells;
439
443 std::vector<Point<spacedim>> coarse_cell_vertices;
444
450 std::vector<types::coarse_cell_id> coarse_cell_index_to_coarse_cell_id;
451
457 std::vector<std::vector<CellData<dim>>> cell_infos;
458
469
474
479 };
480
481
485 namespace Utilities
486 {
573 template <int dim, int spacedim = dim>
576 const ::Triangulation<dim, spacedim> &tria,
577 const MPI_Comm comm,
580 const unsigned int my_rank_in = numbers::invalid_unsigned_int);
581
611 template <int dim, int spacedim>
616 &partition,
619
627 template <int dim, int spacedim>
632 &partition,
633 const std::vector<
635 &mg_partitions,
638
696 template <int dim, int spacedim = dim>
699 const std::function<void(::Triangulation<dim, spacedim> &)>
700 &serial_grid_generator,
701 const std::function<void(::Triangulation<dim, spacedim> &,
702 const MPI_Comm,
703 const unsigned int)> &serial_grid_partitioner,
704 const MPI_Comm comm,
705 const int group_size = 1,
706 const typename Triangulation<dim, spacedim>::MeshSmoothing smoothing =
710
711 } // namespace Utilities
712
713
714
715 template <int dim>
717 : subdomain_id(numbers::invalid_subdomain_id)
718 , level_subdomain_id(numbers::invalid_subdomain_id)
719 , manifold_id(numbers::flat_manifold_id)
720 {
721 std::fill(id.begin(), id.end(), numbers::invalid_unsigned_int);
722 std::fill(manifold_line_ids.begin(),
723 manifold_line_ids.end(),
725 std::fill(manifold_quad_ids.begin(),
726 manifold_quad_ids.end(),
728 }
729
730
731
732 template <int dim>
733 template <class Archive>
734 void
735 CellData<dim>::serialize(Archive &ar, const unsigned int /*version*/)
736 {
737 ar &id;
738 ar &subdomain_id;
739 ar &level_subdomain_id;
740 ar &manifold_id;
741 if (dim >= 2)
742 ar &manifold_line_ids;
743 if (dim >= 3)
744 ar &manifold_quad_ids;
745 ar &boundary_ids;
746 }
747
748
749
750 template <int dim, int spacedim>
752 : comm(MPI_COMM_NULL)
753 , settings(Settings::default_setting)
754 , smoothing(Triangulation<dim, spacedim>::MeshSmoothing::none)
755 {}
756
757
758
759 template <int dim, int spacedim>
760 template <class Archive>
761 void
763 const unsigned int /*version*/)
764 {
765 ar &coarse_cells;
768 ar &cell_infos;
769 ar &settings;
770 ar &smoothing;
771 }
772
773
774
775 template <int dim>
776 bool
778 {
779 if (this->id != other.id)
780 return false;
781 if (this->subdomain_id != other.subdomain_id)
782 return false;
783 if (this->level_subdomain_id != other.level_subdomain_id)
784 return false;
785 if (this->manifold_id != other.manifold_id)
786 return false;
787 if (dim >= 2 && this->manifold_line_ids != other.manifold_line_ids)
788 return false;
789 if (dim >= 3 && this->manifold_quad_ids != other.manifold_quad_ids)
790 return false;
791 if (this->boundary_ids != other.boundary_ids)
792 return false;
793
794 return true;
795 }
796
797
798
799 template <int dim, int spacedim>
800 bool
802 const Description<dim, spacedim> &other) const
803 {
804 if (this->coarse_cells != other.coarse_cells)
805 return false;
807 return false;
810 return false;
811 if (this->cell_infos != other.cell_infos)
812 return false;
813 if (this->settings != other.settings)
814 return false;
815 if (this->smoothing != other.smoothing)
816 return false;
817
818 return true;
819 }
820} // namespace TriangulationDescription
821
822
824
825#endif
std::array< unsigned int, 4 > binary_type
Definition cell_id.h:80
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:498
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:499
const MPI_Comm comm
Definition mpi.cc:913
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)
static const unsigned int invalid_unsigned_int
Definition types.h:220
const types::manifold_id flat_manifold_id
Definition types.h:325
unsigned int manifold_id
Definition types.h:156
std::vector< unsigned int > vertices
bool operator==(const CellData< structdim > &other) const
types::manifold_id manifold_id
types::material_id material_id
types::boundary_id boundary_id
void serialize(Archive &ar, const unsigned int version)
std::vector< CellData< 2 > > boundary_quads
bool check_consistency(const unsigned int dim) const
std::vector< CellData< 1 > > boundary_lines
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::vector< std::pair< unsigned int, types::boundary_id > > 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