switch (dim)
{
case 1:
- tmp.data[0] = Number(1);
+ tmp.data[0] = internal::NumberType<Number>::value(1);
break;
case 2:
- tmp.data[0] = tmp.data[1] = Number(1);
+ tmp.data[0] = tmp.data[1] = internal::NumberType<Number>::value(1);
break;
case 3:
- tmp.data[0] = tmp.data[1] = tmp.data[2] = Number(1);
+ tmp.data[0] = tmp.data[1] = tmp.data[2] =
+ internal::NumberType<Number>::value(1);
break;
default:
for (unsigned int d = 0; d < dim; ++d)
- tmp.data[d] = Number(1);
+ tmp.data[d] = internal::NumberType<Number>::value(1);
}
return tmp;
}
// fill the elements treating the diagonal
for (unsigned int i = 0; i < dim; ++i)
for (unsigned int j = 0; j < dim; ++j)
- tmp.data[i][j] = Number((i == j ? 1 : 0) - 1. / dim);
+ tmp.data[i][j] =
+ internal::NumberType<Number>::value((i == j ? 1 : 0) - 1. / dim);
// then fill the ones that copy over the
// non-diagonal elements. note that during
i < internal::SymmetricTensorAccessors::StorageType<4, dim, Number>::
n_rank2_components;
++i)
- tmp.data[i][i] = Number(0.5);
+ tmp.data[i][i] = internal::NumberType<Number>::value(0.5);
return tmp;
}
// fill the elements treating the diagonal
for (unsigned int i = 0; i < dim; ++i)
- tmp.data[i][i] = Number(1);
+ tmp.data[i][i] = internal::NumberType<Number>::value(1);
// then fill the ones that copy over the
// non-diagonal elements. note that during
i < internal::SymmetricTensorAccessors::StorageType<4, dim, Number>::
n_rank2_components;
++i)
- tmp.data[i][i] = Number(0.5);
+ tmp.data[i][i] = internal::NumberType<Number>::value(0.5);
return tmp;
}
// (as well as with switched arguments and double<->float).
using product_type = typename ProductType<Number, OtherNumber>::type;
SymmetricTensor<rank_, dim, product_type> tt(t);
- tt *= product_type(factor);
+ tt *= internal::NumberType<product_type>::value(factor);
return tt;
}
operator/(const SymmetricTensor<rank_, dim, Number> &t,
const OtherNumber & factor)
{
- SymmetricTensor<rank_, dim, typename ProductType<Number, OtherNumber>::type>
- tt = t;
- tt /= factor;
+ using product_type = typename ProductType<Number, OtherNumber>::type;
+ SymmetricTensor<rank_, dim, product_type> tt = t;
+ tt /= internal::NumberType<product_type>::value(factor);
return tt;
}