]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
GeometryInfo::child_to_cell_coordinates
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 1 May 2003 23:48:00 +0000 (23:48 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 1 May 2003 23:48:00 +0000 (23:48 +0000)
git-svn-id: https://svn.dealii.org/trunk@7541 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/grid/geometry_info.h
deal.II/doc/news/2002/c-3-4.html

index 98074da54250ebc579da68587b9e891ca2008cb2..890c45cf2fd96adbe1700b1262423dbedbe08530 100644 (file)
@@ -355,6 +355,17 @@ struct GeometryInfo<1>
     static Point<1> cell_to_child_coordinates (const Point<1>    &p,
                                               const unsigned int child_index);
 
+                                    /**
+                                     * The reverse function to the
+                                     * one above: take a point in the
+                                     * coordinate system of the
+                                     * child, and transform it to the
+                                     * coordinate system of the
+                                     * mother cell.
+                                     */
+    static Point<1> child_to_cell_coordinates (const Point<1>    &p,
+                                              const unsigned int child_index);
+
                                     /**
                                      * Return true if the given point
                                      * is inside the unit cell of the
@@ -604,6 +615,17 @@ struct GeometryInfo<2>
     static Point<2> cell_to_child_coordinates (const Point<2>    &p,
                                               const unsigned int child_index);
 
+                                    /**
+                                     * The reverse function to the
+                                     * one above: take a point in the
+                                     * coordinate system of the
+                                     * child, and transform it to the
+                                     * coordinate system of the
+                                     * mother cell.
+                                     */
+    static Point<2> child_to_cell_coordinates (const Point<2>    &p,
+                                              const unsigned int child_index);
+
                                     /**
                                      * Return true if the given point
                                      * is inside the unit cell of the
@@ -851,6 +873,17 @@ struct GeometryInfo<3>
     static Point<3> cell_to_child_coordinates (const Point<3>    &p,
                                               const unsigned int child_index);
 
+                                    /**
+                                     * The reverse function to the
+                                     * one above: take a point in the
+                                     * coordinate system of the
+                                     * child, and transform it to the
+                                     * coordinate system of the
+                                     * mother cell.
+                                     */
+    static Point<3> child_to_cell_coordinates (const Point<3>    &p,
+                                              const unsigned int child_index);
+
                                     /**
                                      * Return true if the given point
                                      * is inside the unit cell of the
@@ -1152,6 +1185,55 @@ GeometryInfo<3>::cell_to_child_coordinates (const Point<3>    &p,
 
 
 
+inline
+Point<1>
+GeometryInfo<1>::child_to_cell_coordinates (const Point<1>    &p,
+                                           const unsigned int child_index)
+{
+  Assert (child_index < GeometryInfo<dim>::children_per_cell,
+         ExcIndexRange (child_index, 0, GeometryInfo<dim>::children_per_cell));
+  const double x = p[0]/2 + (child_index == 1 ? .5 : 0.);
+  return Point<dim>(x);
+}
+
+
+
+inline
+Point<2>
+GeometryInfo<2>::child_to_cell_coordinates (const Point<2>    &p,
+                                           const unsigned int child_index)
+{
+  Assert (child_index < GeometryInfo<dim>::children_per_cell,
+         ExcIndexRange (child_index, 0, GeometryInfo<dim>::children_per_cell));
+
+  const double x = p[0]/2 + ((child_index == 1) || (child_index == 2) ? .5 : 0.);
+  const double y = p[1]/2 + ((child_index == 2) || (child_index == 3) ? .5 : 0.);
+    
+  return Point<dim>(x,y);
+}
+
+
+
+inline
+Point<3>
+GeometryInfo<3>::child_to_cell_coordinates (const Point<3>    &p,
+                                           const unsigned int child_index)
+{
+  Assert (child_index < GeometryInfo<dim>::children_per_cell,
+         ExcIndexRange (child_index, 0, GeometryInfo<dim>::children_per_cell));
+
+  const double x = p[0]/2 + ((child_index == 1) || (child_index == 2) ||
+                            (child_index == 5) || (child_index == 6)    ? .5 : 0.);
+  const double y = p[1]/2 + ((child_index == 4) || (child_index == 5) ||
+                            (child_index == 6) || (child_index == 7)    ? .5 : 0.);
+  const double z = p[2]/2 + ((child_index == 2) || (child_index == 3) ||
+                            (child_index == 6) || (child_index == 7)    ? .5 : 0.);
+    
+  return Point<dim>(x,y,z);
+}
+
+
+
 inline
 bool
 GeometryInfo<1>::is_inside_unit_cell (const Point<1> &p)
index eeb178e667b0f15ee8bba643f50111c6c9ee82c8..b9e79035dd6a8b6ab44cee8903b29b1e29617b2e 100644 (file)
@@ -763,7 +763,9 @@ contributor's names are abbreviated by WB (Wolfgang Bangerth), GK
        in the unit cell, returns which child cell it is on; <code
        class="member">cell_to_child_coordinates</code> that transforms
        coordinates between the unit coordinate systems from the mother
-       to the child cell; and <code
+       to the child cell; <code
+       class="member">child_to_cell_coordinates</code> that does
+       exactly the opposite; and <code
        class="member">is_inside_unit_cell</code> that tells whether a 
        given point is inside the unit cell.
        <br>

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.