Reference documentation for deal.II version 9.2.0
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Classes | Namespaces
grid_tools.h File Reference
#include <deal.II/base/config.h>
#include <deal.II/base/bounding_box.h>
#include <deal.II/base/geometry_info.h>
#include <deal.II/base/std_cxx17/optional.h>
#include <deal.II/boost_adaptors/bounding_box.h>
#include <deal.II/dofs/dof_handler.h>
#include <deal.II/fe/mapping.h>
#include <deal.II/fe/mapping_q1.h>
#include <deal.II/grid/manifold.h>
#include <deal.II/grid/tria.h>
#include <deal.II/grid/tria_accessor.h>
#include <deal.II/grid/tria_iterator.h>
#include <deal.II/hp/dof_handler.h>
#include <deal.II/lac/sparsity_tools.h>
#include <deal.II/numerics/rtree.h>
#include <boost/archive/binary_iarchive.hpp>
#include <boost/archive/binary_oarchive.hpp>
#include <boost/geometry/index/rtree.hpp>
#include <boost/serialization/array.hpp>
#include <boost/serialization/vector.hpp>
#include <boost/iostreams/device/back_inserter.hpp>
#include <boost/iostreams/filter/gzip.hpp>
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/stream.hpp>
#include <bitset>
#include <list>
#include <set>

Go to the source code of this file.

Classes

class  internal::ActiveCellIterator< dim, spacedim, MeshType >
 
class  GridTools::Cache< dim, spacedim >
 
struct  GridTools::PeriodicFacePair< CellIterator >
 
struct  GridTools::CellDataTransferBuffer< dim, T >
 

Namespaces

 internal
 
 GridTools
 

Functions

Exceptions
static ::ExceptionBaseGridTools::ExcInvalidNumberOfPartitions (int arg1)
 
static ::ExceptionBaseGridTools::ExcNonExistentSubdomain (int arg1)
 
static ::ExceptionBaseGridTools::ExcTriangulationHasBeenRefined ()
 
static ::ExceptionBaseGridTools::ExcScalingFactorNotPositive (double arg1)
 
template<int N>
static ::ExceptionBaseGridTools::ExcPointNotFoundInCoarseGrid (Point< N > arg1)
 
template<int N>
static ::ExceptionBaseGridTools::ExcPointNotFound (Point< N > arg1)
 
static ::ExceptionBaseGridTools::ExcVertexNotUsed (unsigned int arg1)
 
Exceptions
static ::ExceptionBaseGridTools::ExcInvalidNumberOfPartitions (int arg1)
 
static ::ExceptionBaseGridTools::ExcNonExistentSubdomain (int arg1)
 
static ::ExceptionBaseGridTools::ExcTriangulationHasBeenRefined ()
 
static ::ExceptionBaseGridTools::ExcScalingFactorNotPositive (double arg1)
 
template<int N>
static ::ExceptionBaseGridTools::ExcPointNotFoundInCoarseGrid (Point< N > arg1)
 
template<int N>
static ::ExceptionBaseGridTools::ExcPointNotFound (Point< N > arg1)
 
static ::ExceptionBaseGridTools::ExcVertexNotUsed (unsigned int arg1)
 

Information about meshes and cells

template<int dim, int spacedim>
double GridTools::diameter (const Triangulation< dim, spacedim > &tria)
 
template<int dim, int spacedim>
double GridTools::volume (const Triangulation< dim, spacedim > &tria, const Mapping< dim, spacedim > &mapping=(StaticMappingQ1< dim, spacedim >::mapping))
 
template<int dim, int spacedim>
double GridTools::minimal_cell_diameter (const Triangulation< dim, spacedim > &triangulation, const Mapping< dim, spacedim > &mapping=(StaticMappingQ1< dim, spacedim >::mapping))
 
template<int dim, int spacedim>
double GridTools::maximal_cell_diameter (const Triangulation< dim, spacedim > &triangulation, const Mapping< dim, spacedim > &mapping=(StaticMappingQ1< dim, spacedim >::mapping))
 
template<int dim>
double GridTools::cell_measure (const std::vector< Point< dim >> &all_vertices, const unsigned int(&vertex_indices)[GeometryInfo< dim >::vertices_per_cell])
 
template<int dim, typename T >
double GridTools::cell_measure (const T &,...)
 
template<int dim>
Vector< doubleGridTools::compute_aspect_ratio_of_cells (const Mapping< dim > &mapping, const Triangulation< dim > &triangulation, const Quadrature< dim > &quadrature)
 
template<int dim>
double GridTools::compute_maximum_aspect_ratio (const Mapping< dim > &mapping, const Triangulation< dim > &triangulation, const Quadrature< dim > &quadrature)
 
template<int dim, int spacedim>
BoundingBox< spacedim > GridTools::compute_bounding_box (const Triangulation< dim, spacedim > &triangulation)
 
template<typename Iterator >
Point< Iterator::AccessorType::space_dimension > GridTools::project_to_object (const Iterator &object, const Point< Iterator::AccessorType::space_dimension > &trial_point)
 
template<int dim, int spacedim>
std::tuple< std::vector< Point< spacedim > >, std::vector< CellData< dim > >, SubCellDataGridTools::get_coarse_mesh_description (const Triangulation< dim, spacedim > &tria)
 

Rotating, stretching and otherwise transforming meshes

template<int dim, typename Transformation , int spacedim>
void GridTools::transform (const Transformation &transformation, Triangulation< dim, spacedim > &triangulation)
 
template<int dim, int spacedim>
void GridTools::shift (const Tensor< 1, spacedim > &shift_vector, Triangulation< dim, spacedim > &triangulation)
 
template<int dim>
void GridTools::rotate (const double angle, Triangulation< dim > &triangulation)
 
template<int dim>
void GridTools::rotate (const double angle, const unsigned int axis, Triangulation< dim, 3 > &triangulation)
 
template<int dim>
void GridTools::laplace_transform (const std::map< unsigned int, Point< dim >> &new_points, Triangulation< dim > &tria, const Function< dim, double > *coefficient=nullptr, const bool solve_for_absolute_positions=false)
 
template<int dim, int spacedim>
std::map< unsigned int, Point< spacedim > > GridTools::get_all_vertices_at_boundary (const Triangulation< dim, spacedim > &tria)
 
template<int dim, int spacedim>
void GridTools::scale (const double scaling_factor, Triangulation< dim, spacedim > &triangulation)
 
template<int dim, int spacedim>
void GridTools::distort_random (const double factor, Triangulation< dim, spacedim > &triangulation, const bool keep_boundary=true)
 
template<int dim, int spacedim>
void GridTools::remove_hanging_nodes (Triangulation< dim, spacedim > &tria, const bool isotropic=false, const unsigned int max_iterations=100)
 
template<int dim, int spacedim>
void GridTools::remove_anisotropy (Triangulation< dim, spacedim > &tria, const double max_ratio=1.6180339887, const unsigned int max_iterations=5)
 
template<int dim, int spacedim>
void GridTools::regularize_corner_cells (Triangulation< dim, spacedim > &tria, const double limit_angle_fraction=.75)
 

Finding cells and vertices of a triangulation

template<int dim, int spacedim>
return_type GridTools::compute_point_locations (const Cache< dim, spacedim > &cache, const std::vector< Point< spacedim >> &points, const typename Triangulation< dim, spacedim >::active_cell_iterator &cell_hint=typename Triangulation< dim, spacedim >::active_cell_iterator())
 
template<int dim, int spacedim>
return_type GridTools::compute_point_locations_try_all (const Cache< dim, spacedim > &cache, const std::vector< Point< spacedim >> &points, const typename Triangulation< dim, spacedim >::active_cell_iterator &cell_hint=typename Triangulation< dim, spacedim >::active_cell_iterator())
 
template<int dim, int spacedim>
return_type GridTools::distributed_compute_point_locations (const GridTools::Cache< dim, spacedim > &cache, const std::vector< Point< spacedim >> &local_points, const std::vector< std::vector< BoundingBox< spacedim >>> &global_bboxes)
 
template<int dim, int spacedim>
std::map< unsigned int, Point< spacedim > > GridTools::extract_used_vertices (const Triangulation< dim, spacedim > &container, const Mapping< dim, spacedim > &mapping=StaticMappingQ1< dim, spacedim >::mapping)
 
template<int spacedim>
unsigned int GridTools::find_closest_vertex (const std::map< unsigned int, Point< spacedim >> &vertices, const Point< spacedim > &p)
 
template<int dim, template< int, int > class MeshType, int spacedim>
unsigned int GridTools::find_closest_vertex (const MeshType< dim, spacedim > &mesh, const Point< spacedim > &p, const std::vector< bool > &marked_vertices={})
 
template<int dim, template< int, int > class MeshType, int spacedim>
unsigned int GridTools::find_closest_vertex (const Mapping< dim, spacedim > &mapping, const MeshType< dim, spacedim > &mesh, const Point< spacedim > &p, const std::vector< bool > &marked_vertices={})
 
template<int dim, template< int, int > class MeshType, int spacedim>
std::vector< typename MeshType< dim, spacedim >::active_cell_iterator > GridTools::find_cells_adjacent_to_vertex (const MeshType< dim, spacedim > &container, const unsigned int vertex_index)
 
template<int dim, template< int, int > class MeshType, int spacedim>
MeshType< dim, spacedim >::active_cell_iterator GridTools::find_active_cell_around_point (const MeshType< dim, spacedim > &mesh, const Point< spacedim > &p, const std::vector< bool > &marked_vertices={})
 
template<int dim, template< int, int > class MeshType, int spacedim>
std::pair< typename MeshType< dim, spacedim >::active_cell_iterator, Point< dim > > GridTools::find_active_cell_around_point (const Mapping< dim, spacedim > &mapping, const MeshType< dim, spacedim > &mesh, const Point< spacedim > &p, const std::vector< bool > &marked_vertices={})
 
template<int dim, template< int, int > class MeshType, int spacedim>
std::pair< typename MeshType< dim, spacedim >::active_cell_iterator, Point< dim > > GridTools::find_active_cell_around_point (const Mapping< dim, spacedim > &mapping, const MeshType< dim, spacedim > &mesh, const Point< spacedim > &p, const std::vector< std::set< typename MeshType< dim, spacedim >::active_cell_iterator >> &vertex_to_cell_map, const std::vector< std::vector< Tensor< 1, spacedim >>> &vertex_to_cell_centers, const typename MeshType< dim, spacedim >::active_cell_iterator &cell_hint=typename MeshType< dim, spacedim >::active_cell_iterator(), const std::vector< bool > &marked_vertices={}, const RTree< std::pair< Point< spacedim >, unsigned int >> &used_vertices_rtree=RTree< std::pair< Point< spacedim >, unsigned int >>{})
 
template<int dim, int spacedim>
std::pair< typename hp::DoFHandler< dim, spacedim >::active_cell_iterator, Point< dim > > GridTools::find_active_cell_around_point (const hp::MappingCollection< dim, spacedim > &mapping, const hp::DoFHandler< dim, spacedim > &mesh, const Point< spacedim > &p)
 
template<int dim, int spacedim>
std::pair< typename Triangulation< dim, spacedim >::active_cell_iterator, Point< dim > > GridTools::find_active_cell_around_point (const Cache< dim, spacedim > &cache, const Point< spacedim > &p, const typename Triangulation< dim, spacedim >::active_cell_iterator &cell_hint=typename Triangulation< dim, spacedim >::active_cell_iterator(), const std::vector< bool > &marked_vertices={})
 
template<int dim, template< int, int > class MeshType, int spacedim>
std::vector< std::pair< typename MeshType< dim, spacedim >::active_cell_iterator, Point< dim > > > GridTools::find_all_active_cells_around_point (const Mapping< dim, spacedim > &mapping, const MeshType< dim, spacedim > &mesh, const Point< spacedim > &p, const double tolerance=1e-10, const std::vector< bool > &marked_vertices={})
 
template<class MeshType >
std::vector< typename MeshType::active_cell_iterator > GridTools::get_active_child_cells (const typename MeshType::cell_iterator &cell)
 
template<class MeshType >
void GridTools::get_active_neighbors (const typename MeshType::active_cell_iterator &cell, std::vector< typename MeshType::active_cell_iterator > &active_neighbors)
 
template<class MeshType >
std::vector< typename MeshType::active_cell_iterator > GridTools::compute_active_cell_halo_layer (const MeshType &mesh, const std::function< bool(const typename MeshType::active_cell_iterator &)> &predicate)
 
template<class MeshType >
std::vector< typename MeshType::cell_iterator > GridTools::compute_cell_halo_layer_on_level (const MeshType &mesh, const std::function< bool(const typename MeshType::cell_iterator &)> &predicate, const unsigned int level)
 
template<class MeshType >
std::vector< typename MeshType::active_cell_iterator > GridTools::compute_ghost_cell_halo_layer (const MeshType &mesh)
 
template<class MeshType >
std::vector< typename MeshType::active_cell_iterator > GridTools::compute_active_cell_layer_within_distance (const MeshType &mesh, const std::function< bool(const typename MeshType::active_cell_iterator &)> &predicate, const double layer_thickness)
 
template<class MeshType >
std::vector< typename MeshType::active_cell_iterator > GridTools::compute_ghost_cell_layer_within_distance (const MeshType &mesh, const double layer_thickness)
 
template<class MeshType >
std::pair< Point< MeshType::space_dimension >, Point< MeshType::space_dimension > > GridTools::compute_bounding_box (const MeshType &mesh, const std::function< bool(const typename MeshType::active_cell_iterator &)> &predicate)
 
template<class MeshType >
std::vector< BoundingBox< MeshType::space_dimension > > GridTools::compute_mesh_predicate_bounding_box (const MeshType &mesh, const std::function< bool(const typename MeshType::active_cell_iterator &)> &predicate, const unsigned int refinement_level=0, const bool allow_merge=false, const unsigned int max_boxes=numbers::invalid_unsigned_int)
 
template<int spacedim>
return_type GridTools::guess_point_owner (const std::vector< std::vector< BoundingBox< spacedim >>> &global_bboxes, const std::vector< Point< spacedim >> &points)
 
template<int spacedim>
return_type GridTools::guess_point_owner (const RTree< std::pair< BoundingBox< spacedim >, unsigned int >> &covering_rtree, const std::vector< Point< spacedim >> &points)
 
template<int dim, int spacedim>
std::vector< std::set< typename Triangulation< dim, spacedim >::active_cell_iterator > > GridTools::vertex_to_cell_map (const Triangulation< dim, spacedim > &triangulation)
 
template<int dim, int spacedim>
std::vector< std::vector< Tensor< 1, spacedim > > > GridTools::vertex_to_cell_centers_directions (const Triangulation< dim, spacedim > &mesh, const std::vector< std::set< typename Triangulation< dim, spacedim >::active_cell_iterator >> &vertex_to_cells)
 
template<int dim, int spacedim>
unsigned int GridTools::find_closest_vertex_of_cell (const typename Triangulation< dim, spacedim >::active_cell_iterator &cell, const Point< spacedim > &position, const Mapping< dim, spacedim > &mapping=StaticMappingQ1< dim, spacedim >::mapping)
 
template<int dim, int spacedim>
std::map< unsigned int, types::global_vertex_indexGridTools::compute_local_to_global_vertex_index_map (const parallel::distributed::Triangulation< dim, spacedim > &triangulation)
 
template<int dim, int spacedim>
std::pair< unsigned int, doubleGridTools::get_longest_direction (typename Triangulation< dim, spacedim >::active_cell_iterator cell)
 

Dealing with periodic domains

template<typename FaceIterator >
bool GridTools::orthogonal_equality (std::bitset< 3 > &orientation, const FaceIterator &face1, const FaceIterator &face2, const int direction, const Tensor< 1, FaceIterator::AccessorType::space_dimension > &offset=Tensor< 1, FaceIterator::AccessorType::space_dimension >(), const FullMatrix< double > &matrix=FullMatrix< double >())
 
template<typename FaceIterator >
bool GridTools::orthogonal_equality (const FaceIterator &face1, const FaceIterator &face2, const int direction, const Tensor< 1, FaceIterator::AccessorType::space_dimension > &offset=Tensor< 1, FaceIterator::AccessorType::space_dimension >(), const FullMatrix< double > &matrix=FullMatrix< double >())
 
template<typename MeshType >
void GridTools::collect_periodic_faces (const MeshType &mesh, const types::boundary_id b_id1, const types::boundary_id b_id2, const int direction, std::vector< PeriodicFacePair< typename MeshType::cell_iterator >> &matched_pairs, const Tensor< 1, MeshType::space_dimension > &offset=::Tensor< 1, MeshType::space_dimension >(), const FullMatrix< double > &matrix=FullMatrix< double >())
 
template<typename MeshType >
void GridTools::collect_periodic_faces (const MeshType &mesh, const types::boundary_id b_id, const int direction, std::vector< PeriodicFacePair< typename MeshType::cell_iterator >> &matched_pairs, const ::Tensor< 1, MeshType::space_dimension > &offset=::Tensor< 1, MeshType::space_dimension >(), const FullMatrix< double > &matrix=FullMatrix< double >())
 

Dealing with boundary and manifold ids

template<int dim, int spacedim>
void GridTools::copy_boundary_to_manifold_id (Triangulation< dim, spacedim > &tria, const bool reset_boundary_ids=false)
 
template<int dim, int spacedim>
void GridTools::map_boundary_to_manifold_ids (const std::vector< types::boundary_id > &src_boundary_ids, const std::vector< types::manifold_id > &dst_manifold_ids, Triangulation< dim, spacedim > &tria, const std::vector< types::boundary_id > &reset_boundary_ids={})
 
template<int dim, int spacedim>
void GridTools::copy_material_to_manifold_id (Triangulation< dim, spacedim > &tria, const bool compute_face_ids=false)
 
template<int dim, int spacedim>
void GridTools::assign_co_dimensional_manifold_indicators (Triangulation< dim, spacedim > &tria, const std::function< types::manifold_id(const std::set< types::manifold_id > &)> &disambiguation_function=[](const std::set< types::manifold_id > &manifold_ids) { if(manifold_ids.size()==1) return *manifold_ids.begin();else return numbers::flat_manifold_id;}, bool overwrite_only_flat_manifold_ids=true)
 
template<typename DataType , typename MeshType >
void GridTools::exchange_cell_data_to_ghosts (const MeshType &mesh, const std::function< std_cxx17::optional< DataType >(const typename MeshType::active_cell_iterator &)> &pack, const std::function< void(const typename MeshType::active_cell_iterator &, const DataType &)> &unpack)
 
template<int spacedim>
std::vector< std::vector< BoundingBox< spacedim > > > GridTools::exchange_local_bounding_boxes (const std::vector< BoundingBox< spacedim >> &local_bboxes, MPI_Comm mpi_communicator)
 
template<int spacedim>
RTree< std::pair< BoundingBox< spacedim >, unsigned int > > GridTools::build_global_description_tree (const std::vector< BoundingBox< spacedim >> &local_description, MPI_Comm mpi_communicator)
 
template<int dim, int spacedim>
void GridTools::collect_coinciding_vertices (const Triangulation< dim, spacedim > &tria, std::map< unsigned int, std::vector< unsigned int >> &coinciding_vertex_groups, std::map< unsigned int, unsigned int > &vertex_to_coinciding_vertex_group)
 
template<int dim, int spacedim>
std::map< unsigned int, std::set<::types::subdomain_id > > GridTools::compute_vertices_with_ghost_neighbors (const Triangulation< dim, spacedim > &tria)