Saving and loading files

Hello guys!

I need to save a solution and then read ir in another freefem file. I’m not sure how to do this. I am able to save the mesh and load it, but I can’t do dat with the solution.

Just to clarify:

problem Psiext(psiext,v)=
+on(izq,psiext=0)+on(circ,psiext=0); // condicion de Dirichlet de Soloviev


My solution would be psiext.


Maybe you can try ifstream

using ofstream to save solutions and ifstream to load solutions.

Hello! First of all, thank you for your anwser. I understand that ifstream and ofstream are the solution to my problem, but I have no idea which is the information I have to write down in the file. I am not sure if the solution is an 2D array of how the information is storaged.


You can try

fespace Vh(Th, P1);
Vh Psiext;
ofstream fileSol ("file.txt");
for (int i = 0; i<Vh.ndof; i++){
	fileSol <<psiext[][i]<<endl;

And do the same thing with ifstream to load your solution