From 1ae6914d46465ac6be842c9a70c7e9fbf1e7a862 Mon Sep 17 00:00:00 2001 From: Fanny CHOPOT <fanny.chopot.ocre@cea.fr> Date: Thu, 31 May 2018 14:35:30 +0200 Subject: [PATCH] ecriture pas de temps dans un autre fichier --- src/main.cpp | 26 +++++++++++++++++++------- src/mesh/Mesh.hpp | 2 +- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 97bc4e94c..c8b6fe135 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -141,7 +141,7 @@ int main(int argc, char *argv[]) const Kokkos::View<const double*> Vj = mesh_data.Vj(); const Kokkos::View<const Rd**> Cjr = mesh_data.Cjr(); - const double tmax=2.; + const double tmax=0.5; double t=0.; int itermax=std::numeric_limits<int>::max(); @@ -161,14 +161,20 @@ 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("inter"); + std::ofstream fout("inter", std::ios::trunc); fout.precision(15); - fout << std::fixed << 0. << ' ' << std::fixed << t << '\n'; + //fout << std::fixed << 0. << ' ' << std::fixed << t << '\n'; for (size_t j=0; j<mesh.numberOfCells(); ++j) { fout << std::fixed << xj[j][0] << ' ' << std::fixed << rhoj[j] << '\n'; } fout.close(); + // Fichier temps + std::ofstream tempo("temps"); + tempo.precision(5); + tempo << std::fixed << t << '\n'; + tempo.close(); + while((t<tmax) and (iteration<itermax)) { // ETAPE 1 DU SPLITTING - EULER @@ -224,8 +230,8 @@ int main(int argc, char *argv[]) //fout.clear(); //fout.seekp(0, std::ios::beg); std::string ligne; - getline(fint, ligne); - fout << ligne << ' ' << std::fixed << t << '\n'; + //getline(fint,ligne); + //fout << ligne << ' ' << std::fixed << t << '\n'; for (size_t j = 0; j<mesh.numberOfCells(); ++j) { getline(fint, ligne); fout << ligne << ' ' << std::fixed << rhoj[j] << '\n'; @@ -236,8 +242,8 @@ int main(int argc, char *argv[]) std::ifstream rint("film_rho"); std::ofstream rout("inter", std::ios::trunc); fout.precision(15); - getline(rint, ligne); - rout << ligne << '\n'; + //getline(rint, ligne); + //rout << ligne << '\n'; for (size_t j = 0; j<mesh.numberOfCells(); ++j) { getline(rint, ligne); rout << ligne << '\n'; @@ -245,6 +251,12 @@ int main(int argc, char *argv[]) rint.close(); rout.close(); + // Fichier temps + std::ofstream tempo("temps", std::ios::app); + tempo.precision(5); + tempo << std::fixed << t << '\n'; + tempo.close(); + } std::cout << "* " << rang::style::underline << "Final time" << rang::style::reset diff --git a/src/mesh/Mesh.hpp b/src/mesh/Mesh.hpp index 667f1877d..51c7f7d00 100644 --- a/src/mesh/Mesh.hpp +++ b/src/mesh/Mesh.hpp @@ -81,7 +81,7 @@ public: m_xmax("xmax", 1) { double a = 0.; - double b = 10.; + double b = 1.; m_x0[0][0] = a; m_xmax[0][0] = b; const double delta_x = (b-a)/connectivity.numberOfCells(); -- GitLab