16 #ifndef dealii__grid_tools_H 17 #define dealii__grid_tools_H 20 #include <deal.II/base/config.h> 21 #include <deal.II/fe/mapping.h> 22 #include <deal.II/grid/tria.h> 23 #include <deal.II/grid/tria_accessor.h> 24 #include <deal.II/grid/tria_iterator.h> 25 #include <deal.II/fe/mapping_q1.h> 31 DEAL_II_NAMESPACE_OPEN
35 template <
int,
int>
class Mapping;
39 template <
int,
int>
class MappingCollection;
46 template<
int dim,
int spacedim,
class MeshType>
47 class ActiveCellIterator
50 typedef typename MeshType::active_cell_iterator type;
53 template<
int dim,
int spacedim>
54 class ActiveCellIterator<dim, spacedim, ::
DoFHandler<dim, spacedim> >
58 typedef typename ::DoFHandler<dim, spacedim>::active_cell_iterator type;
64 template<
int dim,
int spacedim>
65 class ActiveCellIterator<dim, spacedim, ::
hp::DoFHandler<dim, spacedim> >
69 typedef typename ::hp::DoFHandler<dim, spacedim>::active_cell_iterator type;
97 template <
int dim,
int spacedim>
126 template <
int dim,
int spacedim>
134 template <
int dim,
int spacedim>
141 template <
int dim,
int spacedim>
180 template <
int dim,
int spacedim>
200 template <
int dim,
int spacedim>
204 std::vector<unsigned int> &considered_vertices,
205 const double tol=1e-12);
236 template <
int dim,
typename Transformation,
int spacedim>
237 void transform (
const Transformation &transformation,
245 template <
int dim,
int spacedim>
257 void rotate (
const double angle,
305 template <
int dim,
int spacedim>
306 std::map<unsigned int,Point<spacedim> >
316 template <
int dim,
int spacedim>
317 void scale (
const double scaling_factor,
330 template <
int dim,
int spacedim>
333 const bool keep_boundary=
true);
352 template <
int dim,
template <
int,
int>
class MeshType,
int spacedim>
381 template<
int dim,
template <
int,
int>
class MeshType,
int spacedim>
383 std::vector<typename MeshType<dim, spacedim>::active_cell_iterator>
385 std::vector<typename ::internal::ActiveCellIterator<dim, spacedim, MeshType<dim, spacedim> >::type>
388 const unsigned int vertex_index);
423 template <
int dim,
template <
int,
int>
class MeshType,
int spacedim>
425 typename MeshType<dim,spacedim>::active_cell_iterator
427 typename ::internal::ActiveCellIterator<dim, spacedim, MeshType<dim, spacedim> >::type
477 template <
int dim,
template<
int,
int>
class MeshType,
int spacedim>
479 std::pair<typename MeshType<dim, spacedim>::active_cell_iterator,
Point<dim> >
481 std::pair<typename ::internal::ActiveCellIterator<dim, spacedim, MeshType<dim, spacedim> >::type,
Point<dim> >
484 const MeshType<dim,spacedim> &mesh,
508 template <
int dim,
int spacedim>
509 std::pair<typename hp::DoFHandler<dim, spacedim>::active_cell_iterator,
Point<dim> >
535 template <
class MeshType>
536 std::vector<typename MeshType::active_cell_iterator>
549 template <
class MeshType>
552 std::vector<typename MeshType::active_cell_iterator> &active_neighbors);
605 template <
class MeshType>
606 std::vector<typename MeshType::active_cell_iterator>
608 (
const MeshType &mesh,
609 const std_cxx11::function<
bool (
const typename MeshType::active_cell_iterator &)> &predicate);
626 template <
class MeshType>
627 std::vector<typename MeshType::active_cell_iterator>
639 template <
int dim,
int spacedim>
640 std::vector<std::set<typename Triangulation<dim,spacedim>::active_cell_iterator> >
654 template <
int dim,
int spacedim>
655 std::map<unsigned int, types::global_vertex_index>
674 template <
int dim,
int spacedim>
684 template <
int dim,
int spacedim>
697 template <
int dim,
int spacedim>
714 template <
int dim,
int spacedim>
761 template <
int dim,
int spacedim>
777 template <
int dim,
int spacedim>
780 std::vector<types::subdomain_id> &subdomain);
796 template <
int dim,
int spacedim>
831 template <
int dim,
int spacedim>
869 template <
typename MeshType>
870 std::list<std::pair<
typename MeshType::cell_iterator,
871 typename MeshType::cell_iterator> >
873 const MeshType &mesh_2);
884 template <
int dim,
int spacedim>
898 template <
typename MeshType>
901 const MeshType &mesh_2);
924 template <
int dim,
int spacedim>
979 template <
class MeshType>
980 std::vector<typename MeshType::active_cell_iterator>
1007 template <
class Container>
1008 std::vector<typename Container::cell_iterator>
1072 template <
class Container>
1075 const std::vector<typename Container::active_cell_iterator> &patch,
1078 typename Container::active_cell_iterator> &patch_to_global_tria_map);
1116 template <
class DoFHandlerType>
1117 std::map< types::global_dof_index,std::vector<typename DoFHandlerType::active_cell_iterator> >
1135 template <
template <
int,
int>
class MeshType,
int dim,
int spacedim>
1136 struct ExtractBoundaryMesh
1139 std::map<
typename MeshType<dim-1,spacedim>::cell_iterator,
1140 typename MeshType<dim,spacedim>::face_iterator>
1156 template<
typename CellIterator>
1157 struct PeriodicFacePair
1162 CellIterator cell[2];
1168 unsigned int face_idx[2];
1258 template<
typename FaceIterator>
1261 const FaceIterator &face1,
1262 const FaceIterator &face2,
1263 const int direction,
1272 template<
typename FaceIterator>
1275 const FaceIterator &face2,
1276 const int direction,
1334 template <
typename MeshType>
1337 (
const MeshType &mesh,
1340 const int direction,
1368 template <
typename MeshType>
1371 (
const MeshType &mesh,
1373 const int direction,
1406 template <
int dim,
int spacedim>
1408 const bool reset_boundary_ids=
false);
1441 template <
int dim,
int spacedim>
1443 const bool compute_face_ids=
false);
1458 <<
"The number of partitions you gave is " << arg1
1459 <<
", but must be greater than zero.");
1465 <<
"The subdomain id " << arg1
1466 <<
" has no cells associated with it.");
1477 <<
"The scaling factor must be positive, but is " << arg1);
1484 <<
"The point <" << arg1
1485 <<
"> could not be found inside any of the " 1486 <<
"coarse grid cells.");
1493 <<
"The point <" << arg1
1494 <<
"> could not be found inside any of the " 1495 <<
"subcells of a coarse grid cell.");
1502 <<
"The given vertex " << arg1
1503 <<
" is not used in the given triangulation");
1519 template <
int dim,
typename Predicate,
int spacedim>
1520 void transform (
const Predicate &predicate,
1523 std::vector<bool> treated_vertices (triangulation.
n_vertices(),
1534 endc = triangulation.
end ();
1535 for (; cell!=endc; ++cell)
1536 for (
unsigned int v=0; v<GeometryInfo<dim>::vertices_per_cell; ++v)
1537 if (treated_vertices[cell->vertex_index(v)] ==
false)
1540 cell->vertex(v) = predicate(cell->vertex(v));
1542 treated_vertices[cell->vertex_index(v)] =
true;
1551 endc = triangulation.
end();
1552 for (; cell!=endc; ++cell)
1553 for (
unsigned int face=0; face<GeometryInfo<dim>::faces_per_cell; ++face)
1554 if (cell->face(face)->has_children() &&
1555 !cell->face(face)->at_boundary())
1558 cell->face(face)->child(0)->vertex(1)
1559 = (cell->face(face)->vertex(0) +
1560 cell->face(face)->vertex(1)) / 2;
1567 endc = triangulation.
end();
1568 for (; cell!=endc; ++cell)
1569 for (
unsigned int face=0; face<GeometryInfo<dim>::faces_per_cell; ++face)
1570 if (cell->face(face)->has_children() &&
1571 !cell->face(face)->at_boundary())
1574 cell->face(face)->child(0)->vertex(1)
1575 = (cell->face(face)->vertex(0) + cell->face(face)->vertex(1)) / 2.0;
1576 cell->face(face)->child(0)->vertex(2)
1577 = (cell->face(face)->vertex(0) + cell->face(face)->vertex(2)) / 2.0;
1578 cell->face(face)->child(1)->vertex(3)
1579 = (cell->face(face)->vertex(1) + cell->face(face)->vertex(3)) / 2.0;
1580 cell->face(face)->child(2)->vertex(3)
1581 = (cell->face(face)->vertex(2) + cell->face(face)->vertex(3)) / 2.0;
1584 cell->face(face)->child(0)->vertex(3)
1585 = (cell->face(face)->vertex(0) + cell->face(face)->vertex(1)
1586 + cell->face(face)->vertex(2) + cell->face(face)->vertex(3)) / 4.0;
1593 template <
class MeshType>
1594 std::vector<typename MeshType::active_cell_iterator>
1597 std::vector<typename MeshType::active_cell_iterator> child_cells;
1599 if (cell->has_children())
1601 for (
unsigned int child=0;
1602 child<cell->n_children(); ++child)
1603 if (cell->child (child)->has_children())
1605 const std::vector<typename MeshType::active_cell_iterator>
1606 children = get_active_child_cells<MeshType> (cell->child(child));
1607 child_cells.insert (child_cells.end(),
1608 children.begin(), children.end());
1611 child_cells.push_back (cell->child(child));
1619 template <
class MeshType>
1622 std::vector<typename MeshType::active_cell_iterator> &active_neighbors)
1624 active_neighbors.clear ();
1625 for (
unsigned int n=0; n<GeometryInfo<MeshType::dimension>::faces_per_cell; ++n)
1626 if (! cell->at_boundary(n))
1628 if (MeshType::dimension == 1)
1635 typename MeshType::cell_iterator
1636 neighbor_child = cell->neighbor(n);
1637 if (!neighbor_child->active())
1639 while (neighbor_child->has_children())
1640 neighbor_child = neighbor_child->child (n==0 ? 1 : 0);
1642 Assert (neighbor_child->neighbor(n==0 ? 1 : 0)==cell,
1643 ExcInternalError());
1645 active_neighbors.push_back (neighbor_child);
1649 if (cell->face(n)->has_children())
1653 for (
unsigned int c=0; c<cell->face(n)->number_of_children(); ++c)
1654 active_neighbors.push_back (cell->neighbor_child_on_subface(n,c));
1659 Assert(cell->neighbor(n)->active(), ExcInternalError());
1660 active_neighbors.push_back(cell->neighbor(n));
1672 cell_measure<3>(
const std::vector<Point<3> > &all_vertices,
1677 cell_measure<2>(
const std::vector<Point<2> > &all_vertices,
1683 DEAL_II_NAMESPACE_CLOSE
unsigned int n_vertices() const
void copy_boundary_to_manifold_id(Triangulation< dim, spacedim > &tria, const bool reset_boundary_ids=false)
active_cell_iterator begin_active(const unsigned int level=0) const
cell_iterator end() const
#define DEAL_II_DEPRECATED
#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
void transform(const InputIterator &begin_in, const InputIterator &end_in, OutputIterator out, Predicate &predicate, const unsigned int grainsize)
unsigned char boundary_id