Dear Daniel,

Ok, I think I got it to work now, can you verify that it is correct or if I 
have missed something crucial.

  std::vector<double>       x,y,z;
  x.resize (dof_handler_scalar.n_dofs());
  y.resize (dof_handler_scalar.n_dofs());
  z.resize (dof_handler_scalar.n_dofs());

 Quadrature<dim> quadrature_formula(fe_scalar.get_unit_support_points());

 FEValues<dim> fe_values (fe, quadrature_formula,
                          update_values | update_quadrature_points);

 FEValues<dim> fe_values_scalar (fe_scalar, quadrature_formula,
                          update_values | update_quadrature_points);

 std::vector<Vector<double>> local_velocity_values 
(quadrature_formula.size());

 for (unsigned int i=0;i<quadrature_formula.size();i++)
 local_velocity_values[i].reinit(dim);

 const unsigned int   dofs_per_cell = fe_scalar.dofs_per_cell;

 std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell);

 typename DoFHandler<dim>::active_cell_iterator
   cell_scalar = dof_handler_scalar.begin_active(),
   endc_scalar = dof_handler_scalar.end();

 typename DoFHandler<dim>::active_cell_iterator
 cell = dof_handler.begin_active(),
 endc = dof_handler.end();

 for (; cell!=endc; ++cell, ++cell_scalar)
   {
     fe_values.reinit (cell);
     fe_values_scalar.reinit (cell_scalar);
     fe_values.get_function_values (solution,local_velocity_values);

     cell_scalar->get_dof_indices (local_dof_indices);

       for (unsigned int i=0; i<dofs_per_cell; ++i)
         {
        x[local_dof_indices[i]] = local_velocity_values[i](0);
        y[local_dof_indices[i]] = local_velocity_values[i](1);
        z[local_dof_indices[i]] = local_velocity_values[i](2);
         }
     }

I appreciate all your help,

Joel

On Wednesday, September 28, 2016 at 7:24:33 PM UTC+2, Daniel Arndt wrote:
>
> Joel,
>
> I did try it, but I cant just change the local_velocity_values from a 
>> std::vector<Tensor<1,dim>> to std::vector<double>. Then the 
>> fe_values[velocities].get_function_values function doesnt compile. 
>>
> That's true, but you should use std::vector<Vector<double> > and not 
> std::vector<double>, see also [1].
>  
>
>> (correct me if wrong) This method of using norm_sqr() would only produce 
>> the size, not the individual x,y and z components. I need the x,y and 
>> z components separately so I can get the size but also the difference 
>> between two solutions and that error of these two solutions. Hence my 
>> previous message. I want to be able to manipulate the vector components. 
>> How would I do this?
>>
> Yes, but since you get all the values at the local dofs, you can play 
> around with them as you like and store the result in velocity. If this is 
> not sufficient, you can also make velocity a std::vector and use something 
> like
> velocity[component][local_dof_indices[i]] = 
> local_velocity_values[i][component]
>
> Best,
> Daniel
>
>>
> [1] 
> https://www.dealii.org/8.4.1/doxygen/deal.II/classFEValuesBase.html#a396f1430dd3f5716a9fe6ef2762edb5d
>

-- 
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 dealii+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to