From a50f27287113222f8ed16583bfc0f5cb5a55dbf9 Mon Sep 17 00:00:00 2001
From: cedricRobert <38067772+cedricRobert@users.noreply.github.com>
Date: Thu, 4 Jan 2024 10:39:30 +0100
Subject: [PATCH] V3.1.0 (#37)
functionnality:
* WITSML2.1 Completions/Perforations
* Property collection
* Well collection
BugFix:
* link between vtkDataAssembly & vtkPartitionedDataSetCollection
---
CMakeLists.txt | 4 +-
Plugin/CMakeLists.txt | 23 +-
Plugin/Energistics/CMakeLists.txt | 4 +-
Plugin/Energistics/Energistics.xml | 4 +-
...actObjectSetToVtkPartitionedDataSetSet.cxx | 85 +
...tractObjectSetToVtkPartitionedDataSetSet.h | 70 +
...nAbstractObjectToVtkPartitionedDataSet.cxx | 30 +
...monAbstractObjectToVtkPartitionedDataSet.h | 78 +
...tRepresentationToVtkPartitionedDataSet.cxx | 128 ++
...actRepresentationToVtkPartitionedDataSet.h | 57 +-
...itoryToVtkPartitionedDataSetCollection.cxx | 1415 +++++++++++++++++
...ositoryToVtkPartitionedDataSetCollection.h | 165 ++
.../ResqmlGrid2dToVtkStructuredGrid.cxx | 41 +-
.../ResqmlGrid2dToVtkStructuredGrid.h | 16 +-
...GridSubRepToVtkExplicitStructuredGrid.cxx} | 52 +-
...jkGridSubRepToVtkExplicitStructuredGrid.h} | 22 +-
...sqmlIjkGridToVtkExplicitStructuredGrid.cxx | 269 ++++
...esqmlIjkGridToVtkExplicitStructuredGrid.h} | 16 +-
.../ResqmlPolylineToVtkPolyData.cxx | 35 +-
.../ResqmlPolylineToVtkPolyData.h | 4 +-
.../ResqmlPropertyToVtkDataArray.cxx | 35 +-
.../ResqmlPropertyToVtkDataArray.h | 12 +-
...TriangulatedSetToVtkPartitionedDataSet.cxx | 39 +-
...mlTriangulatedSetToVtkPartitionedDataSet.h | 18 +-
.../ResqmlTriangulatedToVtkPolyData.cxx | 30 +-
.../ResqmlTriangulatedToVtkPolyData.h | 21 +-
...ucturedGridSubRepToVtkUnstructuredGrid.cxx | 49 +-
...tructuredGridSubRepToVtkUnstructuredGrid.h | 11 +-
...lUnstructuredGridToVtkUnstructuredGrid.cxx | 175 +-
...qmlUnstructuredGridToVtkUnstructuredGrid.h | 51 +-
.../ResqmlWellboreChannelToVtkPolyData.cxx | 52 +-
.../ResqmlWellboreChannelToVtkPolyData.h | 8 +-
...mlWellboreFrameToVtkPartitionedDataSet.cxx | 44 +
...sqmlWellboreFrameToVtkPartitionedDataSet.h | 22 +-
...boreMarkerFrameToVtkPartitionedDataSet.cxx | 65 +
...llboreMarkerFrameToVtkPartitionedDataSet.h | 20 +-
.../ResqmlWellboreMarkerToVtkPolyData.cxx | 123 +-
.../ResqmlWellboreMarkerToVtkPolyData.h | 31 +-
.../ResqmlWellboreTrajectoryToVtkPolyData.cxx | 32 +-
.../ResqmlWellboreTrajectoryToVtkPolyData.h | 15 +-
...boreCompletionPerforationToVtkPolyData.cxx | 205 +++
...llboreCompletionPerforationToVtkPolyData.h | 55 +
...lboreCompletionToVtkPartitionedDataSet.cxx | 54 +
...ellboreCompletionToVtkPartitionedDataSet.h | 50 +
...tRepresentationToVtkPartitionedDataSet.cxx | 141 --
...itoryToVtkPartitionedDataSetCollection.cxx | 867 ----------
...ositoryToVtkPartitionedDataSetCollection.h | 122 --
.../ResqmlIjkGridToVtkUnstructuredGrid.cxx | 255 ---
...mlWellboreFrameToVtkPartitionedDataSet.cxx | 74 -
...boreMarkerFrameToVtkPartitionedDataSet.cxx | 102 --
Plugin/Energistics/Tools/enum.h | 51 +
Plugin/Energistics/vtk.module | 3 +
Plugin/Energistics/vtkEPCReader.cxx | 89 +-
Plugin/Energistics/vtkEPCReader.h | 3 +-
Plugin/Energistics/vtkETPSource.cxx | 3 +-
Plugin/Energistics/vtkETPSource.h | 2 +-
Plugin/paraview.plugin | 14 +-
README.md | 19 +-
cmake/modules/FindAVRO.cmake | 108 ++
cmake/modules/FindFESAPI.cmake | 118 ++
60 files changed, 3538 insertions(+), 2168 deletions(-)
create mode 100644 Plugin/Energistics/Mapping/CommonAbstractObjectSetToVtkPartitionedDataSetSet.cxx
create mode 100644 Plugin/Energistics/Mapping/CommonAbstractObjectSetToVtkPartitionedDataSetSet.h
create mode 100644 Plugin/Energistics/Mapping/CommonAbstractObjectToVtkPartitionedDataSet.cxx
create mode 100644 Plugin/Energistics/Mapping/CommonAbstractObjectToVtkPartitionedDataSet.h
create mode 100644 Plugin/Energistics/Mapping/ResqmlAbstractRepresentationToVtkPartitionedDataSet.cxx
rename Plugin/Energistics/{ResqmlMapping => Mapping}/ResqmlAbstractRepresentationToVtkPartitionedDataSet.h (62%)
create mode 100644 Plugin/Energistics/Mapping/ResqmlDataRepositoryToVtkPartitionedDataSetCollection.cxx
create mode 100644 Plugin/Energistics/Mapping/ResqmlDataRepositoryToVtkPartitionedDataSetCollection.h
rename Plugin/Energistics/{ResqmlMapping => Mapping}/ResqmlGrid2dToVtkStructuredGrid.cxx (73%)
rename Plugin/Energistics/{ResqmlMapping => Mapping}/ResqmlGrid2dToVtkStructuredGrid.h (81%)
rename Plugin/Energistics/{ResqmlMapping/ResqmlIjkGridSubRepToVtkUnstructuredGrid.cxx => Mapping/ResqmlIjkGridSubRepToVtkExplicitStructuredGrid.cxx} (68%)
rename Plugin/Energistics/{ResqmlMapping/ResqmlIjkGridSubRepToVtkUnstructuredGrid.h => Mapping/ResqmlIjkGridSubRepToVtkExplicitStructuredGrid.h} (69%)
create mode 100644 Plugin/Energistics/Mapping/ResqmlIjkGridToVtkExplicitStructuredGrid.cxx
rename Plugin/Energistics/{ResqmlMapping/ResqmlIjkGridToVtkUnstructuredGrid.h => Mapping/ResqmlIjkGridToVtkExplicitStructuredGrid.h} (71%)
rename Plugin/Energistics/{ResqmlMapping => Mapping}/ResqmlPolylineToVtkPolyData.cxx (77%)
rename Plugin/Energistics/{ResqmlMapping => Mapping}/ResqmlPolylineToVtkPolyData.h (87%)
rename Plugin/Energistics/{ResqmlMapping => Mapping}/ResqmlPropertyToVtkDataArray.cxx (84%)
rename Plugin/Energistics/{ResqmlMapping => Mapping}/ResqmlPropertyToVtkDataArray.h (88%)
rename Plugin/Energistics/{ResqmlMapping => Mapping}/ResqmlTriangulatedSetToVtkPartitionedDataSet.cxx (73%)
rename Plugin/Energistics/{ResqmlMapping => Mapping}/ResqmlTriangulatedSetToVtkPartitionedDataSet.h (76%)
rename Plugin/Energistics/{ResqmlMapping => Mapping}/ResqmlTriangulatedToVtkPolyData.cxx (81%)
rename Plugin/Energistics/{ResqmlMapping => Mapping}/ResqmlTriangulatedToVtkPolyData.h (76%)
rename Plugin/Energistics/{ResqmlMapping => Mapping}/ResqmlUnstructuredGridSubRepToVtkUnstructuredGrid.cxx (83%)
rename Plugin/Energistics/{ResqmlMapping => Mapping}/ResqmlUnstructuredGridSubRepToVtkUnstructuredGrid.h (83%)
rename Plugin/Energistics/{ResqmlMapping => Mapping}/ResqmlUnstructuredGridToVtkUnstructuredGrid.cxx (79%)
rename Plugin/Energistics/{ResqmlMapping => Mapping}/ResqmlUnstructuredGridToVtkUnstructuredGrid.h (77%)
rename Plugin/Energistics/{ResqmlMapping => Mapping}/ResqmlWellboreChannelToVtkPolyData.cxx (68%)
rename Plugin/Energistics/{ResqmlMapping => Mapping}/ResqmlWellboreChannelToVtkPolyData.h (78%)
create mode 100644 Plugin/Energistics/Mapping/ResqmlWellboreFrameToVtkPartitionedDataSet.cxx
rename Plugin/Energistics/{ResqmlMapping => Mapping}/ResqmlWellboreFrameToVtkPartitionedDataSet.h (60%)
create mode 100644 Plugin/Energistics/Mapping/ResqmlWellboreMarkerFrameToVtkPartitionedDataSet.cxx
rename Plugin/Energistics/{ResqmlMapping => Mapping}/ResqmlWellboreMarkerFrameToVtkPartitionedDataSet.h (67%)
rename Plugin/Energistics/{ResqmlMapping => Mapping}/ResqmlWellboreMarkerToVtkPolyData.cxx (56%)
rename Plugin/Energistics/{ResqmlMapping => Mapping}/ResqmlWellboreMarkerToVtkPolyData.h (64%)
rename Plugin/Energistics/{ResqmlMapping => Mapping}/ResqmlWellboreTrajectoryToVtkPolyData.cxx (77%)
rename Plugin/Energistics/{ResqmlMapping => Mapping}/ResqmlWellboreTrajectoryToVtkPolyData.h (82%)
create mode 100644 Plugin/Energistics/Mapping/WitsmlWellboreCompletionPerforationToVtkPolyData.cxx
create mode 100644 Plugin/Energistics/Mapping/WitsmlWellboreCompletionPerforationToVtkPolyData.h
create mode 100644 Plugin/Energistics/Mapping/WitsmlWellboreCompletionToVtkPartitionedDataSet.cxx
create mode 100644 Plugin/Energistics/Mapping/WitsmlWellboreCompletionToVtkPartitionedDataSet.h
delete mode 100644 Plugin/Energistics/ResqmlMapping/ResqmlAbstractRepresentationToVtkPartitionedDataSet.cxx
delete mode 100644 Plugin/Energistics/ResqmlMapping/ResqmlDataRepositoryToVtkPartitionedDataSetCollection.cxx
delete mode 100644 Plugin/Energistics/ResqmlMapping/ResqmlDataRepositoryToVtkPartitionedDataSetCollection.h
delete mode 100644 Plugin/Energistics/ResqmlMapping/ResqmlIjkGridToVtkUnstructuredGrid.cxx
delete mode 100644 Plugin/Energistics/ResqmlMapping/ResqmlWellboreFrameToVtkPartitionedDataSet.cxx
delete mode 100644 Plugin/Energistics/ResqmlMapping/ResqmlWellboreMarkerFrameToVtkPartitionedDataSet.cxx
create mode 100644 Plugin/Energistics/Tools/enum.h
create mode 100644 cmake/modules/FindAVRO.cmake
create mode 100644 cmake/modules/FindFESAPI.cmake
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8117da7..04e4874 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,12 +4,14 @@ cmake_minimum_required(VERSION 3.14.0)
cmake_policy(SET CMP0048 NEW)
project(Fespp
- VERSION 3.0.0
+ VERSION 3.1.0
DESCRIPTION "Paraview plugin for importing EPC documents"
HOMEPAGE_URL "https://github.com/F2I-Consulting/fespp"
LANGUAGES C CXX
)
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/modules)
+
# These five lines are required in order to set up installation directories
# (which also control build directory locations) and enable shared builds
# (CMake's default is for a static build).
diff --git a/Plugin/CMakeLists.txt b/Plugin/CMakeLists.txt
index 5cc13b3..020403f 100644
--- a/Plugin/CMakeLists.txt
+++ b/Plugin/CMakeLists.txt
@@ -11,14 +11,16 @@ endif (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
# DEPENDENCIES
# -----------------------------------------------------------------------------
-set (FESAPI_INCLUDE_DIR FESAPI_INCLUDE_DIR-NOTFOUND CACHE PATH "Path to the directory which contains the FESAPI header files")
-set (FESAPI_LIBRARY_RELEASE FESAPI_LIBRARY_RELEASE-NOTFOUND CACHE FILEPATH "Path to the FESAPI release library")
-set (FESAPI_LIBRARY_DEBUG FESAPI_LIBRARY_DEBUG-NOTFOUND CACHE FILEPATH "Path to the FESAPI debug library")
+find_package(FESAPI REQUIRED)
set (WITH_ETP_SSL OFF CACHE BOOL "Only if FESAPI build with ETP support... for building Fespp with ETP support.")
if (WITH_ETP_SSL)
- find_package(Boost 1.66.0 REQUIRED system)
+ find_package(Boost 1.70)
+ if (NOT Boost_FOUND)
+ # Boost system is required for Beast untill version 1.70 : https://www.boost.org/doc/libs/1_69_0/libs/beast/doc/html/beast/introduction.html
+ find_package(Boost 1.66 REQUIRED system)
+ endif()
find_package( Threads )
if (NOT TARGET OpenSSL::SSL OR NOT TARGET OpenSSL::Crypto)
find_package(OpenSSL REQUIRED)
@@ -39,18 +41,7 @@ if (WITH_ETP_SSL)
endif ()
#AVRO
- set (AVRO_INCLUDE_DIR AVRO_INCLUDE_DIR-NOTFOUND CACHE PATH "Path to the directory which contains the avro header files")
- if (NOT IS_DIRECTORY ${AVRO_INCLUDE_DIR})
- message(SEND_ERROR "The Avro include dir (AVRO_INCLUDE_DIR variable) does not look to be a valid directory. Please modify it.")
- endif ()
- set (AVRO_LIBRARY_RELEASE AVRO_LIBRARY_RELEASE-NOTFOUND CACHE FILEPATH "Path to the file which contains the avro library release")
- if (NOT EXISTS ${AVRO_LIBRARY_RELEASE})
- message(WARNING "The avro library (AVRO_LIBRARY_RELEASE variable) does not look to be a valid file. Please modify it.")
- endif ()
- set (AVRO_LIBRARY_DEBUG AVRO_LIBRARY_DEBUG-NOTFOUND CACHE FILEPATH "Path to the file which contains the AVRO library DEBUG")
- if (NOT EXISTS ${AVRO_LIBRARY_DEBUG})
- message(WARNING "The AVRO library (AVRO_LIBRARY_DEBUG variable) does not look to be a valid file. Please modify it.")
- endif ()
+ find_package(AVRO REQUIRED)
endif (WITH_ETP_SSL)
# -----------------------------------------------------------------------------
diff --git a/Plugin/Energistics/CMakeLists.txt b/Plugin/Energistics/CMakeLists.txt
index d732f86..547365a 100644
--- a/Plugin/Energistics/CMakeLists.txt
+++ b/Plugin/Energistics/CMakeLists.txt
@@ -3,8 +3,8 @@ set(classes
vtkETPSource
)
-FILE (GLOB FESPP_MAPPING_SOURCES ResqmlMapping/*.cxx)
-FILE (GLOB FESPP_MAPPING_HEADERS ResqmlMapping/*.h)
+FILE (GLOB FESPP_MAPPING_SOURCES Mapping/*.cxx)
+FILE (GLOB FESPP_MAPPING_HEADERS Mapping/*.h Tools/*.h)
set (ENERGISTICS_SOURCES
${FESPP_MAPPING_SOURCES}
)
diff --git a/Plugin/Energistics/Energistics.xml b/Plugin/Energistics/Energistics.xml
index 77890f7..77d0a83 100644
--- a/Plugin/Energistics/Energistics.xml
+++ b/Plugin/Energistics/Energistics.xml
@@ -76,7 +76,7 @@
-
+
This property specifies the string used to describe the ETP Url
@@ -89,7 +89,7 @@
-
+
diff --git a/Plugin/Energistics/Mapping/CommonAbstractObjectSetToVtkPartitionedDataSetSet.cxx b/Plugin/Energistics/Mapping/CommonAbstractObjectSetToVtkPartitionedDataSetSet.cxx
new file mode 100644
index 0000000..4d43e07
--- /dev/null
+++ b/Plugin/Energistics/Mapping/CommonAbstractObjectSetToVtkPartitionedDataSetSet.cxx
@@ -0,0 +1,85 @@
+/*-----------------------------------------------------------------------
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"; you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-----------------------------------------------------------------------*/
+#include "Mapping/CommonAbstractObjectSetToVtkPartitionedDataSetSet.h"
+
+//----------------------------------------------------------------------------
+CommonAbstractObjectSetToVtkPartitionedDataSetSet::CommonAbstractObjectSetToVtkPartitionedDataSetSet(const COMMON_NS::AbstractObject *p_abstractObject, int p_procNumber, int p_maxProc)
+ : _procNumber(p_procNumber),
+ _maxProc(p_maxProc),
+ _resqmlData(p_abstractObject),
+ _mapperSet()
+{
+ _uuid = p_abstractObject->getUuid();
+ _title = p_abstractObject->getTitle();
+}
+
+CommonAbstractObjectSetToVtkPartitionedDataSetSet::~CommonAbstractObjectSetToVtkPartitionedDataSetSet()
+{
+ for (auto &w_item : _mapperSet)
+ {
+ delete w_item;
+ }
+ _mapperSet.clear();
+}
+
+void CommonAbstractObjectSetToVtkPartitionedDataSetSet::loadVtkObject()
+{
+ for (int w_i = _procNumber; w_i < _mapperSet.size(); w_i += _maxProc)
+ {
+ _mapperSet[w_i]->loadVtkObject();
+ }
+}
+
+//----------------------------------------------------------------------------
+void CommonAbstractObjectSetToVtkPartitionedDataSetSet::removeCommonAbstractObjectToVtkPartitionedDataSet(const std::string &p_id)
+{
+ for (auto w_it = _mapperSet.begin(); w_it != _mapperSet.end();)
+ {
+ CommonAbstractObjectToVtkPartitionedDataSet *w_mapper = *w_it;
+ if (w_mapper->getUuid() == p_id)
+ {
+ delete w_mapper;
+ w_it = _mapperSet.erase(w_it);
+
+ return;
+ }
+ else
+ {
+ ++w_it;
+ }
+ }
+}
+
+//----------------------------------------------------------------------------
+bool CommonAbstractObjectSetToVtkPartitionedDataSetSet::existUuid(const std::string &p_id)
+{
+ for (auto w_it = _mapperSet.begin(); w_it != _mapperSet.end();)
+ {
+ CommonAbstractObjectToVtkPartitionedDataSet *w_mapper = *w_it;
+ if (w_mapper->getUuid() == p_id)
+ {
+ return true;
+ }
+ else
+ {
+ ++w_it;
+ }
+ }
+ return false;
+}
diff --git a/Plugin/Energistics/Mapping/CommonAbstractObjectSetToVtkPartitionedDataSetSet.h b/Plugin/Energistics/Mapping/CommonAbstractObjectSetToVtkPartitionedDataSetSet.h
new file mode 100644
index 0000000..be9cbe1
--- /dev/null
+++ b/Plugin/Energistics/Mapping/CommonAbstractObjectSetToVtkPartitionedDataSetSet.h
@@ -0,0 +1,70 @@
+/*-----------------------------------------------------------------------
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"; you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-----------------------------------------------------------------------*/
+#ifndef __CommonAbstractObjectSetToVtkPartitionedDataSetSet__h__
+#define __CommonAbstractObjectSetToVtkPartitionedDataSetSet__h__
+
+// include system
+#include
+
+// include VTK library
+#include
+#include
+
+// include F2i-consulting Energistics Standards API
+#include
+
+// include F2i-consulting Energistics ParaView Plugin
+#include "Mapping/CommonAbstractObjectToVtkPartitionedDataSet.h"
+
+/** @brief transform a RESQML abstract object set to vtkPartitionedDataSet set
+ */
+class CommonAbstractObjectSetToVtkPartitionedDataSetSet
+{
+public:
+ // Constructor
+ CommonAbstractObjectSetToVtkPartitionedDataSetSet(const COMMON_NS::AbstractObject *p_abstractObject, int p_procNumber = 0, int p_maxProc = 1);
+
+ // destructor
+ ~CommonAbstractObjectSetToVtkPartitionedDataSetSet();
+
+ /**
+ *
+ */
+ std::string getUuid() const { return _uuid; };
+ std::string getTitle() const { return _title; };
+
+ void loadVtkObject();
+ void removeCommonAbstractObjectToVtkPartitionedDataSet(const std::string &p_id);
+ std::vector getMapperSet() { return _mapperSet; }
+
+ bool existUuid(const std::string &p_id);
+
+protected:
+ const COMMON_NS::AbstractObject *_resqmlData;
+
+ // for Multithreading
+ int _procNumber;
+ int _maxProc;
+
+ std::string _uuid;
+ std::string _title;
+
+ std::vector _mapperSet;
+};
+#endif
diff --git a/Plugin/Energistics/Mapping/CommonAbstractObjectToVtkPartitionedDataSet.cxx b/Plugin/Energistics/Mapping/CommonAbstractObjectToVtkPartitionedDataSet.cxx
new file mode 100644
index 0000000..a48b5a4
--- /dev/null
+++ b/Plugin/Energistics/Mapping/CommonAbstractObjectToVtkPartitionedDataSet.cxx
@@ -0,0 +1,30 @@
+/*-----------------------------------------------------------------------
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"; you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-----------------------------------------------------------------------*/
+#include "Mapping/CommonAbstractObjectToVtkPartitionedDataSet.h"
+
+//----------------------------------------------------------------------------
+CommonAbstractObjectToVtkPartitionedDataSet::CommonAbstractObjectToVtkPartitionedDataSet(const COMMON_NS::AbstractObject *p_abstractObject, int p_procNumber, int p_maxProc)
+ : _procNumber(p_procNumber),
+ _maxProc(p_maxProc),
+ _resqmlData(p_abstractObject),
+ _vtkData(nullptr)
+{
+ _absUuid = getResqmlData()->getUuid();
+ _absTitle = getResqmlData()->getTitle();
+}
diff --git a/Plugin/Energistics/Mapping/CommonAbstractObjectToVtkPartitionedDataSet.h b/Plugin/Energistics/Mapping/CommonAbstractObjectToVtkPartitionedDataSet.h
new file mode 100644
index 0000000..778db30
--- /dev/null
+++ b/Plugin/Energistics/Mapping/CommonAbstractObjectToVtkPartitionedDataSet.h
@@ -0,0 +1,78 @@
+/*-----------------------------------------------------------------------
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"; you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-----------------------------------------------------------------------*/
+#ifndef __CommonAbstractObjectTovtkPartitionedDataSet__h__
+#define __CommonAbstractObjectTovtkPartitionedDataSet__h__
+
+// include system
+#include
+
+// include VTK library
+#include
+#include
+
+// include F2i-consulting Energistics Standards API
+#include
+
+/** @brief transform a RESQML abstract object to vtkPartitionedDataSet
+ */
+class CommonAbstractObjectToVtkPartitionedDataSet
+{
+public:
+ /**
+ * Constructor
+ */
+ CommonAbstractObjectToVtkPartitionedDataSet(const COMMON_NS::AbstractObject *p_abstractObject, int p_procNumber = 0, int p_maxProc = 1);
+
+ /**
+ * Destructor
+ */
+ virtual ~CommonAbstractObjectToVtkPartitionedDataSet() = default;
+
+ /**
+ * load VtkPartitionedDataSet with resqml data
+ */
+ virtual void loadVtkObject() = 0;
+
+ /**
+ * return the vtkPartitionedDataSet of resqml object
+ */
+ vtkSmartPointer getOutput() const { return _vtkData; }
+
+ /**
+ *
+ */
+ std::string getUuid() const { return _absUuid; };
+ std::string getTitle() const { return _absTitle; };
+ void setUuid(std::string p_newUuid) { _absUuid = p_newUuid; }
+ void setTitle(std::string p_newTitle) { _absTitle = p_newTitle; }
+
+protected:
+ const COMMON_NS::AbstractObject *getResqmlData() const { return _resqmlData; }
+
+ int _procNumber;
+ int _maxProc;
+
+ const COMMON_NS::AbstractObject *_resqmlData;
+
+ vtkSmartPointer _vtkData;
+
+ std::string _absUuid;
+ std::string _absTitle;
+};
+#endif
diff --git a/Plugin/Energistics/Mapping/ResqmlAbstractRepresentationToVtkPartitionedDataSet.cxx b/Plugin/Energistics/Mapping/ResqmlAbstractRepresentationToVtkPartitionedDataSet.cxx
new file mode 100644
index 0000000..7f0156d
--- /dev/null
+++ b/Plugin/Energistics/Mapping/ResqmlAbstractRepresentationToVtkPartitionedDataSet.cxx
@@ -0,0 +1,128 @@
+/*-----------------------------------------------------------------------
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"; you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-----------------------------------------------------------------------*/
+#include "Mapping/ResqmlAbstractRepresentationToVtkPartitionedDataSet.h"
+
+#include
+#include
+
+// include VTK library
+#include
+#include
+#include
+
+// FESAPI
+#include
+#include
+
+// include F2i-consulting Energistics Paraview Plugin
+#include "Mapping/ResqmlPropertyToVtkDataArray.h"
+
+//----------------------------------------------------------------------------
+ResqmlAbstractRepresentationToVtkPartitionedDataSet::ResqmlAbstractRepresentationToVtkPartitionedDataSet(const RESQML2_NS::AbstractRepresentation *p_abstractRepresentation, int p_procNumber, int p_maxProc)
+ : CommonAbstractObjectToVtkPartitionedDataSet(p_abstractRepresentation,
+ p_procNumber,
+ p_maxProc),
+ _subrepPointerOnPointsCount(0),
+ _resqmlData(p_abstractRepresentation),
+ _uuidToVtkDataArray()
+{
+}
+
+void ResqmlAbstractRepresentationToVtkPartitionedDataSet::addDataArray(const std::string &p_uuid, int p_patchIndex)
+{
+ std::vector w_valuesPropertySet = getResqmlData()->getValuesPropertySet();
+ std::vector::iterator w_it = std::find_if(w_valuesPropertySet.begin(), w_valuesPropertySet.end(),
+ [&p_uuid](RESQML2_NS::AbstractValuesProperty const *w_property)
+ { return w_property->getUuid() == p_uuid; });
+ if (w_it != std::end(w_valuesPropertySet))
+ {
+ auto const *const w_resqmlProp = *w_it;
+ ResqmlPropertyToVtkDataArray *w_fesppProperty = _isHyperslabed
+ ? new ResqmlPropertyToVtkDataArray(w_resqmlProp,
+ _iCellCount * _jCellCount * (_maxKIndex - _initKIndex),
+ _pointCount,
+ _iCellCount,
+ _jCellCount,
+ _maxKIndex - _initKIndex,
+ _initKIndex,
+ p_patchIndex)
+ : new ResqmlPropertyToVtkDataArray(w_resqmlProp,
+ _iCellCount * _jCellCount * _kCellCount,
+ _pointCount,
+ p_patchIndex);
+ switch (w_resqmlProp->getAttachmentKind())
+ {
+ case gsoap_eml2_3::eml23__IndexableElement::cells:
+ case gsoap_eml2_3::eml23__IndexableElement::triangles:
+ _vtkData->GetPartition(0)->GetCellData()->AddArray(w_fesppProperty->getVtkData());
+ break;
+ case gsoap_eml2_3::eml23__IndexableElement::nodes:
+ _vtkData->GetPartition(0)->GetPointData()->AddArray(w_fesppProperty->getVtkData());
+ break;
+ default:
+ throw std::invalid_argument("The property " + p_uuid + " is attached on a non supported topological element i.e. not cell, not point.");
+ }
+ _uuidToVtkDataArray[p_uuid] = w_fesppProperty;
+ _vtkData->Modified();
+ }
+ else
+ {
+ throw std::invalid_argument("The property " + p_uuid + "cannot be added since it is not contained in the representation " + getResqmlData()->getUuid());
+ }
+}
+
+void ResqmlAbstractRepresentationToVtkPartitionedDataSet::deleteDataArray(const std::string &p_uuid)
+{
+ ResqmlPropertyToVtkDataArray *w_vtkDataArray = _uuidToVtkDataArray[p_uuid];
+ if (w_vtkDataArray != nullptr)
+ {
+ char *w_dataArrayName = w_vtkDataArray->getVtkData()->GetName();
+ if (_vtkData->GetPartition(0)->GetCellData()->HasArray(w_dataArrayName))
+ {
+ _vtkData->GetPartition(0)->GetCellData()->RemoveArray(w_dataArrayName);
+ }
+ if (_vtkData->GetPartition(0)->GetPointData()->HasArray(w_dataArrayName))
+ {
+ _vtkData->GetPartition(0)->GetPointData()->RemoveArray(w_dataArrayName);
+ }
+
+ // Cleaning
+ delete w_vtkDataArray;
+ _uuidToVtkDataArray.erase(p_uuid);
+ }
+ else
+ {
+ throw std::invalid_argument("The property " + p_uuid + "cannot be deleted from representation " + getResqmlData()->getUuid() + " since it has never been added");
+ }
+}
+
+void ResqmlAbstractRepresentationToVtkPartitionedDataSet::registerSubRep()
+{
+ ++_subrepPointerOnPointsCount;
+}
+
+void ResqmlAbstractRepresentationToVtkPartitionedDataSet::unregisterSubRep()
+{
+ --_subrepPointerOnPointsCount;
+}
+
+unsigned int ResqmlAbstractRepresentationToVtkPartitionedDataSet::subRepLinkedCount()
+{
+ return _subrepPointerOnPointsCount;
+}
diff --git a/Plugin/Energistics/ResqmlMapping/ResqmlAbstractRepresentationToVtkPartitionedDataSet.h b/Plugin/Energistics/Mapping/ResqmlAbstractRepresentationToVtkPartitionedDataSet.h
similarity index 62%
rename from Plugin/Energistics/ResqmlMapping/ResqmlAbstractRepresentationToVtkPartitionedDataSet.h
rename to Plugin/Energistics/Mapping/ResqmlAbstractRepresentationToVtkPartitionedDataSet.h
index ced225c..c193bbb 100644
--- a/Plugin/Energistics/ResqmlMapping/ResqmlAbstractRepresentationToVtkPartitionedDataSet.h
+++ b/Plugin/Energistics/Mapping/ResqmlAbstractRepresentationToVtkPartitionedDataSet.h
@@ -29,15 +29,18 @@ under the License.
// include F2i-consulting Energistics Standards API
#include
+// include F2i-consulting Energistics Standards Paraview Plugin
+#include "CommonAbstractObjectToVtkPartitionedDataSet.h"
+
/** @brief transform a RESQML abstract representation to vtkPartitionedDataSet
*/
-class ResqmlAbstractRepresentationToVtkPartitionedDataSet
+class ResqmlAbstractRepresentationToVtkPartitionedDataSet : public CommonAbstractObjectToVtkPartitionedDataSet
{
public:
/**
* Constructor
*/
- ResqmlAbstractRepresentationToVtkPartitionedDataSet(RESQML2_NS::AbstractRepresentation *abstract_representation, int proc_number = 0, int max_proc = 1);
+ ResqmlAbstractRepresentationToVtkPartitionedDataSet(const RESQML2_NS::AbstractRepresentation *p_abstractRepresentation, int p_procNumber = 0, int p_maxProc = 1);
/**
* Destructor
@@ -48,62 +51,40 @@ class ResqmlAbstractRepresentationToVtkPartitionedDataSet
* load VtkPartitionedDataSet with resqml data
*/
virtual void loadVtkObject() = 0;
- /**
- * unload VtkPartitionedDataSet
- */
- void unloadVtkObject();
/**
* add a resqml property to VtkPartitionedDataSet
*/
- void addDataArray(const std::string &uuid, int patch_index = 0);
+ void addDataArray(const std::string &p_uuid, int p_patchIndex = 0);
/**
* remove a resqml property to VtkPartitionedDataSet
*/
- void deleteDataArray(const std::string &uuid);
+ void deleteDataArray(const std::string &p_uuid);
/**
- * return the vtkPartitionedDataSet of resqml representation
+ *
*/
- vtkSmartPointer getOutput() const { return vtkData; }
-
- /**
- *
- */
void registerSubRep();
void unregisterSubRep();
unsigned int subRepLinkedCount();
- /**
- *
- */
- std::string getUuid() const;
- std::string getTitle() const;
-
-
protected:
+ const RESQML2_NS::AbstractRepresentation *getResqmlData() const { return _resqmlData; }
- RESQML2_NS::AbstractRepresentation * getResqmlData() const { return resqmlData; }
-
- unsigned int subrep_pointer_on_points_count;
-
- uint64_t pointCount = 0;
- uint32_t iCellCount = 0; // = cellcount if not ijkGrid
- uint32_t jCellCount = 1;
- uint32_t kCellCount = 1;
- uint32_t initKIndex = 0;
- uint32_t maxKIndex = 0;
-
- bool isHyperslabed = false;
+ unsigned int _subrepPointerOnPointsCount;
- int procNumber;
- int maxProc;
+ uint64_t _pointCount = 0;
+ uint32_t _iCellCount = 0; // = cellcount if not ijkGrid
+ uint32_t _jCellCount = 1;
+ uint32_t _kCellCount = 1;
+ uint32_t _initKIndex = 0;
+ uint32_t _maxKIndex = 0;
- RESQML2_NS::AbstractRepresentation * resqmlData;
+ bool _isHyperslabed = false;
- vtkSmartPointer vtkData;
- std::unordered_map uuidToVtkDataArray;
+ const RESQML2_NS::AbstractRepresentation *_resqmlData;
+ std::unordered_map _uuidToVtkDataArray;
};
#endif
diff --git a/Plugin/Energistics/Mapping/ResqmlDataRepositoryToVtkPartitionedDataSetCollection.cxx b/Plugin/Energistics/Mapping/ResqmlDataRepositoryToVtkPartitionedDataSetCollection.cxx
new file mode 100644
index 0000000..356455a
--- /dev/null
+++ b/Plugin/Energistics/Mapping/ResqmlDataRepositoryToVtkPartitionedDataSetCollection.cxx
@@ -0,0 +1,1415 @@
+/*-----------------------------------------------------------------------
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"; you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-----------------------------------------------------------------------*/
+
+/*
+Documentation:
+==============
+
+VtkAssembly => TreeView:
+ - each node required 3 attributes:
+ - id = uuid of resqml/witsml object
+ - label = name to display in TreeView
+ - type = type
+*/
+#include "ResqmlDataRepositoryToVtkPartitionedDataSetCollection.h"
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+// VTK includes
+#include
+#include
+#include
+#include
+#include
+
+// FESAPI includes
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#ifdef WITH_ETP_SSL
+#include
+
+#include
+
+#include
+#include
+#include
+#include
+#endif
+
+#include "Mapping/ResqmlIjkGridToVtkExplicitStructuredGrid.h"
+#include "Mapping/ResqmlIjkGridSubRepToVtkExplicitStructuredGrid.h"
+#include "Mapping/ResqmlGrid2dToVtkStructuredGrid.h"
+#include "Mapping/ResqmlPolylineToVtkPolyData.h"
+#include "Mapping/ResqmlTriangulatedSetToVtkPartitionedDataSet.h"
+#include "Mapping/ResqmlUnstructuredGridToVtkUnstructuredGrid.h"
+#include "Mapping/ResqmlUnstructuredGridSubRepToVtkUnstructuredGrid.h"
+#include "Mapping/ResqmlWellboreTrajectoryToVtkPolyData.h"
+#include "Mapping/ResqmlWellboreMarkerFrameToVtkPartitionedDataSet.h"
+#include "Mapping/ResqmlWellboreFrameToVtkPartitionedDataSet.h"
+#include "Mapping/WitsmlWellboreCompletionToVtkPartitionedDataSet.h"
+#include "Mapping/WitsmlWellboreCompletionPerforationToVtkPolyData.h"
+#include "Mapping/CommonAbstractObjectSetToVtkPartitionedDataSetSet.h"
+
+ResqmlDataRepositoryToVtkPartitionedDataSetCollection::ResqmlDataRepositoryToVtkPartitionedDataSetCollection()
+ : _markerOrientation(false),
+ _markerSize(10),
+ _repository(new common::DataObjectRepository()),
+ _output(vtkSmartPointer::New()),
+ _nodeIdToMapper(),
+ _currentSelection(),
+ _oldSelection()
+{
+ auto w_assembly = vtkSmartPointer::New();
+ w_assembly->SetRootNodeName("data");
+
+ _output->SetDataAssembly(w_assembly);
+ _timesStep.clear();
+}
+
+ResqmlDataRepositoryToVtkPartitionedDataSetCollection::~ResqmlDataRepositoryToVtkPartitionedDataSetCollection()
+{
+ delete _repository;
+ for (const auto &w_keyVal : _nodeIdToMapper)
+ {
+ delete w_keyVal.second;
+ }
+}
+
+MapperType getMapperType(TreeViewNodeType p_type)
+{
+ switch (p_type) {
+ case TreeViewNodeType::Properties:
+ case TreeViewNodeType::Perforation:
+ case TreeViewNodeType::WellboreChannel:
+ case TreeViewNodeType::WellboreMarker:
+ case TreeViewNodeType::TimeSeries:
+ return MapperType::Data;
+ case TreeViewNodeType::Unknown:
+ case TreeViewNodeType::Collection:
+ case TreeViewNodeType::Wellbore:
+ return MapperType::Folder;
+ case TreeViewNodeType::Representation:
+ case TreeViewNodeType::SubRepresentation:
+ case TreeViewNodeType::WellboreTrajectory:
+ return MapperType::Mapper;
+ case TreeViewNodeType::WellboreMarkerFrame:
+ case TreeViewNodeType::WellboreFrame:
+ case TreeViewNodeType::WellboreCompletion:
+ return MapperType::MapperSet;
+ default:
+ return MapperType::Folder;
+ }
+}
+
+// This function replaces the VTK function this->MakeValidNodeName(),
+// which has a bug in the sorted_valid_chars array. The '.' character is placed
+// before the '-' character, which is incorrect. This function uses a valid_chars
+// array that correctly sorts the characters. The function checks if each character
+// in the input string is valid, and adds it to the output string if it is valid.
+// If the first character of the output string is not valid, an underscore is added
+// to the beginning of the output string. This function is designed to create a valid
+// node name from a given string.
+std::string ResqmlDataRepositoryToVtkPartitionedDataSetCollection::MakeValidNodeName(const char *p_name)
+{
+ if (p_name == nullptr || p_name[0] == '\0')
+ {
+ return std::string();
+ }
+
+ const char w_sortedValidChars[] =
+ "-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz";
+ const auto w_sortedValidCharsLen = strlen(w_sortedValidChars);
+
+ std::string w_result;
+ w_result.reserve(strlen(p_name));
+ for (size_t w_cc = 0, max = strlen(p_name); w_cc < max; ++w_cc)
+ {
+ if (std::binary_search(
+ w_sortedValidChars, w_sortedValidChars + w_sortedValidCharsLen, p_name[w_cc]))
+ {
+ w_result += p_name[w_cc];
+ }
+ }
+
+ if (w_result.empty() ||
+ ((w_result[0] < 'a' || w_result[0] > 'z') && (w_result[0] < 'A' || w_result[0] > 'Z') &&
+ w_result[0] != '_'))
+ {
+ return "_" + w_result;
+ }
+ return w_result;
+}
+
+std::string SimplifyXmlTag(std::string p_typeRepresentation)
+{
+ std::string w_suffix = "Representation";
+ std::string w_prefix = "Wellbore";
+
+ if (p_typeRepresentation.size() >= w_suffix.size() && p_typeRepresentation.substr(p_typeRepresentation.size() - w_suffix.size()) == w_suffix)
+ {
+ p_typeRepresentation = p_typeRepresentation.substr(0, p_typeRepresentation.size() - w_suffix.size());
+ }
+
+ if (p_typeRepresentation.size() >= w_prefix.size() && p_typeRepresentation.substr(0, w_prefix.size()) == w_prefix)
+ {
+ p_typeRepresentation = p_typeRepresentation.substr(w_prefix.size());
+ }
+ return p_typeRepresentation;
+}
+
+//----------------------------------------------------------------------------
+std::vector ResqmlDataRepositoryToVtkPartitionedDataSetCollection::connect(const std::string &p_etpUrl, const std::string &p_dataPartition, const std::string &p_authConnection)
+{
+ std::vector w_result;
+#ifdef WITH_ETP_SSL
+ boost::uuids::random_generator w_gen;
+ ETP_NS::InitializationParameters w_initializationParams(w_gen(), p_etpUrl);
+
+ std::map w_additionalHandshakeHeaderFields = {{"data-partition-id", p_dataPartition}};
+ if (p_etpUrl.find("ws://") == 0)
+ {
+ _session = ETP_NS::ClientSessionLaunchers::createWsClientSession(&w_initializationParams, p_authConnection, w_additionalHandshakeHeaderFields);
+ }
+ else
+ {
+ _session = ETP_NS::ClientSessionLaunchers::createWssClientSession(&w_initializationParams, p_authConnection, w_additionalHandshakeHeaderFields);
+ }
+ try
+ {
+ _session->setDataspaceProtocolHandlers(std::make_shared(_session.get()));
+ }
+ catch (const std::exception &e)
+ {
+ vtkOutputWindowDisplayErrorText((std::string("fesapi error > ") + e.what()).c_str());
+ }
+ try
+ {
+ _session->setDiscoveryProtocolHandlers(std::make_shared(_session.get()));
+ }
+ catch (const std::exception &e)
+ {
+ vtkOutputWindowDisplayErrorText((std::string("fesapi error > ") + e.what()).c_str());
+ }
+ try
+ {
+ _session->setStoreProtocolHandlers(std::make_shared(_session.get()));
+ }
+ catch (const std::exception &e)
+ {
+ vtkOutputWindowDisplayErrorText((std::string("fesapi error > ") + e.what()).c_str());
+ }
+ try
+ {
+ _session->setDataArrayProtocolHandlers(std::make_shared(_session.get()));
+ }
+ catch (const std::exception &e)
+ {
+ vtkOutputWindowDisplayErrorText((std::string("fesapi error > ") + e.what()).c_str());
+ }
+
+ _repository->setHdfProxyFactory(new ETP_NS::FesapiHdfProxyFactory(_session.get()));
+
+ //
+ if (p_etpUrl.find("ws://") == 0)
+ {
+ auto w_plainSession = std::dynamic_pointer_cast(_session);
+ std::thread w_sessionThread(&ETP_NS::PlainClientSession::run, w_plainSession);
+ w_sessionThread.detach();
+ }
+ else
+ {
+ auto w_sslSession = std::dynamic_pointer_cast(_session);
+ std::thread w_sessionThread(&ETP_NS::SslClientSession::run, w_sslSession);
+ w_sessionThread.detach();
+ }
+
+ // Wait for the ETP session to be opened
+ auto w_tStart = std::chrono::high_resolution_clock::now();
+ while (_session->isEtpSessionClosed())
+ {
+ if (std::chrono::duration(std::chrono::high_resolution_clock::now() - w_tStart).count() > 5000)
+ {
+ throw std::invalid_argument("Did you forget to click apply button before to connect? Time out for websocket connection" +
+ std::to_string(std::chrono::duration(std::chrono::high_resolution_clock::now() - w_tStart).count()) + "ms.\n");
+ }
+ }
+
+ //************ LIST DATASPACES ************
+ const auto w_dataspaces = _session->getDataspaces();
+
+ std::transform(w_dataspaces.begin(), w_dataspaces.end(), std::back_inserter(w_result),
+ [](const Energistics::Etp::v12::Datatypes::Object::Dataspace &w_ds)
+ { return w_ds.uri; });
+
+#endif
+ return w_result;
+}
+
+//----------------------------------------------------------------------------
+void ResqmlDataRepositoryToVtkPartitionedDataSetCollection::disconnect()
+{
+#ifdef WITH_ETP_SSL
+ _session->close();
+#endif
+}
+
+//----------------------------------------------------------------------------
+std::string ResqmlDataRepositoryToVtkPartitionedDataSetCollection::addFile(const char *p_fileName)
+{
+ COMMON_NS::EpcDocument w_pck(p_fileName);
+ std::string w_message = w_pck.deserializeInto(*_repository);
+ w_pck.close();
+
+ w_message += buildDataAssemblyFromDataObjectRepo(p_fileName);
+ return w_message;
+}
+
+//----------------------------------------------------------------------------
+std::string ResqmlDataRepositoryToVtkPartitionedDataSetCollection::addDataspace(const char *p_dataspace)
+{
+#ifdef WITH_ETP_SSL
+ //************ LIST RESOURCES ************
+ Energistics::Etp::v12::Datatypes::Object::ContextInfo w_ctxInfo;
+ w_ctxInfo.uri = p_dataspace;
+ w_ctxInfo.depth = 0;
+ w_ctxInfo.navigableEdges = Energistics::Etp::v12::Datatypes::Object::RelationshipKind::Both;
+ w_ctxInfo.includeSecondaryTargets = false;
+ w_ctxInfo.includeSecondarySources = false;
+ const auto w_resources = _session->getResources(w_ctxInfo, Energistics::Etp::v12::Datatypes::Object::ContextScopeKind::targets);
+
+ //************ GET ALL DATAOBJECTS ************
+ _repository->setHdfProxyFactory(new ETP_NS::FesapiHdfProxyFactory(_session.get()));
+ if (!w_resources.empty())
+ {
+ std::map w_query;
+ for (size_t w_i = 0; w_i < w_resources.size(); ++w_i)
+ {
+ w_query[std::to_string(w_i)] = w_resources[w_i].uri;
+ }
+ const auto w_dataobjects = _session->getDataObjects(w_query);
+ for (auto &w_datoObject : w_dataobjects)
+ {
+ _repository->addOrReplaceGsoapProxy(w_datoObject.second.data,
+ ETP_NS::EtpHelpers::getDataObjectType(w_datoObject.second.resource.uri),
+ ETP_NS::EtpHelpers::getDataspaceUri(w_datoObject.second.resource.uri));
+ }
+ }
+ else
+ {
+ vtkOutputWindowDisplayWarningText(("There is no dataobject in the dataspace : " + std::string(p_dataspace) + "\n").c_str());
+ }
+#endif
+ return buildDataAssemblyFromDataObjectRepo("");
+}
+
+namespace
+{
+ auto lexicographicalComparison = [](const COMMON_NS::AbstractObject *p_a, const COMMON_NS::AbstractObject *p_b) -> bool
+ {
+ return p_a->getTitle().compare(p_b->getTitle()) < 0;
+ };
+
+ template
+ void sortAndAdd(std::vector p_source, std::vector &p_dest)
+ {
+ std::sort(p_source.begin(), p_source.end(), lexicographicalComparison);
+ std::move(p_source.begin(), p_source.end(), std::inserter(p_dest, p_dest.end()));
+ }
+}
+
+std::string ResqmlDataRepositoryToVtkPartitionedDataSetCollection::buildDataAssemblyFromDataObjectRepo(const char *p_fileName)
+{
+ std::vector w_allReps;
+
+ // create vtkDataAssembly: create treeView in property panel
+ sortAndAdd(_repository->getHorizonGrid2dRepresentationSet(), w_allReps);
+ sortAndAdd(_repository->getIjkGridRepresentationSet(), w_allReps);
+ sortAndAdd(_repository->getAllPolylineSetRepresentationSet(), w_allReps);
+ sortAndAdd(_repository->getAllTriangulatedSetRepresentationSet(), w_allReps);
+ sortAndAdd(_repository->getUnstructuredGridRepresentationSet(), w_allReps);
+
+ // See https://stackoverflow.com/questions/15347123/how-to-construct-a-stdstring-from-a-stdvectorstring
+ std::string w_message = std::accumulate(std::begin(w_allReps), std::end(w_allReps), std::string{},
+ [&](std::string &message, RESQML2_NS::AbstractRepresentation const *rep)
+ {
+ return message += searchRepresentations(rep);
+ });
+ // get WellboreTrajectory
+ w_message += searchWellboreTrajectory(p_fileName);
+
+ // get TimeSeries
+ w_message += searchTimeSeries(p_fileName);
+
+ return w_message;
+}
+
+std::string ResqmlDataRepositoryToVtkPartitionedDataSetCollection::searchRepresentations(resqml2::AbstractRepresentation const *p_representation, int p_NodeId)
+{
+ std::string w_result;
+
+ if (p_representation->isPartial())
+ {
+ // check if it has already been added
+ // not exist => not loaded
+ if (_output->GetDataAssembly()->FindFirstNodeWithName(("_" + p_representation->getUuid()).c_str()) == -1)
+ {
+ return "Partial representation with UUID \"" + p_representation->getUuid() + "\" is not loaded.\n";
+ } /******* TODO ********/ // exist but not the same type ?
+ }
+ else
+ {
+ // The leading underscore is forced by VTK which does not support a node name starting with a digit (probably because it is a QNAME).
+ const std::string w_nodeName = "_" + p_representation->getUuid();
+ const int w_existingNodeId = _output->GetDataAssembly()->FindFirstNodeWithName(w_nodeName.c_str());
+ if (w_existingNodeId == -1)
+ {
+ p_NodeId = _output->GetDataAssembly()->AddNode(w_nodeName.c_str(), p_NodeId);
+
+ auto const *w_subrep = dynamic_cast(p_representation);
+ // To shorten the xmlTag by removing �Representation� from the end.
+
+ std::string w_typeRepresentation = SimplifyXmlTag(p_representation->getXmlTag());
+
+ const std::string w_representationVtkValidName = w_subrep == nullptr
+ ? this->MakeValidNodeName((w_typeRepresentation + "_" + p_representation->getTitle()).c_str())
+ : this->MakeValidNodeName((w_typeRepresentation + "_" + w_subrep->getSupportingRepresentation(0)->getTitle() + "_" + p_representation->getTitle()).c_str());
+
+ const TreeViewNodeType w_type = w_subrep == nullptr
+ ? TreeViewNodeType::Representation
+ : TreeViewNodeType::SubRepresentation;
+
+ _output->GetDataAssembly()->SetAttribute(p_NodeId, "label", w_representationVtkValidName.c_str());
+ _output->GetDataAssembly()->SetAttribute(p_NodeId, "type", std::to_string(static_cast(TreeViewNodeType::Representation)).c_str());
+ }
+ else
+ {
+ p_NodeId = w_existingNodeId;
+ }
+ }
+
+ // add sub representation with properties (only for ijkGrid and unstructured grid)
+ if (dynamic_cast(p_representation) != nullptr ||
+ dynamic_cast(p_representation) != nullptr)
+ {
+ w_result += searchSubRepresentation(p_representation, p_NodeId);
+ }
+
+ // add properties to representation
+ w_result += searchProperties(p_representation, p_NodeId);
+
+ return w_result;
+}
+
+std::string ResqmlDataRepositoryToVtkPartitionedDataSetCollection::searchSubRepresentation(RESQML2_NS::AbstractRepresentation const *p_representation, int p_nodeParent)
+{
+ std::string w_message = "";
+ try
+ {
+ auto w_subRepresentationSet = p_representation->getSubRepresentationSet();
+ std::sort(w_subRepresentationSet.begin(), w_subRepresentationSet.end(), lexicographicalComparison);
+
+ w_message = std::accumulate(std::begin(w_subRepresentationSet), std::end(w_subRepresentationSet), std::string{},
+ [&](std::string &message, RESQML2_NS::SubRepresentation *b)
+ {
+ return message += searchRepresentations(b, _output->GetDataAssembly()->GetParent(p_nodeParent));
+ });
+ }
+ catch (const std::exception &e)
+ {
+ return "Exception in FESAPI when calling getSubRepresentationSet for uuid : " + p_representation->getUuid() + " : " + e.what() + ".\n";
+ }
+
+ return w_message;
+}
+
+int ResqmlDataRepositoryToVtkPartitionedDataSetCollection::searchPropertySet(resqml2_0_1::PropertySet const *p_propSet, int p_nodeId)
+{
+ if (_output->GetDataAssembly()->FindFirstNodeWithName(("_" + p_propSet->getUuid()).c_str()) == -1)
+ { // verify uuid exist in treeview
+ // To shorten the xmlTag by removing �Representation� from the end.
+ resqml2_0_1::PropertySet *w_parent = p_propSet->getParent();
+ if (w_parent != nullptr)
+ {
+ p_nodeId = searchPropertySet(w_parent, p_nodeId);
+ }
+ if (_output->GetDataAssembly()->FindFirstNodeWithName(("_" + p_propSet->getUuid()).c_str()) == -1)
+ {
+ const std::string w_vtkValidName = MakeValidNodeName(("Collection_" + p_propSet->getTitle()).c_str());
+ p_nodeId = _output->GetDataAssembly()->AddNode(("_" + p_propSet->getUuid()).c_str(), p_nodeId);
+ _output->GetDataAssembly()->SetAttribute(p_nodeId, "label", w_vtkValidName.c_str());
+ _output->GetDataAssembly()->SetAttribute(p_nodeId, "type", std::to_string(static_cast(TreeViewNodeType::Collection)).c_str());
+ }
+ }
+ else
+ {
+ return _output->GetDataAssembly()->FindFirstNodeWithName(("_" + p_propSet->getUuid()).c_str());
+ }
+
+ return p_nodeId;
+}
+
+std::string ResqmlDataRepositoryToVtkPartitionedDataSetCollection::searchProperties(RESQML2_NS::AbstractRepresentation const *p_representation, int p_nodeParent)
+{
+ try
+ {
+ auto w_valuesPropertySet = p_representation->getValuesPropertySet();
+ std::sort(w_valuesPropertySet.begin(), w_valuesPropertySet.end(), lexicographicalComparison);
+
+ int w_propertySetNodeId = p_nodeParent;
+ // property
+ for (auto const *w_property : w_valuesPropertySet)
+ {
+ for (resqml2_0_1::PropertySet const *w_propertySet : w_property->getPropertySets())
+ {
+ w_propertySetNodeId = searchPropertySet(w_propertySet, p_nodeParent);
+ }
+
+ const std::string w_vtkValidName = MakeValidNodeName((w_property->getXmlTag() + '_' + w_property->getTitle()).c_str());
+
+ if (_output->GetDataAssembly()->FindFirstNodeWithName(("_" + w_property->getUuid()).c_str()) == -1)
+ { // verify uuid exist in treeview
+ int w_propertyNodeId = _output->GetDataAssembly()->AddNode(("_" + w_property->getUuid()).c_str(), w_propertySetNodeId);
+ _output->GetDataAssembly()->SetAttribute(w_propertyNodeId, "label", w_vtkValidName.c_str());
+ _output->GetDataAssembly()->SetAttribute(w_propertyNodeId, "type", std::to_string(static_cast(TreeViewNodeType::Properties)).c_str());
+ }
+ }
+ }
+ catch (const std::exception &e)
+ {
+ return "Exception in FESAPI when calling getValuesPropertySet with representation uuid: " + p_representation->getUuid() + " : " + e.what() + ".\n";
+ }
+
+ return "";
+}
+
+int ResqmlDataRepositoryToVtkPartitionedDataSetCollection::searchRepresentationSetRepresentation(resqml2::RepresentationSetRepresentation const *p_rsr, int p_nodeId)
+{
+ if (_output->GetDataAssembly()->FindFirstNodeWithName(("_" + p_rsr->getUuid()).c_str()) == -1)
+ { // verify uuid exist in treeview
+ // To shorten the xmlTag by removing �Representation� from the end.
+ for (resqml2::RepresentationSetRepresentation *w_rsr : p_rsr->getRepresentationSetRepresentationSet())
+ {
+ p_nodeId = searchRepresentationSetRepresentation(w_rsr, p_nodeId);
+ }
+ if (_output->GetDataAssembly()->FindFirstNodeWithName(("_" + p_rsr->getUuid()).c_str()) == -1)
+ {
+ const std::string w_vtkValidName = this->MakeValidNodeName(("Collection_" + p_rsr->getTitle()).c_str());
+ p_nodeId = _output->GetDataAssembly()->AddNode(("_" + p_rsr->getUuid()).c_str(), p_nodeId);
+ _output->GetDataAssembly()->SetAttribute(p_nodeId, "label", w_vtkValidName.c_str());
+ _output->GetDataAssembly()->SetAttribute(p_nodeId, "type", std::to_string(static_cast(TreeViewNodeType::Collection)).c_str());
+ }
+ }
+ else
+ {
+ return _output->GetDataAssembly()->FindFirstNodeWithName(("_" + p_rsr->getUuid()).c_str());
+ }
+ return p_nodeId;
+}
+
+std::string ResqmlDataRepositoryToVtkPartitionedDataSetCollection::searchWellboreTrajectory(const std::string &p_fileName)
+{
+ std::string w_result;
+
+ int w_nodeId = 0;
+ for (auto *w_wellboreTrajectory : _repository->getWellboreTrajectoryRepresentationSet())
+ {
+ const auto *w_wellboreFeature = dynamic_cast(w_wellboreTrajectory->getInterpretation()->getInterpretedFeature());
+
+ int w_nodeId = 0;
+ int w_initNodeId = 0;
+ if (_output->GetDataAssembly()->FindFirstNodeWithName(("_" + w_wellboreTrajectory->getUuid()).c_str()) == -1)
+ { // verify uuid exist in treeview
+ // To shorten the xmlTag by removing �Representation� from the end.
+ for (resqml2::RepresentationSetRepresentation *w_rsr : w_wellboreTrajectory->getRepresentationSetRepresentationSet())
+ {
+ w_initNodeId = searchRepresentationSetRepresentation(w_rsr);
+ }
+
+ if (_output->GetDataAssembly()->FindFirstNodeWithName(("_" + w_wellboreFeature->getUuid()).c_str()) == -1)
+ {
+ const std::string w_vtkValidName = "Wellbore_" + MakeValidNodeName(w_wellboreFeature->getTitle().c_str());
+ w_initNodeId = _output->GetDataAssembly()->AddNode(("_" + w_wellboreFeature->getUuid()).c_str(), w_initNodeId);
+ _output->GetDataAssembly()->SetAttribute(w_initNodeId, "label", w_vtkValidName.c_str());
+ _output->GetDataAssembly()->SetAttribute(w_initNodeId, "type", std::to_string(static_cast(TreeViewNodeType::Wellbore)).c_str());
+ }
+
+ if (w_wellboreTrajectory->isPartial())
+ {
+ // check if it has already been added
+
+ const std::string w_vtkValidName = MakeValidNodeName((SimplifyXmlTag(w_wellboreTrajectory->getXmlTag()) + "_" + w_wellboreTrajectory->getTitle()).c_str());
+ // not exist => not loaded
+ if (_output->GetDataAssembly()->FindFirstNodeWithName(("_" + w_vtkValidName).c_str()) == -1)
+ {
+ w_result = w_result + " Partial UUID: (" + w_wellboreTrajectory->getUuid() + ") is not loaded \n";
+ continue;
+ } /******* TODO ********/ // exist but not the same type ?
+ }
+ else
+ {
+ const std::string w_vtkValidName = MakeValidNodeName((SimplifyXmlTag(w_wellboreTrajectory->getXmlTag()) + '_' + w_wellboreTrajectory->getTitle()).c_str());
+ w_nodeId = _output->GetDataAssembly()->AddNode(("_" + w_wellboreTrajectory->getUuid()).c_str(), w_initNodeId);
+ _output->GetDataAssembly()->SetAttribute(w_nodeId, "label", w_vtkValidName.c_str());
+ _output->GetDataAssembly()->SetAttribute(w_nodeId, "type", std::to_string(static_cast(TreeViewNodeType::WellboreTrajectory)).c_str());
+ }
+ }
+ w_result += searchWellboreFrame(w_wellboreTrajectory, w_initNodeId);
+ w_result += searchWellboreCompletion(w_wellboreFeature, w_initNodeId);
+ }
+ return w_result;
+}
+
+std::string ResqmlDataRepositoryToVtkPartitionedDataSetCollection::searchWellboreFrame(const resqml2::WellboreTrajectoryRepresentation *p_wellboreTrajectory, int p_nodeId)
+{
+ std::string w_result = "";
+ for (auto *w_wellboreFrame : p_wellboreTrajectory->getWellboreFrameRepresentationSet())
+ {
+ if (_output->GetDataAssembly()->FindFirstNodeWithName(("_" + w_wellboreFrame->getUuid()).c_str()) == -1)
+ { // verify uuid exist in treeview
+ // common with wellboreMarkerFrame & WellboreFrame
+ const std::string w_vtkValidName = MakeValidNodeName((SimplifyXmlTag(w_wellboreFrame->getXmlTag()) + '_' + w_wellboreFrame->getTitle()).c_str());
+ int w_frameNodeId = _output->GetDataAssembly()->AddNode(("_" + w_wellboreFrame->getUuid()).c_str(), p_nodeId);
+ _output->GetDataAssembly()->SetAttribute(w_frameNodeId, "label", w_vtkValidName.c_str());
+
+ auto *w_wellboreMarkerFrame = dynamic_cast(w_wellboreFrame);
+ if (w_wellboreMarkerFrame == nullptr)
+ { // WellboreFrame
+ _output->GetDataAssembly()->SetAttribute(w_frameNodeId, "type", std::to_string(static_cast(TreeViewNodeType::WellboreFrame)).c_str());
+ // chanel
+ for (auto *w_property : w_wellboreFrame->getValuesPropertySet())
+ {
+ const std::string w_vtkValidName = MakeValidNodeName((w_property->getXmlTag() + '_' + w_property->getTitle()).c_str());
+ int w_nodeId = _output->GetDataAssembly()->AddNode(("_" + w_property->getUuid()).c_str(), w_frameNodeId);
+ _output->GetDataAssembly()->SetAttribute(w_nodeId, "label", w_vtkValidName.c_str());
+ _output->GetDataAssembly()->SetAttribute(w_nodeId, "type", std::to_string(static_cast(TreeViewNodeType::WellboreChannel)).c_str());
+ }
+ }
+ else
+ { // WellboreMarkerFrame
+ _output->GetDataAssembly()->SetAttribute(w_frameNodeId, "type", std::to_string(static_cast(TreeViewNodeType::WellboreMarkerFrame)).c_str());
+ // marker
+ for (auto *w_wellboreMarker : w_wellboreMarkerFrame->getWellboreMarkerSet())
+ {
+ const std::string w_vtkValidName = MakeValidNodeName((w_wellboreMarker->getXmlTag() + '_' + w_wellboreMarker->getTitle()).c_str());
+ int w_nodeId = _output->GetDataAssembly()->AddNode(("_" + w_wellboreMarker->getUuid()).c_str(), w_frameNodeId);
+ _output->GetDataAssembly()->SetAttribute(w_nodeId, "label", w_vtkValidName.c_str());
+ _output->GetDataAssembly()->SetAttribute(w_nodeId, "type", std::to_string(static_cast(TreeViewNodeType::WellboreMarker)).c_str());
+ }
+ }
+ }
+ }
+ return w_result;
+}
+
+std::string ResqmlDataRepositoryToVtkPartitionedDataSetCollection::searchWellboreCompletion(const RESQML2_NS::WellboreFeature *p_wellboreFeature, int p_nodeId)
+{
+ std::string w_result = "";
+ // witsml2::Wellbore *witsmlWellbore = nullptr;
+ if (!p_wellboreFeature->isPartial())
+ {
+ if (const witsml2::Wellbore *w_witsmlWellbore = dynamic_cast(p_wellboreFeature->getWitsmlWellbore()))
+ {
+ for (const auto *w_wellboreCompletion : w_witsmlWellbore->getWellboreCompletionSet())
+ {
+ const std::string w_vtkValidName = MakeValidNodeName((SimplifyXmlTag(w_wellboreCompletion->getXmlTag()) + '_' + w_wellboreCompletion->getTitle()).c_str());
+ int w_completionNodeId = _output->GetDataAssembly()->AddNode(("_" + w_wellboreCompletion->getUuid()).c_str(), p_nodeId);
+ _output->GetDataAssembly()->SetAttribute(w_completionNodeId, "label", w_vtkValidName.c_str());
+ _output->GetDataAssembly()->SetAttribute(w_completionNodeId, "type", std::to_string(static_cast(TreeViewNodeType::WellboreCompletion)).c_str());
+ // Iterate over the perforations.
+ for (uint64_t w_perforationIndex = 0; w_perforationIndex < w_wellboreCompletion->getConnectionCount(WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::PERFORATION); ++w_perforationIndex)
+ {
+ // init
+ std::string w_perforationName = "Perfo";
+ std::string w_perforationSkin = "";
+ std::string w_perforationDiameter = "";
+
+ // Test with Petrel rules
+ auto w_petrelName = w_wellboreCompletion->getConnectionExtraMetadata(WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::PERFORATION, w_perforationIndex, "Petrel:Name0");
+ // arbitrarily select the first event name as perforation name
+ if (w_petrelName.size() > 0)
+ {
+ w_perforationName += "_" + w_petrelName[0];
+ // skin
+ auto w_petrelSkin = w_wellboreCompletion->getConnectionExtraMetadata(WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::PERFORATION, w_perforationIndex, "Petrel:Skin0");
+ if (w_petrelSkin.size() > 0)
+ {
+ w_perforationSkin = w_petrelSkin[0];
+ }
+ // diameter
+ auto w_petrelDiam = w_wellboreCompletion->getConnectionExtraMetadata(WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::PERFORATION, w_perforationIndex, "Petrel:BoreholePerforatedSection0");
+ if (w_petrelDiam.size() > 0)
+ {
+ w_perforationDiameter = w_petrelDiam[0];
+ }
+ }
+ else
+ {
+ // Test with Sismage rules
+ auto w_sismageName = w_wellboreCompletion->getConnectionExtraMetadata(WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::PERFORATION, w_perforationIndex, "Sismage-CIG:Name");
+ if (w_sismageName.size() > 0)
+ {
+ w_perforationName += "_" + w_sismageName[0];
+ // skin
+ auto w_sismageSkin = w_wellboreCompletion->getConnectionExtraMetadata(WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::PERFORATION, w_perforationIndex, "Sismage-CIG:Skin");
+ if (w_sismageSkin.size() > 0)
+ {
+ w_perforationSkin = w_sismageSkin[0];
+ }
+ // diameter
+ auto w_sismageDiam = w_wellboreCompletion->getConnectionExtraMetadata(WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::PERFORATION, w_perforationIndex, "Petrel:CompletionDiameter");
+ if (w_sismageDiam.size() > 0)
+ {
+ w_perforationDiameter = w_sismageDiam[0];
+ }
+ }
+ else
+ {
+ // default
+ w_perforationName += "_" + w_wellboreCompletion->getConnectionUid(WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::PERFORATION, w_perforationIndex);
+ }
+ }
+ w_perforationName += "__Skin_" + w_perforationSkin + "__Diam_" + w_perforationDiameter;
+
+ int w_nodeId = _output->GetDataAssembly()->AddNode(this->MakeValidNodeName(("_" + w_wellboreCompletion->getUuid() + "_" + w_wellboreCompletion->getConnectionUid(WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::PERFORATION, w_perforationIndex)).c_str()).c_str(), w_completionNodeId);
+ _output->GetDataAssembly()->SetAttribute(w_nodeId, "label", MakeValidNodeName((w_perforationName).c_str()).c_str());
+ _output->GetDataAssembly()->SetAttribute(w_nodeId, "type", std::to_string(static_cast(TreeViewNodeType::Perforation)).c_str());
+ _output->GetDataAssembly()->SetAttribute(w_nodeId, "connection", w_wellboreCompletion->getConnectionUid(WITSML2_1_NS::WellboreCompletion::WellReservoirConnectionType::PERFORATION, w_perforationIndex).c_str());
+ _output->GetDataAssembly()->SetAttribute(w_nodeId, "skin", w_perforationSkin.c_str());
+ _output->GetDataAssembly()->SetAttribute(w_nodeId, "diameter", w_perforationDiameter.c_str());
+ }
+ }
+ }
+ }
+ return w_result;
+}
+std::string ResqmlDataRepositoryToVtkPartitionedDataSetCollection::searchTimeSeries(const std::string &p_fileName)
+{
+ _timesStep.clear();
+
+ std::string w_message = "";
+ std::vector w_timeSeriesSet;
+ try
+ {
+ w_timeSeriesSet = _repository->getTimeSeriesSet();
+ }
+ catch (const std::exception &e)
+ {
+ w_message = w_message + "Exception in FESAPI when calling getTimeSeriesSet with file: " + p_fileName + " : " + e.what();
+ }
+
+ /****
+ * change property parent to times serie parent
+ ****/
+ for (auto const *w_timeSeries : w_timeSeriesSet)
+ {
+ // get properties link to Times series
+ try
+ {
+ std::map> w_propertyNameToNodeIdSet;
+ for (auto const *w_prop : w_timeSeries->getPropertySet())
+ {
+ if (w_prop->getXmlTag() == RESQML2_NS::ContinuousProperty::XML_TAG ||
+ w_prop->getXmlTag() == RESQML2_NS::DiscreteProperty::XML_TAG)
+ {
+ auto w_nodeId = (_output->GetDataAssembly()->FindFirstNodeWithName(("_" + w_prop->getUuid()).c_str()));
+ if (w_nodeId == -1)
+ {
+ w_message = w_message + "The property " + w_prop->getUuid() + " is not supported and consequently cannot be associated to its time series.\n";
+ continue;
+ }
+ else
+ {
+ // same node parent else not supported
+ const int w_parentNodeId = _output->GetDataAssembly()->GetParent(w_nodeId);
+ if (w_parentNodeId != -1)
+ {
+ w_propertyNameToNodeIdSet[w_prop->getTitle()].push_back(w_nodeId);
+ const size_t w_timeIndexInTimeSeries = w_timeSeries->getTimestampIndex(w_prop->getSingleTimestamp());
+ _timesStep.push_back(w_timeIndexInTimeSeries);
+ _timeSeriesUuidAndTitleToIndexAndPropertiesUuid[w_timeSeries->getUuid()][MakeValidNodeName((w_timeSeries->getXmlTag() + '_' + w_prop->getTitle()).c_str())][w_timeIndexInTimeSeries] = w_prop->getUuid();
+ }
+ else
+ {
+ w_message = w_message + "The properties of time series " + w_timeSeries->getUuid() + " aren't parent and is not supported.\n";
+ continue;
+ }
+ }
+ }
+ }
+ // erase duplicate Index
+ sort(_timesStep.begin(), _timesStep.end());
+ _timesStep.erase(unique(_timesStep.begin(), _timesStep.end()), _timesStep.end());
+
+ for (const auto &w_myPair : w_propertyNameToNodeIdSet)
+ {
+ std::vector w_propertyNodeSet = w_myPair.second;
+
+ int w_parentNodeId = -1;
+ // erase property add to treeview for group by TimeSerie
+ for (auto node : w_propertyNodeSet)
+ {
+ w_parentNodeId = _output->GetDataAssembly()->GetParent(node);
+ _output->GetDataAssembly()->RemoveNode(node);
+ }
+ std::string w_vtkValidName = MakeValidNodeName((w_timeSeries->getXmlTag() + '_' + w_myPair.first).c_str());
+ auto w_nodeId = _output->GetDataAssembly()->AddNode(("_" + w_timeSeries->getUuid() + w_vtkValidName).c_str(), w_parentNodeId);
+ _output->GetDataAssembly()->SetAttribute(w_nodeId, "label", w_vtkValidName.c_str());
+ _output->GetDataAssembly()->SetAttribute(w_nodeId, "type", std::to_string(static_cast(TreeViewNodeType::TimeSeries)).c_str());
+ }
+ }
+ catch (const std::exception &e)
+ {
+ w_message = w_message + "Exception in FESAPI when calling getPropertySet with file: " + p_fileName + " : " + e.what();
+ }
+ }
+
+ return w_message;
+}
+
+std::string ResqmlDataRepositoryToVtkPartitionedDataSetCollection::selectNodeId(int p_node)
+{
+ if (p_node != 0)
+ {
+ selectNodeIdParent(p_node);
+
+ _currentSelection.insert(p_node);
+ _oldSelection.erase(p_node);
+ }
+ selectNodeIdChildren(p_node);
+
+ return "";
+}
+
+void ResqmlDataRepositoryToVtkPartitionedDataSetCollection::selectNodeIdParent(int p_node)
+{
+ if (_output->GetDataAssembly()->GetParent(p_node) > 0)
+ {
+ _currentSelection.insert(_output->GetDataAssembly()->GetParent(p_node));
+ _oldSelection.erase(_output->GetDataAssembly()->GetParent(p_node));
+ selectNodeIdParent(_output->GetDataAssembly()->GetParent(p_node));
+ }
+}
+void ResqmlDataRepositoryToVtkPartitionedDataSetCollection::selectNodeIdChildren(int p_node)
+{
+ for (int w_nodeChild : _output->GetDataAssembly()->GetChildNodes(p_node))
+ {
+ _currentSelection.insert(w_nodeChild);
+ _oldSelection.erase(w_nodeChild);
+ selectNodeIdChildren(w_nodeChild);
+ }
+}
+
+void ResqmlDataRepositoryToVtkPartitionedDataSetCollection::clearSelection()
+{
+ _oldSelection = _currentSelection;
+ _currentSelection.clear();
+}
+
+void ResqmlDataRepositoryToVtkPartitionedDataSetCollection::initMapperSet(const TreeViewNodeType p_type, const int p_nodeId, const int p_nbProcess, const int p_processId)
+{
+ CommonAbstractObjectToVtkPartitionedDataSet *w_caotvpds = nullptr;
+ const std::string w_uuid = std::string(_output->GetDataAssembly()->GetNodeName(p_nodeId)).substr(1);
+
+ COMMON_NS::AbstractObject* const w_abstractObject = _repository->getDataObjectByUuid(w_uuid);
+
+ if (p_type == TreeViewNodeType::WellboreCompletion)
+ {
+ try
+ {
+ if (dynamic_cast(w_abstractObject) != nullptr)
+ {
+ _nodeIdToMapperSet[p_nodeId] = new WitsmlWellboreCompletionToVtkPartitionedDataSet(static_cast(w_abstractObject), p_processId, p_nbProcess);
+ }
+ else
+ {
+ vtkOutputWindowDisplayErrorText(("Error object type in vtkDataAssembly for uuid: " + w_uuid + "\n").c_str());
+ }
+ }
+ catch (const std::exception& e)
+ {
+ vtkOutputWindowDisplayErrorText(("Error when initialize uuid: " + w_uuid + "\n" + e.what()).c_str());
+ }
+ }
+ else if (p_type == TreeViewNodeType::WellboreMarkerFrame)
+ {
+ try
+ {
+ if (dynamic_cast(w_abstractObject) != nullptr)
+ {
+ _nodeIdToMapperSet[p_nodeId] = new ResqmlWellboreMarkerFrameToVtkPartitionedDataSet(static_cast(w_abstractObject), p_processId, p_nbProcess);
+ }
+ else
+ {
+ vtkOutputWindowDisplayErrorText(("Error object type in vtkDataAssembly for uuid: " + w_uuid + "\n").c_str());
+ }
+ }
+ catch (const std::exception& e)
+ {
+ vtkOutputWindowDisplayErrorText(("Error when initialize uuid: " + w_uuid + "\n" + e.what()).c_str());
+ }
+ }
+ else if (p_type == TreeViewNodeType::WellboreFrame)
+ {
+ try
+ {
+ if (dynamic_cast(w_abstractObject) != nullptr)
+ {
+ _nodeIdToMapperSet[p_nodeId] = new ResqmlWellboreFrameToVtkPartitionedDataSet(static_cast(w_abstractObject), p_processId, p_nbProcess);
+ }
+ else
+ {
+ vtkOutputWindowDisplayErrorText(("Error object type in vtkDataAssembly for uuid: " + w_uuid + "\n").c_str());
+ }
+ }
+ catch (const std::exception& e)
+ {
+ vtkOutputWindowDisplayErrorText(("Error when initialize uuid: " + w_uuid + "\n" + e.what()).c_str());
+ }
+ }
+
+}
+
+void ResqmlDataRepositoryToVtkPartitionedDataSetCollection::loadMapper(const TreeViewNodeType p_type, const int p_nodeId, const int p_nbProcess, const int p_processId)
+{
+ if (TreeViewNodeType::Representation == p_type)
+ {
+ loadRepresentationMapper(p_nodeId, p_nbProcess, p_processId);
+ }
+ else if (TreeViewNodeType::WellboreTrajectory == p_type)
+ {
+ loadWellboreTrajectoryMapper(p_nodeId);
+ }
+ else if (TreeViewNodeType::SubRepresentation == p_type)
+ {
+ loadWellboreTrajectoryMapper(p_nodeId);
+ }
+}
+
+void ResqmlDataRepositoryToVtkPartitionedDataSetCollection::loadRepresentationMapper(const int p_nodeId, const int p_nbProcess, const int p_processId)
+{
+ CommonAbstractObjectToVtkPartitionedDataSet* w_caotvpds = nullptr;
+ const std::string w_uuid = std::string(_output->GetDataAssembly()->GetNodeName(p_nodeId)).substr(1);
+ COMMON_NS::AbstractObject* const w_abstractObject = _repository->getDataObjectByUuid(w_uuid);
+
+ if (dynamic_cast(w_abstractObject) != nullptr)
+ {
+ w_caotvpds = new ResqmlIjkGridToVtkExplicitStructuredGrid(static_cast(w_abstractObject), p_processId, p_nbProcess);
+ }
+ else if (dynamic_cast(w_abstractObject) != nullptr)
+ {
+ w_caotvpds = new ResqmlGrid2dToVtkStructuredGrid(static_cast(w_abstractObject));
+ }
+ else if (dynamic_cast(w_abstractObject) != nullptr)
+ {
+ w_caotvpds = new ResqmlTriangulatedSetToVtkPartitionedDataSet(static_cast(w_abstractObject));
+ }
+ else if (dynamic_cast(w_abstractObject) != nullptr)
+ {
+ w_caotvpds = new ResqmlPolylineToVtkPolyData(static_cast(w_abstractObject));
+ }
+ else if (dynamic_cast(w_abstractObject) != nullptr)
+ {
+ w_caotvpds = new ResqmlUnstructuredGridToVtkUnstructuredGrid(static_cast(w_abstractObject));
+ }
+ else if (dynamic_cast(w_abstractObject) != nullptr)
+ {
+ RESQML2_NS::SubRepresentation* w_subRep = static_cast(w_abstractObject);
+
+ if (dynamic_cast(w_subRep->getSupportingRepresentation(0)) != nullptr)
+ {
+ auto* w_supportingGrid = static_cast(w_subRep->getSupportingRepresentation(0));
+ if (_nodeIdToMapper.find(_output->GetDataAssembly()->FindFirstNodeWithName(("_" + w_supportingGrid->getUuid()).c_str())) == _nodeIdToMapper.end())
+ {
+ _nodeIdToMapper[_output->GetDataAssembly()->FindFirstNodeWithName(("_" + w_supportingGrid->getUuid()).c_str())] = new ResqmlIjkGridToVtkExplicitStructuredGrid(w_supportingGrid);
+ }
+ w_caotvpds = new ResqmlIjkGridSubRepToVtkExplicitStructuredGrid(w_subRep, dynamic_cast(_nodeIdToMapper[_output->GetDataAssembly()->FindFirstNodeWithName(("_" + w_supportingGrid->getUuid()).c_str())]));
+ }
+ else if (dynamic_cast(w_subRep->getSupportingRepresentation(0)) != nullptr)
+ {
+ auto* w_supportingGrid = static_cast(w_subRep->getSupportingRepresentation(0));
+ if (_nodeIdToMapper.find(_output->GetDataAssembly()->FindFirstNodeWithName(("_" + w_supportingGrid->getUuid()).c_str())) == _nodeIdToMapper.end())
+ {
+ _nodeIdToMapper[_output->GetDataAssembly()->FindFirstNodeWithName(("_" + w_supportingGrid->getUuid()).c_str())] = new ResqmlUnstructuredGridToVtkUnstructuredGrid(w_supportingGrid);
+ }
+ w_caotvpds = new ResqmlUnstructuredGridSubRepToVtkUnstructuredGrid(w_subRep, dynamic_cast(_nodeIdToMapper[_output->GetDataAssembly()->FindFirstNodeWithName(("_" + w_supportingGrid->getUuid()).c_str())]));
+ }
+ }
+ _nodeIdToMapper[p_nodeId] = w_caotvpds;
+ try
+ { // load representation
+ _nodeIdToMapper[p_nodeId]->loadVtkObject();
+ return;
+ }
+ catch (const std::exception& e)
+ {
+ vtkOutputWindowDisplayErrorText(("Error when rendering uuid: " + w_uuid + "\n" + e.what()).c_str());
+ return;
+ }
+}
+
+void ResqmlDataRepositoryToVtkPartitionedDataSetCollection::loadWellboreTrajectoryMapper(const int p_nodeId)
+{
+ const std::string w_uuid = std::string(_output->GetDataAssembly()->GetNodeName(p_nodeId)).substr(1);
+ COMMON_NS::AbstractObject* const w_abstractObject = _repository->getDataObjectByUuid(w_uuid);
+
+
+ if (dynamic_cast(w_abstractObject) != nullptr)
+ {
+ _nodeIdToMapper[p_nodeId] = new ResqmlWellboreTrajectoryToVtkPolyData(static_cast(w_abstractObject));
+ } else {
+ vtkOutputWindowDisplayErrorText(("Error object type in vtkDataAssembly for uuid: " + w_uuid + "\n").c_str());
+ return;
+ }
+ try
+ { // load representation
+ _nodeIdToMapper[p_nodeId]->loadVtkObject();
+ return;
+ }
+ catch (const std::exception& e)
+ {
+ vtkOutputWindowDisplayErrorText(("Error when rendering uuid: " + w_uuid + "\n" + e.what()).c_str());
+ return;
+ }
+}
+
+void ResqmlDataRepositoryToVtkPartitionedDataSetCollection::addDataToParent(const TreeViewNodeType p_type, const int p_nodeId, const int p_nbProcess, const int p_processId, const double p_time)
+{
+ const std::string w_uuid = std::string(_output->GetDataAssembly()->GetNodeName(p_nodeId)).substr(1);
+
+ // search representation NodeId
+ int w_nodeParent = _output->GetDataAssembly()->GetParent(p_nodeId);
+ int value_type;
+ _output->GetDataAssembly()->GetAttribute(w_nodeParent, "type", value_type);
+ TreeViewNodeType w_typeParent = static_cast(value_type);
+ while (w_typeParent == TreeViewNodeType::Collection)
+ {
+ w_nodeParent = _output->GetDataAssembly()->GetParent(w_nodeParent);
+ value_type;
+ _output->GetDataAssembly()->GetAttribute(w_nodeParent, "type", value_type);
+ w_typeParent = static_cast(value_type);
+ }
+
+ if (TreeViewNodeType::Perforation == p_type)
+ {
+ try
+ {
+ if (static_cast(_nodeIdToMapperSet[w_nodeParent]))
+ {
+ const char* w_connection;
+ _output->GetDataAssembly()->GetAttribute(p_nodeId, "connection", w_connection);
+ const char* w_name;
+ _output->GetDataAssembly()->GetAttribute(p_nodeId, "label", w_name);
+ const char* w_skin_s;
+ _output->GetDataAssembly()->GetAttribute(p_nodeId, "skin", w_skin_s);
+ const double w_skin = std::strtod(w_skin_s, nullptr);
+ if (!_nodeIdToMapperSet[w_nodeParent]->existUuid(w_connection))
+ {
+ (static_cast(_nodeIdToMapperSet[w_nodeParent]))->addPerforation(w_connection, w_name, w_skin);
+ }
+ else
+ {
+ vtkOutputWindowDisplayErrorText(("Error object type in vtkDataAssembly for uuid: " + w_uuid + "\n").c_str());
+ }
+ }
+ }
+ catch (const std::exception& e)
+ {
+ vtkOutputWindowDisplayErrorText(("Error when initialize uuid: " + w_uuid + "\n" + e.what()).c_str());
+ }
+ return;
+ }
+ else if (TreeViewNodeType::WellboreChannel == p_type)
+ {
+ try
+ {
+ COMMON_NS::AbstractObject *const w_result = _repository->getDataObjectByUuid(w_uuid);
+ if (static_cast(_nodeIdToMapperSet[w_nodeParent]))
+ {
+ if (!_nodeIdToMapperSet[w_nodeParent]->existUuid(w_uuid))
+ {
+ if (dynamic_cast(w_result) != nullptr)
+ {
+ (static_cast(_nodeIdToMapperSet[w_nodeParent]))->addChannel(w_uuid, static_cast(w_result));
+ }
+ }
+ }
+ else
+ {
+ vtkOutputWindowDisplayErrorText(("Error object type in vtkDataAssembly for uuid: " + w_uuid + "\n").c_str());
+ }
+ }
+ catch (const std::exception& e)
+ {
+ vtkOutputWindowDisplayErrorText(("Error when initialize uuid: " + w_uuid + "\n" + e.what()).c_str());
+ }
+ return;
+ }
+ else if (TreeViewNodeType::WellboreMarker == p_type)
+ {
+ try
+ {
+ if (static_cast(_nodeIdToMapperSet[w_nodeParent]))
+ {
+ const std::string w_uuidParent = std::string(_output->GetDataAssembly()->GetNodeName(w_nodeParent)).substr(1);
+ resqml2::WellboreMarkerFrameRepresentation* w_markerFrame = _repository->getDataObjectByUuid(w_uuidParent);
+ if (!_nodeIdToMapperSet[w_nodeParent]->existUuid(w_uuid))
+ {
+ resqml2::WellboreMarker* const w_marker = _repository->getDataObjectByUuid(w_uuid);
+ (static_cast(_nodeIdToMapperSet[w_nodeParent]))->addMarker(w_markerFrame, w_uuid, _markerOrientation, _markerSize);
+ }
+ else
+ {
+ (static_cast(_nodeIdToMapperSet[w_nodeParent]))->changeOrientationAndSize(w_uuid, _markerOrientation, _markerSize);
+ }
+ }
+ else
+ {
+ vtkOutputWindowDisplayErrorText(("Error object type in vtkDataAssembly for uuid: " + w_uuid + "\n").c_str());
+ }
+ }
+ catch (const std::exception& e)
+ {
+ vtkOutputWindowDisplayErrorText(("Error when initialize uuid: " + w_uuid + "\n" + e.what()).c_str());
+ }
+ return;
+ }
+ else if (TreeViewNodeType::Properties == p_type)
+ {
+ try
+ {
+ if (static_cast(_nodeIdToMapper[w_nodeParent]))
+ {
+ static_cast(_nodeIdToMapper[w_nodeParent])->addDataArray(w_uuid);
+ }
+ else
+ {
+ vtkOutputWindowDisplayErrorText(("Error representation for property uuid: " + w_uuid + " not exist\n").c_str());
+ }
+ }
+ catch (const std::exception& e)
+ {
+ vtkOutputWindowDisplayErrorText(("Error when initialize uuid: " + w_uuid + "\n" + e.what()).c_str());
+ }
+ }
+ else if (TreeViewNodeType::TimeSeries == p_type)
+ {
+ try
+ {
+ std::string w_tsUuid = w_uuid.substr(0, 36);
+ std::string w_nodeName = w_uuid.substr(36);
+
+ auto const* assembly = _output->GetDataAssembly();
+ if (_nodeIdToMapper[w_nodeParent])
+ {
+ static_cast(_nodeIdToMapper[w_nodeParent])->addDataArray(_timeSeriesUuidAndTitleToIndexAndPropertiesUuid[w_tsUuid][w_nodeName][p_time]);
+ }
+ }
+ catch (const std::exception& e)
+ {
+ vtkOutputWindowDisplayErrorText(("Error when load Time Series property marker uuid: " + w_uuid + "\n" + e.what()).c_str());
+ }
+ return;
+ }
+}
+
+/**
+ * delete oldSelection mapper
+ */
+void ResqmlDataRepositoryToVtkPartitionedDataSetCollection::deleteMapper(double p_time)
+{
+ // initialization the output (VtkPartitionedDatasSetCollection) with same vtkDataAssembly
+ vtkSmartPointer w_Assembly = vtkSmartPointer::New();
+ w_Assembly->DeepCopy(_output->GetDataAssembly());
+ _output = vtkSmartPointer::New();
+ _output->SetDataAssembly(w_Assembly);
+
+ // delete unchecked object
+ for (const int w_nodeId : _oldSelection)
+ {
+ // retrieval of object type for nodeid
+ int w_valueType;
+ w_Assembly->GetAttribute(w_nodeId, "type", w_valueType);
+ TreeViewNodeType valueType = static_cast(w_valueType);
+
+ // retrieval of object UUID for nodeId
+ const std::string uuid_unselect = std::string(w_Assembly->GetNodeName(w_nodeId)).substr(1);
+
+ if (valueType == TreeViewNodeType::TimeSeries)
+ { // TimeSerie properties deselection
+ std::string w_timeSeriesuuid = uuid_unselect.substr(0, 36);
+ std::string w_nodeName = uuid_unselect.substr(36);
+
+ const int w_nodeParent = w_Assembly->GetParent(w_Assembly->FindFirstNodeWithName(("_" + uuid_unselect).c_str()));
+ if (_nodeIdToMapper.find(w_nodeParent) != _nodeIdToMapper.end())
+ {
+ static_cast(_nodeIdToMapper[w_nodeParent])->deleteDataArray(_timeSeriesUuidAndTitleToIndexAndPropertiesUuid[w_timeSeriesuuid][w_nodeName][p_time]);
+ }
+ }
+ else if (valueType == TreeViewNodeType::Properties)
+ {
+ int w_nodeParent = _output->GetDataAssembly()->GetParent(w_nodeId);
+ int w_typeValue;
+ _output->GetDataAssembly()->GetAttribute(w_nodeParent, "type", w_typeValue);
+ TreeViewNodeType w_typeParent = static_cast(w_typeValue);
+ while (w_typeParent == TreeViewNodeType::Collection)
+ {
+ w_nodeParent = _output->GetDataAssembly()->GetParent(w_nodeParent);
+ w_typeValue;
+ _output->GetDataAssembly()->GetAttribute(w_nodeParent, "type", w_typeValue);
+ w_typeParent = static_cast(w_typeValue);
+ }
+
+ try
+ {
+ if (_nodeIdToMapper.find(w_nodeParent) != _nodeIdToMapper.end())
+ {
+ static_cast(_nodeIdToMapper[w_nodeParent])->deleteDataArray(std::string(w_Assembly->GetNodeName(w_nodeId)).substr(1));
+ }
+ }
+ catch (const std::exception &e)
+ {
+ vtkOutputWindowDisplayErrorText(("Error in property unload for uuid: " + uuid_unselect + "\n" + e.what()).c_str());
+ }
+ }
+ else if (valueType == TreeViewNodeType::WellboreMarker ||
+ valueType == TreeViewNodeType::WellboreChannel)
+ {
+ const int w_nodeParent = w_Assembly->GetParent(w_nodeId);
+ try
+ {
+ if (_nodeIdToMapperSet.find(w_nodeParent) != _nodeIdToMapperSet.end())
+ {
+ _nodeIdToMapperSet[w_nodeParent]->removeCommonAbstractObjectToVtkPartitionedDataSet(std::string(w_Assembly->GetNodeName(w_nodeId)).substr(1));
+ }
+ }
+ catch (const std::exception &e)
+ {
+ vtkOutputWindowDisplayErrorText(("Error in property unload for uuid: " + uuid_unselect + "\n" + e.what()).c_str());
+ }
+ }
+ else if (valueType == TreeViewNodeType::SubRepresentation)
+ {
+ try
+ {
+ if (_nodeIdToMapper.find(w_nodeId) != _nodeIdToMapper.end())
+ {
+ std::string uuid_supporting_grid = "";
+ if (dynamic_cast(_nodeIdToMapper[w_nodeId]) != nullptr)
+ {
+ uuid_supporting_grid = static_cast(_nodeIdToMapper[w_nodeId])->unregisterToMapperSupportingGrid();
+ }
+ else if (dynamic_cast(_nodeIdToMapper[w_nodeId]) != nullptr)
+ {
+ uuid_supporting_grid = static_cast(_nodeIdToMapper[w_nodeId])->unregisterToMapperSupportingGrid();
+ }
+ delete _nodeIdToMapper[w_nodeId];
+ _nodeIdToMapper.erase(w_nodeId);
+ }
+ else
+ {
+ vtkOutputWindowDisplayErrorText(("Error in deselection for uuid: " + uuid_unselect + "\n").c_str());
+ }
+ }
+ catch (const std::exception &e)
+ {
+ vtkOutputWindowDisplayErrorText(("Error in subrepresentation unload for uuid: " + uuid_unselect + "\n" + e.what()).c_str());
+ }
+ }
+ else if (valueType == TreeViewNodeType::Representation ||
+ valueType == TreeViewNodeType::WellboreTrajectory)
+ {
+ try
+ {
+ if (_nodeIdToMapper.find(w_nodeId) != _nodeIdToMapper.end())
+ {
+ delete _nodeIdToMapper[w_nodeId];
+ _nodeIdToMapper.erase(w_nodeId);
+ }
+ }
+ catch (const std::exception &e)
+ {
+ vtkOutputWindowDisplayErrorText(("Error for unload uuid: " + uuid_unselect + "\n" + e.what()).c_str());
+ }
+ }
+ else if (valueType == TreeViewNodeType::Perforation)
+ // delete child of CommonAbstractObjectSetToVtkPartitionedDataSetSet
+ {
+ const int w_nodeParent = w_Assembly->GetParent(w_nodeId);
+ try
+ {
+ if (_nodeIdToMapperSet.find(w_nodeParent) != _nodeIdToMapperSet.end())
+ {
+ const char *w_connection;
+ _output->GetDataAssembly()->GetAttribute(w_nodeId, "connection", w_connection);
+ _nodeIdToMapperSet[w_nodeParent]->removeCommonAbstractObjectToVtkPartitionedDataSet(w_connection);
+ }
+ }
+ catch (const std::exception &e)
+ {
+ vtkOutputWindowDisplayErrorText(("Error in WellboreCompletion unload for uuid: " + uuid_unselect + "\n" + e.what()).c_str());
+ }
+ }
+ else if (valueType == TreeViewNodeType::WellboreCompletion ||
+ valueType == TreeViewNodeType::WellboreMarkerFrame ||
+ valueType == TreeViewNodeType::WellboreFrame)
+ {
+ try
+ {
+ if (_nodeIdToMapperSet.find(w_nodeId) != _nodeIdToMapperSet.end())
+ {
+ delete _nodeIdToMapperSet[w_nodeId];
+ _nodeIdToMapperSet.erase(w_nodeId);
+ }
+ }
+ catch (const std::exception &e)
+ {
+ vtkOutputWindowDisplayErrorText(("Error in WellboreCompletion unload for uuid: " + uuid_unselect + "\n" + e.what()).c_str());
+ }
+ }
+ }
+}
+
+vtkPartitionedDataSetCollection *ResqmlDataRepositoryToVtkPartitionedDataSetCollection::getVtkPartitionedDatasSetCollection(const double p_time, const int p_nbProcess, const int p_processId)
+{
+ deleteMapper(p_time);
+
+ // vtkParitionedDataSetCollection - hierarchy - build
+ // foreach selection node init object
+ auto w_it = _currentSelection.begin();
+ while (w_it != _currentSelection.end())
+ {
+ int w_typeValue;
+ _output->GetDataAssembly()->GetAttribute(*w_it, "type", w_typeValue);
+ TreeViewNodeType w_type = static_cast(w_typeValue);
+
+ // init MapperSet && save nodeId for attach to vtkPartitionedDataSetcollection
+ if (getMapperType(w_type) == MapperType::MapperSet)
+ {
+ // initialize mapperSet with nodeId
+ if (_nodeIdToMapperSet.find(*w_it) == _nodeIdToMapperSet.end())
+ {
+ initMapperSet(w_type, *w_it, p_nbProcess, p_processId);
+ }
+ ++w_it;
+ }
+ else if (getMapperType(w_type) == MapperType::Mapper)
+ {
+ // load mapper with nodeId
+ if (_nodeIdToMapper.find(*w_it) == _nodeIdToMapper.end())
+ {
+ loadMapper(w_type, *w_it, p_nbProcess, p_processId);
+ }
+ ++w_it;
+ }
+ else if (getMapperType(w_type) == MapperType::Folder)
+ {
+ ++w_it;
+ }
+ else if (getMapperType(w_type) == MapperType::Data)
+ {
+ addDataToParent(w_type, *w_it, p_nbProcess, p_processId, p_time);
+ ++w_it;
+ }
+ }
+
+ unsigned int w_PartitionIndex = 0;
+ // foreach selection node load object
+ for (const int w_nodeSelection : _currentSelection)
+ {
+ int w_typeValue;
+ _output->GetDataAssembly()->GetAttribute(w_nodeSelection, "type", w_typeValue);
+ TreeViewNodeType w_type = static_cast(w_typeValue);
+
+ if (getMapperType(w_type) == MapperType::MapperSet)
+ {
+ // load mapper representation
+ if (_nodeIdToMapperSet.find(w_nodeSelection) != _nodeIdToMapperSet.end())
+ {
+ try
+ {
+ _nodeIdToMapperSet[w_nodeSelection]->loadVtkObject();
+ }
+ catch (const std::exception& e)
+ {
+ vtkOutputWindowDisplayErrorText(("Fesapi Error for uuid : " + std::string(_output->GetDataAssembly()->GetNodeName(w_nodeSelection)).substr(1) + "\n" + e.what()).c_str());
+ }
+ for (auto partition : _nodeIdToMapperSet[w_nodeSelection]->getMapperSet())
+ {
+ _output->SetPartitionedDataSet(w_PartitionIndex, partition->getOutput());
+ _output->GetMetaData(w_PartitionIndex)->Set(vtkCompositeDataSet::NAME(), partition->getTitle() + '(' + partition->getUuid() + ')');
+ GetAssembly()->AddDataSetIndex(w_nodeSelection, w_PartitionIndex + 1); // attach hierarchy to assembly
+ w_PartitionIndex++;
+ }
+ }
+ }
+ else if (getMapperType(w_type) == MapperType::Mapper)
+ {
+ // load mapper representation
+ if (_nodeIdToMapper.find(w_nodeSelection) != _nodeIdToMapper.end())
+ {
+ _output->SetPartitionedDataSet(w_PartitionIndex, _nodeIdToMapper[w_nodeSelection]->getOutput());
+ _output->GetMetaData(w_PartitionIndex)->Set(vtkCompositeDataSet::NAME(), _nodeIdToMapper[w_nodeSelection]->getTitle() + '(' + _nodeIdToMapper[w_nodeSelection]->getUuid() + ')');
+ GetAssembly()->AddDataSetIndex(w_nodeSelection, w_PartitionIndex + 1); // attach hierarchy to assembly
+ w_PartitionIndex++;
+ }
+ }
+ }
+
+ _output->Modified();
+ return _output;
+}
+
+void ResqmlDataRepositoryToVtkPartitionedDataSetCollection::setMarkerOrientation(bool orientation)
+{
+ _markerOrientation = orientation;
+}
+
+void ResqmlDataRepositoryToVtkPartitionedDataSetCollection::setMarkerSize(int size)
+{
+ _markerSize = size;
+}
diff --git a/Plugin/Energistics/Mapping/ResqmlDataRepositoryToVtkPartitionedDataSetCollection.h b/Plugin/Energistics/Mapping/ResqmlDataRepositoryToVtkPartitionedDataSetCollection.h
new file mode 100644
index 0000000..163d663
--- /dev/null
+++ b/Plugin/Energistics/Mapping/ResqmlDataRepositoryToVtkPartitionedDataSetCollection.h
@@ -0,0 +1,165 @@
+/*-----------------------------------------------------------------------
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"; you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-----------------------------------------------------------------------*/
+#ifndef __ResqmlDataRepositoryToVtkPartitionedDataSetCollection_h
+#define __ResqmlDataRepositoryToVtkPartitionedDataSetCollection_h
+
+// include system
+#include
+#include