33#include <boost/serialization/map.hpp>
34#include <boost/serialization/split_member.hpp>
35#include <boost/serialization/unique_ptr.hpp>
36#include <boost/serialization/vector.hpp>
37#include <boost/signals2.hpp>
52 "The name 'signals' is already defined. You are most likely using the QT library \
53and using the 'signals' keyword. You can either #include the Qt headers (or any conflicting headers) \
54*after* the deal.II headers or you can define the 'QT_NO_KEYWORDS' macro and use the 'Q_SIGNALS' macro."
59template <
int dim,
int spacedim>
75 template <
typename CellIterator>
76 struct PeriodicFacePair;
79template <
int,
int,
int>
81template <
int spacedim>
83template <
int,
int,
int>
88 namespace TriangulationImplementation
102 struct Implementation;
103 struct ImplementationMixedMesh;
106 namespace TriaAccessorImplementation
108 struct Implementation;
123 namespace TriangulationImplementation
189 memory_consumption()
const;
196 template <
class Archive>
247 memory_consumption()
const;
254 template <
class Archive>
306 memory_consumption()
const;
313 template <
class Archive>
1120template <
int dim,
int spacedim = dim>
1656 const
Manifold<dim, spacedim> &manifold_object);
1720 const
types::manifold_id number);
1748 virtual
std::vector<
types::boundary_id>
1763 virtual
std::vector<
types::manifold_id>
1862 &construction_data);
2051 template <
typename T>
2056 template <
typename InputIterator>
2060 return std::accumulate(
first, last, T());
2124 boost::signals2::signal<void(
2134 boost::signals2::signal<void(
2144 boost::signals2::signal<void(
2220 : cell_weight(weight)
2235 boost::signals2::slot<signature_type, slot_function_type>;
2241 boost::signals2::signal<signature_type, combiner_type> &new_signal)
2242 : new_signal(new_signal)
2250 base_weight.disconnect();
2259 DEAL_II_DEPRECATED_EARLY
2260 boost::signals2::connection
2263 boost::signals2::connect_position position = boost::signals2::at_back)
2265 if (base_weight.connected() ==
false)
2267 base_weight = new_signal.connect(
2271 Assert(base_weight.connected() && new_signal.num_slots() == 1,
2275 return new_signal.connect(slot, position);
2282 DEAL_II_DEPRECATED_EARLY
2286 return new_signal.num_slots() -
2287 static_cast<std::size_t
>(base_weight.connected());
2293 DEAL_II_DEPRECATED_EARLY
2297 if (num_slots() == 0)
2311 template <
typename S>
2312 DEAL_II_DEPRECATED_EARLY
void
2315 new_signal.disconnect(connection);
2317 if (num_slots() == 0)
2319 Assert(base_weight.connected() && new_signal.num_slots() == 1,
2321 new_signal.disconnect(base_weight);
2328 DEAL_II_DEPRECATED_EARLY
2332 return new_signal(iterator, status);
2344 boost::signals2::signal<signature_type, combiner_type> &
new_signal;
3293 virtual unsigned int
3326 const std::vector<Point<spacedim>> &
3346 const std::vector<bool> &
3511 template <
class Archive>
3513 save(Archive &ar,
const unsigned int version)
const;
3532 template <
class Archive>
3534 load(Archive &ar,
const unsigned int version);
3560 std::pair<cell_iterator, unsigned int>,
3561 std::pair<std::pair<cell_iterator, unsigned int>, std::bitset<3>>> &
3568 const std::vector<ReferenceCell> &
3599 template <
class Archive>
3605 BOOST_SERIALIZATION_SPLIT_MEMBER()
3621 <<
"You are requesting information from refinement level "
3623 <<
" of a triangulation, but this triangulation only has "
3624 << arg2 <<
" refinement levels. The given level " << arg1
3625 <<
" must be *less* than " << arg2 <<
'.');
3636 <<
"You are trying to perform an operation on a triangulation "
3637 <<
"that is only allowed if the triangulation is currently empty. "
3638 <<
"However, it currently stores " << arg1 <<
" vertices and has "
3639 <<
"cells on " << arg2 <<
" levels.");
3658 <<
"You tried to do something on level " << arg1
3659 <<
", but this level is empty.");
3676 <<
"The given boundary_id " << arg1
3677 <<
" is not defined in this Triangulation!");
3686 "A cell is flagged for coarsening, but either not all of its siblings "
3687 "are active or flagged for coarsening as well. Please clean up all "
3688 "coarsen flags on your triangulation via "
3689 "Triangulation::prepare_coarsening_and_refinement() beforehand!");
3723 const std::vector<bool> &v,
3724 const unsigned int magic_number2,
3725 std::ostream & out);
3733 std::vector<bool> &v,
3734 const unsigned int magic_number2,
3766 std::vector<GridTools::PeriodicFacePair<cell_iterator>>
3773 std::map<std::pair<cell_iterator, unsigned int>,
3774 std::pair<std::pair<cell_iterator, unsigned int>, std::bitset<3>>>
4126 virtual unsigned int
4145 const unsigned int coarse_cell_index)
const;
4152 std::unique_ptr<::internal::TriangulationImplementation::TriaLevel>>
4160 std::unique_ptr<::internal::TriangulationImplementation::TriaFaces>
4178 std::map<types::manifold_id, std::unique_ptr<const Manifold<dim, spacedim>>>
4218 std::unique_ptr<std::map<unsigned int, types::boundary_id>>
4241 std::unique_ptr<std::map<unsigned int, types::manifold_id>>
4245 template <
int,
int,
int>
4247 template <
int,
int,
int>
4253 friend struct ::internal::TriaAccessorImplementation::Implementation;
4255 friend struct ::internal::TriangulationImplementation::Implementation;
4256 friend struct ::internal::TriangulationImplementation::
4257 ImplementationMixedMesh;
4259 friend class ::internal::TriangulationImplementation::TriaObjects;
4264 static_assert(dim <= spacedim,
4265 "The dimension <dim> of a Triangulation must be less than or "
4266 "equal to the space dimension <spacedim> in which it lives.");
4277 namespace TriangulationImplementation
4279 template <
class Archive>
4281 NumberCache<1>::serialize(Archive &ar,
const unsigned int)
4284 ar &n_lines &n_lines_level;
4285 ar &n_active_lines &n_active_lines_level;
4289 template <
class Archive>
4291 NumberCache<2>::serialize(Archive &ar,
const unsigned int version)
4293 this->NumberCache<1>::serialize(ar, version);
4295 ar &n_quads &n_quads_level;
4296 ar &n_active_quads &n_active_quads_level;
4300 template <
class Archive>
4302 NumberCache<3>::serialize(Archive &ar,
const unsigned int version)
4304 this->NumberCache<2>::serialize(ar, version);
4306 ar &n_hexes &n_hexes_level;
4307 ar &n_active_hexes &n_active_hexes_level;
4314template <
int dim,
int spacedim>
4324template <
int dim,
int spacedim>
4331template <
int dim,
int spacedim>
4339template <
int dim,
int spacedim>
4348template <
int dim,
int spacedim>
4349inline const std::vector<Point<spacedim>> &
4356template <
int dim,
int spacedim>
4357template <
class Archive>
4373 bool faces_is_nullptr = (
faces.get() ==
nullptr);
4374 ar & faces_is_nullptr;
4375 if (!faces_is_nullptr)
4395template <
int dim,
int spacedim>
4396template <
class Archive>
4410 for (
auto &level_ :
levels)
4412 std::unique_ptr<internal::TriangulationImplementation::TriaLevel>
level;
4414 level_ = std::move(
level);
4418 bool faces_is_nullptr =
true;
4419 ar & faces_is_nullptr;
4420 if (!faces_is_nullptr)
4435 level->active_cell_indices.resize(
level->refine_flags.size());
4436 level->global_active_cell_indices.resize(
level->refine_flags.size());
4437 level->global_level_cell_indices.resize(
level->refine_flags.size());
4446 bool my_check_for_distorted_cells;
4447 ar & my_check_for_distorted_cells;
4450 ExcMessage(
"The triangulation loaded into here must have the "
4451 "same setting with regard to reporting distorted "
4452 "cell as the one previously stored."));
4468template <
int dim,
int spacedim>
4478template <
int dim,
int spacedim>
4481 const unsigned int coarse_cell_index)
const
4483 return coarse_cell_index;
unsigned int operator()(const cell_iterator &iterator, const CellStatus status)
boost::signals2::slot< signature_type, slot_function_type > slot_type
std::size_t num_slots() const
boost::function< signature_type > slot_function_type
boost::signals2::connection connect(const slot_type &slot, boost::signals2::connect_position position=boost::signals2::at_back)
boost::signals2::signal< signature_type, combiner_type > & new_signal
LegacySignal(boost::signals2::signal< signature_type, combiner_type > &new_signal)
unsigned int(const cell_iterator &, const CellStatus) signature_type
boost::signals2::connection base_weight
void disconnect(const S &connection)
unsigned int n_hexs(const unsigned int level) const
virtual void add_periodicity(const std::vector< GridTools::PeriodicFacePair< cell_iterator > > &)
void save_user_flags_line(std::vector< bool > &v) const
virtual types::global_cell_index n_global_active_cells() const
@ smoothing_on_refinement
@ eliminate_refined_boundary_islands
@ do_not_produce_unrefined_islands
@ smoothing_on_coarsening
@ limit_level_difference_at_vertices
@ allow_anisotropic_smoothing
@ eliminate_unrefined_islands
@ eliminate_refined_inner_islands
static constexpr unsigned int dimension
quad_iterator begin_quad(const unsigned int level=0) const
typename IteratorSelector::raw_line_iterator raw_line_iterator
active_vertex_iterator begin_active_vertex() const
virtual MPI_Comm get_communicator() const
void load_user_indices_quad(const std::vector< unsigned int > &v)
unsigned int n_quads() const
void load_user_indices(const std::vector< unsigned int > &v)
std::vector< bool > vertices_used
bool anisotropic_refinement
active_quad_iterator begin_active_quad(const unsigned int level=0) const
bool get_anisotropic_refinement_flag() const
virtual const MeshSmoothing & get_mesh_smoothing() const
virtual void copy_triangulation(const Triangulation< dim, spacedim > &other_tria)
virtual types::coarse_cell_id n_global_coarse_cells() const
std::unique_ptr< std::map< unsigned int, types::manifold_id > > vertex_to_manifold_id_map_1d
void save_user_pointers_quad(std::vector< void * > &v) const
void save_user_flags_hex(std::ostream &out) const
void clear_user_flags_quad()
unsigned int n_faces() const
active_hex_iterator begin_active_hex(const unsigned int level=0) const
static void read_bool_vector(const unsigned int magic_number1, std::vector< bool > &v, const unsigned int magic_number2, std::istream &in)
unsigned int n_active_lines(const unsigned int level) const
bool all_reference_cells_are_hyper_cube() const
void load_user_flags_line(std::istream &in)
raw_hex_iterator begin_raw_hex(const unsigned int level=0) const
void save_user_flags_line(std::ostream &out) const
active_cell_iterator last_active() const
void save(Archive &ar, const unsigned int version) const
const Triangulation< dim, spacedim > & get_triangulation() const
void reset_global_cell_indices()
face_iterator end_face() const
void reset_active_cell_indices()
cell_iterator create_cell_iterator(const CellId &cell_id) const
cell_iterator begin(const unsigned int level=0) const
std::map< std::pair< cell_iterator, unsigned int >, std::pair< std::pair< cell_iterator, unsigned int >, std::bitset< 3 > > > periodic_face_map
unsigned int n_active_cells(const unsigned int level) const
const std::map< std::pair< cell_iterator, unsigned int >, std::pair< std::pair< cell_iterator, unsigned int >, std::bitset< 3 > > > & get_periodic_face_map() const
unsigned int n_cells(const unsigned int level) const
void save_user_pointers_line(std::vector< void * > &v) const
void save_user_flags_quad(std::vector< bool > &v) const
void load_refine_flags(std::istream &in)
void save_user_indices_line(std::vector< unsigned int > &v) const
raw_cell_iterator begin_raw(const unsigned int level=0) const
unsigned int n_lines() const
void load_coarsen_flags(const std::vector< bool > &v)
virtual void set_mesh_smoothing(const MeshSmoothing mesh_smoothing)
unsigned int n_raw_lines() const
virtual std::size_t memory_consumption() const
std::vector< Point< spacedim > > vertices
raw_quad_iterator begin_raw_quad(const unsigned int level=0) const
virtual types::subdomain_id locally_owned_subdomain() const
unsigned int n_raw_faces() const
unsigned int n_active_faces() const
virtual void create_triangulation(const std::vector< Point< spacedim > > &vertices, const std::vector< CellData< dim > > &cells, const SubCellData &subcelldata)
const bool check_for_distorted_cells
raw_cell_iterator end_raw(const unsigned int level) const
line_iterator end_line() const
std::unique_ptr< std::map< unsigned int, types::boundary_id > > vertex_to_boundary_id_map_1d
void load_user_flags_quad(std::istream &in)
unsigned int n_active_cells() const
virtual void update_reference_cells()
std::vector< ReferenceCell > reference_cells
void update_periodic_face_map()
unsigned int n_raw_lines(const unsigned int level) const
void clear_despite_subscriptions()
void coarsen_global(const unsigned int times=1)
void save_user_flags(std::ostream &out) const
void refine_global(const unsigned int times=1)
void load_user_flags_hex(std::istream &in)
const std::vector< Point< spacedim > > & get_vertices() const
void load_user_pointers_quad(const std::vector< void * > &v)
virtual void create_triangulation_compatibility(const std::vector< Point< spacedim > > &vertices, const std::vector< CellData< dim > > &cells, const SubCellData &subcelldata)
std::unique_ptr<::internal::TriangulationImplementation::TriaFaces > faces
unsigned int n_used_vertices() const
void reset_cell_vertex_indices_cache()
unsigned int n_active_lines() const
unsigned int n_levels() const
void load_user_flags_hex(const std::vector< bool > &v)
void load_user_indices_line(const std::vector< unsigned int > &v)
void clear_user_flags_hex()
void save_user_pointers_hex(std::vector< void * > &v) const
const std::vector< ReferenceCell > & get_reference_cells() const
typename IteratorSelector::raw_quad_iterator raw_quad_iterator
void load_user_pointers(const std::vector< void * > &v)
::internal::TriangulationImplementation::NumberCache< dim > number_cache
void load_user_flags_quad(const std::vector< bool > &v)
void load_user_flags_line(const std::vector< bool > &v)
void save_user_indices_hex(std::vector< unsigned int > &v) const
DistortedCellList execute_refinement()
active_line_iterator begin_active_line(const unsigned int level=0) const
void save_user_indices_quad(std::vector< unsigned int > &v) const
void load_user_pointers_hex(const std::vector< void * > &v)
cell_iterator end() const
virtual bool has_hanging_nodes() const
static constexpr unsigned int space_dimension
std::vector< GridTools::PeriodicFacePair< cell_iterator > > periodic_face_pairs_level_0
unsigned int n_raw_cells(const unsigned int level) const
cell_iterator end(const unsigned int level) const
virtual types::coarse_cell_id coarse_cell_index_to_coarse_cell_id(const unsigned int coarse_cell_index) const
unsigned int n_raw_quads(const unsigned int level) const
void load_coarsen_flags(std::istream &out)
quad_iterator end_quad() const
line_iterator begin_line(const unsigned int level=0) const
unsigned int max_adjacent_cells() const
vertex_iterator begin_vertex() const
unsigned int n_hexs() const
vertex_iterator end_vertex() const
bool vertex_used(const unsigned int index) const
void load_user_pointers_line(const std::vector< void * > &v)
void save_user_flags(std::vector< bool > &v) const
hex_iterator end_hex() const
hex_iterator begin_hex(const unsigned int level=0) const
virtual void execute_coarsening_and_refinement()
virtual unsigned int n_global_levels() const
active_cell_iterator end_active(const unsigned int level) const
bool is_mixed_mesh() const
cell_iterator last() const
unsigned int n_active_quads() const
void save_coarsen_flags(std::vector< bool > &v) const
void load_user_indices_hex(const std::vector< unsigned int > &v)
unsigned int n_raw_quads() const
void save_user_pointers(std::vector< void * > &v) const
face_iterator begin_face() const
unsigned int n_cells() const
virtual bool prepare_coarsening_and_refinement()
unsigned int n_active_quads(const unsigned int level) const
const std::vector< bool > & get_used_vertices() const
void load_user_flags(const std::vector< bool > &v)
typename IteratorSelector::raw_hex_iterator raw_hex_iterator
std::map< types::manifold_id, std::unique_ptr< const Manifold< dim, spacedim > > > manifolds
void serialize(Archive &archive, const unsigned int version)
void load_refine_flags(const std::vector< bool > &v)
MeshSmoothing smooth_grid
void save_refine_flags(std::ostream &out) const
std::unique_ptr< ::internal::TriangulationImplementation::Policy< dim, spacedim > > policy
Triangulation< dim, spacedim > & get_triangulation()
void save_user_flags_quad(std::ostream &out) const
unsigned int n_active_hexs(const unsigned int level) const
unsigned int n_vertices() const
void load(Archive &ar, const unsigned int version)
void save_user_indices(std::vector< unsigned int > &v) const
void save_user_flags_hex(std::vector< bool > &v) const
bool all_reference_cells_are_simplex() const
std::vector< std::unique_ptr<::internal::TriangulationImplementation::TriaLevel > > levels
unsigned int n_raw_hexs(const unsigned int level) const
void set_all_refine_flags()
unsigned int n_lines(const unsigned int level) const
unsigned int n_active_hexs() const
virtual std::vector< types::boundary_id > get_boundary_ids() const
virtual unsigned int coarse_cell_id_to_coarse_cell_index(const types::coarse_cell_id coarse_cell_id) const
unsigned int n_quads(const unsigned int level) const
void load_user_flags(std::istream &in)
void save_coarsen_flags(std::ostream &out) const
active_face_iterator begin_active_face() const
void clear_user_flags_line()
raw_line_iterator begin_raw_line(const unsigned int level=0) const
static void write_bool_vector(const unsigned int magic_number1, const std::vector< bool > &v, const unsigned int magic_number2, std::ostream &out)
void flip_all_direction_flags()
active_cell_iterator begin_active(const unsigned int level=0) const
void execute_coarsening()
void save_refine_flags(std::vector< bool > &v) const
#define DEAL_II_DEPRECATED
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
IteratorRange< active_cell_iterator > active_cell_iterators_on_level(const unsigned int level) const
IteratorRange< active_face_iterator > active_face_iterators() const
IteratorRange< active_cell_iterator > active_cell_iterators() const
IteratorRange< cell_iterator > cell_iterators_on_level(const unsigned int level) const
IteratorRange< cell_iterator > cell_iterators() const
static ::ExceptionBase & ExcBoundaryIdNotFound(types::boundary_id arg1)
#define DeclException0(Exception0)
static ::ExceptionBase & ExcTriangulationNotEmpty(int arg1, int arg2)
static ::ExceptionBase & ExcFacesHaveNoLevel()
static ::ExceptionBase & ExcInvalidLevel(int arg1, int arg2)
static ::ExceptionBase & ExcGridReadError()
#define Assert(cond, exc)
#define DeclException2(Exception2, type1, type2, outsequence)
#define AssertIndexRange(index, range)
#define DeclExceptionMsg(Exception, defaulttext)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcInconsistentCoarseningFlags()
#define DeclException1(Exception1, type1, outsequence)
static ::ExceptionBase & ExcNonOrientableTriangulation()
static ::ExceptionBase & ExcEmptyLevel(int arg1)
static ::ExceptionBase & ExcMessage(std::string arg1)
typename IteratorSelector::hex_iterator hex_iterator
typename IteratorSelector::active_quad_iterator active_quad_iterator
typename IteratorSelector::active_hex_iterator active_hex_iterator
typename IteratorSelector::quad_iterator quad_iterator
typename IteratorSelector::line_iterator line_iterator
TriaIterator< CellAccessor< dim, spacedim > > cell_iterator
typename IteratorSelector::active_line_iterator active_line_iterator
void set_all_manifold_ids_on_boundary(const types::manifold_id number)
const Manifold< dim, spacedim > & get_manifold(const types::manifold_id number) const
virtual std::vector< types::manifold_id > get_manifold_ids() const
void reset_manifold(const types::manifold_id manifold_number)
void set_manifold(const types::manifold_id number, const Manifold< dim, spacedim > &manifold_object)
void reset_all_manifolds()
void set_all_manifold_ids(const types::manifold_id number)
global_cell_index coarse_cell_id
T operator()(InputIterator first, InputIterator last) const
virtual ~DistortedCellList() noexcept override
std::list< typename Triangulation< dim, spacedim >::cell_iterator > distorted_cells
boost::signals2::signal< unsigned int(const cell_iterator &, const CellStatus), CellWeightSum< unsigned int > > weight
boost::signals2::signal< void()> mesh_movement
boost::signals2::signal< void()> post_distributed_load
boost::signals2::signal< void()> pre_distributed_save
boost::signals2::signal< void(const Triangulation< dim, spacedim > &destination_tria)> copy
boost::signals2::signal< void()> pre_distributed_refinement
boost::signals2::signal< void()> post_distributed_refinement
boost::signals2::signal< void()> pre_refinement
boost::signals2::signal< void()> any_change
boost::signals2::signal< void()> create
boost::signals2::signal< void()> clear
boost::signals2::signal< void(const typename Triangulation< dim, spacedim >::cell_iterator &cell)> post_refinement_on_cell
boost::signals2::signal< void(const typename Triangulation< dim, spacedim >::cell_iterator &cell)> pre_coarsening_on_cell
boost::signals2::signal< void()> post_refinement
boost::signals2::signal< void()> pre_partition
boost::signals2::signal< void()> pre_distributed_repartition
boost::signals2::signal< void()> pre_distributed_load
boost::signals2::signal< void()> post_p4est_refinement
boost::signals2::signal< void()> post_distributed_repartition
boost::signals2::signal< void()> post_distributed_save
std::vector< unsigned int > n_lines_level
unsigned int n_active_lines
void serialize(Archive &ar, const unsigned int version)
std::vector< unsigned int > n_active_lines_level
std::vector< unsigned int > n_active_quads_level
unsigned int n_active_quads
void serialize(Archive &ar, const unsigned int version)
std::vector< unsigned int > n_quads_level
unsigned int n_active_hexes
void serialize(Archive &ar, const unsigned int version)
std::vector< unsigned int > n_hexes_level
std::vector< unsigned int > n_active_hexes_level
const ::Triangulation< dim, spacedim > & tria