From e896e5c3bddbf723d4d3e640a508ae4daaa31839 Mon Sep 17 00:00:00 2001 From: wolf Date: Wed, 20 Mar 2002 12:39:42 +0000 Subject: [PATCH] Suns Forte compiler chokes on template argument computations, like in /* ----------------------------------------------- */ /* Problem 5 -- no computations with template args */ template struct T2 {}; template T2 g(T2) {}; Fix this by introducing a new type local to the class that uses it. git-svn-id: https://svn.dealii.org/trunk@5594 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/include/base/quadrature.h | 36 +++++++++++++++------ deal.II/base/include/base/tensor_function.h | 16 ++++++--- deal.II/base/source/quadrature.cc | 8 ++--- deal.II/base/source/tensor_function.cc | 8 ++--- deal.II/doc/news/2002/c-3-3.html | 10 ++++++ 5 files changed, 57 insertions(+), 21 deletions(-) diff --git a/deal.II/base/include/base/quadrature.h b/deal.II/base/include/base/quadrature.h index de7de07aaf..efff37f7f5 100644 --- a/deal.II/base/include/base/quadrature.h +++ b/deal.II/base/include/base/quadrature.h @@ -73,6 +73,15 @@ template class Quadrature : public Subscriptor { public: + /** + * Define a typedef for a + * quadrature that acts on an + * object of one dimension + * less. For cells, this would + * then be a face quadrature. + */ + typedef Quadrature SubQuadrature; + /** * Number of quadrature points. */ @@ -90,8 +99,8 @@ class Quadrature : public Subscriptor * less than the present and a * formula in one dimension. */ - Quadrature (const Quadrature &, - const Quadrature<1> &); + Quadrature (const SubQuadrature &, + const Quadrature<1> &); /** * Construct a quadrature formula @@ -280,6 +289,15 @@ template class QProjector { public: + /** + * Define a typedef for a + * quadrature that acts on an + * object of one dimension + * less. For cells, this would + * then be a face quadrature. + */ + typedef Quadrature SubQuadrature; + /** * Compute the quadrature points * on the cell if the given @@ -288,8 +306,8 @@ class QProjector * details, see the general doc * for this class. */ - static void project_to_face (const Quadrature &quadrature, - const unsigned int face_no, + static void project_to_face (const SubQuadrature &quadrature, + const unsigned int face_no, typename std::vector > &q_points); /** @@ -301,9 +319,9 @@ class QProjector * further details, see the * general doc for this class. */ - static void project_to_subface (const Quadrature &quadrature, - const unsigned int face_no, - const unsigned int subface_no, + static void project_to_subface (const SubQuadrature &quadrature, + const unsigned int face_no, + const unsigned int subface_no, typename std::vector > &q_points); /** @@ -335,7 +353,7 @@ class QProjector * later. */ static Quadrature - project_to_all_faces (const Quadrature &quadrature); + project_to_all_faces (const SubQuadrature &quadrature); /** * This function is alike the @@ -346,7 +364,7 @@ class QProjector * faces of the unit cell. */ static Quadrature - project_to_all_subfaces (const Quadrature &quadrature); + project_to_all_subfaces (const SubQuadrature &quadrature); /** * Project a give quadrature diff --git a/deal.II/base/include/base/tensor_function.h b/deal.II/base/include/base/tensor_function.h index 5840f901cb..5b23bee0b4 100644 --- a/deal.II/base/include/base/tensor_function.h +++ b/deal.II/base/include/base/tensor_function.h @@ -55,6 +55,14 @@ class TensorFunction : public FunctionTime, public Subscriptor { public: + /** + * Define typedefs for the return + * types of the @p{value} and the + * @p{gradient} functions. + */ + typedef Tensor value_type; + typedef Tensor gradient_type; + /** * Constructor. May take an * initial value for the time @@ -77,7 +85,7 @@ class TensorFunction : public FunctionTime, * Return the value of the function * at the given point. */ - virtual Tensor value (const Point &p) const; + virtual value_type value (const Point &p) const; /** * Set @p{values} to the point @@ -88,13 +96,13 @@ class TensorFunction : public FunctionTime, * size as the @p{points} array. */ virtual void value_list (const typename std::vector > &points, - typename std::vector > &values) const; + typename std::vector &values) const; /** * Return the gradient of the * function at the given point. */ - virtual Tensor gradient (const Point &p) const; + virtual gradient_type gradient (const Point &p) const; /** * Set @p{gradients} to the @@ -105,7 +113,7 @@ class TensorFunction : public FunctionTime, * size as the @p{points} array. */ virtual void gradient_list (const typename std::vector > &points, - typename std::vector > &gradients) const; + typename std::vector &gradients) const; /** * Exception diff --git a/deal.II/base/source/quadrature.cc b/deal.II/base/source/quadrature.cc index 3b62588d5d..c43175d15c 100644 --- a/deal.II/base/source/quadrature.cc +++ b/deal.II/base/source/quadrature.cc @@ -96,8 +96,8 @@ Quadrature<1>::Quadrature (const Quadrature<0> &, template -Quadrature::Quadrature (const Quadrature &q1, - const Quadrature<1> &q2) : +Quadrature::Quadrature (const SubQuadrature &q1, + const Quadrature<1> &q2) : n_quadrature_points (q1.n_quadrature_points * q2.n_quadrature_points), quadrature_points (n_quadrature_points), @@ -575,7 +575,7 @@ QProjector<1>::project_to_all_faces (const Quadrature<0> &) template Quadrature -QProjector::project_to_all_faces (const Quadrature &quadrature) +QProjector::project_to_all_faces (const SubQuadrature &quadrature) { const unsigned int n_points = quadrature.n_quadrature_points, n_faces = GeometryInfo::faces_per_cell; @@ -616,7 +616,7 @@ QProjector<1>::project_to_all_subfaces (const Quadrature<0> &) template Quadrature -QProjector::project_to_all_subfaces (const Quadrature &quadrature) +QProjector::project_to_all_subfaces (const SubQuadrature &quadrature) { const unsigned int n_points = quadrature.n_quadrature_points, n_faces = GeometryInfo::faces_per_cell, diff --git a/deal.II/base/source/tensor_function.cc b/deal.II/base/source/tensor_function.cc index 68333f88b6..8cfcb2f75b 100644 --- a/deal.II/base/source/tensor_function.cc +++ b/deal.II/base/source/tensor_function.cc @@ -36,7 +36,7 @@ TensorFunction::~TensorFunction () template -Tensor +typename TensorFunction::value_type TensorFunction::value (const Point &) const { Assert (false, ExcPureFunctionCalled()); @@ -53,7 +53,7 @@ using namespace std; template void TensorFunction::value_list (const typename std::vector > &points, - typename std::vector > &values) const + typename std::vector &values) const { Assert (values.size() == points.size(), ExcDimensionMismatch(values.size(), points.size())); @@ -64,7 +64,7 @@ TensorFunction::value_list (const typename std::vector > & template -Tensor +typename TensorFunction::gradient_type TensorFunction::gradient (const Point &) const { Assert (false, ExcPureFunctionCalled()); @@ -75,7 +75,7 @@ TensorFunction::gradient (const Point &) const template void TensorFunction::gradient_list (const typename std::vector > &points, - typename std::vector > &gradients) const + typename std::vector &gradients) const { Assert (gradients.size() == points.size(), ExcDimensionMismatch(gradients.size(), points.size())); diff --git a/deal.II/doc/news/2002/c-3-3.html b/deal.II/doc/news/2002/c-3-3.html index 50c65dc3cd..5c1003c90f 100644 --- a/deal.II/doc/news/2002/c-3-3.html +++ b/deal.II/doc/news/2002/c-3-3.html @@ -78,6 +78,16 @@ contributor's names are abbreviated by WB (Wolfgang Bangerth), GK

base

    +
  1. + Fixed: The class TensorFunction + now uses local types value_type and + gradient_type as return values of + its member functions. This works around a bug in Sun's Forte + C++ compilers. +
    + (WB 2002/03/20) +

    +
  2. Improved: The AssertThrow macro now uses __builtin_expect if the -- 2.39.5