The call to data_out.add_data_vector() does not copy the contents of the vector but it just keeps track of it until the data is actually written. You will need to store your solutions in different vectors without touching the old ones.
On Tue, Feb 15, 2022, 11:05 Uclus Heis <uclush...@gmail.com> wrote: > Good afternoon, > > I want to store my results in a hdf5 file using a distributed > implementation. I am computing different frequencies, so I have a loop in > my run() function where I solve for each frequency. When for example > computing 5 frequencies, I get 5 results with the same value in my hdf5 > file, however, the solution vector inside dealii is correct. Can I ask for > help, I do not know what am I doing wrong when exporting the results, my > code looks like the following: > > DataOut<dim> data_out; > data_out.attach_dof_handler(dof_handler); > for(int freq_iter=0 ... ) *//solver loop, * > { > ... //*computes the solution per frequency* > string nname = "rb"; > string nit = to_string(freq_iter); > string fitame =nname+nit; > data_out.add_data_vector(locally_relevant_solution, fitame); > } > data_out.build_patches(); > DataOutBase::DataOutFilterFlags flags(true, true); > DataOutBase::DataOutFilter data_filter(flags); > data_out.write_filtered_data(data_filter); > data_out.write_hdf5_parallel(data_filter, "solution.h5", MPI_COMM_WORLD); > > > Thank you for you time. > > -- > 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+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/dealii/540023f3-2531-4d00-97dc-8d24c3e9219en%40googlegroups.com > <https://groups.google.com/d/msgid/dealii/540023f3-2531-4d00-97dc-8d24c3e9219en%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/CAMRj59EgWTSCPq5EgtfFd%2B%3DhY6oH1wBGQFiySh9KrLNK8YeonQ%40mail.gmail.com.