From: wolf Date: Fri, 26 Oct 2001 12:58:07 +0000 (+0000) Subject: Fix a bug which made this function useless in 3d. Probably never X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bb9ec58f6652c41bf8c40ef0719e36fed8c74c57;p=dealii-svn.git Fix a bug which made this function useless in 3d. Probably never tested in 3d. git-svn-id: https://svn.dealii.org/trunk@5162 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 04eb18181f..a0f3e382a0 100644 --- a/deal.II/deal.II/source/grid/grid_generator.cc +++ b/deal.II/deal.II/source/grid/grid_generator.cc @@ -48,57 +48,41 @@ GridGenerator::hyper_rectangle (Triangulation &tria, for (unsigned int i=0;i p2(i)) - { - double h = p1(i); - p1(i) = p2(i); - p2(i) = h; - } + std::swap (p1(i), p2(i)); std::vector > vertices (GeometryInfo::vertices_per_cell); switch (dim) { case 1: - vertices[0](0) = p1(0); - vertices[1](0) = p2(0); - break; + vertices[0] = p1; + vertices[1] = p2; + break; case 2: - vertices[0](0) = p1(0); - vertices[1](0) = p2(0); - vertices[2](0) = p2(0); - vertices[3](0) = p1(0); - vertices[0](1) = p1(1); - vertices[1](1) = p1(1); - vertices[2](1) = p2(1); - vertices[3](1) = p2(1); - break; + vertices[0] = p1; + vertices[2] = p2; + + vertices[1](0) = p2(0); + vertices[3](0) = p1(0); + vertices[1](1) = p1(1); + vertices[3](1) = p2(1); + break; case 3: - vertices[0](0) = p1(0); - vertices[1](0) = p2(0); - vertices[2](0) = p2(0); - vertices[3](0) = p1(0); - vertices[4](0) = p1(0); - vertices[5](0) = p2(0); - vertices[6](0) = p2(0); - vertices[7](0) = p1(0); - vertices[0](1) = p1(0); - vertices[1](1) = p1(0); - vertices[2](1) = p1(0); - vertices[3](1) = p1(0); - vertices[4](1) = p2(0); - vertices[5](1) = p2(0); - vertices[6](1) = p2(0); - vertices[7](1) = p2(0); - vertices[0](2) = p1(0); - vertices[1](2) = p1(0); - vertices[2](2) = p2(0); - vertices[3](2) = p2(0); - vertices[4](2) = p1(0); - vertices[5](2) = p1(0); - vertices[6](2) = p2(0); - vertices[7](2) = p2(0); - break; + vertices[0] = vertices[1] = vertices[2] = vertices[3] = p1; + vertices[4] = vertices[5] = vertices[6] = vertices[7] = p2; + + vertices[1](0) = p2(0); + vertices[3](2) = p2(2); + vertices[2](0) = p2(0); + vertices[2](2) = p2(2); + + vertices[5](2) = p1(2); + vertices[7](0) = p1(0); + vertices[4](0) = p1(0); + vertices[4](2) = p1(2); + + break; default: - Assert (false, ExcNotImplemented ()); + Assert (false, ExcNotImplemented ()); } // Prepare cell data