/**
* Fill a vector with all tensor elements.
*
- * Thsi function unrolls all
+ * This function unrolls all
* tensor entries into a single,
* linearly numbered vector. As
* usual in C++, the rightmost
/*--------------------------- Inline functions -----------------------------*/
+// in the following, declarations of operators look rather weird because they are
+// split over several lines. this is necessary, however, because otherwise doc++
+// gets really confused about this all... :-(
template <int rank_, int dim>
template <int rank_, int dim>
inline
Tensor<rank_-1,dim> &
-Tensor<rank_,dim>::operator[] (const unsigned int i) {
+Tensor<rank_,dim>::
+operator[] (const unsigned int i) {
Assert (i<dim, ExcInvalidIndex(i));
return subtensor[i];
template <int rank_, int dim>
inline
const Tensor<rank_-1,dim> &
-Tensor<rank_,dim>::operator[] (const unsigned int i) const {
+Tensor<rank_,dim>::
+operator[] (const unsigned int i) const {
Assert (i<dim, ExcInvalidIndex(i));
return subtensor[i];
template <int rank_, int dim>
inline
-Tensor<rank_,dim> & Tensor<rank_,dim>::operator = (const Tensor<rank_,dim> &t) {
+Tensor<rank_,dim> &
+Tensor<rank_,dim>::
+operator = (const Tensor<rank_,dim> &t) {
for (unsigned int i=0; i<dim; ++i)
subtensor[i] = t.subtensor[i];
return *this;
template <int rank_, int dim>
inline
-bool Tensor<rank_,dim>::operator == (const Tensor<rank_,dim> &p) const {
+bool
+Tensor<rank_,dim>::
+operator == (const Tensor<rank_,dim> &p) const {
for (unsigned int i=0; i<dim; ++i)
if (subtensor[i] != p.subtensor[i]) return false;
return true;
template <int rank_, int dim>
inline
-bool Tensor<rank_,dim>::operator != (const Tensor<rank_,dim> &p) const {
+bool
+Tensor<rank_,dim>::
+operator != (const Tensor<rank_,dim> &p) const {
return !((*this) == p);
};
template <int rank_, int dim>
inline
-Tensor<rank_,dim> & Tensor<rank_,dim>::operator += (const Tensor<rank_,dim> &p) {
+Tensor<rank_,dim> &
+Tensor<rank_,dim>::
+operator += (const Tensor<rank_,dim> &p) {
for (unsigned int i=0; i<dim; ++i)
subtensor[i] += p.subtensor[i];
return *this;
template <int rank_, int dim>
inline
-Tensor<rank_,dim> & Tensor<rank_,dim>::operator -= (const Tensor<rank_,dim> &p) {
+Tensor<rank_,dim> &
+Tensor<rank_,dim>::
+operator -= (const Tensor<rank_,dim> &p) {
for (unsigned int i=0; i<dim; ++i)
subtensor[i] -= p.subtensor[i];
return *this;
template <int rank_, int dim>
inline
-Tensor<rank_,dim> & Tensor<rank_,dim>::operator *= (const double &s) {
+Tensor<rank_,dim> &
+Tensor<rank_,dim>::
+operator *= (const double &s) {
for (unsigned int i=0; i<dim; ++i)
subtensor[i] *= s;
return *this;
template <int rank_, int dim>
inline
-Tensor<rank_,dim> & Tensor<rank_,dim>::operator /= (const double &s) {
+Tensor<rank_,dim> &
+Tensor<rank_,dim>::
+operator /= (const double &s) {
for (unsigned int i=0; i<dim; ++i)
subtensor[i] /= s;
return *this;
template <int rank_, int dim>
inline
Tensor<rank_,dim>
-Tensor<rank_,dim>::operator + (const Tensor<rank_,dim> &t) const {
+Tensor<rank_,dim>::
+operator + (const Tensor<rank_,dim> &t) const {
Tensor<rank_,dim> tmp(*this);
for (unsigned int i=0; i<dim; ++i)
template <int rank_, int dim>
inline
Tensor<rank_,dim>
-Tensor<rank_,dim>::operator - (const Tensor<rank_,dim> &t) const {
+Tensor<rank_,dim>::
+operator - (const Tensor<rank_,dim> &t) const {
Tensor<rank_,dim> tmp(*this);
for (unsigned int i=0; i<dim; ++i)
/*------------------------------- Inline functions: Tensor ---------------------------*/
+// in the following, declarations of operators look rather weird because they are
+// split over several lines. this is necessary, however, because otherwise doc++
+// gets really confused about this all... :-(
+
template <int dim>
template <int dim>
inline
-double Tensor<1,dim>::operator [] (const unsigned int index) const {
+double Tensor<1,dim>::
+operator [] (const unsigned int index) const {
Assert (index<dim, ExcInvalidIndex (index));
return values[index];
};
template <int dim>
inline
-double & Tensor<1,dim>::operator [] (const unsigned int index) {
+double & Tensor<1,dim>::
+operator [] (const unsigned int index) {
Assert (index<dim, ExcInvalidIndex (index));
return values[index];
};
template <int dim>
inline
-Tensor<1,dim> & Tensor<1,dim>::operator = (const Tensor<1,dim> &p) {
+Tensor<1,dim> & Tensor<1,dim>::
+operator = (const Tensor<1,dim> &p) {
for (unsigned int i=0; i<dim; ++i)
values[i] = p.values[i];
return *this;
template <int dim>
inline
-bool Tensor<1,dim>::operator == (const Tensor<1,dim> &p) const {
+bool Tensor<1,dim>::
+operator == (const Tensor<1,dim> &p) const {
for (unsigned int i=0; i<dim; ++i)
if (values[i] != p.values[i]) return false;
return true;
template <int dim>
inline
-bool Tensor<1,dim>::operator != (const Tensor<1,dim> &p) const {
+bool Tensor<1,dim>::
+operator != (const Tensor<1,dim> &p) const {
return !((*this) == p);
};
template <int dim>
inline
-Tensor<1,dim> & Tensor<1,dim>::operator += (const Tensor<1,dim> &p) {
+Tensor<1,dim> & Tensor<1,dim>::
+operator += (const Tensor<1,dim> &p) {
for (unsigned int i=0; i<dim; ++i)
values[i] += p.values[i];
return *this;
template <int dim>
inline
-Tensor<1,dim> & Tensor<1,dim>::operator -= (const Tensor<1,dim> &p) {
+Tensor<1,dim> & Tensor<1,dim>::
+operator -= (const Tensor<1,dim> &p) {
for (unsigned int i=0; i<dim; ++i)
values[i] -= p.values[i];
return *this;
template <int dim>
inline
-Tensor<1,dim> & Tensor<1,dim>::operator *= (const double &s) {
+Tensor<1,dim> & Tensor<1,dim>::
+operator *= (const double &s) {
for (unsigned int i=0; i<dim; ++i)
values[i] *= s;
return *this;
template <int dim>
inline
-Tensor<1,dim> & Tensor<1,dim>::operator /= (const double &s) {
+Tensor<1,dim> & Tensor<1,dim>::
+operator /= (const double &s) {
for (unsigned int i=0; i<dim; ++i)
values[i] /= s;
return *this;
template <int dim>
inline
-double Tensor<1,dim>::operator * (const Tensor<1,dim> &p) const {
+double Tensor<1,dim>::
+operator * (const Tensor<1,dim> &p) const {
double q=0;
for (unsigned int i=0; i<dim; ++i)
q += values[i] * p.values[i];
template <int dim>
inline
-Tensor<1,dim> Tensor<1,dim>::operator + (const Tensor<1,dim> &p) const {
+Tensor<1,dim> Tensor<1,dim>::
+operator + (const Tensor<1,dim> &p) const {
return (Tensor<1,dim>(*this) += p);
};
template <int dim>
inline
-Tensor<1,dim> Tensor<1,dim>::operator - (const Tensor<1,dim> &p) const {
+Tensor<1,dim> Tensor<1,dim>::
+operator - (const Tensor<1,dim> &p) const {
return (Tensor<1,dim>(*this) -= p);
};