From dd37a58a06ae61eb2ce197837279f52cc4f8ca93 Mon Sep 17 00:00:00 2001 From: wolf Date: Thu, 5 Jul 2001 07:50:05 +0000 Subject: [PATCH] Fix issues with Compaq's cxx compiler. git-svn-id: https://svn.dealii.org/trunk@4816 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/examples/step-9/step-9.cc | 41 ++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/deal.II/examples/step-9/step-9.cc b/deal.II/examples/step-9/step-9.cc index 8b97ffed21..5ee4440065 100644 --- a/deal.II/examples/step-9/step-9.cc +++ b/deal.II/examples/step-9/step-9.cc @@ -229,6 +229,8 @@ template class AdvectionField : public TensorFunction<1,dim> { public: + AdvectionField () : TensorFunction<1,dim> () {}; + virtual Tensor<1,dim> value (const Point &p) const; virtual void value_list (const std::vector > &points, @@ -369,6 +371,8 @@ template class RightHandSide : public Function { public: + RightHandSide () : Function() {}; + virtual double value (const Point &p, const unsigned int component = 0) const; @@ -449,6 +453,8 @@ template class BoundaryValues : public Function { public: + BoundaryValues () : Function() {}; + virtual double value (const Point &p, const unsigned int component = 0) const; @@ -1459,11 +1465,34 @@ GradientEstimation::estimate (const DoFHandler &dof_handler, // but rather a static function, we // need not (and can not) pass a // ``this'' function in this case. + // + // Taking pointers to templated + // functions seems to be + // notoriously difficult for many + // compilers (since there are + // several functions with the same + // name -- just as with overloaded + // functions). It therefore happens + // quite frequently that we can't + // directly insert taking the + // address of a function in the + // call to ``encapsulate'' for one + // or the other compiler, but have + // to take a temporary variable for + // that purpose. Here, in this + // case, Compaq's ``cxx'' compiler + // choked on the code so we use the + // workaround with the function + // pointer: Threads::ThreadManager thread_manager; + void (*estimate_interval_ptr) (const DoFHandler &, + const Vector &, + const IndexInterval &, + Vector &) + = &GradientEstimation::template estimate_interval; for (unsigned int i=0; i) + Threads::encapsulate (estimate_interval_ptr) .collect_args (dof_handler, solution, index_intervals[i], error_per_cell)); // Ok, now the threads are at work, @@ -1908,7 +1937,7 @@ GradientEstimation::estimate_interval (const DoFHandler &dof_handler, // used everywhere in the // computations. Point y = neighbor_center - this_center; - const double distance = sqrt(y.square()); + const double distance = std::sqrt(y.square()); y /= distance; // Then add up the @@ -1994,9 +2023,9 @@ GradientEstimation::estimate_interval (const DoFHandler &dof_handler, Point gradient; contract (gradient, Y_inverse, projected_gradient); - *error_on_this_cell = (pow(cell->diameter(), - 1+1.0*dim/2) * - sqrt(gradient.square())); + *error_on_this_cell = (std::pow(cell->diameter(), + 1+1.0*dim/2) * + std::sqrt(gradient.square())); }; }; -- 2.39.5