[dune-pdelab] Writing subtree of a CompositeGridFunctionSpace to VTK
Jö Fahlke
jorrit at jorrit.de
Tue Jun 23 13:46:36 CEST 2015
Am Tue, 23. Jun 2015, 10:42:02 +0200 schrieb Oliver Sander:
> Date: Tue, 23 Jun 2015 10:42:02 +0200
> From: Oliver Sander <sander at igpm.rwth-aachen.de>
> To: dune-pdelab mailing list <dune-pdelab at dune-project.org>
> Subject: Re: [dune-pdelab] Writing subtree of a CompositeGridFunctionSpace
> to VTK
>
> Am 22.06.2015 um 12:47 schrieb Jö Fahlke:
> > Am Mon, 22. Jun 2015, 06:21:41 +0200 schrieb Oliver Sander:
> >> Date: Mon, 22 Jun 2015 06:21:41 +0200
> >> From: Oliver Sander <sander at igpm.rwth-aachen.de>
> >> To: dune-pdelab mailing list <dune-pdelab at dune-project.org>
> >> Subject: [dune-pdelab] Writing subtree of a CompositeGridFunctionSpace to
> >> VTK
> >>
> >> Dear pdelab team,
> >> I have written a program that uses a CompositeGridFunctionSpace with two childen,
> >> each of which is a VectorGridFunctionSpace. Simulation results are written to
> >> VTK using [roughly]
> >>
> >> VTKWriter<GridView> vtkWriter(grid->leafGridView());
> >> VectorContainer x(compositeGFS);
> >> PDELab::addSolutionToVTKWriter(vtkWriter,compositeGFS,x);
> >>
> >> which works. However, I actually only want the first subtree in the file.
> >> How do I do that?
> >
> > I'm not 100% certain, but I would try the GridFunctionSubspace:
> > https://www.dune-project.org/doc-pdelab-2.0.0/doxygen/html/classDune_1_1PDELab_1_1GridFunctionSubSpace.html
> > With that your code should become something like that:
> >
> > VTKWriter<GridView> vtkWriter(grid->leafGridView());
> > VectorContainer x(compositeGFS);
> > PDELab::GridFunctionSubSpace<GFS, TypeTree::TreePath<0> >
> > subGFS(stackobject_to_shared_ptr(compositeGFS));
> > PDELab::addSolutionToVTKWriter(vtkWriter,subGFS,x);
> >
> > That is quite ugly. Maybe Steffen knows a better way?
>
> Thanks, Jö! That works, and I don't even think it is ugly.
I was referring to the stackobject_to_shared_ptr() call. I don't think that
is something users should be exposed to, ideally.
> There is one problem, though: The first subtree my space is a displacement field.
> When using my original code, that subtree appeared in ParaView as one data set 'displacement',
> and I could use the warp-by-vector filter, for example. When using the code snippet you
> propose, the three components of the displacement appear as separate scalar fields 'displacement0',
> 'displacement1', 'displacement2'. How can I keep them as a single data set?
Christian described what probably is the problem. I opened an issue:
http://conan2.iwr.uni-heidelberg.de/git/pdelab/dune-pdelab/issues/23
You could try to work around it usingthe old way: Turn the subspace into a
VectorDiscreteGridFunction, put that into a VTKGridFunctionAdapter, and give
that to vtkwriter.addVertexData().
Regards,
Jö.
--
Jorrit (Jö) Fahlke, Institute for Computational und Applied Mathematics,
University of Münster, Orleans-Ring 10, D-48149 Münster
Tel: +49 251 83 35146 Fax: +49 251 83 32729
If God had intended Man to Smoke, He would have set him on Fire.
-- fortune
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 811 bytes
Desc: Digital signature
URL: <https://lists.dune-project.org/pipermail/dune-pdelab/attachments/20150623/89742810/attachment.sig>
More information about the dune-pdelab
mailing list