From: guido Date: Mon, 5 Mar 2001 11:16:05 +0000 (+0000) Subject: << for tensors of arbitrary rank X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f4f9a9919714847303dd66c5169c07fe0a62ad67;p=dealii-svn.git << for tensors of arbitrary rank git-svn-id: https://svn.dealii.org/trunk@4098 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/base/include/base/tensor.h b/deal.II/base/include/base/tensor.h index 5b4ea1fece..1656ed9af2 100644 --- a/deal.II/base/include/base/tensor.h +++ b/deal.II/base/include/base/tensor.h @@ -397,6 +397,37 @@ DeclException1 (ExcInvalidTensorIndex, << "Invalid tensor index " << arg1); +/** + * Output operator for tensors. Print the elements consecutively, with + * a space in between, two spaces between rank 1 subtensors, three + * between rank 2 and so on. + */ +template +inline +std::ostream & operator << (std::ostream &out, const Tensor &p) +{ + for (unsigned int i=0; i +inline +std::ostream & operator << (std::ostream &out, const Tensor &p) +{ + out << p[0]; + + return out; +}; + + + /** * Contract a tensor of rank 1 with a tensor of rank 1. The result is * @p{sum_j src1[j] src2[j]}.