20 #include <deal.II/base/config.h> 22 #include <deal.II/base/geometry_info.h> 23 #include <deal.II/base/iterator_range.h> 24 #include <deal.II/base/point.h> 25 #include <deal.II/base/smartpointer.h> 26 #include <deal.II/base/subscriptor.h> 28 #include <deal.II/grid/tria_iterator_selector.h> 30 #include <boost/serialization/map.hpp> 31 #include <boost/serialization/split_member.hpp> 32 #include <boost/serialization/unique_ptr.hpp> 33 #include <boost/serialization/vector.hpp> 34 #include <boost/signals2.hpp> 45 DEAL_II_NAMESPACE_OPEN
47 template <
int dim,
int spacedim>
52 template <
typename CellIterator>
53 struct PeriodicFacePair;
56 template <
int,
int,
int>
58 template <
int spacedim>
60 template <
int,
int,
int>
65 namespace TriangulationImplementation
83 namespace TriaAccessorImplementation
91 template <
int dim,
int spacedim>
133 template <
int structdim>
290 namespace TriangulationImplementation
360 memory_consumption()
const;
366 template <
class Archive>
368 serialize(Archive &ar,
const unsigned int version);
419 memory_consumption()
const;
425 template <
class Archive>
427 serialize(Archive &ar,
const unsigned int version);
479 memory_consumption()
const;
485 template <
class Archive>
487 serialize(Archive &ar,
const unsigned int version);
1276 template <
int dim,
int spacedim = dim>
1285 ::internal::TriangulationImplementation::Iterators<dim, spacedim>;
1685 std::list<typename Triangulation<dim, spacedim>::cell_iterator>
1908 std::vector<types::boundary_id>
1922 std::vector<types::manifold_id>
2167 template <
typename T>
2170 using result_type = T;
2172 template <
typename InputIterator>
2174 operator()(InputIterator first, InputIterator
last)
const 2176 return std::accumulate(first,
last, T());
2240 boost::signals2::signal<void(
2250 boost::signals2::signal<void(
2260 boost::signals2::signal<void(
2770 begin(
const unsigned int level = 0)
const;
2831 end(
const unsigned int level)
const;
3072 n_lines(
const unsigned int level)
const;
3096 n_quads(
const unsigned int level)
const;
3121 n_hexs(
const unsigned int level)
const;
3148 n_cells(
const unsigned int level)
const;
3217 virtual unsigned int 3250 const std::vector<Point<spacedim>> &
3270 const std::vector<bool> &
3434 template <
class Archive>
3436 save(Archive &ar,
const unsigned int version)
const;
3453 template <
class Archive>
3455 load(Archive &ar,
const unsigned int version);
3481 std::pair<cell_iterator, unsigned int>,
3482 std::pair<std::pair<cell_iterator, unsigned int>, std::bitset<3>>> &
3486 BOOST_SERIALIZATION_SPLIT_MEMBER()
3501 << "You are requesting information from refinement level "
3503 << " of a triangulation, but this triangulation only has "
3504 << arg2 << " refinement
levels. The given level " << arg1
3505 << " must be *less* than " << arg2 << ".");
3516 << "You are trying to perform an operation on a triangulation "
3517 << "that is only allowed if the triangulation is currently empty. "
3518 << "However, it currently stores " << arg1 << "
vertices and has "
3519 << "cells on " << arg2 << "
levels.");
3538 << "You tried to do something on level " << arg1
3539 << ", but this level is empty.");
3556 << "The given boundary_id " << arg1
3585 const
std::vector<
bool> &v,
3586 const
unsigned int magic_number2,
3587 std::ostream & out);
3595 std::vector<
bool> &v,
3596 const
unsigned int magic_number2,
3652 begin_raw(const
unsigned int level = 0) const;
3659 end_raw(const
unsigned int level) const;
3697 begin_line(const
unsigned int level = 0) const;
3775 begin_quad(const
unsigned int level = 0) const;
3852 begin_hex(const
unsigned int level = 0) const;
3947 std::vector<
std::unique_ptr<
3948 ::
internal::TriangulationImplementation::TriaLevel<dim>>>
3956 std::unique_ptr<::
internal::TriangulationImplementation::TriaFaces<dim>>
4014 std::unique_ptr<
std::map<
unsigned int,
types::boundary_id>>
4037 std::unique_ptr<
std::map<
unsigned int,
types::manifold_id>>
4041 template <
int,
int,
int>
4043 template <
int,
int,
int>
4049 friend struct ::
internal::TriaAccessorImplementation::Implementation;
4053 friend struct ::
internal::TriangulationImplementation::Implementation;
4056 friend class ::
internal::TriangulationImplementation::TriaObjects;
4060 #ifndef DEAL_II_MSVC 4061 static_assert(dim <= spacedim,
4062 "The dimension <dim> of a Triangulation must be less than or " 4063 "equal to the space dimension <spacedim> in which it lives.");
4071 template <
int structdim>
4074 for (
unsigned int i = 0; i < GeometryInfo<structdim>::vertices_per_cell; ++i)
4087 namespace TriangulationImplementation
4089 template <
class Archive>
4094 ar &n_lines &n_lines_level;
4095 ar &n_active_lines &n_active_lines_level;
4099 template <
class Archive>
4105 ar &n_quads &n_quads_level;
4106 ar &n_active_quads &n_active_quads_level;
4110 template <
class Archive>
4116 ar &n_hexes &n_hexes_level;
4117 ar &n_active_hexes &n_active_hexes_level;
4124 template <
int dim,
int spacedim>
4128 Assert(index < vertices_used.size(),
4130 return vertices_used[index];
4135 template <
int dim,
int spacedim>
4139 return number_cache.n_levels;
4142 template <
int dim,
int spacedim>
4146 return number_cache.n_levels;
4150 template <
int dim,
int spacedim>
4154 return vertices.size();
4159 template <
int dim,
int spacedim>
4160 inline const std::vector<Point<spacedim>> &
4167 template <
int dim,
int spacedim>
4168 template <
class Archive>
4176 unsigned int n_levels = levels.size();
4178 for (
unsigned int i = 0; i < levels.size(); ++i)
4184 bool faces_is_nullptr = (faces.get() ==
nullptr);
4185 ar & faces_is_nullptr;
4186 if (!faces_is_nullptr)
4192 ar &anisotropic_refinement;
4195 ar &check_for_distorted_cells;
4199 ar &vertex_to_boundary_id_map_1d;
4200 ar &vertex_to_manifold_id_map_1d;
4206 template <
int dim,
int spacedim>
4207 template <
class Archive>
4220 levels.resize(size);
4221 for (
unsigned int i = 0; i < levels.size(); ++i)
4223 std::unique_ptr<internal::TriangulationImplementation::TriaLevel<dim>>
4226 levels[i] = std::move(level);
4230 bool faces_is_nullptr =
true;
4231 ar & faces_is_nullptr;
4232 if (!faces_is_nullptr)
4238 ar &anisotropic_refinement;
4245 for (
unsigned int l = 0;
l < levels.size(); ++
l)
4246 levels[l]->active_cell_indices.resize(levels[l]->refine_flags.size());
4247 reset_active_cell_indices();
4251 bool my_check_for_distorted_cells;
4252 ar & my_check_for_distorted_cells;
4254 Assert(my_check_for_distorted_cells == check_for_distorted_cells,
4255 ExcMessage(
"The triangulation loaded into here must have the " 4256 "same setting with regard to reporting distorted " 4257 "cell as the one previously stored."));
4261 ar &vertex_to_boundary_id_map_1d;
4262 ar &vertex_to_manifold_id_map_1d;
4370 DEAL_II_NAMESPACE_CLOSE
4376 #include <deal.II/grid/tria_accessor.h> std::vector< CellData< 1 > > boundary_lines
boost::signals2::signal< void(const Triangulation< dim, spacedim > &destination_tria)> copy
::internal::TriangulationImplementation::NumberCache< dim > number_cache
unsigned int n_active_cells() const
boost::signals2::signal< void()> post_refinement
static const unsigned int space_dimension
virtual void copy_triangulation(const Triangulation< dim, spacedim > &other_tria)
unsigned int n_vertices() const
unsigned int n_used_vertices() const
std::vector< unsigned int > n_quads_level
const types::manifold_id flat_manifold_id
static const unsigned int invalid_unsigned_int
void load_user_flags_line(std::istream &in)
boost::signals2::signal< void(const typename Triangulation< dim, spacedim >::cell_iterator &cell)> pre_coarsening_on_cell
#define DeclException2(Exception2, type1, type2, outsequence)
hex_iterator begin_hex(const unsigned int level=0) const
active_face_iterator begin_active_face() const
boost::signals2::signal< void()> post_distributed_repartition
typename IteratorSelector::line_iterator line_iterator
virtual void create_triangulation_compatibility(const std::vector< Point< spacedim >> &vertices, const std::vector< CellData< dim >> &cells, const SubCellData &subcelldata)
void save_user_flags_quad(std::ostream &out) const
virtual bool has_hanging_nodes() const
unsigned int n_raw_cells(const unsigned int level) const
cell_iterator last() const
void save_user_pointers_hex(std::vector< void *> &v) const
vertex_iterator begin_vertex() const
unsigned int n_active_lines
unsigned int n_cells() const
std::vector< GridTools::PeriodicFacePair< cell_iterator > > periodic_face_pairs_level_0
std::vector< Point< spacedim > > vertices
std::map< types::manifold_id, std::unique_ptr< const Manifold< dim, spacedim > > > manifold
typename IteratorSelector::hex_iterator hex_iterator
IteratorRange< active_cell_iterator > active_cell_iterators() const
void set_all_refine_flags()
void load_user_flags(std::istream &in)
typename IteratorSelector::active_line_iterator active_line_iterator
boost::signals2::signal< void()> pre_distributed_refinement
bool anisotropic_refinement
static void read_bool_vector(const unsigned int magic_number1, std::vector< bool > &v, const unsigned int magic_number2, std::istream &in)
line_iterator begin_line(const unsigned int level=0) const
line_iterator end_line() const
static ::ExceptionBase & ExcGridReadError()
void clear_user_flags_quad()
unsigned int n_faces() const
void serialize(Archive &ar, const unsigned int version)
void flip_all_direction_flags()
virtual ~DistortedCellList() noexcept override=default
active_cell_iterator begin_active(const unsigned int level=0) const
types::boundary_id boundary_id
static void write_bool_vector(const unsigned int magic_number1, const std::vector< bool > &v, const unsigned int magic_number2, std::ostream &out)
unsigned int n_active_hexs() const
void save_user_pointers_quad(std::vector< void *> &v) const
static ::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
void execute_coarsening()
cell_iterator begin(const unsigned int level=0) const
void load_user_flags_quad(std::istream &in)
unsigned int n_levels() const
void set_manifold(const types::manifold_id number, const Manifold< dim, spacedim > &manifold_object)
raw_hex_iterator begin_raw_hex(const unsigned int level=0) const
static ::ExceptionBase & ExcFacesHaveNoLevel()
void load_user_pointers_line(const std::vector< void *> &v)
unsigned int n_active_faces() const
raw_quad_iterator begin_raw_quad(const unsigned int level=0) const
std::unique_ptr<::internal::TriangulationImplementation::TriaFaces< dim > > faces
cell_iterator end() const
virtual void add_periodicity(const std::vector< GridTools::PeriodicFacePair< cell_iterator >> &)
void load_coarsen_flags(std::istream &out)
void load_user_flags_hex(std::istream &in)
active_quad_iterator begin_active_quad(const unsigned int level=0) const
virtual void execute_coarsening_and_refinement()
unsigned int n_active_quads
unsigned int n_active_lines() const
IteratorRange< cell_iterator > cell_iterators_on_level(const unsigned int level) const
virtual bool prepare_coarsening_and_refinement()
static ::ExceptionBase & ExcMessage(std::string arg1)
bool check_consistency(const unsigned int dim) const
boost::signals2::signal< void()> pre_refinement
static ::ExceptionBase & ExcTriangulationNotEmpty(int arg1, int arg2)
void reset_active_cell_indices()
DistortedCellList execute_refinement()
const bool check_for_distorted_cells
unsigned int subdomain_id
static const unsigned int dimension
void save_user_flags_line(std::ostream &out) const
static ::ExceptionBase & ExcNonOrientableTriangulation()
void save_user_pointers_line(std::vector< void *> &v) const
Triangulation(const MeshSmoothing smooth_grid=none, const bool check_for_distorted_cells=false)
#define DeclException1(Exception1, type1, outsequence)
unsigned int n_active_hexes
void clear_user_flags_hex()
void load_user_indices_line(const std::vector< unsigned int > &v)
vertex_iterator end_vertex() const
unsigned int n_raw_quads() const
virtual void create_triangulation(const std::vector< Point< spacedim >> &vertices, const std::vector< CellData< dim >> &cells, const SubCellData &subcelldata)
#define Assert(cond, exc)
active_hex_iterator begin_active_hex(const unsigned int level=0) const
void save_user_indices_line(std::vector< unsigned int > &v) const
boost::signals2::signal< void()> clear
void set_all_manifold_ids(const types::manifold_id number)
::internal::TriangulationImplementation::Iterators< dim, spacedim > IteratorSelector
unsigned int n_raw_hexs(const unsigned int level) const
unsigned int max_adjacent_cells() const
bool get_anisotropic_refinement_flag() const
void load(Archive &ar, const unsigned int version)
std::list< typename Triangulation< dim, spacedim >::cell_iterator > distorted_cells
unsigned int n_quads() const
std::unique_ptr< std::map< unsigned int, types::manifold_id > > vertex_to_manifold_id_map_1d
std::vector< bool > vertices_used
#define DeclException0(Exception0)
boost::signals2::signal< void(const typename Triangulation< dim, spacedim >::cell_iterator &cell)> post_refinement_on_cell
void save_coarsen_flags(std::ostream &out) const
void reset_all_manifolds()
typename IteratorSelector::active_quad_iterator active_quad_iterator
void save_user_indices(std::vector< unsigned int > &v) const
types::material_id material_id
const std::vector< Point< spacedim > > & get_vertices() const
boost::signals2::signal< void()> mesh_movement
void load_user_indices(const std::vector< unsigned int > &v)
void save_refine_flags(std::ostream &out) const
unsigned int n_lines() const
void clear_despite_subscriptions()
raw_cell_iterator begin_raw(const unsigned int level=0) const
unsigned int n_raw_lines() const
boost::signals2::signal< void()> pre_distributed_save
virtual std::size_t memory_consumption() const
std::map< std::pair< cell_iterator, unsigned int >, std::pair< std::pair< cell_iterator, unsigned int >, std::bitset< 3 > > > periodic_face_map
void save(Archive &ar, const unsigned int version) const
IteratorRange< active_face_iterator > active_face_iterators() const
void serialize(Archive &ar, const unsigned int version)
typename IteratorSelector::quad_iterator quad_iterator
virtual void set_mesh_smoothing(const MeshSmoothing mesh_smoothing)
void load_user_pointers_hex(const std::vector< void *> &v)
void save_user_flags_hex(std::ostream &out) const
face_iterator begin_face() const
boost::signals2::signal< void()> create
std::unique_ptr< std::map< unsigned int, types::boundary_id > > vertex_to_boundary_id_map_1d
virtual types::global_dof_index n_global_active_cells() const
unsigned int n_hexs() const
std::vector< std::unique_ptr< ::internal::TriangulationImplementation::TriaLevel< dim > > > levels
unsigned int n_active_quads() const
active_line_iterator begin_active_line(const unsigned int level=0) const
types::manifold_id manifold_id
raw_cell_iterator end_raw(const unsigned int level) const
unsigned int n_raw_faces() const
std::vector< unsigned int > n_lines_level
void load_user_indices_hex(const std::vector< unsigned int > &v)
boost::signals2::signal< void()> pre_partition
typename IteratorSelector::active_hex_iterator active_hex_iterator
active_vertex_iterator begin_active_vertex() const
void reset_manifold(const types::manifold_id manifold_number)
unsigned int global_dof_index
boost::signals2::signal< void()> post_distributed_save
void load_user_pointers_quad(const std::vector< void *> &v)
active_cell_iterator end_active(const unsigned int level) const
void update_periodic_face_map()
std::vector< unsigned int > n_active_hexes_level
void save_user_indices_quad(std::vector< unsigned int > &v) const
const std::vector< bool > & get_used_vertices() const
virtual unsigned int n_global_levels() const
hex_iterator end_hex() const
std::vector< CellData< 2 > > boundary_quads
MeshSmoothing smooth_grid
virtual ~Triangulation() override
boost::signals2::signal< unsigned int(const cell_iterator &, const CellStatus), CellWeightSum< unsigned int > > cell_weight
boost::signals2::signal< void()> pre_distributed_load
IteratorRange< active_cell_iterator > active_cell_iterators_on_level(const unsigned int level) const
void load_user_pointers(const std::vector< void *> &v)
std::vector< unsigned int > n_active_lines_level
void refine_global(const unsigned int times=1)
static ::ExceptionBase & ExcInvalidLevel(int arg1, int arg2)
void save_user_pointers(std::vector< void *> &v) const
void save_user_flags(std::ostream &out) const
quad_iterator end_quad() const
static ::ExceptionBase & ExcEmptyLevel(int arg1)
IteratorRange< cell_iterator > cell_iterators() const
face_iterator end_face() const
void set_all_manifold_ids_on_boundary(const types::manifold_id number)
active_cell_iterator last_active() const
std::vector< unsigned int > n_active_quads_level
void clear_user_flags_line()
static ::ExceptionBase & ExcBoundaryIdNotFound(types::boundary_id arg1)
void serialize(Archive &ar, const unsigned int version)
quad_iterator begin_quad(const unsigned int level=0) const
boost::signals2::signal< void()> post_distributed_load
Triangulation & operator=(Triangulation< dim, spacedim > &&tria) noexcept
std::vector< unsigned int > n_hexes_level
boost::signals2::signal< void()> pre_distributed_repartition
std::vector< types::manifold_id > get_manifold_ids() const
bool vertex_used(const unsigned int index) const
const Manifold< dim, spacedim > & get_manifold(const types::manifold_id number) const
void load_user_indices_quad(const std::vector< unsigned int > &v)
virtual types::subdomain_id locally_owned_subdomain() const
std::vector< types::boundary_id > get_boundary_ids() const
boost::signals2::signal< void()> any_change
raw_line_iterator begin_raw_line(const unsigned int level=0) const
virtual const MeshSmoothing & get_mesh_smoothing() 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
void load_refine_flags(std::istream &in)
Tensor< 2, dim, Number > l(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
unsigned int vertices[GeometryInfo< structdim >::vertices_per_cell]
Triangulation< dim, spacedim > & get_triangulation()
void save_user_indices_hex(std::vector< unsigned int > &v) const
boost::signals2::signal< void()> post_distributed_refinement