static
void rotate (const double angle,
Triangulation<2> &triangulation);
+
+ /**
+ * Scale the entire triangulation
+ * by the given factor. To
+ * preserve the orientation of
+ * the triangulation, the factor
+ * must be positive.
+ *
+ * This function uses the
+ * @ref{transform} function
+ * above, so the requirements on
+ * the triangulation stated there
+ * hold for this function as
+ * well.
+ */
+ template <int dim>
+ static
+ void scale (const double scaling_factor,
+ Triangulation<dim> &triangulation);
/**
* Exception
*/
DeclException0 (ExcTriangulationHasBeenRefined);
+
+ /**
+ * Exception
+ */
+ DeclException1 (ExcScalingFactorNotPositive,
+ double,
+ << "The scaling factor must be positive, but is " << arg1);
};
return Point<2> (std::cos(angle)*p(0) - std::sin(angle) * p(1),
std::sin(angle)*p(0) + std::cos(angle) * p(1));
};
+
+
+
+ template <int dim>
+ inline
+ Point<dim> scale_point (const Point<dim> p,
+ const double factor)
+ {
+ return p*factor;
+ };
};
#endif
+template <int dim>
+void
+GridTools::scale (const double scaling_factor,
+ Triangulation<dim> &triangulation)
+{
+ Assert (scaling_factor>0, ExcScalingFactorNotPositive (scaling_factor));
+
+ transform (std::bind2nd(std::ptr_fun(&scale_point<dim>),
+ scaling_factor),
+ triangulation);
+};
+
+
#if deal_II_dimension != 1
template
template
void GridTools::shift<deal_II_dimension> (const Point<deal_II_dimension> &,
Triangulation<deal_II_dimension> &);
+
+template
+void GridTools::scale<deal_II_dimension> (const double,
+ Triangulation<deal_II_dimension> &);
<li> <p> New: The <code class="class">GridTools</code> class now
offers functions to apply general transformations to all
vertices of a triangulation, and also more specialized
- functions that shift and rotate triangulations.
+ functions that shift, scale, and rotate triangulations.
<br>
(RH 2002/07/25)
</p>