[Dune] vtkwriter in loop

Dedner, Andreas A.S.Dedner at warwick.ac.uk
Wed Apr 18 20:46:37 CEST 2012


The vtkwritter does not make a copy of your data but
stores a reference to the blockvector - so you are just
adding the same reference again and again and when
you call write the values that are in the block vector at that
time are used.

________________________________
From: dune-bounces+a.s.dedner=warwick.ac.uk at dune-project.org [dune-bounces+a.s.dedner=warwick.ac.uk at dune-project.org] on behalf of DHIRENDRA VAIDYA [dhirendra22121987 at gmail.com]
Sent: Wednesday, April 18, 2012 7:14 PM
To: dune at dune-project.org
Subject: [Dune] vtkwriter in loop

I am writing program where a blockvector is geeting modified after every iteration. I am wrting blockvector to .vtu file in every iteration. but .vtu file replicates last entry of vector to all its previous.

code looks like this

 Dune::VTKWriter<GridView> vtkwriter(gv,Dune::VTKOptions::conforming);
for(int i=0i<N;i++)
{
//blockvector gets modified here
 std::string blkv_str("blkvector");
 std::stringstream ss;
 ss<<i;
 blkv_str+=ss.str(); // generatrs string as blkvectori i.e i=0 string is blkvector0, for i=1 it is blkvector1
 vtkwriter.addVertexData(blockvector, blkv_str);
}
 vtkwriter.write("blockvector", Dune::VTKOptions::ascii);

but in .vtu file I get blkvectorN=blkvectorN-1.....=blkvector1=blkvector0
--
Warm Regards,
Dhirendra Vaidya
VNIT Nagpur

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20120418/fe4aa230/attachment.htm>


More information about the Dune mailing list