[Dune] Exporting displacement field to VTK
Timo Koch
timo.koch at iws.uni-stuttgart.de
Tue Apr 14 10:36:40 CEST 2020
Dear Thomas,
AFAIK the default implementation expects a flat vector, i.e. the entries can’t be blocked into a FieldVector<double,3>.
You can pass a custom VTKFunction instead that knows how to handle the nested type.
For example there is a possible implementation in Dumux (https://git.iws.uni-stuttgart.de/dumux-repositories/dumux/-/blob/master/dumux/io/vtkfunction.hh <https://git.iws.uni-stuttgart.de/dumux-repositories/dumux/-/blob/master/dumux/io/vtkfunction.hh>)
I don’t know if that’s too complicated for your needs.
There might be a solution with dune-functions. I’m not sure...
Best wishes,
Timo
--
_________________________________________________
Timo Koch phone: +49 711 685 64676
IWS, Universität Stuttgart fax: +49 711 685 60430
Pfaffenwaldring 61 email: timo.koch at iws.uni-stuttgart.de
D-70569 Stuttgart url: www.iws.uni-stuttgart.de/en/lh2/
_________________________________________________
> On 14. Apr 2020, at 10:14, HELFER Thomas 202608 <thomas.helfer at cea.fr> wrote:
>
> Dear all,
>
> I have written a small elastic example. However, I wish to export my displacement field to VTK,
> However, the following call to `addVertexData` fails (error message below):
>
> Dune::VTKWriter<GridView> vtkWriter(gv);
> vtkWriter.addVertexData(x, "solution", 3);
>
> where x is an instance of Dune::BlockVector<Dune::FieldVector<double, dime>>. The third parameter
> of the method is probably not relevant here.
>
> I would be grateful if someone could tell what I missed.
>
> Regards,
>
> Thomas Helfer
>
> [ 75%] Building CXX object src/CMakeFiles/dune-mgis-elasticity-test.dir/dune-mgis-elasticity-test.cc.o
> In file included from /home/th202608/codes/dune/2.7/install/include/dune/grid/io/file/vtk/vtkwriter.hh:29,
> from /home/th202608/codes/dune/2.7/tests/dune-mgis/src/dune-mgis-elasticity-test.cc:24:
> /home/th202608/codes/dune/2.7/install/include/dune/grid/io/file/vtk/function.hh: In instantiation of 'double Dune::P1VTKFunction<GV, V>::evaluate(int, const Entity&, const Dune::FieldVector<typename Dune::VTKFunction<GV>::ctype, #'using_decl' not supported by dump_expr#<expression error> >&) const [with GV = Dune::GridView<Dune::DefaultLeafGridViewTraits<const Dune::YaspGrid<3> > >; V = Dune::BlockVector<Dune::FieldVector<double, 3> >; Dune::P1VTKFunction<GV, V>::Entity = Dune::Entity<0, 3, const Dune::YaspGrid<3>, Dune::YaspEntity>; Dune::P1VTKFunction<GV, V>::Base = Dune::VTKFunction<Dune::GridView<Dune::DefaultLeafGridViewTraits<const Dune::YaspGrid<3> > > >; typename Dune::VTKFunction<GV>::ctype = double]':
> /home/th202608/codes/dune/2.7/install/include/dune/grid/io/file/vtk/function.hh:235:12: required from here
> /home/th202608/codes/dune/2.7/install/include/dune/grid/io/file/vtk/function.hh:243:25: error: use of deleted function 'Dune::FieldVector<K, 1>& Dune::FieldVector<K, 1>::operator=(const Dune::FieldVector<T, N>&) [with T = double; int N = 3; K = double]'
> 243 | cornerValues[i] = v[mapper.subIndex(e,i,dim)*ncomps_+mycomp_];
> | ~~~~~~~~~~~~~~~~^~~~
> In file included from /home/th202608/codes/dune/2.7/install/include/dune/grid/common/grid.hh:15,
> from /home/th202608/codes/dune/2.7/install/include/dune/grid/yaspgrid.hh:20,
> from /home/th202608/codes/dune/2.7/tests/dune-mgis/src/dune-mgis-elasticity-test.cc:14:
> /home/th202608/codes/dune/2.7/install/include/dune/common/fvector.hh:352:18: note: declared here
> 352 | FieldVector& operator=(const FieldVector<T, N>&) = delete;
>
> _______________________________________________
> Dune mailing list
> Dune at lists.dune-project.org
> https://lists.dune-project.org/mailman/listinfo/dune
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20200414/70771c69/attachment.htm>
More information about the Dune
mailing list