From ebd3cce7eb004d5924c4676d17f7d61a3aa9c918 Mon Sep 17 00:00:00 2001 From: Guido Kanschat Date: Mon, 5 Mar 2001 11:16:05 +0000 Subject: [PATCH] << for tensors of arbitrary rank git-svn-id: https://svn.dealii.org/trunk@4098 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/include/base/tensor.h | 31 ++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) 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]}. -- 2.39.5