From: wolf Date: Wed, 27 Sep 2000 14:42:35 +0000 (+0000) Subject: CellData::rotate. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b96ece8a372c3a470bb31c4ad748cd35d1c82f16;p=dealii-svn.git CellData::rotate. git-svn-id: https://svn.dealii.org/trunk@3349 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/grid/tria.h b/deal.II/deal.II/include/grid/tria.h index 583e716a52..009ff436c3 100644 --- a/deal.II/deal.II/include/grid/tria.h +++ b/deal.II/deal.II/include/grid/tria.h @@ -35,9 +35,10 @@ template class MGDoFHandler; /** - * Structure which is passed to the @ref{Triangulation}@p{::create_triangulation} - * function. It contains all data needed to construct a cell, namely the - * indices of the vertices and the material indicator. + * Structure which is passed to the + * @ref{Triangulation}@p{::create_triangulation} function. It + * contains all data needed to construct a cell, namely the indices + * of the vertices and the material indicator. */ template struct CellData @@ -48,6 +49,33 @@ struct CellData int vertices[1 << dim]; #endif unsigned char material_id; + + /** + * Rotate the cell as many times + * as is given by the + * argument. Rotation is done by + * rotating the vertices. Note + * that rotation is not possible + * in 1d, and that there are four + * possible orientations of a + * cell in 2d, which are numbered + * counter-clockwise. The + * function is presently not + * implemented for 3d. + */ + void rotate (const unsigned int times); + + /** + * Rotations are not possible in 1d. + */ + DeclException0 (ExcNotPossible); + /** + * Exception + */ + DeclException1 (ExcInvalidRotation, + int, + << "The requested number of rotations, " << arg1 + << " is not possible in the present space dimension."); }; diff --git a/deal.II/deal.II/source/grid/tria.all_dimensions.cc b/deal.II/deal.II/source/grid/tria.all_dimensions.cc index c7cbe07d1b..4b8cc045b2 100644 --- a/deal.II/deal.II/source/grid/tria.all_dimensions.cc +++ b/deal.II/deal.II/source/grid/tria.all_dimensions.cc @@ -31,6 +31,40 @@ */ +template <> +void CellData<1>::rotate (unsigned int) +{ + Assert (false, ExcNotPossible()); +}; + + + +template <> +void CellData<2>::rotate (unsigned int times) +{ + while (times != 0) + { + const unsigned int x = vertices[0]; + vertices[0] = vertices[1]; + vertices[1] = vertices[2]; + vertices[2] = vertices[3]; + vertices[3] = x; + + --times; + }; +}; + + + +template <> +void CellData<3>::rotate (unsigned int) +{ + Assert (false, ExcNotImplemented()); +}; + + + + bool SubCellData::check_consistency (const unsigned int dim) const { switch (dim)