Dear John,

You don’t say how you write this "solution-…txt” file, so its difficult to say 
exactly what the best course of action is. Do you know about the block_write() 
<https://www.dealii.org/9.0.0/doxygen/deal.II/classVector.html#aef98e4994a6c0b20bb33b0290f8d607c>
 and block_read() 
<https://www.dealii.org/9.0.0/doxygen/deal.II/classVector.html#a57d77409b8591a13d5ee10c2e705593a>
 functions? It looks to me like these already do what you’re trying to 
implement here.

I hope that this helps.

Best,
Jean-Paul

> On 22 Feb 2019, at 09:13, yswang2...@sjtu.edu.cn wrote:
> 
> Dear all,
> 
>  
> I am a beginner of deal ii and C++. I want to modify some codes in step-6. I 
> want to load the solution from outside but I meet some problem and have no 
> idea how to fix it. The following is my modification, I just add a function:
> 
> template <int dim>
> 
> void Step6<dim>::read_solution (const unsigned int cycle) const
> 
> {
> 
>     int n = 0;
> 
>  
> 
>     ifstream File;
> 
>     File.open("solution-" + std::to_string(cycle) + ".txt");
> 
>     while(!File.eof())
> 
>     {
> 
>       File >> solution[n];
> 
>       n++;
> 
>     }
> 
>  
> 
>     File.close();
> 
> }
> 
> Thanks for your time and I know it’s a simple question.
> 
>  
> 
> Bests,
> 
> John
> 
> 
> -- 
> The deal.II project is located at http://www.dealii.org/ 
> <http://www.dealii.org/>
> For mailing list/forum options, see 
> https://groups.google.com/d/forum/dealii?hl=en 
> <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 
> <mailto:dealii+unsubscr...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to