From: bangerth Date: Mon, 14 Jan 2013 13:36:38 +0000 (+0000) Subject: Deprecate one function, introduce alternative interface. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=de9edf904bfe136183a8d57a3ccbb25a241c3a33;p=dealii-svn.git Deprecate one function, introduce alternative interface. git-svn-id: https://svn.dealii.org/trunk@28045 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/include/deal.II/grid/grid_generator.h b/deal.II/include/deal.II/grid/grid_generator.h index 90372b0362..d70b55b5cb 100644 --- a/deal.II/include/deal.II/grid/grid_generator.h +++ b/deal.II/include/deal.II/grid/grid_generator.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -284,32 +284,33 @@ public: const bool colorize=false); /** - * A parallelogram. The first - * corner point is the - * origin. The dim - * adjacent points are the - * one-dimensional subtensors of - * the tensor provided and - * additional points will be sums - * of these two vectors. - * Colorizing is done according - * to hyper_rectangle(). - * - * @note This function is - * implemented in 2d only. + * A parallelogram. The first corner point is the origin. The dim + * adjacent points are the ones given in the second argument and the fourth + * point will be the sum of these two vectors. Colorizing is done in the + * same way as in hyper_rectangle(). * - * @note The triangulation needs to be - * void upon calling this - * function. + * @note This function is implemented in 2d only. + * + * @note The triangulation needs to be void upon calling this function. */ template - static - void - parallelogram(Triangulation &tria, - const Tensor<2,dim> &corners, - const bool colorize=false); + static + void + parallelogram(Triangulation &tria, + const Point (&corners)[dim], + const bool colorize=false); + /** + * @deprecated Use the other function of same name. + */ + template + static + void + parallelogram(Triangulation &tria, + const Tensor<2,dim> &corners, + const bool colorize=false) DEAL_II_DEPRECATED; + /** * A parallelepiped. The first corner point is the origin. The * dim adjacent points are vectors describing the edges of @@ -328,7 +329,7 @@ public: * function. */ template - static + static void parallelepiped (Triangulation &tria, const Point (&corners) [dim], diff --git a/deal.II/source/grid/grid_generator.cc b/deal.II/source/grid/grid_generator.cc index 50f5e6eb8d..072852f587 100644 --- a/deal.II/source/grid/grid_generator.cc +++ b/deal.II/source/grid/grid_generator.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -370,10 +370,9 @@ GridGenerator::torus (Triangulation<2,3> &tria, // Implementation for 2D only template<> void -GridGenerator::parallelogram ( - Triangulation<2> &tria, - const Tensor<2,2> &corners, - const bool colorize) +GridGenerator::parallelogram (Triangulation<2> &tria, + const Point<2> (&corners)[2], + const bool colorize) { std::vector > vertices (GeometryInfo<2>::vertices_per_cell); @@ -394,6 +393,18 @@ GridGenerator::parallelogram ( } +template<> +void +GridGenerator::parallelogram (Triangulation<2> &tria, + const Tensor<2,2> &corners, + const bool colorize) +{ + // simply pass everything to the other function of same name + const Point<2> x[2] = { corners[0], corners[1] }; + parallelogram (tria, x, colorize); +} + + // Parallelepiped implementation in 1d, 2d, and 3d. @note The // implementation in 1d is similar to hyper_rectangle(), and in 2d is @@ -441,7 +452,7 @@ GridGenerator::parallelepiped (Triangulation &tria, vertices[1] = corners[0]; vertices[2] = corners[1]; vertices[4] = corners[2]; - + // compose the remaining vertices: vertices[3] = vertices[1] + vertices[2]; vertices[5] = vertices[1] + vertices[4]; @@ -458,7 +469,7 @@ GridGenerator::parallelepiped (Triangulation &tria, for (unsigned int i=0; i::vertices_per_cell; ++i) cells[0].vertices[i] = i; cells[0].material_id = 0; - + // Check ordering of vertices and create triangulation GridReordering::reorder_cells (cells); tria.create_triangulation (vertices, cells, SubCellData());