Thanks Wolfgang.
What you surmised is exactly what it is happening, see the error message 
below.
I have no run-time errors in running this code

  const std::vector<DataComponentInterpretation::DataComponentInterpretation
>

    data_component_interpretation(dim+2, DataComponentInterpretation::
component_is_part_of_vector);

  data_out.add_data_vector(system_solution,

                           std::vector<std::string> (dim+2, "displacement"),

                           DataOut<dim>::type_dof_data, 
data_component_interpretation);

but I believe it is not what I want. I suppose that the data_out contains 
now 4 components for each node, two displacements, plus pressure and 
dilatation. I'd love to export displacements 
and the other two separately, but I am not sure how to achieve this. Doing 
this:

  data_out.add_data_vector(system_solution,

                           std::vector<std::string> (dim, "displacement"),

                           DataOut<dim>::type_dof_data, 
data_component_interpretation);

provides an run-time error, which makes sense. 
Thanks,
Alberto



*--------------------------------------------------------*

*An error occurred in line <984> of file 
<../source/numerics/data_out_dof_data.cc> in function*

*    void dealii::DataOut_DoFData<dealii::DoFHandler<2, 2>, 2, 
2>::add_data_vector(const VectorType &, const std::vector<std::string> &, 
const dealii::DataOut_DoFData::DataVectorType, const 
std::vector<DataComponentInterpretation::DataComponentInterpretation> &) 
[VectorType = dealii::Vector<double>]*

*The violated condition was: *

*    names.size() == dofs->get_fe().n_components()*

*The name and call sequence of the exception was:*

*    Exceptions::DataOut::ExcInvalidNumberOfNames (names.size(), 
dofs->get_fe().n_components())*

*Additional Information: *

*You have to give one name per component in your data vector. The number 
you gave was 2, but the number of components is 4.*


Il giorno lunedì 17 aprile 2017 10:24:23 UTC-4, Wolfgang Bangerth ha 
scritto:
>
> On 04/17/2017 08:09 AM, Alberto Salvadori wrote: 
> >   DataOut<dim> data_out; 
> > 
> >   data_out.attach_dof_handler(dof_handler); 
> > 
> > 
> > 
> >   // displacement output 
> > 
> > 
> >   
> conststd::vector<DataComponentInterpretation::DataComponentInterpretation> 
> > 
> >     data_component_interpretation(dim, 
> > DataComponentInterpretation::component_is_part_of_vector); 
> > 
> >   data_out.add_data_vector(system_solution, 
> > 
> >                            std::vector<std::string> (dim, 
> "displacement"), 
> > 
> >                            DataOut<dim>::type_dof_data, 
> > data_component_interpretation); 
> > 
> > 
> > 
> > is inappropriate as it stands, since the system_solution contains u,p,J 
> and I 
> > want to extract u, p and J separately. Any hint? 
>
> Alberto -- what happens if you do this? I suspect that if the DoFHandler 
> you 
> attach above has components for both u,p,J and I, then passing in a 
> data_component_interpretation that only contains 'dim' elements will not 
> work 
> -- you need to account for *all* vector components of the finite element 
> upon 
> which the DoFhandler is built. 
>
> Best 
>   W. 
>
> -- 
> ------------------------------------------------------------------------ 
> Wolfgang Bangerth          email:                 bang...@colostate.edu 
> <javascript:> 
>                             www: http://www.math.colostate.edu/~bangerth/ 
>
>
-- 

Informativa sulla Privacy: http://www.unibs.it/node/8155

-- 
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