20 #include <deal.II/base/config.h> 21 #include <deal.II/base/point.h> 22 #include <deal.II/base/subscriptor.h> 23 #include <deal.II/base/smartpointer.h> 24 #include <deal.II/base/geometry_info.h> 25 #include <deal.II/base/iterator_range.h> 26 #include <deal.II/grid/tria_iterator_selector.h> 28 #include <boost/signals2.hpp> 29 #include <boost/serialization/vector.hpp> 30 #include <boost/serialization/map.hpp> 31 #include <boost/serialization/unique_ptr.hpp> 32 #include <boost/serialization/split_member.hpp> 43 DEAL_II_NAMESPACE_OPEN
45 template <
int dim,
int spacedim>
class Boundary;
47 template <
int dim,
int spacedim>
class Manifold;
51 template <
typename CellIterator>
struct PeriodicFacePair;
55 template <
int spacedim>
class TriaAccessor<0,1,spacedim>;
60 namespace TriangulationImplementation
75 namespace TriaAccessorImplementation
83 template <
int dim,
int spacedim>
class DoFHandler;
124 template <
int structdim>
279 namespace TriangulationImplementation
350 std::size_t memory_consumption ()
const;
356 template <
class Archive>
357 void serialize (Archive &ar,
358 const unsigned int version);
408 std::size_t memory_consumption ()
const;
414 template <
class Archive>
415 void serialize (Archive &ar,
416 const unsigned int version);
467 std::size_t memory_consumption ()
const;
473 template <
class Archive>
474 void serialize (Archive &ar,
475 const unsigned int version);
1268 template <
int dim,
int spacedim=dim>
1581 typedef typename IteratorSelector::line_iterator line_iterator;
1582 typedef typename IteratorSelector::active_line_iterator active_line_iterator;
1584 typedef typename IteratorSelector::quad_iterator quad_iterator;
1585 typedef typename IteratorSelector::active_quad_iterator active_quad_iterator;
1587 typedef typename IteratorSelector::hex_iterator hex_iterator;
1588 typedef typename IteratorSelector::active_hex_iterator active_hex_iterator;
1622 std::list<typename Triangulation<dim,spacedim>::cell_iterator>
1694 virtual void clear ();
2158 template <
typename T>
2161 typedef T result_type;
2163 template <
typename InputIterator>
2164 T operator()(InputIterator first, InputIterator
last)
const 2166 return std::accumulate (first,
last, T());
2238 boost::signals2::signal<void (const Triangulation<dim, spacedim> &destination_tria)>
copy;
2289 boost::signals2::signal<
unsigned int (
const cell_iterator &,
2864 unsigned int n_lines ()
const;
2869 unsigned int n_lines (
const unsigned int level)
const;
2884 unsigned int n_quads ()
const;
2889 unsigned int n_quads (
const unsigned int level)
const;
2904 unsigned int n_hexs()
const;
2910 unsigned int n_hexs(
const unsigned int level)
const;
2927 unsigned int n_cells ()
const;
2933 unsigned int n_cells (
const unsigned int level)
const;
2962 unsigned int n_faces ()
const;
3028 const std::vector<Point<spacedim> > &
3040 bool vertex_used (
const unsigned int index)
const;
3046 const std::vector<bool> &
3119 unsigned int n_raw_lines (
const unsigned int level)
const;
3141 unsigned int n_raw_quads (
const unsigned int level)
const;
3152 unsigned int n_raw_hexs (
const unsigned int level)
const;
3163 unsigned int n_raw_cells (
const unsigned int level)
const;
3199 template <
class Archive>
3200 void save (Archive &ar,
3201 const unsigned int version)
const;
3218 template <
class Archive>
3219 void load (Archive &ar,
3220 const unsigned int version);
3245 const std::map<std::pair<cell_iterator, unsigned int>,std::pair<std::pair<cell_iterator, unsigned int>, std::bitset<3> > > &
3249 BOOST_SERIALIZATION_SPLIT_MEMBER()
3263 << "The given level " << arg1
3264 << " is not in the valid range!");
3273 << "You are trying to perform an operation on a triangulation "
3274 << "that is only allowed if the triangulation is currently empty. "
3275 << "However, it currently stores " << arg1 << "
vertices and has "
3276 << "cells on " << arg2 << "
levels.");
3295 << "You tried to do something on level " << arg1
3296 << ", but this level is empty.");
3313 << "The given boundary_id " << arg1
3341 const
std::vector<
bool> &v,
3342 const
unsigned int magic_number2,
3350 std::vector<
bool> &v,
3351 const
unsigned int magic_number2,
3428 begin_line (const
unsigned int level = 0) const;
3433 active_line_iterator
3463 begin_quad (const
unsigned int level = 0) const;
3468 active_quad_iterator
3498 begin_hex (const
unsigned int level = 0) const;
3668 friend struct ::
internal::TriaAccessorImplementation::Implementation;
3672 friend struct ::
internal::TriangulationImplementation::Implementation;
3675 friend class ::
internal::TriangulationImplementation::TriaObjects;
3679 #ifndef DEAL_II_MSVC 3680 static_assert (dim<=spacedim,
3681 "The dimension <dim> of a Triangulation must be less than or " 3682 "equal to the space dimension <spacedim> in which it lives.");
3691 template <
int structdim>
3695 for (
unsigned int i=0; i<GeometryInfo<structdim>::vertices_per_cell; ++i)
3708 namespace TriangulationImplementation
3710 template <
class Archive>
3715 ar &n_lines &n_lines_level;
3716 ar &n_active_lines &n_active_lines_level;
3720 template <
class Archive>
3722 const unsigned int version)
3726 ar &n_quads &n_quads_level;
3727 ar &n_active_quads &n_active_quads_level;
3731 template <
class Archive>
3733 const unsigned int version)
3737 ar &n_hexes &n_hexes_level;
3738 ar &n_active_hexes &n_active_hexes_level;
3745 template <
int dim,
int spacedim>
3750 Assert (index < vertices_used.size(),
3752 return vertices_used[index];
3757 template <
int dim,
int spacedim>
3761 return number_cache.n_levels;
3764 template <
int dim,
int spacedim>
3768 return number_cache.n_levels;
3772 template <
int dim,
int spacedim>
3777 return vertices.size();
3782 template <
int dim,
int spacedim>
3784 const std::vector<Point<spacedim> > &
3791 template <
int dim,
int spacedim>
3792 template <
class Archive>
3795 const unsigned int)
const 3801 unsigned int n_levels = levels.size();
3803 for (
unsigned int i = 0; i < levels.size(); ++i)
3809 bool faces_is_nullptr = (faces.get()==
nullptr);
3810 ar &faces_is_nullptr;
3811 if (!faces_is_nullptr)
3817 ar &anisotropic_refinement;
3820 ar &check_for_distorted_cells;
3824 ar &vertex_to_boundary_id_map_1d;
3825 ar &vertex_to_manifold_id_map_1d;
3831 template <
int dim,
int spacedim>
3832 template <
class Archive>
3846 levels.resize(size);
3847 for (
unsigned int i = 0; i < levels.size(); ++i)
3849 std::unique_ptr<internal::TriangulationImplementation::TriaLevel<dim>> level;
3851 levels[i] = std::move(level);
3855 bool faces_is_nullptr =
true;
3856 ar &faces_is_nullptr;
3857 if (!faces_is_nullptr)
3863 ar &anisotropic_refinement;
3870 for (
unsigned int l=0;
l<levels.size(); ++
l)
3871 levels[l]->active_cell_indices.resize (levels[l]->refine_flags.size());
3872 reset_active_cell_indices ();
3876 bool my_check_for_distorted_cells;
3877 ar &my_check_for_distorted_cells;
3879 Assert (my_check_for_distorted_cells == check_for_distorted_cells,
3880 ExcMessage (
"The triangulation loaded into here must have the " 3881 "same setting with regard to reporting distorted " 3882 "cell as the one previously stored."));
3886 ar &vertex_to_boundary_id_map_1d;
3887 ar &vertex_to_manifold_id_map_1d;
3941 DEAL_II_NAMESPACE_CLOSE
3947 #include <deal.II/grid/tria_accessor.h> std::vector< CellData< 1 > > boundary_lines
TriaActiveIterator< CellAccessor< dim, spacedim > > active_cell_iterator
boost::signals2::signal< void()> any_change
::internal::TriangulationImplementation::NumberCache< dim > number_cache
unsigned int n_active_cells() const
void set_boundary(const types::manifold_id number, const Boundary< dim, spacedim > &boundary_object)
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
static const unsigned int invalid_unsigned_int
static ::ExceptionBase & ExcInvalidLevel(int arg1)
void load_user_flags_line(std::istream &in)
#define DeclException2(Exception2, type1, type2, outsequence)
hex_iterator begin_hex(const unsigned int level=0) const
virtual ~DistortedCellList() noexcept
active_face_iterator begin_active_face() const
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::list< typename Triangulation< dim, spacedim >::cell_iterator > distorted_cells
std::vector< Point< spacedim > > vertices
boost::signals2::signal< void()> clear
IteratorRange< active_cell_iterator > active_cell_iterators() const
TriaActiveIterator< TriaAccessor< dim-1, dim, spacedim > > active_face_iterator
void set_all_refine_flags()
void load_user_flags(std::istream &in)
TriaActiveIterator<::TriaAccessor< 0, dim, spacedim > > active_vertex_iterator
bool anisotropic_refinement
boost::signals2::signal< unsigned int(const cell_iterator &, const CellStatus), CellWeightSum< unsigned int > > cell_weight
boost::signals2::signal< void(const typename Triangulation< dim, spacedim >::cell_iterator &cell)> pre_coarsening_on_cell
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
boost::signals2::signal< void()> mesh_movement
::internal::TriangulationImplementation::Iterators< dim, spacedim > IteratorSelector
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()
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
const Boundary< dim, spacedim > & get_boundary(const types::manifold_id number) 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
std::vector< std::unique_ptr<::internal::TriangulationImplementation::TriaLevel< dim > > > levels
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
TriaIterator< TriaAccessor< dim-1, dim, spacedim > > face_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_distributed_save
static ::ExceptionBase & ExcTriangulationNotEmpty(int arg1, int arg2)
void reset_active_cell_indices()
DistortedCellList execute_refinement()
const bool check_for_distorted_cells
boost::signals2::signal< void()> pre_refinement
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
TriaIterator< CellAccessor< dim, spacedim > > cell_iterator
void clear_user_flags_hex()
void load_user_indices_line(const std::vector< unsigned int > &v)
unsigned int global_dof_index
vertex_iterator end_vertex() const
unsigned int n_raw_quads() const
#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
void set_all_manifold_ids(const types::manifold_id number)
boost::signals2::signal< void()> create
static const StraightBoundary< dim, spacedim > straight_boundary
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)
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)
virtual void create_triangulation(const std::vector< Point< spacedim > > &vertices, const std::vector< CellData< dim > > &cells, const SubCellData &subcelldata)
void save_coarsen_flags(std::ostream &out) const
void reset_all_manifolds()
void save_user_indices(std::vector< unsigned int > &v) const
types::material_id material_id
const std::vector< Point< spacedim > > & get_vertices() const
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
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
boost::signals2::signal< void()> post_distributed_refinement
void save(Archive &ar, const unsigned int version) const
void serialize(Archive &ar, const unsigned int version)
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
unsigned int subdomain_id
boost::signals2::signal< void(const typename Triangulation< dim, spacedim >::cell_iterator &cell)> post_refinement_on_cell
boost::signals2::signal< void()> post_refinement
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
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)
active_vertex_iterator begin_active_vertex() const
void reset_manifold(const types::manifold_id manifold_number)
std::vector< types::boundary_id > get_boundary_ids() const
const types::manifold_id invalid_manifold_id
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
virtual void add_periodicity(const std::vector< GridTools::PeriodicFacePair< cell_iterator > > &)
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
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)
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::map< types::manifold_id, std::unique_ptr< const Manifold< dim, spacedim > > > manifold
std::vector< unsigned int > n_active_quads_level
void clear_user_flags_line()
static ::ExceptionBase & ExcBoundaryIdNotFound(types::boundary_id arg1)
boost::signals2::signal< void()> post_distributed_load
void serialize(Archive &ar, const unsigned int version)
quad_iterator begin_quad(const unsigned int level=0) const
Triangulation & operator=(Triangulation< dim, spacedim > &&tria) noexcept
std::vector< unsigned int > n_hexes_level
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
virtual void create_triangulation_compatibility(const std::vector< Point< spacedim > > &vertices, const std::vector< CellData< dim > > &cells, const SubCellData &subcelldata)
void load_user_indices_quad(const std::vector< unsigned int > &v)
virtual types::subdomain_id locally_owned_subdomain() const
raw_line_iterator begin_raw_line(const unsigned int level=0) const
virtual const MeshSmoothing & get_mesh_smoothing() const
boost::signals2::signal< void(const Triangulation< dim, spacedim > &destination_tria)> copy
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()
boost::signals2::signal< void()> pre_distributed_refinement
void save_user_indices_hex(std::vector< unsigned int > &v) const
TriaIterator<::TriaAccessor< 0, dim, spacedim > > vertex_iterator