From 8fa3dd1b15bf16081a170f5dc37f70974844ee4b Mon Sep 17 00:00:00 2001
From: Boris Basic <boris.basic@edf.fr>
Date: Fri, 28 Mar 2025 08:27:37 +0100
Subject: [PATCH] [fix #1088] Correct errors in TelemacFile.print_info

The function now proplery displays the number of interface points, as well
as boundary information regardless of the presence or not of a boundary
conditions file
---
 NEWS.txt                                      |  4 ++++
 .../data_manip/extraction/telemac_file.py     | 23 ++++++-------------
 2 files changed, 11 insertions(+), 16 deletions(-)

diff --git a/NEWS.txt b/NEWS.txt
index b446a1b2ae..5a4f247d10 100644
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -18,6 +18,10 @@ TELEMAC-3D: New keywords SIGMA DISTRIBUTION OF PLANES and
 PRESCRIBED ELEVATION OF PLANES to set vertical planes directly in the steering
 file
 
+PYTHON: TelemacFile.print_info now correctly displays the number of interface
+points if any, as well as the number of boundary points and elements regardless
+of the presence or not of a boundary conditions file.
+
 TOMAWAC: fix time series for wave directions
 
 MASCARET: Reference Documentation has been added
diff --git a/scripts/python3/data_manip/extraction/telemac_file.py b/scripts/python3/data_manip/extraction/telemac_file.py
index b8eaca2774..f1a0f83b03 100644
--- a/scripts/python3/data_manip/extraction/telemac_file.py
+++ b/scripts/python3/data_manip/extraction/telemac_file.py
@@ -426,11 +426,7 @@ class TelemacFile(HermesFile if HERMES_AVAIL else SerafinFile):
         Returns the number of boundary elements
         """
         if self._nelebd is None:
-            if self.boundary_file is not None:
-                self._nelebd = self.get_bnd_npoin()
-            else:
-                raise TelemacException(
-                    "Can not read nelebd no boundary file was given")
+            self._nelebd = self.get_bnd_nelem()
 
         return self._nelebd
 
@@ -2084,22 +2080,17 @@ class TelemacFile(HermesFile if HERMES_AVAIL else SerafinFile):
         if self.nptir == 0:
             print("  - No parallel information")
         else:
-            print("  - Number of interface points: {}".format(self.nptfr))
+            print("  - Number of interface points: {}".format(self.nptir))
             print("  - Local ot Global numbering {}".format(self.knolg))
 
         print()
         print("~> Boundary info")
         print()
-        if self.boundary_file is None:
-            print("  - No boundary file given")
-        else:
-            print("  - Boundary element type: {}"
-                  .format(elem2str(self.typ_bnd_elem)))
-
-            print("  - Number of bnd points: {}".format(self.nptfr))
-            print("  - Number of bnd elements: {}".format(self.nelebd))
-
-            # TODO: display stuff on boundary values ?
+        print("  - Number of boundary points: {}".format(self.nptfr))
+        print(
+            "  - Boundary element type: {}".format(elem2str(self.typ_bnd_elem))
+        )
+        print("  - Number of boundary elements: {}".format(self.nelebd))
 
         print()
         print("~> Data info")
-- 
GitLab