David, if you look at step-33
On Monday, May 23, 2016 at 6:59:27 AM UTC-4, David wrote: > > Thanks for your help. But I have already looked at step 29 -33, the > question is I don't quite understand it. Just look at this small piece of > code: > > Tensor<2,dim> > <https://www.dealii.org/8.4.0/doxygen/deal.II/classTensor.html> grad_u; > > for (unsigned int d=0; d<dim; ++d) > > grad_u[d] = duh[q][d]; > > here, grad_u is declared as a 2nd order tensor, namely a matrix. But after > the for loop, grad_u is only filled with a vector. > > duh is a vector<vector<Tensor<1,dim>> so duh[q][d] is a a vector. You are filling each row of the matrix with a vector which works. uh has two components so: duh[q][0] = (duh[0]/dx, duh[0]/dy) duh[q][1] = (duh[1]/dx, duh[1]/dy) Best, Bruno -- The deal.II project is located at http://www.dealii.org/ For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en --- You received this message because you are subscribed to the Google Groups "deal.II User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
