* @deprecated The boundary classes have been deprecated in favor of the more
* general Manifold classes. For this class CylindricalManifold is an appropriate
* replacement which is expected to produce better results under mesh refinement.
+ * For a two-dimensional cylinder use FlatManifold instead.
*
* @ingroup boundary
*
-// check the cells generated by the CylinderBoundary the default
+// check the cells generated by the CylindricalManifold for the default
// axiparallel cylinder
#include "../tests.h"
#include <deal.II/base/quadrature_lib.h>
#include <deal.II/grid/tria.h>
-#include <deal.II/grid/tria_boundary_lib.h>
+#include <deal.II/grid/manifold_lib.h>
#include <deal.II/grid/tria_accessor.h>
#include <deal.II/grid/tria_iterator.h>
#include <deal.II/grid/grid_generator.h>
#include <deal.II/fe/mapping_c1.h>
-
-
template <int dim>
void check ()
{
+ AssertThrow(false, ExcInternalError());
+}
+
+
+template<>
+void check<2> ()
+{
+ constexpr int dim = 2;
+ Triangulation<dim> triangulation;
+ GridGenerator::cylinder (triangulation);
+ triangulation.refine_global (2);
+
+ for (typename Triangulation<dim>::active_cell_iterator
+ cell = triangulation.begin_active();
+ cell!=triangulation.end(); ++cell)
+ for (unsigned int i=0; i<GeometryInfo<dim>::vertices_per_cell; ++i)
+ deallog << cell->vertex(i) << std::endl;
+}
+
+
+template<>
+void check<3> ()
+{
+ constexpr int dim = 3;
+ const CylindricalManifold<dim> boundary;
Triangulation<dim> triangulation;
GridGenerator::cylinder (triangulation);
- static const CylinderBoundary<dim> boundary (1,0);
- triangulation.set_boundary (0, boundary);
+ triangulation.set_manifold(0, boundary);
triangulation.refine_global (2);
for (typename Triangulation<dim>::active_cell_iterator
-// check the cells generated by the CylinderBoundary the
+// check the cells generated by the CylindricalManifold for an
// axiparallel cylinder parallel to the y-axis
#include "../tests.h"
#include <deal.II/base/quadrature_lib.h>
#include <deal.II/grid/tria.h>
-#include <deal.II/grid/tria_boundary_lib.h>
+#include <deal.II/grid/manifold_lib.h>
#include <deal.II/grid/tria_accessor.h>
#include <deal.II/grid/tria_iterator.h>
#include <deal.II/grid/grid_generator.h>
return Point<dim> (-p[1], p[0], p[2]);
}
+void set_manifold(Triangulation<2> &triangulation)
+{
+}
+
+void set_manifold(Triangulation<3> &triangulation)
+{
+ static const CylindricalManifold<3> boundary (1);
+ triangulation.set_manifold (0, boundary);
+}
template <int dim>
void check ()
GridTools::transform ((Point<dim> ( *)(const Point<dim> &))&rotate_to_y<dim>, triangulation);
- static const CylinderBoundary<dim> boundary (1,1);
- triangulation.set_boundary (0, boundary);
+ set_manifold(triangulation);
triangulation.refine_global (2);
for (typename Triangulation<dim>::active_cell_iterator
-// check the cells generated by the CylinderBoundary the axiparallel
+// check the cells generated by the CylindricalManifold the axiparallel
// cylinder parallel to the z-axis. this of course only works for 3d
#include "../tests.h"
#include <deal.II/base/quadrature_lib.h>
#include <deal.II/grid/tria.h>
-#include <deal.II/grid/tria_boundary_lib.h>
+#include <deal.II/grid/manifold_lib.h>
#include <deal.II/grid/tria_accessor.h>
#include <deal.II/grid/tria_iterator.h>
#include <deal.II/grid/grid_generator.h>
template <int dim>
-Point<dim> rotate_to_y (const Point<dim> &p)
+Point<dim> rotate_to_z (const Point<dim> &p)
{
return Point<dim> (-p[2], p[1], p[0]);
}
+void set_manifold(Triangulation<3> &triangulation)
+{
+ static const CylindricalManifold<3> boundary (2);
+ triangulation.set_manifold (0, boundary);
+}
template <int dim>
void check ()
Triangulation<dim> triangulation;
GridGenerator::cylinder (triangulation);
- GridTools::transform ((Point<dim> ( *)(const Point<dim> &))&rotate_to_y<dim>, triangulation);
+ GridTools::transform ((Point<dim> ( *)(const Point<dim> &))&rotate_to_z<dim>, triangulation);
- static const CylinderBoundary<dim> boundary (1,2);
- triangulation.set_boundary (0, boundary);
+ set_manifold(triangulation);
triangulation.refine_global (2);
for (typename Triangulation<dim>::active_cell_iterator
deallog << cell->vertex(i) << std::endl;
}
-
int main ()
{
initlog();
-// check the cells generated by the CylinderBoundary for an arbitrary
+// check the cells generated by the CylindricalManifold for an arbitrary
// orientation
#include "../tests.h"
#include <deal.II/base/quadrature_lib.h>
#include <deal.II/grid/tria.h>
-#include <deal.II/grid/tria_boundary_lib.h>
+#include <deal.II/grid/manifold_lib.h>
#include <deal.II/grid/tria_accessor.h>
#include <deal.II/grid/tria_iterator.h>
#include <deal.II/grid/grid_generator.h>
const double xy_angle = numbers::PI/6;
template <int dim>
-Point<dim> rotate_to_y (const Point<dim> &p)
+Point<dim> rotate_by_xy_angle (const Point<dim> &p)
{
return Point<dim> (p[0]*std::cos(xy_angle) - p[1]*std::sin(xy_angle),
p[0]*std::sin(xy_angle) + p[1]*std::cos(xy_angle),
Triangulation<dim> triangulation;
GridGenerator::cylinder (triangulation);
- GridTools::transform ((Point<dim> ( *)(const Point<dim> &))&rotate_to_y<dim>, triangulation);
+ GridTools::transform ((Point<dim> ( *)(const Point<dim> &))&rotate_by_xy_angle<dim>, triangulation);
- static const CylinderBoundary<dim> boundary (1,
- Point<dim>(std::cos(xy_angle), std::sin(xy_angle), 0),
- Point<dim>());
- triangulation.set_boundary (0, boundary);
+ static const CylindricalManifold<dim> boundary (Point<dim>(std::cos(xy_angle), std::sin(xy_angle), 0),
+ Point<dim>());
+ triangulation.set_manifold (0, boundary);
triangulation.refine_global (2);
for (typename Triangulation<dim>::active_cell_iterator
// resorting to manifold_ids. this testcase in essence just ensures
// that we continue to get this "undesirable" behavior until someone
// comes up with a better idea
+//
+// In particular, it doesn't make sense to replace CylinderBoundary
+// by CylindricalManifold here as the problem then doesn't appear anymore.
#include "../tests.h"
#include <deal.II/grid/grid_generator.h>
#include <deal.II/grid/grid_out.h>
#include <deal.II/grid/grid_tools.h>
-#include <deal.II/grid/tria_boundary_lib.h>
+#include <deal.II/grid/manifold_lib.h>
cell != triangulation.end(); ++cell)
for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
if (cell->face(f)->at_boundary())
- if (cell->face(f)->boundary_id() == 0)
- cell->face(f)->set_all_manifold_ids(0);
- else
- cell->face(f)->set_manifold_id(cell->face(f)->boundary_id());
-
- static const CylinderBoundary<dim> outer_cylinder (100,0);
+ {
+ if (cell->face(f)->boundary_id() == 0)
+ cell->face(f)->set_all_manifold_ids(0);
+ else
+ cell->face(f)->set_manifold_id(cell->face(f)->boundary_id());
+ }
+
+ static const CylindricalManifold<dim> outer_cylinder (0);
triangulation.set_manifold(0,outer_cylinder);
// now extract the surface mesh
Triangulation<dim-1,dim> triangulation_surface;
- static const CylinderBoundary<dim-1,dim> surface_cyl(100,0);
+ static const CylindricalManifold<dim-1,dim> surface_cyl(0);
triangulation_surface.set_manifold(0,surface_cyl);
GridGenerator::extract_boundary_mesh(triangulation,triangulation_surface);
#include <deal.II/grid/grid_generator.h>
#include <deal.II/grid/grid_out.h>
#include <deal.II/grid/grid_tools.h>
-#include <deal.II/grid/tria_boundary_lib.h>
+#include <deal.II/grid/manifold_lib.h>
// faces
GridTools::copy_boundary_to_manifold_id (triangulation);
- static const CylinderBoundary<dim> outer_cylinder (100,0);
+ static const CylindricalManifold<dim> outer_cylinder (0);
triangulation.set_manifold(0,outer_cylinder);
// now extract the surface mesh
Triangulation<dim-1,dim> triangulation_surface;
- static const CylinderBoundary<dim-1,dim> surface_cyl(100,0);
+ static const CylindricalManifold<dim-1,dim> surface_cyl(0);
triangulation_surface.set_manifold(0,surface_cyl);
GridGenerator::extract_boundary_mesh(triangulation,triangulation_surface);
#include <deal.II/grid/grid_generator.h>
#include <deal.II/grid/grid_out.h>
#include <deal.II/grid/grid_tools.h>
-#include <deal.II/grid/tria_boundary_lib.h>
+#include <deal.II/grid/manifold_lib.h>
cell != triangulation.end(); ++cell)
for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
if (cell->face(f)->at_boundary())
- if (cell->face(f)->boundary_id() == 0)
- cell->face(f)->set_all_manifold_ids(0);
- else
- cell->face(f)->set_manifold_id(cell->face(f)->boundary_id());
-
- static const CylinderBoundary<dim> outer_cylinder (100,0);
+ {
+ if (cell->face(f)->boundary_id() == 0)
+ cell->face(f)->set_all_manifold_ids(0);
+ else
+ cell->face(f)->set_manifold_id(cell->face(f)->boundary_id());
+ }
+
+ static const CylindricalManifold<dim> outer_cylinder (0);
triangulation.set_manifold(0,outer_cylinder);
// refine the surface mesh to see the effect of boundary/manifold
// now extract the surface mesh
Triangulation<dim-1,dim> triangulation_surface;
- static const CylinderBoundary<dim-1,dim> surface_cyl(100,0);
+ static const CylindricalManifold<dim-1,dim> surface_cyl(0);
triangulation_surface.set_manifold(0,surface_cyl);
GridGenerator::extract_boundary_mesh(triangulation,triangulation_surface);
#include "../tests.h"
#include <deal.II/grid/tria.h>
#include <deal.II/grid/grid_generator.h>
-#include <deal.II/grid/tria_boundary_lib.h>
+#include <deal.II/grid/manifold_lib.h>
#include <deal.II/grid/grid_out.h>
#include <deal.II/grid/grid_in.h>
Triangulation<dim> tr;
GridGenerator::hyper_cube_with_cylindrical_hole(tr, .3, .4, 1, 1, false);
- CylinderBoundary<dim> boundary(.3, 2);
- tr.set_boundary(1, boundary);
+ CylindricalManifold<dim> boundary(2);
+ tr.set_manifold(1, boundary);
{
std::ofstream grid_file("coarse_grid.inp");
go.write_ucd(tr, grid_file);
deallog << "Writing refined from constructor" << std::endl;
go.write_ucd(tr, out);
- tr.set_boundary(1);
+ tr.set_manifold(1);
tr.clear();
GridIn<dim> gi;
grid_file.close();
}
- tr.set_boundary(1, boundary);
+ tr.set_manifold(1, boundary);
tr.refine_global(1);
deallog << "Writing refined from file" << std::endl;
go.write_ucd(tr, out);
grid_file.close();
}
- tr.set_boundary(1);
+ tr.set_manifold(1);
tr.clear();
}
#include "../tests.h"
#include <deal.II/grid/tria.h>
#include <deal.II/grid/tria_accessor.h>
-#include <deal.II/grid/tria_boundary_lib.h>
+#include <deal.II/grid/manifold_lib.h>
#include <deal.II/grid/grid_generator.h>
#include <deal.II/grid/grid_tools.h>
#include <deal.II/grid/grid_out.h>
{
const unsigned int dim=3;
Point<dim> origin;
- CylinderBoundary<dim> boundary;
+ CylindricalManifold<dim> boundary;
Triangulation<dim> tria;
- tria.set_boundary(0, boundary);
GridGenerator::cylinder(tria, 1, .7);
+ tria.set_manifold(0, boundary);
tria.refine_global(2);
// build up a map of vertex indices
Triangulation<d> tr;
GridGenerator::hyper_cube_with_cylindrical_hole(tr,inner,outer,outer,true);
- static CylinderBoundary<d> boundary(inner,2);
+ static CylindricalManifold<d> boundary(2);
tr.set_all_manifold_ids_on_boundary(1,1);
tr.set_manifold(1,boundary);