From 846d28409287fa5ce51f38d6eb0850ac88d70fd3 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 21 Aug 2000 00:40:33 +0000 Subject: [PATCH] Doc updates. git-svn-id: https://svn.dealii.org/trunk@3263 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/include/base/point.h | 96 ++++++++++++++++++------- deal.II/base/include/base/tensor_base.h | 26 +++++++ 2 files changed, 97 insertions(+), 25 deletions(-) diff --git a/deal.II/base/include/base/point.h b/deal.II/base/include/base/point.h index a5f09cba67..c094c31ca8 100644 --- a/deal.II/base/include/base/point.h +++ b/deal.II/base/include/base/point.h @@ -156,148 +156,194 @@ class Point : public Tensor<1,dim> template inline Point::Point (const bool initialize) : - Tensor<1,dim>(initialize) {}; + Tensor<1,dim>(initialize) +{}; + template inline Point::Point (const Tensor<1,dim> &t) : - Tensor<1,dim>(t) {}; + Tensor<1,dim>(t) +{}; + template <> inline -Point<1>::Point (const double x) { +Point<1>::Point (const double x) +{ values[0] = x; }; + template <> inline -Point<1>::Point (const double, const double) { +Point<1>::Point (const double, const double) +{ Assert (false, ExcInvalidConstructorCalled()); }; + template <> inline -Point<1>::Point (const double, const double, const double) { +Point<1>::Point (const double, const double, const double) +{ Assert (false, ExcInvalidConstructorCalled()); }; template <> inline -Point<2>::Point (const double x, const double y) { +Point<2>::Point (const double x, const double y) +{ values[0] = x; values[1] = y; }; + template <> inline -Point<2>::Point (const double, const double, const double) { +Point<2>::Point (const double, const double, const double) +{ Assert (false, ExcInvalidConstructorCalled()); }; + template <> inline -Point<3>::Point (const double, const double) { +Point<3>::Point (const double, const double) +{ Assert (false, ExcInvalidConstructorCalled()); }; + template <> inline -Point<3>::Point (const double x, const double y, const double z) { +Point<3>::Point (const double x, const double y, const double z) +{ values[0] = x; values[1] = y; values[2] = z; }; + template <> inline -Point<4>::Point (const double, const double) { +Point<4>::Point (const double, const double) +{ Assert (false, ExcInvalidConstructorCalled()); }; + template <> inline -Point<4>::Point (const double, const double, const double) { +Point<4>::Point (const double, const double, const double) +{ Assert (false, ExcInvalidConstructorCalled()); }; + template inline -double Point::operator () (const unsigned int index) const { +double Point::operator () (const unsigned int index) const + { Assert (index inline -double & Point::operator () (const unsigned int index) { +double & Point::operator () (const unsigned int index) +{ Assert (index inline -Point Point::operator + (const Point &p) const { +Point Point::operator + (const Point &p) const +{ return (Point(*this) += p); }; + template inline -Point Point::operator - (const Point &p) const { +Point Point::operator - (const Point &p) const +{ return (Point(*this) -= p); }; + template inline -Point Point::operator * (const double factor) const { +Point Point::operator * (const double factor) const +{ return (Point(*this) *= factor); }; + template inline -double Point::operator * (const Point &p) const { +double Point::operator * (const Point &p) const +{ // simply pass down return Tensor<1,dim>::operator * (p); }; + + template inline -Point operator * (const double factor, const Point &p) { - return p*factor; +double Point::square () const +{ + double q=0; + for (unsigned int i=0; i inline -Point Point::operator / (const double factor) const { +Point Point::operator / (const double factor) const +{ return (Point(*this) /= factor); }; + +/*------------------------------- Global functions: Point ---------------------------*/ + + +/** + * Global operator scaling a point vector by a scalar. + */ template inline -double Point::square () const { - double q=0; - for (unsigned int i=0; i operator * (const double factor, const Point &p) +{ + return p*factor; }; + #endif diff --git a/deal.II/base/include/base/tensor_base.h b/deal.II/base/include/base/tensor_base.h index d34c4f3f5a..39d48df790 100644 --- a/deal.II/base/include/base/tensor_base.h +++ b/deal.II/base/include/base/tensor_base.h @@ -270,6 +270,7 @@ Tensor<1,dim>::Tensor (const bool initialize) }; + template inline Tensor<1,dim>::Tensor (const array_type &initializer) @@ -279,6 +280,7 @@ Tensor<1,dim>::Tensor (const array_type &initializer) }; + template inline Tensor<1,dim>::Tensor (const Tensor<1,dim> &p) @@ -288,6 +290,7 @@ Tensor<1,dim>::Tensor (const Tensor<1,dim> &p) }; + template inline double Tensor<1,dim>::operator [] (const unsigned int index) const @@ -297,6 +300,7 @@ double Tensor<1,dim>::operator [] (const unsigned int index) const }; + template inline double & Tensor<1,dim>::operator [] (const unsigned int index) @@ -306,6 +310,7 @@ double & Tensor<1,dim>::operator [] (const unsigned int index) }; + template inline Tensor<1,dim> & Tensor<1,dim>::operator = (const Tensor<1,dim> &p) @@ -316,6 +321,7 @@ Tensor<1,dim> & Tensor<1,dim>::operator = (const Tensor<1,dim> &p) }; + template inline bool Tensor<1,dim>::operator == (const Tensor<1,dim> &p) const @@ -326,6 +332,7 @@ bool Tensor<1,dim>::operator == (const Tensor<1,dim> &p) const }; + template inline bool Tensor<1,dim>::operator != (const Tensor<1,dim> &p) const @@ -334,6 +341,7 @@ bool Tensor<1,dim>::operator != (const Tensor<1,dim> &p) const }; + template inline Tensor<1,dim> & Tensor<1,dim>::operator += (const Tensor<1,dim> &p) @@ -344,6 +352,7 @@ Tensor<1,dim> & Tensor<1,dim>::operator += (const Tensor<1,dim> &p) }; + template inline Tensor<1,dim> & Tensor<1,dim>::operator -= (const Tensor<1,dim> &p) @@ -354,6 +363,7 @@ Tensor<1,dim> & Tensor<1,dim>::operator -= (const Tensor<1,dim> &p) }; + template inline Tensor<1,dim> & Tensor<1,dim>::operator *= (const double &s) @@ -364,6 +374,7 @@ Tensor<1,dim> & Tensor<1,dim>::operator *= (const double &s) }; + template inline Tensor<1,dim> & Tensor<1,dim>::operator /= (const double &s) @@ -374,6 +385,7 @@ Tensor<1,dim> & Tensor<1,dim>::operator /= (const double &s) }; + template inline double Tensor<1,dim>::operator * (const Tensor<1,dim> &p) const @@ -385,6 +397,7 @@ double Tensor<1,dim>::operator * (const Tensor<1,dim> &p) const }; + template inline Tensor<1,dim> Tensor<1,dim>::operator + (const Tensor<1,dim> &p) const @@ -393,6 +406,7 @@ Tensor<1,dim> Tensor<1,dim>::operator + (const Tensor<1,dim> &p) const }; + template inline Tensor<1,dim> Tensor<1,dim>::operator - (const Tensor<1,dim> &p) const @@ -401,6 +415,7 @@ Tensor<1,dim> Tensor<1,dim>::operator - (const Tensor<1,dim> &p) const }; + template inline void Tensor<1,dim>::clear () @@ -410,6 +425,11 @@ void Tensor<1,dim>::clear () }; + +/** + * Output operator for tensors of rank 1. Print the elements + * consecutively, with a space in between. + */ template inline ostream & operator << (ostream &out, const Tensor<1,dim> &p) @@ -422,6 +442,12 @@ ostream & operator << (ostream &out, const Tensor<1,dim> &p) }; + +/** + * Output operator for tensors of rank 1 and dimension 1. This is + * implemented specialized from the general template in order to avoid + * a compiler warning that the loop is empty. + */ template <> inline ostream & operator << (ostream &out, const Tensor<1,1> &p) -- 2.39.5