17 #include <deal.II/base/utilities.h> 18 #include <deal.II/base/mpi.h> 19 #include <deal.II/grid/tria.h> 20 #include <deal.II/grid/tria_accessor.h> 21 #include <deal.II/grid/tria_iterator.h> 22 #include <deal.II/grid/grid_tools.h> 23 #include <deal.II/grid/filtered_iterator.h> 24 #include <deal.II/distributed/shared_tria.h> 25 #include <deal.II/distributed/tria.h> 28 DEAL_II_NAMESPACE_OPEN
30 #ifdef DEAL_II_WITH_MPI 36 template <
int dim,
int spacedim>
38 const typename ::Triangulation<dim,spacedim>::MeshSmoothing smooth_grid,
39 const bool allow_artificial_cells):
41 allow_artificial_cells(allow_artificial_cells)
46 template <
int dim,
int spacedim>
49 ::GridTools::partition_triangulation (this->n_subdomains, *
this);
51 true_subdomain_ids_of_cells.resize(this->n_active_cells());
54 typename parallel::shared::Triangulation<dim,spacedim>::active_cell_iterator
55 cell = this->begin_active(),
58 if (allow_artificial_cells)
62 std_cxx11::function<bool (const typename parallel::shared::Triangulation<dim,spacedim>::active_cell_iterator &)> predicate
65 const std::vector<typename parallel::shared::Triangulation<dim,spacedim>::active_cell_iterator>
67 std::set<typename parallel::shared::Triangulation<dim,spacedim>::active_cell_iterator>
68 active_halo_layer(active_halo_layer_vector.begin(), active_halo_layer_vector.end());
70 for (
unsigned int index=0; cell != endc; cell++, index++)
73 true_subdomain_ids_of_cells[index] = cell->subdomain_id();
75 if (cell->is_locally_owned() ==
false &&
76 active_halo_layer.find(cell) == active_halo_layer.
end())
83 for (
unsigned int index=0; cell != endc; cell++, index++)
84 true_subdomain_ids_of_cells[index] = cell->subdomain_id();
91 template <
int dim,
int spacedim>
95 return allow_artificial_cells;
100 template <
int dim,
int spacedim>
101 const std::vector<types::subdomain_id> &
104 return true_subdomain_ids_of_cells;
109 template <
int dim,
int spacedim>
115 template <
int dim,
int spacedim>
121 this->update_number_cache ();
126 template <
int dim,
int spacedim>
137 catch (
const typename ::Triangulation<dim,spacedim>::DistortedCellList &)
144 this->update_number_cache ();
149 template <
int dim,
int spacedim>
154 Assert ((
dynamic_cast<const ::parallel::distributed::Triangulation<dim,spacedim> *
>(&other_tria) == NULL),
155 ExcMessage(
"Cannot use this function on parallel::distributed::Triangulation."));
159 this->update_number_cache ();
171 template <
int dim,
int spacedim>
181 template <
int dim,
int spacedim>
191 template <
int dim,
int spacedim>
192 const std::vector<unsigned int> &
196 return true_subdomain_ids_of_cells;
207 #include "shared_tria.inst" 209 DEAL_II_NAMESPACE_CLOSE
virtual void execute_coarsening_and_refinement()
Triangulation(MPI_Comm mpi_communicator, const typename ::Triangulation< dim, spacedim >::MeshSmoothing=(::Triangulation< dim, spacedim >::none), const bool allow_artificial_cells=false)
virtual void copy_triangulation(const ::Triangulation< dim, spacedim > &old_tria)
const std::vector< types::subdomain_id > & get_true_subdomain_ids_of_cells() const
virtual void create_triangulation(const std::vector< Point< spacedim > > &vertices, const std::vector< CellData< dim > > &cells, const SubCellData &subcelldata)
cell_iterator end() const
virtual void execute_coarsening_and_refinement()
static ::ExceptionBase & ExcMessage(std::string arg1)
virtual void copy_triangulation(const ::Triangulation< dim, spacedim > &other_tria)
#define Assert(cond, exc)
virtual void create_triangulation(const std::vector< Point< spacedim > > &vertices, const std::vector< CellData< dim > > &cells, const SubCellData &subcelldata)
const types::subdomain_id artificial_subdomain_id
bool with_artificial_cells() const
static ::ExceptionBase & ExcNotImplemented()
static ::ExceptionBase & ExcInternalError()