Reference documentation for deal.II version Git 3d170a2f6b 2020-04-03 17:03:45 -0400
\(\newcommand{\vcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\vcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
tria_description.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2019 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 
27 DEAL_II_NAMESPACE_OPEN
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 
376  std::vector<types::coarse_cell_id> coarse_cell_index_to_coarse_cell_id;
377 
383  std::vector<std::vector<CellData<dim>>> cell_infos;
384 
395  MPI_Comm comm;
396 
401  };
402 
403 
409  namespace Utilities
410  {
441  template <int dim, int spacedim = dim>
444  const ::Triangulation<dim, spacedim> &tria,
445  const MPI_Comm comm,
446  const bool construct_multilevel_hierarchy = false,
447  const unsigned int my_rank_in = numbers::invalid_unsigned_int);
448 
449 
475  template <int dim, int spacedim = dim>
478  const std::function<void(::Triangulation<dim, spacedim> &)>
479  & serial_grid_generator,
480  const std::function<void(::Triangulation<dim, spacedim> &,
481  const MPI_Comm,
482  const unsigned int)> &serial_grid_partitioner,
483  const MPI_Comm comm,
484  const int group_size = 1,
485  const bool construct_multilevel_hierarchy = false);
486 
487  } // namespace Utilities
488 
489 
490 
491  template <int dim>
492  template <class Archive>
493  void
494  CellData<dim>::serialize(Archive &ar, const unsigned int /*version*/)
495  {
496  ar &id;
497  ar &subdomain_id;
498  ar &level_subdomain_id;
499  ar &manifold_id;
500  if (dim >= 2)
501  ar &manifold_line_ids;
502  if (dim >= 3)
503  ar &manifold_quad_ids;
504  ar &boundary_ids;
505  }
506 
507 
508  template <int dim, int spacedim>
509  template <class Archive>
510  void
512  const unsigned int /*version*/)
513  {
514  ar &coarse_cells;
515  ar &coarse_cell_vertices;
516  ar &coarse_cell_index_to_coarse_cell_id;
517  ar &cell_infos;
518  ar &settings;
519  }
520 
521 
522 
523  template <int dim>
524  bool
526  {
527  if (this->id != other.id)
528  return false;
529  if (this->subdomain_id != other.subdomain_id)
530  return false;
531  if (this->level_subdomain_id != other.level_subdomain_id)
532  return false;
533  if (this->manifold_id != other.manifold_id)
534  return false;
535  if (dim >= 2 && this->manifold_line_ids != other.manifold_line_ids)
536  return false;
537  if (dim >= 3 && this->manifold_quad_ids != other.manifold_quad_ids)
538  return false;
539  if (this->boundary_ids != other.boundary_ids)
540  return false;
541 
542  return true;
543  }
544 
545 
546 
547  template <int dim, int spacedim>
548  bool
551  {
552  if (this->coarse_cells != other.coarse_cells)
553  return false;
554  if (this->coarse_cell_vertices != other.coarse_cell_vertices)
555  return false;
556  if (this->coarse_cell_index_to_coarse_cell_id !=
558  return false;
559  if (this->cell_infos != other.cell_infos)
560  return false;
561  if (this->settings != other.settings)
562  return false;
563 
564  return true;
565  }
566 } // namespace TriangulationDescription
567 
568 
569 DEAL_II_NAMESPACE_CLOSE
570 
571 #endif
std::vector< CellData< 1 > > boundary_lines
static const unsigned int invalid_unsigned_int
Definition: types.h:190
unsigned int manifold_id
Definition: types.h:140
std::vector<::CellData< dim > > coarse_cells
std::vector< std::pair< unsigned int, types::boundary_id > > boundary_ids
bool operator==(const CellData< structdim > &other) const
Definition: tria.cc:61
std::vector< types::coarse_cell_id > coarse_cell_index_to_coarse_cell_id
unsigned int material_id
Definition: types.h:151
std::array< types::manifold_id, GeometryInfo< dim >::lines_per_cell > manifold_line_ids
types::boundary_id boundary_id
std::array< unsigned int, 4 > binary_type
Definition: cell_id.h:78
std::array< types::manifold_id, dim==1 ? 1 :GeometryInfo< 3 >::quads_per_cell > manifold_quad_ids
unsigned int subdomain_id
Definition: types.h:44
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 bool construct_multilevel_hierarchy=false)
CellData()
Definition: tria.cc:48
types::material_id material_id
types::manifold_id manifold_id
Definition: cuda.h:31
Description< dim, spacedim > create_description_from_triangulation(const ::Triangulation< dim, spacedim > &tria, const MPI_Comm comm, const bool construct_multilevel_hierarchy=false, const unsigned int my_rank_in=numbers::invalid_unsigned_int)
std::vector< std::vector< CellData< dim > > > cell_infos
std::vector< CellData< 2 > > boundary_quads
unsigned int boundary_id
Definition: types.h:128
std::vector< Point< spacedim > > coarse_cell_vertices
void serialize(Archive &ar, const unsigned int version)
unsigned int vertices[GeometryInfo< structdim >::vertices_per_cell]