Loading [MathJax]/extensions/TeX/AMSsymbols.js
 Reference documentation for deal.II version 9.3.3
\(\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\}}\)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
tria_description.h
Go to the documentation of this file.
1// ---------------------------------------------------------------------
2//
3// Copyright (C) 2019 - 2021 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
24#include <deal.II/grid/tria.h>
25
26
28
29/*------------------------------------------------------------------------*/
30
66template <int structdim>
68{
74 std::vector<unsigned int> vertices;
75
83 union
84 {
94
105 };
106
116
124 CellData(
125 const unsigned int n_vertices = GeometryInfo<structdim>::vertices_per_cell);
126
130 bool
131 operator==(const CellData<structdim> &other) const;
132
138 template <class Archive>
139 void
140 serialize(Archive &ar, const unsigned int version);
141
142 static_assert(structdim > 0,
143 "The class CellData can only be used for structdim>0.");
144};
145
146
147
203{
210 std::vector<CellData<1>> boundary_lines;
211
218 std::vector<CellData<2>> boundary_quads;
219
228 bool
229 check_consistency(const unsigned int dim) const;
230};
231
232
233template <int structdim>
234template <class Archive>
235void
236CellData<structdim>::serialize(Archive &ar, const unsigned int /*version*/)
237{
238 ar &vertices;
239 ar &material_id;
240 ar &boundary_id;
241 ar &manifold_id;
242}
243
249{
255 {
266 };
267
280 template <int dim>
281 struct CellData
282 {
288 template <class Archive>
289 void
290 serialize(Archive &ar, const unsigned int /*version*/);
291
295 bool
296 operator==(const CellData<dim> &other) const;
297
302
307
312
317
323 std::array<types::manifold_id, GeometryInfo<dim>::lines_per_cell>
325
331 std::array<types::manifold_id,
332 dim == 1 ? 1 : GeometryInfo<3>::quads_per_cell>
334
339 std::vector<std::pair<unsigned int, types::boundary_id>> boundary_ids;
340 };
341
345 template <int dim, int spacedim>
347 {
353 template <class Archive>
354 void
355 serialize(Archive &ar, const unsigned int /*version*/);
356
360 bool
361 operator==(const Description<dim, spacedim> &other) const;
362
366 std::vector<::CellData<dim>> coarse_cells;
367
371 std::vector<Point<spacedim>> coarse_cell_vertices;
372
378 std::vector<types::coarse_cell_id> coarse_cell_index_to_coarse_cell_id;
379
385 std::vector<std::vector<CellData<dim>>> cell_infos;
386
397
402
407 };
408
409
415 namespace Utilities
416 {
440 template <int dim, int spacedim = dim>
443 const ::Triangulation<dim, spacedim> &tria,
444 const MPI_Comm & comm,
447 const unsigned int my_rank_in = numbers::invalid_unsigned_int);
448
449
478 template <int dim, int spacedim = dim>
481 const std::function<void(::Triangulation<dim, spacedim> &)>
482 & serial_grid_generator,
483 const std::function<void(::Triangulation<dim, spacedim> &,
484 const MPI_Comm &,
485 const unsigned int)> &serial_grid_partitioner,
486 const MPI_Comm & comm,
487 const int group_size = 1,
488 const typename Triangulation<dim, spacedim>::MeshSmoothing smoothing =
492
493 } // namespace Utilities
494
495
496
497 template <int dim>
498 template <class Archive>
499 void
500 CellData<dim>::serialize(Archive &ar, const unsigned int /*version*/)
501 {
502 ar &id;
503 ar &subdomain_id;
504 ar &level_subdomain_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 template <int dim, int spacedim>
515 template <class Archive>
516 void
518 const unsigned int /*version*/)
519 {
520 ar &coarse_cells;
521 ar &coarse_cell_vertices;
522 ar &coarse_cell_index_to_coarse_cell_id;
523 ar &cell_infos;
524 ar &settings;
525 ar &smoothing;
526 }
527
528
529
530 template <int dim>
531 bool
533 {
534 if (this->id != other.id)
535 return false;
536 if (this->subdomain_id != other.subdomain_id)
537 return false;
538 if (this->level_subdomain_id != other.level_subdomain_id)
539 return false;
540 if (this->manifold_id != other.manifold_id)
541 return false;
542 if (dim >= 2 && this->manifold_line_ids != other.manifold_line_ids)
543 return false;
544 if (dim >= 3 && this->manifold_quad_ids != other.manifold_quad_ids)
545 return false;
546 if (this->boundary_ids != other.boundary_ids)
547 return false;
548
549 return true;
550 }
551
552
553
554 template <int dim, int spacedim>
555 bool
557 operator==(const Description<dim, spacedim> &other) const
558 {
559 if (this->coarse_cells != other.coarse_cells)
560 return false;
561 if (this->coarse_cell_vertices != other.coarse_cell_vertices)
562 return false;
563 if (this->coarse_cell_index_to_coarse_cell_id !=
565 return false;
566 if (this->cell_infos != other.cell_infos)
567 return false;
568 if (this->settings != other.settings)
569 return false;
570 if (this->smoothing != other.smoothing)
571 return false;
572
573 return true;
574 }
575} // namespace TriangulationDescription
576
577
579
580#endif
std::array< unsigned int, 4 > binary_type
Definition: cell_id.h:80
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:402
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:403
Point< 3 > vertices[4]
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)
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)
static const unsigned int invalid_unsigned_int
Definition: types.h:196
unsigned int manifold_id
Definition: types.h:141
unsigned int subdomain_id
Definition: types.h:43
unsigned int material_id
Definition: types.h:152
unsigned int boundary_id
Definition: types.h:129
*braid_SplitCommworld & comm
std::vector< unsigned int > vertices
bool operator==(const CellData< structdim > &other) const
types::manifold_id manifold_id
CellData(const unsigned int n_vertices=GeometryInfo< structdim >::vertices_per_cell)
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