Marek,

the attached file should be close to what you want to do.
Basically, you need to create two geometries: One for the cylinder shell 
and one for the cylinder.
Here, we take advantage of the fact that GridGenerator::cylinder always 
creates four subdivisions w.r.t height.
Furthermore, the cylinder needs to be refined once to match the vertices of 
the cylinder shell. Since we can only merge
coarse triangulations, we need to flatten the resulting triangulation.
If you want to create a gemoetry with a different height, you can delete 
cells in the cylinder triangulation using 
GridGenerator::create_triangulation_with_removed_cells
or add more cells by merging another cylinder.

Best,
Daniel

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Point<3> transformation2(const Point<3> &in)
{
  Point<3> out = in;
  double tmp=out(0);
  out(0)=out(2);
  out(2)=1-tmp;
  return out;
}

void grid_4()
{
  const CylinderBoundary<3> boundary (.5,2);
  Triangulation<3> tria1, tria;
  Triangulation<3> tria3, tria3_final;

  GridGenerator::cylinder_shell (tria1, 0.5, 0.5, 1, 8);
  GridGenerator::cylinder (tria3, 0.5, 1);
  GridTools::transform(transformation2, tria3);
  tria3.set_boundary (0, boundary);
  tria3.refine_global(1);
  GridGenerator::flatten_triangulation(tria3, tria3_final);

  std::ofstream out1 ("grid-4a.vtk");
  std::ofstream out3 ("grid-4b.vtk");

  GridOut grid_out;
  grid_out.write_vtk (tria1, out1);
  grid_out.write_vtk (tria3, out3);

  GridGenerator::merge_triangulations (tria1, tria3_final, tria);
  std::ofstream out ("grid-4.vtk");
  grid_out.write_vtk (tria, out);
}

Reply via email to