/usr/include/deal.II/distributed/shared_tria.h is in libdeal.ii-dev 8.5.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | // ---------------------------------------------------------------------
// $Id: tria.h 32739 2014-04-08 16:39:47Z denis.davydov $
//
// Copyright (C) 2008 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
// The deal.II library is free software; you can use it, redistribute
// it, and/or modify it under the terms of the GNU Lesser General
// Public License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// The full text of the license can be found in the file LICENSE at
// the top level of the deal.II distribution.
//
// ---------------------------------------------------------------------
#ifndef dealii__distributed__shared_tria_h
#define dealii__distributed__shared_tria_h
#include <deal.II/base/config.h>
#include <deal.II/base/subscriptor.h>
#include <deal.II/base/smartpointer.h>
#include <deal.II/base/template_constraints.h>
#include <deal.II/grid/tria.h>
#include <deal.II/distributed/tria_base.h>
#include <deal.II/base/std_cxx1x/function.h>
#include <deal.II/base/std_cxx1x/tuple.h>
#include <set>
#include <vector>
#include <list>
#include <utility>
#ifdef DEAL_II_WITH_MPI
# include <mpi.h>
#endif
DEAL_II_NAMESPACE_OPEN
namespace parallel
{
#ifdef DEAL_II_WITH_MPI
namespace shared
{
/**
* This is an extension of dealii::Triangulation class to automatically
* partition triangulation when run with MPI. Different from the
* parallel::distributed::Triangulation, the entire mesh is stored on each
* processor. However, cells are labeled according to the id of the
* processor which "owns" them. The partitioning is done automatically
* inside the DoFHandler by calling Metis. This enables distributing DoFs
* among processors and therefore splitting matrices and vectors across
* processors. The usage of this class is demonstrated in Step-18.
*
* @author Denis Davydov, 2015
* @ingroup distributed
*
*/
template <int dim, int spacedim = dim>
class Triangulation : public dealii::parallel::Triangulation<dim,spacedim>
{
public:
typedef typename dealii::Triangulation<dim,spacedim>::active_cell_iterator active_cell_iterator;
typedef typename dealii::Triangulation<dim,spacedim>::cell_iterator cell_iterator;
/**
* Constructor.
*
* If @p allow_aritifical_cells is true, this class will behave similar
* to parallel::distributed::Triangulation in that there will be locally
* owned, ghost and artificial cells.
*
* Otherwise all non-locally owned cells are considered ghost.
*/
Triangulation (MPI_Comm mpi_communicator,
const typename dealii::Triangulation<dim,spacedim>::MeshSmoothing =
(dealii::Triangulation<dim,spacedim>::none),
const bool allow_artificial_cells = false);
/**
* Destructor.
*/
virtual ~Triangulation ();
/**
* Coarsen and refine the mesh according to refinement and coarsening
* flags set.
*
* This step is equivalent to the dealii::Triangulation class with an
* addition of calling dealii::GridTools::partition_triangulation() at
* the end.
*/
virtual void execute_coarsening_and_refinement ();
/**
* Create a triangulation.
*
* This function also partitions triangulation based on the MPI
* communicator provided to the constructor.
*/
virtual void create_triangulation (const std::vector< Point< spacedim > > &vertices,
const std::vector< CellData< dim > > &cells,
const SubCellData &subcelldata);
/**
* Copy @p other_tria to this triangulation.
*
* This function also partitions triangulation based on the MPI
* communicator provided to the constructor.
*
* @note This function can not be used with parallel::distributed::Triangulation,
* since it only stores those cells that it owns, one layer of ghost cells around
* the ones it locally owns, and a number of artificial cells.
*/
virtual void copy_triangulation (const dealii::Triangulation<dim, spacedim> &other_tria);
/**
* Read the data of this object from a stream for the purpose of
* serialization. Throw away the previous content.
*
* This function first does the same work as in dealii::Triangulation::load,
* then partitions the triangulation based on the MPI communicator
* provided to the constructor.
*/
template <class Archive>
void load (Archive &ar, const unsigned int version);
/**
* Return a vector of length Triangulation::n_active_cells() where each
* element stores the subdomain id of the owner of this cell. The
* elements of the vector are obviously the same as the subdomain ids
* for locally owned and ghost cells, but are also correct for
* artificial cells that do not store who the owner of the cell is in
* their subdomain_id field.
*/
const std::vector<types::subdomain_id> &get_true_subdomain_ids_of_cells() const;
/**
* Return allow_artificial_cells , namely true if artificial cells are
* allowed.
*/
bool with_artificial_cells() const;
private:
/**
* A flag to decide whether or not artificial cells are allowed.
*/
const bool allow_artificial_cells;
/**
* This function calls GridTools::partition_triangulation () and if
* requested in the constructor of the class marks artificial cells.
*/
void partition();
/**
* A vector containing subdomain IDs of cells obtained by partitioning
* using METIS. In case allow_artificial_cells is false, this vector is
* consistent with IDs stored in cell->subdomain_id() of the
* triangulation class. When allow_artificial_cells is true, cells which
* are artificial will have cell->subdomain_id() == numbers::artificial;
*
* The original parition information is stored to allow using sequential
* DoF distribution and partitioning functions with semi-artificial
* cells.
*/
std::vector<types::subdomain_id> true_subdomain_ids_of_cells;
};
template <int dim, int spacedim>
template <class Archive>
void
Triangulation<dim,spacedim>::load (Archive &ar,
const unsigned int version)
{
dealii::Triangulation<dim,spacedim>::load (ar, version);
partition();
this->update_number_cache ();
}
}
#else
namespace shared
{
/**
* Dummy class the compiler chooses for parallel shared triangulations if
* we didn't actually configure deal.II with the MPI library. The
* existence of this class allows us to refer to
* parallel::shared::Triangulation objects throughout the library even if
* it is disabled.
*
* Since the constructor of this class is private, no such objects can
* actually be created if MPI is not available.
*/
template <int dim, int spacedim = dim>
class Triangulation : public dealii::parallel::Triangulation<dim,spacedim>
{
public:
/**
* A dummy function to return empty vector.
*/
const std::vector<types::subdomain_id> &get_true_subdomain_ids_of_cells() const;
/**
* A dummy function which always returns true.
*/
bool with_artificial_cells() const;
private:
/**
* Constructor.
*/
Triangulation ();
/**
* A dummy vector.
*/
std::vector<types::subdomain_id> true_subdomain_ids_of_cells;
};
}
#endif
}
DEAL_II_NAMESPACE_CLOSE
#endif
|