From 7a60434160b42a7ba19dde0964f43b9511e23d9a Mon Sep 17 00:00:00 2001 From: Victor Baconnet Date: Mon, 30 Sep 2024 09:31:53 +0200 Subject: [PATCH 1/4] Safeguard that csv file exists --- src/io/csv_file.f90 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/io/csv_file.f90 b/src/io/csv_file.f90 index 26be324beee..88642ce1c16 100644 --- a/src/io/csv_file.f90 +++ b/src/io/csv_file.f90 @@ -308,8 +308,9 @@ function csv_file_count_lines(this) result(n) integer :: n integer :: ierr, file_unit - open(file = trim(this%fname), status = 'old', newunit = file_unit) - rewind(file_unit) + open(file = trim(f%fname), status = 'old', newunit = file_unit, & + iostat = ierr) + if (ierr .ne. 0) call neko_error("Error while opening " // trim(f%fname)) n = 0 From f5fd3e58a954fb6368f76f35ac205aabaf301644 Mon Sep 17 00:00:00 2001 From: Victor Baconnet Date: Mon, 30 Sep 2024 09:41:04 +0200 Subject: [PATCH 2/4] Add a check_exists --- src/io/csv_file.f90 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/io/csv_file.f90 b/src/io/csv_file.f90 index 88642ce1c16..16cfb98e80e 100644 --- a/src/io/csv_file.f90 +++ b/src/io/csv_file.f90 @@ -308,6 +308,8 @@ function csv_file_count_lines(this) result(n) integer :: n integer :: ierr, file_unit + call this%check_exists() + open(file = trim(f%fname), status = 'old', newunit = file_unit, & iostat = ierr) if (ierr .ne. 0) call neko_error("Error while opening " // trim(f%fname)) From 1325fca3ac812863c05b5f42a45891c0a0726ede Mon Sep 17 00:00:00 2001 From: Victor Baconnet Date: Mon, 30 Sep 2024 09:52:01 +0200 Subject: [PATCH 3/4] Fix compiler --- src/io/csv_file.f90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/io/csv_file.f90 b/src/io/csv_file.f90 index 16cfb98e80e..972dfe2bd55 100644 --- a/src/io/csv_file.f90 +++ b/src/io/csv_file.f90 @@ -310,9 +310,9 @@ function csv_file_count_lines(this) result(n) call this%check_exists() - open(file = trim(f%fname), status = 'old', newunit = file_unit, & + open(file = trim(this%fname), status = 'old', newunit = file_unit, & iostat = ierr) - if (ierr .ne. 0) call neko_error("Error while opening " // trim(f%fname)) + if (ierr .ne. 0) call neko_error("Error while opening " // trim(this%fname)) n = 0 From 79ee9890283a507f5308a005cbc79e2f99e8863f Mon Sep 17 00:00:00 2001 From: Victor Baconnet Date: Mon, 30 Sep 2024 10:11:39 +0200 Subject: [PATCH 4/4] put the rewind back --- src/io/csv_file.f90 | 1 + 1 file changed, 1 insertion(+) diff --git a/src/io/csv_file.f90 b/src/io/csv_file.f90 index 972dfe2bd55..c7c13bacca6 100644 --- a/src/io/csv_file.f90 +++ b/src/io/csv_file.f90 @@ -313,6 +313,7 @@ function csv_file_count_lines(this) result(n) open(file = trim(this%fname), status = 'old', newunit = file_unit, & iostat = ierr) if (ierr .ne. 0) call neko_error("Error while opening " // trim(this%fname)) + rewind(file_unit) n = 0