16 #ifndef dealii__tria_h 17 #define dealii__tria_h 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/base/std_cxx11/function.h> 27 #include <deal.II/base/std_cxx11/unique_ptr.h> 28 #include <deal.II/grid/tria_iterator_selector.h> 31 DEAL_II_DISABLE_EXTRA_DIAGNOSTICS
32 #include <boost/signals2.hpp> 33 #include <boost/serialization/vector.hpp> 34 #include <boost/serialization/map.hpp> 35 #ifdef DEAL_II_WITH_CXX11 36 # include <boost/serialization/unique_ptr.hpp> 38 # include <boost/serialization/scoped_ptr.hpp> 40 #include <boost/serialization/split_member.hpp> 41 DEAL_II_ENABLE_EXTRA_DIAGNOSTICS
50 DEAL_II_NAMESPACE_OPEN
52 template <
int dim,
int spacedim>
class Boundary;
54 template <
int dim,
int spacedim>
class Manifold;
58 template<
typename CellIterator>
struct PeriodicFacePair;
62 template <
int spacedim>
class TriaAccessor<0,1,spacedim>;
90 template <
int dim,
int spacedim>
class DoFHandler;
131 template <
int structdim>
357 std::size_t memory_consumption ()
const;
363 template <
class Archive>
364 void serialize (Archive &ar,
365 const unsigned int version);
415 std::size_t memory_consumption ()
const;
421 template <
class Archive>
422 void serialize (Archive &ar,
423 const unsigned int version);
474 std::size_t memory_consumption ()
const;
480 template <
class Archive>
481 void serialize (Archive &ar,
482 const unsigned int version);
1244 template <
int dim,
int spacedim=dim>
1504 typedef typename IteratorSelector::vertex_iterator vertex_iterator;
1505 typedef typename IteratorSelector::active_vertex_iterator active_vertex_iterator;
1507 typedef typename IteratorSelector::line_iterator line_iterator;
1508 typedef typename IteratorSelector::active_line_iterator active_line_iterator;
1510 typedef typename IteratorSelector::quad_iterator quad_iterator;
1511 typedef typename IteratorSelector::active_quad_iterator active_quad_iterator;
1513 typedef typename IteratorSelector::hex_iterator hex_iterator;
1514 typedef typename IteratorSelector::active_hex_iterator active_hex_iterator;
1548 std::list<typename Triangulation<dim,spacedim>::cell_iterator>
1596 #ifdef DEAL_II_WITH_CXX11 1622 virtual void clear ();
2045 template<
typename T>
2048 typedef T result_type;
2050 template<
typename InputIterator>
2051 T operator()(InputIterator first, InputIterator
last)
const 2053 return std::accumulate (first,
last, T());
2125 boost::signals2::signal<void (const Triangulation<dim, spacedim> &destination_tria)>
copy;
2175 boost::signals2::signal<
unsigned int (
const cell_iterator &,
2713 unsigned int n_lines ()
const;
2718 unsigned int n_lines (
const unsigned int level)
const;
2733 unsigned int n_quads ()
const;
2738 unsigned int n_quads (
const unsigned int level)
const;
2753 unsigned int n_hexs()
const;
2759 unsigned int n_hexs(
const unsigned int level)
const;
2776 unsigned int n_cells ()
const;
2782 unsigned int n_cells (
const unsigned int level)
const;
2811 unsigned int n_faces ()
const;
2877 const std::vector<Point<spacedim> > &
2889 bool vertex_used (
const unsigned int index)
const;
2895 const std::vector<bool> &
2968 unsigned int n_raw_lines (
const unsigned int level)
const;
2990 unsigned int n_raw_quads (
const unsigned int level)
const;
3012 unsigned int n_raw_hexs (
const unsigned int level)
const;
3023 unsigned int n_raw_cells (
const unsigned int level)
const;
3059 template <
class Archive>
3060 void save (Archive &ar,
3061 const unsigned int version)
const;
3078 template <
class Archive>
3079 void load (Archive &ar,
3080 const unsigned int version);
3105 const std::map<std::pair<cell_iterator, unsigned int>,std::pair<std::pair<cell_iterator, unsigned int>, std::bitset<3> > > &
3109 BOOST_SERIALIZATION_SPLIT_MEMBER()
3123 << "The given level " << arg1
3124 << " is not in the valid range!");
3133 << "You are trying to perform an operation on a triangulation "
3134 << "that is only allowed if the triangulation is currently empty. "
3135 << "However, it currently stores " << arg1 << "
vertices and has "
3136 << "cells on " << arg2 << "
levels.");
3155 << "You tried to do something on level " << arg1
3156 << ", but this level is empty.");
3173 << "The given boundary_id " << arg1
3201 const
std::vector<
bool> &v,
3202 const
unsigned int magic_number2,
3210 std::vector<
bool> &v,
3211 const
unsigned int magic_number2,
3249 typedef typename
IteratorSelector::raw_vertex_iterator raw_vertex_iterator;
3288 begin_line (const
unsigned int level = 0) const;
3293 active_line_iterator
3323 begin_quad (const
unsigned int level = 0) const;
3328 active_quad_iterator
3358 begin_hex (const
unsigned int level = 0) const;
3540 #ifdef DEAL_II_WITH_CXX11 3541 #ifndef DEAL_II_MSVC 3542 static_assert (dim<=spacedim,
3543 "The dimension <dim> of a Triangulation must be less than or " 3544 "equal to the space dimension <spacedim> in which it lives.");
3554 template <
int structdim>
3558 for (
unsigned int i=0; i<GeometryInfo<structdim>::vertices_per_cell; ++i)
3573 template <
class Archive>
3578 ar &n_lines &n_lines_level;
3579 ar &n_active_lines &n_active_lines_level;
3583 template <
class Archive>
3585 const unsigned int version)
3589 ar &n_quads &n_quads_level;
3590 ar &n_active_quads &n_active_quads_level;
3594 template <
class Archive>
3596 const unsigned int version)
3600 ar &n_hexes &n_hexes_level;
3601 ar &n_active_hexes &n_active_hexes_level;
3608 template <
int dim,
int spacedim>
3613 Assert (index < vertices_used.size(),
3615 return vertices_used[index];
3620 template <
int dim,
int spacedim>
3624 return number_cache.n_levels;
3627 template <
int dim,
int spacedim>
3631 return number_cache.n_levels;
3635 template <
int dim,
int spacedim>
3640 return vertices.size();
3645 template <
int dim,
int spacedim>
3647 const std::vector<Point<spacedim> > &
3654 template <
int dim,
int spacedim>
3655 template <
class Archive>
3658 const unsigned int)
const 3668 ar &anisotropic_refinement;
3671 ar &check_for_distorted_cells;
3675 ar &vertex_to_boundary_id_map_1d;
3676 ar &vertex_to_manifold_id_map_1d;
3682 template <
int dim,
int spacedim>
3683 template <
class Archive>
3699 ar &anisotropic_refinement;
3706 for (
unsigned int l=0;
l<levels.size(); ++
l)
3707 levels[l]->active_cell_indices.resize (levels[l]->refine_flags.size());
3708 reset_active_cell_indices ();
3712 bool my_check_for_distorted_cells;
3713 ar &my_check_for_distorted_cells;
3715 Assert (my_check_for_distorted_cells == check_for_distorted_cells,
3716 ExcMessage (
"The triangulation loaded into here must have the " 3717 "same setting with regard to reporting distorted " 3718 "cell as the one previously stored."));
3722 ar &vertex_to_boundary_id_map_1d;
3723 ar &vertex_to_manifold_id_map_1d;
3777 DEAL_II_NAMESPACE_CLOSE
3783 #include <deal.II/grid/tria_accessor.h> std::vector< CellData< 1 > > boundary_lines
std::vector<::internal::Triangulation::TriaLevel< dim > * > levels
TriaActiveIterator< CellAccessor< dim, spacedim > > active_cell_iterator
boost::signals2::signal< void()> any_change
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
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
active_face_iterator begin_active_face() const
::internal::Triangulation::NumberCache< dim > number_cache
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_cells() const
std_cxx11::unique_ptr<::internal::Triangulation::TriaFaces< dim > > faces
unsigned int n_raw_hexs() const
std::vector< GridTools::PeriodicFacePair< cell_iterator > > periodic_face_pairs_level_0
std::list< typename Triangulation< dim, spacedim >::cell_iterator > distorted_cells
unsigned char material_id
std::vector< Point< spacedim > > vertices
boost::signals2::signal< void()> clear
IteratorRange< active_cell_iterator > active_cell_iterators() const
void set_all_refine_flags()
void load_user_flags(std::istream &in)
bool anisotropic_refinement
boost::signals2::signal< unsigned int(const cell_iterator &, const CellStatus), CellWeightSum< unsigned int > > cell_weight
std::vector< unsigned int > n_active_lines_level
std::vector< unsigned int > n_hexes_level
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
virtual ~DistortedCellList() DEAL_II_NOEXCEPT
line_iterator end_line() const
boost::signals2::signal< void()> mesh_movement
static ::ExceptionBase & ExcGridReadError()
void clear_user_flags_quad()
unsigned int n_faces() const
std::vector< unsigned int > n_quads_level
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)
std::vector< unsigned int > n_active_quads_level
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)
void serialize(Archive &ar, const unsigned int version)
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_cxx11::unique_ptr< std::map< unsigned int, types::boundary_id > > vertex_to_boundary_id_map_1d
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
cell_iterator end() const
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_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
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)
TriaIterator< CellAccessor< dim, spacedim > > cell_iterator
Triangulation & operator=(Triangulation< dim, spacedim > &&tria)
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
std::map< types::manifold_id, SmartPointer< const Manifold< dim, spacedim >, Triangulation< dim, spacedim > > > manifold
void set_all_manifold_ids(const types::manifold_id number)
boost::signals2::signal< void()> create
static const StraightBoundary< dim, spacedim > straight_boundary
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::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 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
::internal::Triangulation::Iterators< dim, spacedim > IteratorSelector
void save(Archive &ar, const unsigned int version) const
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
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
void load_user_indices_hex(const std::vector< unsigned int > &v)
active_vertex_iterator begin_active_vertex() const
std::vector< types::boundary_id > get_boundary_ids() const
const types::manifold_id invalid_manifold_id
std::vector< unsigned int > n_active_hexes_level
void load_user_pointers_quad(const std::vector< void *> &v)
void serialize(Archive &ar, const unsigned int version)
active_cell_iterator end_active(const unsigned int level) const
void update_periodic_face_map()
void save_user_indices_quad(std::vector< unsigned int > &v) const
virtual void add_periodicity(const std::vector< GridTools::PeriodicFacePair< cell_iterator > > &)
unsigned int n_active_quads
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
void serialize(Archive &ar, const unsigned int version)
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)
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)
std_cxx11::unique_ptr< std::map< unsigned int, types::manifold_id > > vertex_to_manifold_id_map_1d
IteratorRange< cell_iterator > cell_iterators() const
unsigned char boundary_id
face_iterator end_face() const
void set_all_manifold_ids_on_boundary(const types::manifold_id number)
active_cell_iterator last_active() const
void clear_user_flags_line()
static ::ExceptionBase & ExcBoundaryIdNotFound(types::boundary_id arg1)
quad_iterator begin_quad(const unsigned int level=0) const
std::vector< types::manifold_id > get_manifold_ids() const
bool vertex_used(const unsigned int index) const
unsigned int n_active_hexes
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
unsigned int n_active_lines
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]
std::vector< unsigned int > n_lines_level
Triangulation< dim, spacedim > & get_triangulation()
void save_user_indices_hex(std::vector< unsigned int > &v) const