Re: [deal.II] Store data from a Tensor<1, dim> to a Vector

2021-12-07 Thread Judy Lee
Dear Matthias, Thanks so much for your reply. Your comment and Dr. Bangerth's comment both exactly pointed out the problems in my settings on the scalar "Vector cell_x(dofs_per_cell)", and the rank-1 tensor "std::vector> x(dofs_per_cell)", which multiply the scalar "fe_values.shape_value(i, q

Re: [deal.II] Store data from a Tensor<1, dim> to a Vector

2021-12-07 Thread Matthias Maier
Dear Judy, On Tue, Dec 7, 2021, at 11:45 CST, Judy Lee wrote: > cell_x(i) += fe_values.shape_value(i, q_index) * x(i); Here, you are multiplying a scalar (fe_values.shape_value(i, q_index)) and a rank-1 tensor (x(i)), which results in a rank-1 tensor. The error message says that you cannot st

Re: [deal.II] Store data from a Tensor<1, dim> to a Vector

2021-12-07 Thread Judy Lee
Good morning! Dr. Bangerth, Thanks so much for your reply. Yes, your comment exactly pointed out the problem in my declaration that "std::vector> x(dofs_per_cell)" should be created with a size parameter. Now I can output "x[i]" to show vertices of each cell. This is amazing! May I ask a fol

Re: [deal.II] Store data from a Tensor<1, dim> to a Vector

2021-12-07 Thread Wolfgang Bangerth
On 12/7/21 03:30, Judy Lee wrote: But how to use "Point x" for computing with other variables together? Like, I cannot implement "x * fe_values.shape_value(i, q_index)". However, it does not work thru if I tried like this: std::vector> x; for (const unsigned int i: fe_values.dof_indices()))

[deal.II] Store data from a Tensor<1, dim> to a Vector

2021-12-07 Thread Judy Lee
Hello everyone! Can I create "Vector x(n)", to store data values from a Tensor<1, dim> or Point, for physical coordinate after mesh/grid? I can create "Point x", to store data values from a Tensor<1, dim>, it works thru like: Point x; for (const unsigned int i: fe_values.dof_indices())) { x = c