* <tt>symmetrize</tt> function first. If you aren't sure, it is good
* practice to check before calling <tt>symmetrize</tt>.
*/
- SymmetricTensor (const Tensor<2,dim,Number> &t);
+ explicit SymmetricTensor (const Tensor<2,dim,Number> &t);
/**
* A constructor that creates a symmetric tensor from an array holding its
/**
* Constructor, where the data is copied from a C-style array.
*/
- Tensor (const array_type &initializer);
+ explicit Tensor (const array_type &initializer);
/**
* Constructor from tensors with different underlying scalar type. This
Tensor<rank_,dim,Number>::Tensor (const array_type &initializer)
{
for (unsigned int i=0; i<dim; ++i)
- values[i] = initializer[i];
+ values[i] = Tensor<rank_-1, dim, Number>(initializer[i]);
}
Tensor<rank_,dim,Number>::Tensor (const Tensor<rank_,dim,OtherNumber> &initializer)
{
for (unsigned int i=0; i!=dim; ++i)
- values[i] = initializer[i];
+ values[i] = Tensor<rank_-1,dim,Number>(initializer[i]);
}
s[i][j] = (i+1) * (j+1);
Tensor<2,dim> t = s;
- SymmetricTensor<2,dim> u = t;
+ SymmetricTensor<2,dim> u (t);
for (unsigned int i=0; i<dim; ++i)
for (unsigned int j=0; j<dim; ++j)
}
{
- dealii::Tensor<1,2,float> f = { {1., 2.} };
- dealii::Tensor<1,2,double> d = { {4., 8.} };
- dealii::Tensor<1,2,std::complex<double> > c = { {16., 32.} };
+ dealii::Tensor<1,2,float> f ({1., 2.});
+ dealii::Tensor<1,2,double> d ({4., 8.});
+ dealii::Tensor<1,2,std::complex<double> > c ({16., 32.});
deallog << f + d << std::endl;
deallog << f - d << std::endl;
}
{
- dealii::Tensor<1,3,float> f = { {1., 2., 4.} };
- dealii::Tensor<1,3,double> d = { {4., 8., 16.} };
- dealii::Tensor<1,3,std::complex<double> > c = { {32., 64., 128.} };
+ dealii::Tensor<1,3,float> f ({1., 2., 4.});
+ dealii::Tensor<1,3,double> d ({4., 8., 16.});
+ dealii::Tensor<1,3,std::complex<double> > c ({32., 64., 128.});
deallog << f + d << std::endl;
deallog << f - d << std::endl;
AssertThrow (fe_values[vec_components].symmetric_gradient (i,q)
==
- (fe_values[vec_components].gradient(i,q) +
- transpose(fe_values[vec_components].gradient(i,q)))/2,
+ decltype(fe_values[vec_components].symmetric_gradient (i,q))
+ ( (fe_values[vec_components].gradient(i,q) +
+ transpose(fe_values[vec_components].gradient(i,q)))/2 ),
ExcInternalError());
AssertThrow (fe_values[vec_components].hessian (i,q)[d]
AssertThrow (fe_values[vec_components].symmetric_gradient (i,q)
==
- (fe_values[vec_components].gradient(i,q) +
- transpose(fe_values[vec_components].gradient(i,q)))/2,
+ decltype(fe_values[vec_components].symmetric_gradient (i,q))
+ ( (fe_values[vec_components].gradient(i,q) +
+ transpose(fe_values[vec_components].gradient(i,q)))/2 ),
ExcInternalError());
AssertThrow (fe_values[vec_components].hessian (i,q)[d]
{2., 5., 6.},
{3., 6., 9.}
};
- SymmetricTensor<rank,dim> t1(a1);
+ SymmetricTensor<rank,dim> t1((Tensor<rank,dim>(a1)));
double a2[3][3] = {{10., 11., 12.},
{11., 14., 15.},
{12., 15., 18.}
};
- SymmetricTensor<rank,dim> t2(a2);
+ SymmetricTensor<rank,dim> t2((Tensor<rank,dim>(a2)));
verify (t1, t2);
}
int main ()
{
- std::ofstream logfile("output");
- deallog << std::setprecision(3);
- deallog.attach(logfile);
+ initlog();
test ();