]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
CellData::rotate.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 27 Sep 2000 14:42:35 +0000 (14:42 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 27 Sep 2000 14:42:35 +0000 (14:42 +0000)
git-svn-id: https://svn.dealii.org/trunk@3349 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/grid/tria.h
deal.II/deal.II/source/grid/tria.all_dimensions.cc

index 583e716a5229456cb50d4bf15880ec0e904b1841..009ff436c30dd4274f32281f0de03cf3465bdef7 100644 (file)
@@ -35,9 +35,10 @@ template <int dim> class MGDoFHandler;
 
 
 /**
- *  Structure which is passed to the @ref{Triangulation}@p{<dim>::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{<dim>::create_triangulation} function. It
+ *  contains all data needed to construct a cell, namely the indices
+ *  of the vertices and the material indicator.
  */
 template <int dim>
 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.");
 };
 
 
index c7cbe07d1bf5739a54866fd56b8af3daf6992366..4b8cc045b219997598d8208876d3f7a1aeb5c5fa 100644 (file)
  */
 
 
+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) 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.