// $Id$
// Version: $Name$
//
-// Copyright (C) 2005 by the deal.II authors
+// Copyright (C) 2005, 2006 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
*/
SymmetricTensor & operator = (const SymmetricTensor &);
+ /**
+ * This operator assigns a scalar
+ * to a tensor. To avoid
+ * confusion with what exactly it
+ * means to assign a scalar value
+ * to a tensor, zero is the only
+ * value allowed for <tt>d</tt>,
+ * allowing the intuitive
+ * notation <tt>t=0</tt> to reset
+ * all elements of the tensor to
+ * zero.
+ */
+ SymmetricTensor & operator = (const double d);
+
/**
* Convert the present symmetric tensor
* into a full tensor with the same
+template <int rank, int dim>
+inline
+SymmetricTensor<rank,dim> &
+SymmetricTensor<rank,dim>::operator = (const double d)
+{
+ Assert (d==0, ExcMessage ("Only assignment with zero is allowed"));
+
+ data = 0;
+
+ return *this;
+}
+
+
+
template <>
inline
SymmetricTensor<2,1>::
// $Id$
// Version: $Name$
//
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 by the deal.II authors
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
*/
Tensor & operator = (const Tensor<rank_,dim> &);
- /**
+ /**
+ * This operator assigns a scalar
+ * to a tensor. To avoid
+ * confusion with what exactly it
+ * means to assign a scalar value
+ * to a tensor, zero is the only
+ * value allowed for <tt>d</tt>,
+ * allowing the intuitive
+ * notation <tt>t=0</tt> to reset
+ * all elements of the tensor to
+ * zero.
+ */
+ Tensor<rank_,dim> & operator = (const double d);
+
+ /**
* Test for equality of two tensors.
*/
bool operator == (const Tensor<rank_,dim> &) const;
}
+
+template <int rank_, int dim>
+inline
+Tensor<rank_,dim> &
+Tensor<rank_,dim>::operator = (const double d)
+{
+ Assert (d==0, ExcMessage ("Only assignment with zero is allowed"));
+
+ for (unsigned int i=0; i<dim; ++i)
+ subtensor[i] = 0;
+ return *this;
+}
+
+
+
template <int rank_, int dim>
inline
bool
// $Id$
// Version: $Name$
//
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 by the deal.II authors
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
*/
Tensor<1,dim> & operator = (const Tensor<1,dim> &);
+ /**
+ * This operator assigns a scalar
+ * to a tensor. To avoid
+ * confusion with what exactly it
+ * means to assign a scalar value
+ * to a tensor, zero is the only
+ * value allowed for <tt>d</tt>,
+ * allowing the intuitive
+ * notation <tt>t=0</tt> to reset
+ * all elements of the tensor to
+ * zero.
+ */
+ Tensor<1,dim> & operator = (const double d);
+
/**
* Test for equality of two
* tensors.
+template <int dim>
+inline
+Tensor<1,dim> & Tensor<1,dim>::operator = (const double d)
+{
+ Assert (d==0, ExcMessage ("Only assignment with zero is allowed"));
+
+ for (unsigned int i=0; i<dim; ++i)
+ values[i] = 0;
+
+ return *this;
+}
+
+
+
template <int dim>
inline
bool Tensor<1,dim>::operator == (const Tensor<1,dim> &p) const
<ol>
+ <li> <p> New: The various tensor classes can now effectively be reset to zero
+ by simply writing <code>t=0;</code> as has long been allowed for
+ matrices and vectors.
+ <br>
+ (WB 2006/03/24)
+ </p>
+
<li> <p> New: The new <code
class="member">deal_II_numbers::is_finite</code> function can
be used to check whether a floating point number is finite,