*/
typedef typename Tensor<rank_-1,dim,Number>::array_type
array_type[(dim != 0) ? dim : 1];
+ // ... avoid a compiler warning in case of dim == 0 and ensure that the
+ // array always has positive size.
/**
* Constructor. Initialize all entries to zero if
* Array of tensors holding the subelements.
*/
Tensor<rank_-1, dim, Number> values[(dim != 0) ? dim : 1];
+ // ... avoid a compiler warning in case of dim == 0 and ensure that the
+ // array always has positive size.
/**
* Help function for unroll.
inline
Tensor<0,dim,Number>::operator Number &()
{
+ Assert(dim != 0, ExcMessage("Cannot access an object of type Tensor<0,0,Number>"));
return value;
}
inline
Tensor<0,dim,Number>::operator const Number &() const
{
+ Assert(dim != 0, ExcMessage("Cannot access an object of type Tensor<0,0,Number>"));
return value;
}
typename Tensor<0,dim,Number>::real_type
Tensor<0,dim,Number>::norm () const
{
+ Assert(dim != 0, ExcMessage("Cannot access an object of type Tensor<0,0,Number>"));
return numbers::NumberTraits<Number>::abs (value);
}
typename Tensor<0,dim,Number>::real_type
Tensor<0,dim,Number>::norm_square () const
{
+ Assert(dim != 0, ExcMessage("Cannot access an object of type Tensor<0,0,Number>"));
return numbers::NumberTraits<Number>::abs_square (value);
}
Tensor<0, dim, Number>::unroll_recursion (Vector<OtherNumber> &result,
unsigned int &index) const
{
+ Assert(dim != 0, ExcMessage("Cannot unroll an object of type Tensor<0,0,Number>"));
result[index] = value;
++index;
}
typename Tensor<rank_,dim,Number>::value_type &
Tensor<rank_,dim,Number>::operator[] (const unsigned int i)
{
+ Assert(dim != 0, ExcMessage("Cannot access an object of type Tensor<rank_,0,Number>"));
Assert (i<dim, ExcIndexRange(i, 0, dim));
return values[i];
}
const typename Tensor<rank_,dim,Number>::value_type &
Tensor<rank_,dim,Number>::operator[] (const unsigned int i) const
{
+ Assert(dim != 0, ExcMessage("Cannot access an object of type Tensor<rank_,0,Number>"));
Assert (i<dim, ExcIndexRange(i, 0, dim));
return values[i];
}
Number
Tensor<rank_,dim,Number>::operator[] (const TableIndices<rank_> &indices) const
{
+ Assert(dim != 0, ExcMessage("Cannot access an object of type Tensor<rank_,0,Number>"));
Assert (indices[0]<dim, ExcIndexRange (indices[0], 0, dim));
return internal::TensorIndicesHelper<rank_>::extract(*this, indices);
}
Number &
Tensor<rank_,dim,Number>::operator[] (const TableIndices<rank_> &indices)
{
+ Assert(dim != 0, ExcMessage("Cannot access an object of type Tensor<rank_,0,Number>"));
Assert (indices[0]<dim, ExcIndexRange (indices[0], 0, dim));
return internal::TensorIndicesHelper<rank_>::extract(*this, indices);
}