From a9910934750a971fb19ee2417beb787df675fd67 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Tue, 20 Nov 2018 23:47:00 +0100
Subject: [PATCH] COMP: replace deprecated methods for ParaView-5.6

---
 src/catalyst/catalystTools.C | 31 +++++++++++++++++++++++++------
 1 file changed, 25 insertions(+), 6 deletions(-)

diff --git a/src/catalyst/catalystTools.C b/src/catalyst/catalystTools.C
index 1c8d377..f51b7dc 100644
--- a/src/catalyst/catalystTools.C
+++ b/src/catalyst/catalystTools.C
@@ -28,6 +28,7 @@ License
 #include <vtkCPDataDescription.h>
 #include <vtkCPInputDataDescription.h>
 #include <vtkCPProcessor.h>
+#include <vtkDataObject.h>
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
@@ -175,10 +176,16 @@ Foam::label Foam::catalyst::dataQuery::query(vtkCPProcessor* coproc)
         descrip->AddInput(channel.c_str());
         auto* input = descrip->GetInputDescriptionByName(channel.c_str());
 
-        for (const word& fieldName : dataq.fields(channel))
+        for (const word& fldName : dataq.fields(channel))
         {
-            input->AddPointField(fieldName.c_str());
-            input->AddCellField(fieldName.c_str());
+            #if (PARAVIEW_VERSION_MAJOR == 5) && \
+                (PARAVIEW_VERSION_MINOR < 6)
+            input->AddPointField(fldName.c_str());
+            input->AddCellField(fldName.c_str());
+            #else
+            input->AddField(fldName.c_str(), vtkDataObject::CELL);
+            input->AddField(fldName.c_str(), vtkDataObject::POINT);
+            #endif
         }
     }
 
@@ -200,12 +207,24 @@ Foam::label Foam::catalyst::dataQuery::query(vtkCPProcessor* coproc)
         {
             wordHashSet requestedFields;
 
-            for (const word& fieldName : dataq.fields(channel))
+            for (const word& fldName : dataq.fields(channel))
             {
-                if (input->IsFieldNeeded(fieldName.c_str()))
+                #if (PARAVIEW_VERSION_MAJOR == 5) && \
+                    (PARAVIEW_VERSION_MINOR < 6)
+                if (input->IsFieldNeeded(fldName.c_str()))
                 {
-                    requestedFields.insert(fieldName);
+                    requestedFields.insert(fldName);
                 }
+                #else
+                if
+                (
+                    input->IsFieldNeeded(fldName.c_str(), vtkDataObject::CELL)
+                 || input->IsFieldNeeded(fldName.c_str(), vtkDataObject::POINT)
+                )
+                {
+                    requestedFields.insert(fldName);
+                }
+                #endif
             }
 
             dataq.set(channel, requestedFields);
-- 
GitLab