Skip to content
Snippets Groups Projects
Commit 7f127e48 authored by Fanny CHOPOT's avatar Fanny CHOPOT
Browse files

construction fichier colonne par colonne (ok)

parent ae3577fe
Branches
Tags
No related merge requests found
...@@ -161,11 +161,12 @@ int main(int argc, char *argv[]) ...@@ -161,11 +161,12 @@ int main(int argc, char *argv[])
// Ecriture des valeurs initiales de rho dans un fichier // Ecriture des valeurs initiales de rho dans un fichier
const Kokkos::View<const Rd*> xj = mesh_data.xj(); const Kokkos::View<const Rd*> xj = mesh_data.xj();
std::ofstream fout("film_rho", std::ios::trunc); std::ofstream fout("inter");
fout.precision(15); fout.precision(15);
for (size_t j=0; j<mesh.numberOfCells(); ++j) { for (size_t j=0; j<mesh.numberOfCells(); ++j) {
fout << std::fixed << xj[j][0] << ' ' << std::fixed << rhoj[j] << '\n'; fout << std::fixed << xj[j][0] << ' ' << std::fixed << rhoj[j] << '\n';
} }
fout.close();
while((t<tmax) and (iteration<itermax)) { while((t<tmax) and (iteration<itermax)) {
...@@ -214,19 +215,32 @@ int main(int argc, char *argv[]) ...@@ -214,19 +215,32 @@ int main(int argc, char *argv[])
++iteration; ++iteration;
std::cout << "temps t : " << t << std::endl; std::cout << "temps t : " << t << std::endl;
// Ecriture des valeurs de rho par pas de temps dans le fichier // ECRITURE DANS UN FICHIER
std::ofstream fout("film_rho", std::ios::app);
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.precision(15);
fout.clear(); //fout.clear();
fout.seekp(0, std::ios::beg); //fout.seekp(0, std::ios::beg);
//int const position = 0;
for (size_t j = 0; j<mesh.numberOfCells(); ++j) { for (size_t j = 0; j<mesh.numberOfCells(); ++j) {
fout.seekp(35*iteration*j); getline(rint, ligne);
//position = fout.tellp(); rout << ligne << '\n';
//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');
} }
rint.close();
rout.close();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment