Using DataOut when dim != spacedim

34 views
Skip to first unread message

Malhar T.

unread,
Sep 22, 2020, 1:37:41 AM9/22/20
to deal.II User Group
Hello All,
I hope you are doing well !

I am working on a surface patch in 3D (dim=2 & spacedim=3 and developed using ChartManifold<2,3> by following code similar to step-53) and I would like to output the results into a vtk file. I am mostly following tutorials, as I am not really great with C++. So, initially I used the class DataOut and tried to specify the geometry using attach_dof_handler.

This is how its defined,
Triangulation<2, 3> triangulation;
DoFHandler<2, 3>    dof_handler;
And output_results function was written as
{
DataOut<dim> data_out;
data_out.attach_dof_handler(dof_handler);
}
But I got the error

error: cannot convert ‘const dealii::DoFHandler<2, 3>’ to ‘const dealii::DoFHandler<2, 2>&’
note:   initializing argument 1 of ‘void dealii::DataOut_DoFData<DoFHandlerType, patch_dim, patch_space_dim>::attach_dof_handler(const DoFHandlerType&) [with DoFHandlerType = dealii::DoFHandler<2, 2>; int patch_dim = 2; int patch_space_dim = 2]’

I tried searching in the forum and came to know about DataOutFaces (through this post), and I also looked at the step-61 tutorial on its implementation, but I got the same error again. I have a feeling that I am not understanding something very trivial, thus, any pointers would be really helpful.

Thank You.


I tried searching in the forum and came to know about DataOutFaces (through this post), and I also looked at the step-61 tutorial on its implementation, but I got the same error again. I have a feeling that I am not understanding something very trivial, any pointers would be helpful. Thank You.

luca.heltai

unread,
Sep 22, 2020, 8:03:47 AM9/22/20
to Deal.II Users
Dear Malhar,

just as you did for the Triangulation and the DoFHandler, also DataOut should be instantiated with <2,3>, i.e.,

not

DataOut<2> …


but


DataOut<2,3> …

Best,
Luca.


> On 22 Sep 2020, at 7:37, Malhar T. <malhar...@gmail.com> wrote:
>
> Hello All,
> I hope you are doing well !
>
> I am working on a surface patch in 3D (dim=2 & spacedim=3 and developed using ChartManifold<2,3> by following code similar to step-53) and I would like to output the results into a vtk file. I am mostly following tutorials, as I am not really great with C++. So, initially I used the class DataOut and tried to specify the geometry using attach_dof_handler.
>
> This is how its defined,
> Triangulation<2, 3
> > triangulation;
> DoFHandler<
> 2, 3
> > dof_handler;
>
> And output_results function was written as
> {
> DataOut<dim> data_out;
> data_out.attach_dof_handler(dof_handler);
> }
>
> But I got the error
>
> error: cannot convert ‘
> const dealii::DoFHandler<2, 3>’ to ‘const dealii::DoFHandler<2, 2
> >&’
> note: initializing argument
> 1 of ‘void dealii::DataOut_DoFData<DoFHandlerType, patch_dim, patch_space_dim>::attach_dof_handler(const DoFHandlerType&) [with DoFHandlerType = dealii::DoFHandler<2, 2>; int patch_dim = 2; int patch_space_dim = 2
> ]’
>
> I tried searching in the forum and came to know about DataOutFaces (through this post), and I also looked at the step-61 tutorial on its implementation, but I got the same error again. I have a feeling that I am not understanding something very trivial, thus, any pointers would be really helpful.
>
> Thank You.
>
>
>
> --
> 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+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/7e032f3f-2957-4235-9f32-df8858a2c575n%40googlegroups.com.

Daniel Arndt

unread,
Sep 22, 2020, 9:47:21 AM9/22/20
to dea...@googlegroups.com
Malhar,

the template arguments for DataOut are dim and DoFHandlerType where DoFHandlerType defaults to DoFHandler<dim>
since you are using a DoFHandler<2, 3> object you need to specify the second template argument explicitly, i.e.
DataOut<2, DoFHandler<2,3>> data_out;
You could have a look at step-38.

Best,
Daniel

--

Malhar Tidke

unread,
Sep 23, 2020, 1:59:42 AM9/23/20
to dea...@googlegroups.com
Hello Luca,

I am sorry, I should have mentioned it in the question, I had tried it earlier, but it leads to argument mismatch because, as Daniel has posted, the second argument is DofHandlerType rather than spacedim. But, thank you for your help. Appreciate it.

Best Regards,
Malhar

You received this message because you are subscribed to a topic in the Google Groups "deal.II User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dealii/OxYbv521Pjc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dealii+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/EA19A107-0A5B-4604-89D4-6E527B8035CF%40gmail.com.

Malhar Tidke

unread,
Sep 23, 2020, 2:04:20 AM9/23/20
to dea...@googlegroups.com
Hello Daniel,
It worked, Thank you. I had somehow missed step-38, I will look into it. Again, thank you for your help.

Best Regards,
Malhar

You received this message because you are subscribed to a topic in the Google Groups "deal.II User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dealii/OxYbv521Pjc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dealii+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/CAOYDWb%2Be3gw%2BaxNgw9ogx6CMvB0uzJM21pTEKRb7YP4-0807iw%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages