From 7df1ed18239dd76a5ba086ee831991ded2ca033c Mon Sep 17 00:00:00 2001
From: Uwe Schulzweida <uwe.schulzweida@mpimet.mpg.de>
Date: Thu, 6 Feb 2025 09:04:37 +0100
Subject: [PATCH] Added obsolete functions vlistNgrids() and vlistNzaxis() for
 ParaView vtkCDIReader

---
 ChangeLog   |  4 ++++
 src/cdi.h   |  4 ++++
 src/vlist.c | 16 ++++++++++++----
 3 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index df40b1956..3c80e270f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,10 @@
 
 	* Version 2.5.1 released
 
+2025-02-06  Uwe Schulzweida
+
+	* Added obsolete functions vlistNgrids() and vlistNzaxis() for ParaView vtkCDIReader
+
 2025-02-01  Uwe Schulzweida
 
 	* Added support for READ_CELL_CENTER=false
diff --git a/src/cdi.h b/src/cdi.h
index 060f5b2bb..32e8e7cbb 100644
--- a/src/cdi.h
+++ b/src/cdi.h
@@ -1315,6 +1315,10 @@ int  vlistInqVarTypeOfGeneratingProcess(int vlistID, int varID);
 void vlistDefVarTypeOfGeneratingProcess(int vlistID, int varID, int typeOfGeneratingProcess);
 void vlistDefVarProductDefinitionTemplate(int vlistID, int varID, int productDefinitionTemplate);
 
+// Compatibility functions for ParaView vtkCDIReader (obsolete functions)
+int vlistNgrids(int vlistID); // calls vlistNumGrids()
+int vlistNzaxis(int vlistID); // calls vlistNumZaxis()
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/vlist.c b/src/vlist.c
index b7af82e76..a6bf4888e 100644
--- a/src/vlist.c
+++ b/src/vlist.c
@@ -1013,10 +1013,15 @@ int
 vlistNumGrids(int vlistID)
 {
   vlist_t *vlistptr = vlist_to_pointer(vlistID);
-
   return vlistptr->ngrids;
 }
 
+int
+vlistNgrids(int vlistID)
+{
+  return vlistNumGrids(vlistID);
+}
+
 /*
 @Function  vlistNumZaxis
 @Title     Number of zaxis in a variable list
@@ -1037,15 +1042,19 @@ int
 vlistNumZaxis(int vlistID)
 {
   vlist_t *vlistptr = vlist_to_pointer(vlistID);
-
   return vlistptr->nzaxis;
 }
 
+int
+vlistNzaxis(int vlistID)
+{
+  return vlistNumZaxis(vlistID);
+}
+
 int
 vlistNsubtypes(int vlistID)
 {
   vlist_t *vlistptr = vlist_to_pointer(vlistID);
-
   return vlistptr->nsubtypes;
 }
 
@@ -1066,7 +1075,6 @@ int
 vlistNtsteps(int vlistID)
 {
   vlist_t *vlistptr = vlist_to_pointer(vlistID);
-
   return (int) vlistptr->ntsteps;
 }
 
-- 
GitLab