diff --git a/src/main.cpp b/src/main.cpp index 7017de5abc0b0509955b1dadcb5ba8823300e297..84adbade657f8f11bb5f7f658b21f1437eaca4c8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -161,11 +161,12 @@ int main(int argc, char *argv[]) // Ecriture des valeurs initiales de rho dans un fichier const Kokkos::View<const Rd*> xj = mesh_data.xj(); - std::ofstream fout("film_rho", std::ios::trunc); + std::ofstream fout("inter"); fout.precision(15); for (size_t j=0; j<mesh.numberOfCells(); ++j) { fout << std::fixed << xj[j][0] << ' ' << std::fixed << rhoj[j] << '\n'; } + fout.close(); while((t<tmax) and (iteration<itermax)) { @@ -214,19 +215,32 @@ int main(int argc, char *argv[]) ++iteration; std::cout << "temps t : " << t << std::endl; - // Ecriture des valeurs de rho par pas de temps dans le fichier - std::ofstream fout("film_rho", std::ios::app); + // ECRITURE DANS UN FICHIER + + std::ifstream fint("inter"); + std::ofstream fout("film_rho", std::ios::trunc); + fout.precision(15); + //fout.clear(); + //fout.seekp(0, std::ios::beg); + std::string ligne; + for (size_t j = 0; j<mesh.numberOfCells(); ++j) { + getline(fint, ligne); + fout << ligne << ' ' << std::fixed << rhoj[j] << '\n'; + } + fint.close(); + fout.close(); + + std::ifstream rint("film_rho"); + std::ofstream rout("inter", std::ios::trunc); fout.precision(15); - fout.clear(); - fout.seekp(0, std::ios::beg); - //int const position = 0; - for (size_t j=0; j<mesh.numberOfCells(); ++j) { - fout.seekp(35*iteration*j); - //position = fout.tellp(); - //std::cout << "Nous sommes au " << fout.tellp() << "eme caractere du fichier" << std::endl; - fout << ' ' << std::fixed << rhoj[j] << '\n'; - //std::cin.ignore(35*iteration, '\n'); + //fout.clear(); + //fout.seekp(0, std::ios::beg); + for (size_t j = 0; j<mesh.numberOfCells(); ++j) { + getline(rint, ligne); + rout << ligne << '\n'; } + rint.close(); + rout.close(); }