From: bangerth Date: Thu, 8 Mar 2007 21:00:41 +0000 (+0000) Subject: Fixed: The X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=907dfaba55c03d7657ce1b4c74d7bc438d45258f;p=dealii-svn.git Fixed: The GridGenerator::cylinder function in 3d properly set the boundary indicators of the end faces of the generated cylinder to a different value than the outer faces, but it forgot to also adjust the boundary indicators of the edges purely in the interior to the ends of the cylinder. This is now fixed. git-svn-id: https://svn.dealii.org/trunk@14555 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/source/grid/grid_generator.cc b/deal.II/deal.II/source/grid/grid_generator.cc index 716c97b841..7918fd9e44 100644 --- a/deal.II/deal.II/source/grid/grid_generator.cc +++ b/deal.II/deal.II/source/grid/grid_generator.cc @@ -33,6 +33,7 @@ #include #include +#include #include #include @@ -1831,6 +1832,8 @@ GridGenerator::cylinder (Triangulation &tria, const double radius, const double half_length) { + Assert (dim <= 3, ExcNotImplemented()); + // Copy the base from hyper_ball // and transform it to yz const double d = radius/std::sqrt(2.0); @@ -1894,23 +1897,46 @@ GridGenerator::cylinder (Triangulation &tria, cells, SubCellData()); // no boundary information + // set boundary indicators for the + // faces at the ends to 1 and 2, + // respectively. note that we also + // have to deal with those lines + // that are purely in the interior + // of the ends. we determine wether + // an edge is purely in the + // interior if one of its vertices + // is at coordinates '+-a' as set + // above typename Triangulation::cell_iterator cell = tria.begin(); typename Triangulation::cell_iterator end = tria.end(); - while (cell != end) - { - for (unsigned int i=0;i::faces_per_cell;++i) + for (; cell != end; ++cell) + for (unsigned int i=0; i::faces_per_cell; ++i) + if (cell->at_boundary(i)) { - if (cell->face(i)->boundary_indicator() == 255) - continue; - if (cell->face(i)->center()(0) > half_length-1.e-5) - cell->face(i)->set_boundary_indicator(2); + { + cell->face(i)->set_boundary_indicator(2); + + for (unsigned int e=0; e::lines_per_face; ++e) + if ((std::fabs(cell->face(i)->line(e)->vertex(0)[1]) == a) || + (std::fabs(cell->face(i)->line(e)->vertex(0)[2]) == a) || + (std::fabs(cell->face(i)->line(e)->vertex(1)[1]) == a) || + (std::fabs(cell->face(i)->line(e)->vertex(1)[2]) == a)) + cell->face(i)->line(e)->set_boundary_indicator(2); + } else if (cell->face(i)->center()(0) < -half_length+1.e-5) - cell->face(i)->set_boundary_indicator(1); + { + cell->face(i)->set_boundary_indicator(1); + + for (unsigned int e=0; e::lines_per_face; ++e) + if ((std::fabs(cell->face(i)->line(e)->vertex(0)[1]) == a) || + (std::fabs(cell->face(i)->line(e)->vertex(0)[2]) == a) || + (std::fabs(cell->face(i)->line(e)->vertex(1)[1]) == a) || + (std::fabs(cell->face(i)->line(e)->vertex(1)[2]) == a)) + cell->face(i)->line(e)->set_boundary_indicator(1); + } } - ++cell; - } } diff --git a/deal.II/doc/news/changes.html b/deal.II/doc/news/changes.html index ef97f3433d..27662bfb78 100644 --- a/deal.II/doc/news/changes.html +++ b/deal.II/doc/news/changes.html @@ -1023,6 +1023,17 @@ inconvenience this causes.

deal.II

    +
  1. Fixed: The + GridGenerator::cylinder function in 3d properly + set the boundary indicators of the end faces of the generated + cylinder to a different value than the outer faces, but it + forgot to also adjust the boundary indicators of the edges + purely in the interior to the ends of the cylinder. This is now + fixed. +
    + (WB 2007/03/08) +

    +
  2. Improved: The CylinderBoundary class can now describe the boundaries of arbitrarily oriented cylinders, not only does