From: wolf Date: Mon, 5 Aug 2002 12:08:18 +0000 (+0000) Subject: Work around a problem with icc5: that compiler has a problem with the X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5d77c861642f3b892d192a9b7528e81f5457392a;p=dealii-svn.git Work around a problem with icc5: that compiler has a problem with the bind2nd function, so use functional classes instead, which provide an operator(). git-svn-id: https://svn.dealii.org/trunk@6318 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/source/grid/grid_tools.cc b/deal.II/deal.II/source/grid/grid_tools.cc index 4252a2b8d8..ddd1160ddc 100644 --- a/deal.II/deal.II/source/grid/grid_tools.cc +++ b/deal.II/deal.II/source/grid/grid_tools.cc @@ -19,7 +19,6 @@ #include #include -#include #if deal_II_dimension != 1 @@ -99,31 +98,54 @@ GridTools::diameter (const Triangulation<1> &tria) namespace { template - inline - Point shift_point (const Point p, - const Point shift) + class ShiftPoint { - return p+shift; + public: + ShiftPoint (const Point &shift) + : + shift(shift) + {}; + Point operator() (const Point p) const + { + return p+shift; + }; + private: + const Point shift; }; - inline - Point<2> rotate2d (const Point<2> p, - const double angle) + class Rotate2d { - return Point<2> (std::cos(angle)*p(0) - std::sin(angle) * p(1), - std::sin(angle)*p(0) + std::cos(angle) * p(1)); + public: + Rotate2d (const double angle) + : + angle(angle) + {}; + Point<2> operator() (const Point<2> p) const + { + return Point<2> (std::cos(angle)*p(0) - std::sin(angle) * p(1), + std::sin(angle)*p(0) + std::cos(angle) * p(1)); + }; + private: + const double angle; }; - - template - inline - Point scale_point (const Point p, - const double factor) + template + class ScalePoint { - return p*factor; + public: + ScalePoint (const double factor) + : + factor(factor) + {}; + Point operator() (const Point p) const + { + return p*factor; + }; + private: + const double factor; }; }; @@ -133,15 +155,7 @@ void GridTools::shift (const Point &shift_vector, Triangulation &triangulation) { - // use a temporary variable to work - // around a bug in icc, which does - // not like it if we take the - // address of the function right - // within the call to std::ptr_fun - Point (*p) (const Point, const Point) - = &shift_point; - transform (std::bind2nd(std::ptr_fun(p), shift_vector), - triangulation); + transform (ShiftPoint(shift_vector), triangulation); }; @@ -151,9 +165,7 @@ void GridTools::rotate (const double angle, Triangulation<2> &triangulation) { - transform (std::bind2nd(std::ptr_fun(&rotate2d), - angle), - triangulation); + transform (Rotate2d(angle), triangulation); }; #endif @@ -165,16 +177,7 @@ GridTools::scale (const double scaling_factor, Triangulation &triangulation) { Assert (scaling_factor>0, ExcScalingFactorNotPositive (scaling_factor)); - - // use a temporary variable to work - // around a bug in icc, which does - // not like it if we take the - // address of the function right - // within the call to std::ptr_fun - Point (*p) (const Point, const double) - = &scale_point; - transform (std::bind2nd(std::ptr_fun(p), scaling_factor), - triangulation); + transform (ScalePoint(scaling_factor), triangulation); };