From cc4415c0b285031ea601284dae0861f1ea73ec3a Mon Sep 17 00:00:00 2001 From: young Date: Mon, 14 Jan 2013 10:44:14 +0000 Subject: [PATCH] Change parallelepiped interface to something sensible: Point()[dim] not Tensor<2,dim>. git-svn-id: https://svn.dealii.org/trunk@28043 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/include/deal.II/grid/grid_generator.h | 24 +++++++++++-------- deal.II/source/grid/grid_generator.cc | 23 +++++++++--------- deal.II/source/grid/grid_generator.inst.in | 4 ++-- 3 files changed, 28 insertions(+), 23 deletions(-) diff --git a/deal.II/include/deal.II/grid/grid_generator.h b/deal.II/include/deal.II/grid/grid_generator.h index 9f7b344ed2..90372b0362 100644 --- a/deal.II/include/deal.II/grid/grid_generator.h +++ b/deal.II/include/deal.II/grid/grid_generator.h @@ -309,17 +309,20 @@ public: const Tensor<2,dim> &corners, const bool colorize=false); + /** * A parallelepiped. The first corner point is the origin. The - * dim adjacent points are the rank one subtensors of the - * tensor provided and additional points will be sums of those - * dim vectors. Thus in 1d this is a line, in 2d this is a - * parallelogram, and in 3d a parallelepiped. Colorizing is done - * according to hyper_rectangle(). + * dim adjacent points are vectors describing the edges of + * the parallelepiped with respect to the origin. Additional points + * are sums of these dim vectors. Colorizing is done according to + * hyper_rectangle(). * * @note This function silently reorders the vertices on the cells - * to lexiographic ordering if they are not already ordered that way - * (see GridReordering::reorder_grid()). + * to lexiographic ordering (see + * GridReordering::reorder_grid). In other words, if + * reodering of the vertices does occur, the ordering of vertices in + * the array of corners will no longer refer to the + * same triangulation. * * @note The triangulation needs to be void upon calling this * function. @@ -327,9 +330,10 @@ public: template static void - parallelepiped (Triangulation &tria, - const Tensor<2, dim> &corners, - const bool colorize = false); + parallelepiped (Triangulation &tria, + const Point (&corners) [dim], + const bool colorize = false); + /** * Hypercube with a layer of diff --git a/deal.II/source/grid/grid_generator.cc b/deal.II/source/grid/grid_generator.cc index 2d3e21fab2..50f5e6eb8d 100644 --- a/deal.II/source/grid/grid_generator.cc +++ b/deal.II/source/grid/grid_generator.cc @@ -367,8 +367,6 @@ GridGenerator::torus (Triangulation<2,3> &tria, } - - // Implementation for 2D only template<> void @@ -398,22 +396,25 @@ GridGenerator::parallelogram ( // Parallelepiped implementation in 1d, 2d, and 3d. @note The -// implementation in 1d is equivalent to hyper_rectangle, and in 2d is -// equivalent to parallelogram. Reordering of vertices to lexiographic -// occurs if needed. For this reason the triangulation is explicitly -// constructed for each dim here. +// implementation in 1d is similar to hyper_rectangle(), and in 2d is +// similar to parallelogram(). +// +// The GridReordering::reorder_grid is made use of towards the end of +// this function. Thus the triangulation is explicitly constructed for +// all dim here since it is slightly different in that respect +// (cf. hyper_rectangle(), parallelogram()). template void -GridGenerator::parallelepiped (Triangulation &tria, - const Tensor<2, dim> &corners, - const bool colorize) +GridGenerator::parallelepiped (Triangulation &tria, + const Point (&corners) [dim], + const bool colorize) { // Check that none of the user defined vertices overlap for (unsigned int i=0; i > vertices (GeometryInfo::vertices_per_cell); @@ -428,7 +429,7 @@ GridGenerator::parallelepiped (Triangulation &tria, case 2: // assign corners to vertices: vertices[1] = corners[0]; - vertices[2] = corners[1]; + vertices[2] = corners[0]; // compose the remaining vertex: vertices[3] = vertices[1] + vertices[2]; diff --git a/deal.II/source/grid/grid_generator.inst.in b/deal.II/source/grid/grid_generator.inst.in index 0561f0a4a4..68f836e18a 100644 --- a/deal.II/source/grid/grid_generator.inst.in +++ b/deal.II/source/grid/grid_generator.inst.in @@ -67,8 +67,8 @@ for (deal_II_dimension : DIMENSIONS) template void GridGenerator::parallelepiped ( - Triangulation &, - const Tensor<2, deal_II_dimension> &, + Triangulation &, + const Point (&) [deal_II_dimension], const bool); -- 2.39.5