Reference documentation for deal.II version 9.0.0
shared_tria.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2008 - 2018 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 at
12 // the top level of the deal.II distribution.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii_distributed_shared_tria_h
17 #define dealii_distributed_shared_tria_h
18 
19 
20 #include <deal.II/base/config.h>
21 #include <deal.II/base/subscriptor.h>
22 #include <deal.II/base/smartpointer.h>
23 #include <deal.II/base/template_constraints.h>
24 #include <deal.II/grid/tria.h>
25 
26 #include <deal.II/distributed/tria_base.h>
27 
28 
29 #include <tuple>
30 #include <functional>
31 #include <set>
32 #include <vector>
33 #include <list>
34 #include <utility>
35 
36 #ifdef DEAL_II_WITH_MPI
37 # include <mpi.h>
38 #endif
39 
40 
41 DEAL_II_NAMESPACE_OPEN
42 
43 namespace parallel
44 {
45 
46 #ifdef DEAL_II_WITH_MPI
47 
48 
49  namespace shared
50  {
51 
102  template <int dim, int spacedim = dim>
103  class Triangulation : public ::parallel::Triangulation<dim,spacedim>
104  {
105  public:
106  typedef typename ::Triangulation<dim,spacedim>::active_cell_iterator active_cell_iterator;
107  typedef typename ::Triangulation<dim,spacedim>::cell_iterator cell_iterator;
108 
122  enum Settings
123  {
134 
139 
158 
163 
214 
223  };
224 
225 
236  const typename ::Triangulation<dim,spacedim>::MeshSmoothing =
238  const bool allow_artificial_cells = false,
240 
244  virtual ~Triangulation () = default;
245 
254  virtual void execute_coarsening_and_refinement ();
255 
262  virtual void create_triangulation (const std::vector< Point< spacedim > > &vertices,
263  const std::vector< CellData< dim > > &cells,
264  const SubCellData &subcelldata);
265 
276  virtual void copy_triangulation (const ::Triangulation<dim, spacedim> &other_tria);
277 
286  template <class Archive>
287  void load (Archive &ar, const unsigned int version);
288 
297  const std::vector<types::subdomain_id> &get_true_subdomain_ids_of_cells() const;
298 
307  const std::vector<types::subdomain_id> &get_true_level_subdomain_ids_of_cells(const unsigned int level) const;
308 
313  bool with_artificial_cells() const;
314 
315  protected:
316 
321  virtual void update_number_cache ();
322 
323  private:
324 
329 
334 
339  void partition();
340 
353  std::vector<types::subdomain_id> true_subdomain_ids_of_cells;
354 
363  std::vector<std::vector<types::subdomain_id>> true_level_subdomain_ids_of_cells;
364  };
365 
366  template <int dim, int spacedim>
367  template <class Archive>
368  void
370  const unsigned int version)
371  {
373  partition();
374  this->update_number_cache ();
375  }
376  }
377 #else
378 
379  namespace shared
380  {
381 
393  template <int dim, int spacedim = dim>
394  class Triangulation : public ::parallel::Triangulation<dim,spacedim>
395  {
396  public:
401  Triangulation () = delete;
402 
406  const std::vector<types::subdomain_id> &get_true_subdomain_ids_of_cells() const;
407 
411  const std::vector<types::subdomain_id> &get_true_level_subdomain_ids_of_cells(const unsigned int level) const;
412 
416  bool with_artificial_cells() const;
417 
418  private:
422  std::vector<types::subdomain_id> true_subdomain_ids_of_cells;
423 
427  std::vector<types::subdomain_id> true_level_subdomain_ids_of_cells;
428  };
429  }
430 
431 
432 #endif
433 }
434 
435 DEAL_II_NAMESPACE_CLOSE
436 
437 #endif
virtual void execute_coarsening_and_refinement()
Definition: shared_tria.cc:296
std::vector< std::vector< types::subdomain_id > > true_level_subdomain_ids_of_cells
Definition: shared_tria.h:363
std::vector< Point< spacedim > > vertices
Definition: tria.h:3587
const std::vector< types::subdomain_id > & get_true_subdomain_ids_of_cells() const
Definition: shared_tria.cc:278
Triangulation(MPI_Comm mpi_communicator, const typename ::Triangulation< dim, spacedim >::MeshSmoothing=(::Triangulation< dim, spacedim >::none), const bool allow_artificial_cells=false, const Settings settings=partition_auto)
Definition: shared_tria.cc:37
virtual void create_triangulation(const std::vector< Point< spacedim > > &vertices, const std::vector< CellData< dim > > &cells, const SubCellData &subcelldata)
Definition: shared_tria.cc:307
const std::vector< types::subdomain_id > & get_true_level_subdomain_ids_of_cells(const unsigned int level) const
Definition: shared_tria.cc:287
virtual void copy_triangulation(const ::Triangulation< dim, spacedim > &other_tria)
Definition: shared_tria.cc:331
void load(Archive &ar, const unsigned int version)
std::vector< types::subdomain_id > true_subdomain_ids_of_cells
Definition: shared_tria.h:353
void load(Archive &ar, const unsigned int version)
Definition: shared_tria.h:369
virtual ~Triangulation()=default