16 #ifndef dealii__grid_tools_H 17 #define dealii__grid_tools_H 20 #include <deal.II/base/config.h> 21 #include <deal.II/base/geometry_info.h> 22 #include <deal.II/dofs/dof_handler.h> 23 #include <deal.II/fe/mapping.h> 24 #include <deal.II/fe/mapping_q1.h> 25 #include <deal.II/grid/tria.h> 26 #include <deal.II/grid/tria_accessor.h> 27 #include <deal.II/grid/tria_iterator.h> 28 #include <deal.II/hp/dof_handler.h> 34 DEAL_II_NAMESPACE_OPEN
46 template <
int,
int>
class MappingCollection;
53 template<
int dim,
int spacedim,
class MeshType>
54 class ActiveCellIterator
57 typedef typename MeshType::active_cell_iterator type;
60 template<
int dim,
int spacedim>
61 class ActiveCellIterator<dim, spacedim, ::
DoFHandler<dim, spacedim> >
65 typedef typename ::DoFHandler<dim, spacedim>::active_cell_iterator type;
71 template<
int dim,
int spacedim>
72 class ActiveCellIterator<dim, spacedim, ::
hp::DoFHandler<dim, spacedim> >
76 typedef typename ::hp::DoFHandler<dim, spacedim>::active_cell_iterator type;
104 template <
int dim,
int spacedim>
133 template <
int dim,
int spacedim>
141 template <
int dim,
int spacedim>
148 template <
int dim,
int spacedim>
170 template <
int dim,
typename T>
195 template <
int dim,
int spacedim>
215 template <
int dim,
int spacedim>
219 std::vector<unsigned int> &considered_vertices,
220 const double tol=1e-12);
251 template <
int dim,
typename Transformation,
int spacedim>
252 void transform (
const Transformation &transformation,
260 template <
int dim,
int spacedim>
272 void rotate (
const double angle,
289 rotate (
const double angle,
290 const unsigned int axis,
355 const bool solve_for_absolute_positions =
false);
362 template <
int dim,
int spacedim>
363 std::map<unsigned int,Point<spacedim> >
373 template <
int dim,
int spacedim>
374 void scale (
const double scaling_factor,
387 template <
int dim,
int spacedim>
390 const bool keep_boundary=
true);
427 template<
int dim,
int spacedim>
430 const bool isotropic =
false,
431 const unsigned int max_iterations = 100);
458 template<
int dim,
int spacedim>
461 const double max_ratio = 1.6180339887,
462 const unsigned int max_iterations = 5);
481 template <
int dim,
template <
int,
int>
class MeshType,
int spacedim>
510 template<
int dim,
template <
int,
int>
class MeshType,
int spacedim>
512 std::vector<typename MeshType<dim, spacedim>::active_cell_iterator>
514 std::vector<typename ::internal::ActiveCellIterator<dim, spacedim, MeshType<dim, spacedim> >::type>
517 const unsigned int vertex_index);
552 template <
int dim,
template <
int,
int>
class MeshType,
int spacedim>
554 typename MeshType<dim,spacedim>::active_cell_iterator
556 typename ::internal::ActiveCellIterator<dim, spacedim, MeshType<dim, spacedim> >::type
606 template <
int dim,
template<
int,
int>
class MeshType,
int spacedim>
608 std::pair<typename MeshType<dim, spacedim>::active_cell_iterator,
Point<dim> >
610 std::pair<typename ::internal::ActiveCellIterator<dim, spacedim, MeshType<dim, spacedim> >::type,
Point<dim> >
613 const MeshType<dim,spacedim> &mesh,
637 template <
int dim,
int spacedim>
638 std::pair<typename hp::DoFHandler<dim, spacedim>::active_cell_iterator,
Point<dim> >
664 template <
class MeshType>
665 std::vector<typename MeshType::active_cell_iterator>
678 template <
class MeshType>
681 std::vector<typename MeshType::active_cell_iterator> &active_neighbors);
734 template <
class MeshType>
735 std::vector<typename MeshType::active_cell_iterator>
737 (
const MeshType &mesh,
738 const std_cxx11::function<
bool (
const typename MeshType::active_cell_iterator &)> &predicate);
755 template <
class MeshType>
756 std::vector<typename MeshType::active_cell_iterator>
768 template <
int dim,
int spacedim>
769 std::vector<std::set<typename Triangulation<dim,spacedim>::active_cell_iterator> >
783 template <
int dim,
int spacedim>
784 std::map<unsigned int, types::global_vertex_index>
801 template<
int dim,
int spacedim>
802 std::pair<unsigned int, double>
819 template <
int dim,
int spacedim>
829 template <
int dim,
int spacedim>
842 template <
int dim,
int spacedim>
859 template <
int dim,
int spacedim>
906 template <
int dim,
int spacedim>
922 template <
int dim,
int spacedim>
925 std::vector<types::subdomain_id> &subdomain);
941 template <
int dim,
int spacedim>
976 template <
int dim,
int spacedim>
1014 template <
typename MeshType>
1015 std::list<std::pair<
typename MeshType::cell_iterator,
1016 typename MeshType::cell_iterator> >
1018 const MeshType &mesh_2);
1029 template <
int dim,
int spacedim>
1043 template <
typename MeshType>
1046 const MeshType &mesh_2);
1069 template <
int dim,
int spacedim>
1124 template <
class MeshType>
1125 std::vector<typename MeshType::active_cell_iterator>
1152 template <
class Container>
1153 std::vector<typename Container::cell_iterator>
1224 template <
class Container>
1227 const std::vector<typename Container::active_cell_iterator> &patch,
1230 typename Container::active_cell_iterator> &patch_to_global_tria_map);
1268 template <
class DoFHandlerType>
1269 std::map< types::global_dof_index,std::vector<typename DoFHandlerType::active_cell_iterator> >
1285 template<
typename CellIterator>
1286 struct PeriodicFacePair
1387 template<
typename FaceIterator>
1390 const FaceIterator &face1,
1391 const FaceIterator &face2,
1392 const int direction,
1401 template<
typename FaceIterator>
1404 const FaceIterator &face2,
1405 const int direction,
1469 template <
typename MeshType>
1472 (
const MeshType &mesh,
1475 const int direction,
1503 template <
typename MeshType>
1506 (
const MeshType &mesh,
1508 const int direction,
1541 template <
int dim,
int spacedim>
1543 const bool reset_boundary_ids=
false);
1576 template <
int dim,
int spacedim>
1578 const bool compute_face_ids=
false);
1593 <<
"The number of partitions you gave is " << arg1
1594 <<
", but must be greater than zero.");
1600 <<
"The subdomain id " << arg1
1601 <<
" has no cells associated with it.");
1612 <<
"The scaling factor must be positive, but it is " << arg1 <<
".");
1619 <<
"The point <" << arg1
1620 <<
"> could not be found inside any of the " 1621 <<
"coarse grid cells.");
1628 <<
"The point <" << arg1
1629 <<
"> could not be found inside any of the " 1630 <<
"subcells of a coarse grid cell.");
1637 <<
"The given vertex with index " << arg1
1638 <<
" is not used in the given triangulation.");
1653 template <
int dim,
typename T>
1657 return std::numeric_limits<double>::quiet_NaN();
1660 template <
int dim,
typename Predicate,
int spacedim>
1661 void transform (
const Predicate &predicate,
1664 std::vector<bool> treated_vertices (triangulation.
n_vertices(),
1675 endc = triangulation.
end ();
1676 for (; cell!=endc; ++cell)
1677 for (
unsigned int v=0; v<GeometryInfo<dim>::vertices_per_cell; ++v)
1678 if (treated_vertices[cell->vertex_index(v)] ==
false)
1681 cell->vertex(v) = predicate(cell->vertex(v));
1683 treated_vertices[cell->vertex_index(v)] =
true;
1692 endc = triangulation.
end();
1693 for (; cell!=endc; ++cell)
1694 for (
unsigned int face=0; face<GeometryInfo<dim>::faces_per_cell; ++face)
1695 if (cell->face(face)->has_children() &&
1696 !cell->face(face)->at_boundary())
1699 cell->face(face)->child(0)->vertex(1)
1700 = (cell->face(face)->vertex(0) +
1701 cell->face(face)->vertex(1)) / 2;
1708 endc = triangulation.
end();
1709 for (; cell!=endc; ++cell)
1710 for (
unsigned int face=0; face<GeometryInfo<dim>::faces_per_cell; ++face)
1711 if (cell->face(face)->has_children() &&
1712 !cell->face(face)->at_boundary())
1715 cell->face(face)->child(0)->vertex(1)
1716 = (cell->face(face)->vertex(0) + cell->face(face)->vertex(1)) / 2.0;
1717 cell->face(face)->child(0)->vertex(2)
1718 = (cell->face(face)->vertex(0) + cell->face(face)->vertex(2)) / 2.0;
1719 cell->face(face)->child(1)->vertex(3)
1720 = (cell->face(face)->vertex(1) + cell->face(face)->vertex(3)) / 2.0;
1721 cell->face(face)->child(2)->vertex(3)
1722 = (cell->face(face)->vertex(2) + cell->face(face)->vertex(3)) / 2.0;
1725 cell->face(face)->child(0)->vertex(3)
1726 = (cell->face(face)->vertex(0) + cell->face(face)->vertex(1)
1727 + cell->face(face)->vertex(2) + cell->face(face)->vertex(3)) / 4.0;
1732 triangulation.
signals.mesh_movement();
1737 template <
class MeshType>
1738 std::vector<typename MeshType::active_cell_iterator>
1741 std::vector<typename MeshType::active_cell_iterator> child_cells;
1743 if (cell->has_children())
1745 for (
unsigned int child=0;
1746 child<cell->n_children(); ++child)
1747 if (cell->child (child)->has_children())
1749 const std::vector<typename MeshType::active_cell_iterator>
1750 children = get_active_child_cells<MeshType> (cell->child(child));
1751 child_cells.insert (child_cells.end(),
1752 children.begin(), children.end());
1755 child_cells.push_back (cell->child(child));
1763 template <
class MeshType>
1766 std::vector<typename MeshType::active_cell_iterator> &active_neighbors)
1768 active_neighbors.clear ();
1769 for (
unsigned int n=0; n<GeometryInfo<MeshType::dimension>::faces_per_cell; ++n)
1770 if (! cell->at_boundary(n))
1772 if (MeshType::dimension == 1)
1779 typename MeshType::cell_iterator
1780 neighbor_child = cell->neighbor(n);
1781 if (!neighbor_child->active())
1783 while (neighbor_child->has_children())
1784 neighbor_child = neighbor_child->child (n==0 ? 1 : 0);
1786 Assert (neighbor_child->neighbor(n==0 ? 1 : 0)==cell,
1789 active_neighbors.push_back (neighbor_child);
1793 if (cell->face(n)->has_children())
1797 for (
unsigned int c=0; c<cell->face(n)->number_of_children(); ++c)
1798 active_neighbors.push_back (cell->neighbor_child_on_subface(n,c));
1804 active_neighbors.push_back(cell->neighbor(n));
1813 DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcScalingFactorNotPositive(double arg1)
unsigned int n_vertices() const
void copy_boundary_to_manifold_id(Triangulation< dim, spacedim > &tria, const bool reset_boundary_ids=false)
static ::ExceptionBase & ExcPointNotFoundInCoarseGrid(Point< N > arg1)
static ::ExceptionBase & ExcNonExistentSubdomain(int arg1)
active_cell_iterator begin_active(const unsigned int level=0) const
cell_iterator end() const
static ::ExceptionBase & ExcTriangulationHasBeenRefined()
static ::ExceptionBase & ExcInvalidNumberOfPartitions(int arg1)
#define DeclException1(Exception1, type1, outsequence)
#define Assert(cond, exc)
Abstract base class for mapping classes.
#define DeclException0(Exception0)
void copy_material_to_manifold_id(Triangulation< dim, spacedim > &tria, const bool compute_face_ids=false)
unsigned int subdomain_id
static ::ExceptionBase & ExcNotImplemented()
unsigned char boundary_id
static ::ExceptionBase & ExcVertexNotUsed(unsigned int arg1)
static ::ExceptionBase & ExcPointNotFound(Point< N > arg1)
static ::ExceptionBase & ExcInternalError()