Reference documentation for deal.II version 9.2.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\}}\)
tria_description.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2019 - 2020 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_grid_construction_utilities_h
17 #define dealii_grid_construction_utilities_h
18 
19 #include <deal.II/base/config.h>
20 
21 #include <deal.II/base/mpi.h>
22 
23 #include <deal.II/grid/cell_id.h>
24 #include <deal.II/grid/tria.h>
25 
26 
28 
29 /*------------------------------------------------------------------------*/
30 
66 template <int structdim>
67 struct CellData
68 {
75 
83  union
84  {
94 
105  };
106 
116 
124  CellData();
125 
129  bool
130  operator==(const CellData<structdim> &other) const;
131 
135  template <class Archive>
136  void
137  serialize(Archive &ar, const unsigned int version);
138 
139  static_assert(structdim > 0,
140  "The class CellData can only be used for structdim>0.");
141 };
142 
143 
144 
200 {
207  std::vector<CellData<1>> boundary_lines;
208 
215  std::vector<CellData<2>> boundary_quads;
216 
225  bool
226  check_consistency(const unsigned int dim) const;
227 };
228 
229 
230 template <int structdim>
231 template <class Archive>
232 void
233 CellData<structdim>::serialize(Archive &ar, const unsigned int /*version*/)
234 {
235  ar &vertices;
236  ar &material_id;
237  ar &boundary_id;
238  ar &manifold_id;
239 }
240 
246 {
253  enum Settings
254  {
265  };
266 
281  template <int dim>
282  struct CellData
283  {
287  template <class Archive>
288  void
289  serialize(Archive &ar, const unsigned int /*version*/);
290 
294  bool
295  operator==(const CellData<dim> &other) const;
296 
301 
306 
311 
316 
322  std::array<types::manifold_id, GeometryInfo<dim>::lines_per_cell>
324 
330  std::array<types::manifold_id,
331  dim == 1 ? 1 : GeometryInfo<3>::quads_per_cell>
333 
338  std::vector<std::pair<unsigned int, types::boundary_id>> boundary_ids;
339  };
340 
346  template <int dim, int spacedim>
347  struct Description
348  {
352  template <class Archive>
353  void
354  serialize(Archive &ar, const unsigned int /*version*/);
355 
359  bool
360  operator==(const Description<dim, spacedim> &other) const;
361 
365  std::vector<::CellData<dim>> coarse_cells;
366 
370  std::vector<Point<spacedim>> coarse_cell_vertices;
371 
377  std::vector<types::coarse_cell_id> coarse_cell_index_to_coarse_cell_id;
378 
384  std::vector<std::vector<CellData<dim>>> cell_infos;
385 
397 
402 
407  };
408 
409 
415  namespace Utilities
416  {
442  template <int dim, int spacedim = dim>
445  const ::Triangulation<dim, spacedim> &tria,
446  const MPI_Comm comm,
447  const TriangulationDescription::Settings settings =
449  const unsigned int my_rank_in = numbers::invalid_unsigned_int);
450 
451 
482  template <int dim, int spacedim = dim>
485  const std::function<void(::Triangulation<dim, spacedim> &)>
486  & serial_grid_generator,
487  const std::function<void(::Triangulation<dim, spacedim> &,
488  const MPI_Comm,
489  const unsigned int)> &serial_grid_partitioner,
490  const MPI_Comm comm,
491  const int group_size = 1,
492  const typename Triangulation<dim, spacedim>::MeshSmoothing smoothing =
494  const TriangulationDescription::Settings setting =
496 
497  } // namespace Utilities
498 
499 
500 
501  template <int dim>
502  template <class Archive>
503  void
504  CellData<dim>::serialize(Archive &ar, const unsigned int /*version*/)
505  {
506  ar &id;
507  ar &subdomain_id;
508  ar &level_subdomain_id;
509  ar &manifold_id;
510  if (dim >= 2)
511  ar &manifold_line_ids;
512  if (dim >= 3)
513  ar &manifold_quad_ids;
514  ar &boundary_ids;
515  }
516 
517 
518  template <int dim, int spacedim>
519  template <class Archive>
520  void
522  const unsigned int /*version*/)
523  {
524  ar &coarse_cells;
525  ar &coarse_cell_vertices;
526  ar &coarse_cell_index_to_coarse_cell_id;
527  ar &cell_infos;
528  ar &settings;
529  ar &smoothing;
530  }
531 
532 
533 
534  template <int dim>
535  bool
537  {
538  if (this->id != other.id)
539  return false;
540  if (this->subdomain_id != other.subdomain_id)
541  return false;
542  if (this->level_subdomain_id != other.level_subdomain_id)
543  return false;
544  if (this->manifold_id != other.manifold_id)
545  return false;
546  if (dim >= 2 && this->manifold_line_ids != other.manifold_line_ids)
547  return false;
548  if (dim >= 3 && this->manifold_quad_ids != other.manifold_quad_ids)
549  return false;
550  if (this->boundary_ids != other.boundary_ids)
551  return false;
552 
553  return true;
554  }
555 
556 
557 
558  template <int dim, int spacedim>
559  bool
562  {
563  if (this->coarse_cells != other.coarse_cells)
564  return false;
565  if (this->coarse_cell_vertices != other.coarse_cell_vertices)
566  return false;
567  if (this->coarse_cell_index_to_coarse_cell_id !=
569  return false;
570  if (this->cell_infos != other.cell_infos)
571  return false;
572  if (this->settings != other.settings)
573  return false;
574  if (this->smoothing != other.smoothing)
575  return false;
576 
577  return true;
578  }
579 } // namespace TriangulationDescription
580 
581 
583 
584 #endif
TriangulationDescription::Description::serialize
void serialize(Archive &ar, const unsigned int)
Definition: tria_description.h:521
TriangulationDescription::default_setting
@ default_setting
Definition: tria_description.h:258
TriangulationDescription::Description::cell_infos
std::vector< std::vector< CellData< dim > > > cell_infos
Definition: tria_description.h:384
TriangulationDescription::Description::comm
MPI_Comm comm
Definition: tria_description.h:396
SubCellData::boundary_quads
std::vector< CellData< 2 > > boundary_quads
Definition: tria_description.h:215
CellData::CellData
CellData()
Definition: tria.cc:48
CellData
Definition: tria_description.h:67
Triangulation
Definition: tria.h:1109
tria.h
CellData::serialize
void serialize(Archive &ar, const unsigned int version)
Definition: tria_description.h:233
TriangulationDescription::CellData::operator==
bool operator==(const CellData< dim > &other) const
Definition: tria_description.h:536
cell_id.h
GeometryInfo
Definition: geometry_info.h:1224
MPI_Comm
types::boundary_id
unsigned int boundary_id
Definition: types.h:129
CellData::vertices
unsigned int vertices[GeometryInfo< structdim >::vertices_per_cell]
Definition: tria_description.h:74
TriangulationDescription::Description::operator==
bool operator==(const Description< dim, spacedim > &other) const
Definition: tria_description.h:561
TriangulationDescription::Description::coarse_cell_index_to_coarse_cell_id
std::vector< types::coarse_cell_id > coarse_cell_index_to_coarse_cell_id
Definition: tria_description.h:377
types::material_id
unsigned int material_id
Definition: types.h:152
mpi.h
TriangulationDescription::Description::coarse_cell_vertices
std::vector< Point< spacedim > > coarse_cell_vertices
Definition: tria_description.h:370
TriangulationDescription::Utilities::create_description_from_triangulation
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)
Definition: tria_description.cc:104
DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
CellData::boundary_id
types::boundary_id boundary_id
Definition: tria_description.h:104
TriangulationDescription::CellData::manifold_id
types::manifold_id manifold_id
Definition: tria_description.h:315
TriangulationDescription::CellData::serialize
void serialize(Archive &ar, const unsigned int)
Definition: tria_description.h:504
TriangulationDescription::CellData::level_subdomain_id
types::subdomain_id level_subdomain_id
Definition: tria_description.h:310
TriangulationDescription::CellData
Definition: tria_description.h:282
TriangulationDescription::Description::smoothing
Triangulation< dim, spacedim >::MeshSmoothing smoothing
Definition: tria_description.h:406
TriangulationDescription
Definition: tria_description.h:245
TriangulationDescription::CellData::subdomain_id
types::subdomain_id subdomain_id
Definition: tria_description.h:305
types::subdomain_id
unsigned int subdomain_id
Definition: types.h:43
types::manifold_id
unsigned int manifold_id
Definition: types.h:141
unsigned int
vertices
Point< 3 > vertices[4]
Definition: data_out_base.cc:174
TriangulationDescription::CellData::boundary_ids
std::vector< std::pair< unsigned int, types::boundary_id > > boundary_ids
Definition: tria_description.h:338
TriangulationDescription::Description::settings
Settings settings
Definition: tria_description.h:401
SubCellData::check_consistency
bool check_consistency(const unsigned int dim) const
Definition: tria.cc:82
Triangulation::MeshSmoothing
MeshSmoothing
Definition: tria.h:1124
numbers::invalid_unsigned_int
static const unsigned int invalid_unsigned_int
Definition: types.h:191
CellId::binary_type
std::array< unsigned int, 4 > binary_type
Definition: cell_id.h:79
config.h
TriangulationDescription::Utilities::create_description_from_triangulation_in_groups
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)
Definition: tria_description.cc:403
SubCellData::boundary_lines
std::vector< CellData< 1 > > boundary_lines
Definition: tria_description.h:207
TriangulationDescription::Description
Definition: tria_description.h:347
SubCellData
Definition: tria_description.h:199
TriangulationDescription::Settings
Settings
Definition: tria_description.h:253
CellData::material_id
types::material_id material_id
Definition: tria_description.h:93
DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359
TriangulationDescription::CellData::manifold_quad_ids
std::array< types::manifold_id, dim==1 ? 1 :GeometryInfo< 3 >::quads_per_cell > manifold_quad_ids
Definition: tria_description.h:332
TriangulationDescription::CellData::id
CellId::binary_type id
Definition: tria_description.h:300
TriangulationDescription::Description::coarse_cells
std::vector<::CellData< dim > > coarse_cells
Definition: tria_description.h:365
Utilities
Definition: cuda.h:31
CellData::operator==
bool operator==(const CellData< structdim > &other) const
Definition: tria.cc:61
TriangulationDescription::construct_multigrid_hierarchy
@ construct_multigrid_hierarchy
Definition: tria_description.h:264
TriangulationDescription::CellData::manifold_line_ids
std::array< types::manifold_id, GeometryInfo< dim >::lines_per_cell > manifold_line_ids
Definition: tria_description.h:323
CellData::manifold_id
types::manifold_id manifold_id
Definition: tria_description.h:115