[dune-pdelab] Writing subtree of a CompositeGridFunctionSpace to VTK
Oliver Sander
sander at igpm.rwth-aachen.de
Tue Jun 23 10:42:02 CEST 2015
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.
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?
Thanks,
Oliver
>
> Regards,
> Jö.
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <https://lists.dune-project.org/pipermail/dune-pdelab/attachments/20150623/33c575dd/attachment.sig>
More information about the dune-pdelab
mailing list