Accepting request 982665 from home:StefanBruens:branches:science

- Update to version 0.20
- Update to version 0.20:
  * Lots of bugfixes and new features, for details see
    https://wiki.freecad.org/Release_notes_0.20 and
    https://github.com/FreeCAD/FreeCAD/releases/tag/0.20
- Drop upstream patches:
  * fix_unittestgui_tkinter_py3.patch
  * fix-smesh-vtk9.patch
  * 0001-Test-remove-not-needed-u-before-py3-unicode-string.patch
  * 0001-Test-fix-exception-handling-in-tests-for-units.patch
  * 0001-Test-Provide-more-useful-information-when-unit-trans.patch
  * 0002-Base-Fix-wrong-character-encoding-for-micro-siemens.patch
  * 0001-improve-search-for-VTK-9.patch
- Add 0001-Gui-Quarter-Add-missing-OpenGL-includes.patch
- Add 0001-Avoid-catching-SIGSEGV-defer-to-system-services.patch
- Remove VTK::Java/java-devel dependency, add
  0001-improve-search-for-VTK-9.patch

OBS-URL: https://build.opensuse.org/request/show/982665
OBS-URL: https://build.opensuse.org/package/show/science/FreeCAD?expand=0&rev=149
This commit is contained in:
Stefan Brüns 2022-06-15 16:03:40 +00:00 committed by Git OBS Bridge
parent c2db466594
commit c43d052fbd
14 changed files with 118 additions and 1022 deletions

View File

@ -0,0 +1,29 @@
From 00d1d5908f85054f3c149c9b6a14fd36a1eaa572 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Sun, 20 Mar 2022 04:22:24 +0100
Subject: [PATCH] Avoid catching SIGSEGV, defer to system services
The current implementation ignores the basic signal handler requirement
to only call signal safe functions, e.g. backtrace_symbols and
abi::__cxa_demangle. This causes deadlocks when the handler is called
from malloc/free and similar.
---
src/App/Application.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/App/Application.cpp b/src/App/Application.cpp
index 7f93db5775..58e3b1f90f 100644
--- a/src/App/Application.cpp
+++ b/src/App/Application.cpp
@@ -1860,7 +1860,7 @@ void Application::init(int argc, char ** argv)
std::set_terminate(unhandled_exception_handler);
::set_unexpected(unexpection_error_handler);
#elif defined(FC_OS_LINUX)
- std::signal(SIGSEGV,segmentation_fault_handler);
+ // std::signal(SIGSEGV,segmentation_fault_handler);
#endif
#if defined(FC_SE_TRANSLATOR)
_set_se_translator(my_se_translator_filter);
--
2.35.1

View File

@ -0,0 +1,47 @@
From 70b313a5bd282e09129d0643b96dee85f9494c41 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Tue, 14 Jun 2022 20:49:08 +0200
Subject: [PATCH] [Gui] Quarter: Add missing OpenGL includes
QuarterWidget directly uses e.g. glPushAttrib/glPopAttrib, and thus should
include the relevant headers.
The headers are required on e.g. ARM platforms where Qt is build with GLES
instead of Desktop GL, and does not implicitly include the headers.
This fixes a regression introduced with commit 9654786c670b ("[Gui]
Quarter: remove unused includes").
---
src/Gui/Quarter/QuarterWidget.cpp | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/Gui/Quarter/QuarterWidget.cpp b/src/Gui/Quarter/QuarterWidget.cpp
index 5e1f89e04d..18f418e19e 100644
--- a/src/Gui/Quarter/QuarterWidget.cpp
+++ b/src/Gui/Quarter/QuarterWidget.cpp
@@ -72,6 +72,11 @@
#include <Inventor/SbByteBuffer.h>
#endif
+#if !defined(FC_OS_MACOSX)
+# include <GL/gl.h>
+# include <GL/glext.h>
+#endif
+
#include <Inventor/SbColor.h>
#include <Inventor/SbViewportRegion.h>
#include <Inventor/SoDB.h>
@@ -131,10 +136,6 @@ using namespace SIM::Coin3D::Quarter;
#define PRIVATE(obj) obj->pimpl
-#ifndef GL_MULTISAMPLE_BIT_EXT
-#define GL_MULTISAMPLE_BIT_EXT 0x20000000
-#endif
-
//We need to avoid buffer swapping when initializing a QPainter on this widget
class CustomGLWidget : public QOpenGLWidget {
public:
--
2.36.1

View File

@ -1,38 +0,0 @@
From 68c7f70b7b6b01fdcac2f746e19cff7e71e24ed8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Fri, 4 Mar 2022 19:14:15 +0100
Subject: [PATCH 1/2] Test: Provide more useful information when unit
translation fails
Add the input quantity and the target scheme to the exception output.
Also make the output formatting more canonical and remove the unused
"s" temporary.
---
src/Mod/Test/UnitTests.py | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/Mod/Test/UnitTests.py b/src/Mod/Test/UnitTests.py
index a77239977f..4726e46037 100644
--- a/src/Mod/Test/UnitTests.py
+++ b/src/Mod/Test/UnitTests.py
@@ -121,14 +121,13 @@ class UnitBasicCases(unittest.TestCase):
q1 = FreeCAD.Units.Quantity(q1)
q1.Format = {'Precision': 16}
for idx, val in enumerate(schemes):
- t = FreeCAD.Units.schemaTranslate(q1, idx)
+ [t, amountPerUnit, unit] = FreeCAD.Units.schemaTranslate(q1, idx)
try:
- q2 = FreeCAD.Units.Quantity(t[0])
+ q2 = FreeCAD.Units.Quantity(t)
if math.fabs(q1.Value - q2.Value) > 0.01:
print (" {} : {} : {} : {} : {}".format(q1, q2, t, i, val).encode("utf-8").strip())
except Exception as e:
- s = "{}: {}".format(e, t[0])
- print (" ".join(str(e)).encode("utf-8").strip())
+ print ("{} : {} : {} : {}".format(q1, i, val, e).encode("utf-8").strip())
def testVoltage(self):
q1 = FreeCAD.Units.Quantity("1e20 V")
--
2.35.1

View File

@ -1,25 +0,0 @@
From 73307991550f57da9504237581b03faf9bcc0824 Mon Sep 17 00:00:00 2001
From: wmayer <wmayer@users.sourceforge.net>
Date: Tue, 25 Jan 2022 20:20:46 +0100
Subject: [PATCH] Test: fix exception handling in tests for units
---
src/Mod/Test/UnitTests.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Mod/Test/UnitTests.py b/src/Mod/Test/UnitTests.py
index e9006455a0..9228684250 100644
--- a/src/Mod/Test/UnitTests.py
+++ b/src/Mod/Test/UnitTests.py
@@ -128,7 +128,7 @@ class UnitBasicCases(unittest.TestCase):
print (" {} : {} : {} : {} : {}".format(q1, q2, t, i, val).encode("utf-8").strip())
except Exception as e:
s = "{}: {}".format(e, t[0])
- print (" ".join(e).encode("utf-8").strip())
+ print (" ".join(str(e)).encode("utf-8").strip())
def testVoltage(self):
q1 = FreeCAD.Units.Quantity("1e20 V")
--
2.35.1

View File

@ -1,29 +0,0 @@
From 70c5505a75ad545cb671eb73f29d5e1626aebf78 Mon Sep 17 00:00:00 2001
From: Bernd Hahnebach <bernd@bimstatik.org>
Date: Wed, 22 Sep 2021 08:06:47 +0200
Subject: [PATCH] Test: remove not needed u before py3 unicode string
---
src/Mod/Test/UnitTests.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Mod/Test/UnitTests.py b/src/Mod/Test/UnitTests.py
index 6584ae6fc5..5c6ffea7e6 100644
--- a/src/Mod/Test/UnitTests.py
+++ b/src/Mod/Test/UnitTests.py
@@ -125,10 +125,10 @@ class UnitBasicCases(unittest.TestCase):
try:
q2 = FreeCAD.Units.Quantity(t[0])
if math.fabs(q1.Value - q2.Value) > 0.01:
- print (u" {} : {} : {} : {} : {}".format(q1,q2, t, i, val).encode("utf-8").strip())
+ print (" {} : {} : {} : {} : {}".format(q1, q2, t, i, val).encode("utf-8").strip())
except Exception as e:
s = "{}: {}".format(e, t[0])
- print (u" ".join(e).encode("utf-8").strip())
+ print (" ".join(e).encode("utf-8").strip())
def testVoltage(self):
q1 = FreeCAD.Units.Quantity("1e20 V")
--
2.35.1

View File

@ -1,47 +0,0 @@
From a8b903511fead24ac61543ca129eb0737fa2327f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Sat, 5 Mar 2022 00:26:11 +0100
Subject: [PATCH 2/2] Base: Fix wrong character encoding for micro-siemens
Contrary to any other Unit with micro prefix (e.g. ug, uH, uF) the
string was created with a Latin1 encoding instead of UTF-8.
The problem can be verified with these python statements:
```
FreeCAD.Units.schemaTranslate(FreeCAD.Units.MicroSiemens, 0)
FreeCAD.Units.schemaTranslate(FreeCAD.Units.MicroGram, 0)
```
---
src/Base/UnitsSchemaInternal.cpp | 2 +-
src/Base/UnitsSchemaMKS.cpp | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Base/UnitsSchemaInternal.cpp b/src/Base/UnitsSchemaInternal.cpp
index 69b65fa9fc..78ea82a6eb 100644
--- a/src/Base/UnitsSchemaInternal.cpp
+++ b/src/Base/UnitsSchemaInternal.cpp
@@ -351,7 +351,7 @@ QString UnitsSchemaInternal::schemaTranslate(const Quantity &quant, double &fact
}
else if (unit == Unit::ElectricalConductance) {
if (UnitValue < 1e-9) {
- unitString = QString::fromLatin1("\xC2\xB5S");
+ unitString = QString::fromUtf8("\xC2\xB5S");
factor = 1e-12;
}
else if (UnitValue < 1e-6) {
diff --git a/src/Base/UnitsSchemaMKS.cpp b/src/Base/UnitsSchemaMKS.cpp
index 11d23d7d0b..795b7afc54 100644
--- a/src/Base/UnitsSchemaMKS.cpp
+++ b/src/Base/UnitsSchemaMKS.cpp
@@ -299,7 +299,7 @@ QString UnitsSchemaMKS::schemaTranslate(const Quantity &quant, double &factor, Q
}
else if (unit == Unit::ElectricalConductance) {
if (UnitValue < 1e-9) {
- unitString = QString::fromLatin1("\xC2\xB5S");
+ unitString = QString::fromUtf8("\xC2\xB5S");
factor = 1e-12;
}
else if (UnitValue < 1e-6) {
--
2.35.1

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e40a1c343956e13c56cc8578d025ae83d68d9d20acda1732953bc8a3883e9722
size 296990652

3
FreeCAD-0.20.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c4d9ce782d3da0edfa16d6218db4ce8613e346124ee47b3fe6a6dae40c0a61d9
size 75452957

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Tue Jun 14 17:12:47 UTC 2022 - Stefan Brüns <stefan.bruens@rwth-aachen.de>
- Update to version 0.20
-------------------------------------------------------------------
Sun Feb 6 17:33:16 UTC 2022 - Stefan Brüns <stefan.bruens@rwth-aachen.de>

View File

@ -17,7 +17,7 @@
Name: FreeCAD-test
Version: 0.19.4
Version: 0.20
Release: 0
Summary: Meta source package that runs the FreeCAD testsuite when built
License: GPL-2.0-or-later AND LGPL-2.0-or-later

View File

@ -1,3 +1,27 @@
-------------------------------------------------------------------
Tue Jun 14 17:12:11 UTC 2022 - Stefan Brüns <stefan.bruens@rwth-aachen.de>
- Update to version 0.20:
* Lots of bugfixes and new features, for details see
https://wiki.freecad.org/Release_notes_0.20 and
https://github.com/FreeCAD/FreeCAD/releases/tag/0.20
- Drop upstream patches:
* fix_unittestgui_tkinter_py3.patch
* fix-smesh-vtk9.patch
* 0001-Test-remove-not-needed-u-before-py3-unicode-string.patch
* 0001-Test-fix-exception-handling-in-tests-for-units.patch
* 0001-Test-Provide-more-useful-information-when-unit-trans.patch
* 0002-Base-Fix-wrong-character-encoding-for-micro-siemens.patch
* 0001-improve-search-for-VTK-9.patch
- Add 0001-Gui-Quarter-Add-missing-OpenGL-includes.patch
- Add 0001-Avoid-catching-SIGSEGV-defer-to-system-services.patch
-------------------------------------------------------------------
Wed Mar 16 18:15:57 UTC 2022 - Stefan Brüns <stefan.bruens@rwth-aachen.de>
- Remove VTK::Java/java-devel dependency, add
0001-improve-search-for-VTK-9.patch
-------------------------------------------------------------------
Thu Mar 10 20:13:02 UTC 2022 - Stefan Brüns <stefan.bruens@rwth-aachen.de>

View File

@ -27,24 +27,17 @@
%bcond_without smesh
Name: FreeCAD
Version: 0.19.4
Version: 0.20
Release: 0
Summary: General Purpose 3D CAD Modeler
License: GPL-2.0-or-later AND LGPL-2.0-or-later
Group: Productivity/Graphics/CAD
URL: https://www.freecadweb.org/
Source0: https://github.com/FreeCAD/FreeCAD/archive/refs/tags/%{version}.tar.gz#/%{name}-%{version}.tar.gz
# PATCH-FIX-OPENSUSE Use correct import for Python 3 tkinter
Patch1: fix_unittestgui_tkinter_py3.patch
# PATCH-FIX-UPSTREAM Rebased https://github.com/wwmayer/FreeCAD/commit/bb9bcbd51df7
Patch2: fix-smesh-vtk9.patch
# PATCH-FIX-UPSTREAM
Patch3: 0001-Test-remove-not-needed-u-before-py3-unicode-string.patch
# PATCH-FIX-UPSTREAM
Patch4: 0001-Test-fix-exception-handling-in-tests-for-units.patch
# PATCH-FIX-UPSTREAM
Patch5: 0001-Test-Provide-more-useful-information-when-unit-trans.patch
Patch6: 0002-Base-Fix-wrong-character-encoding-for-micro-siemens.patch
Patch0: 0001-Gui-Quarter-Add-missing-OpenGL-includes.patch
# PATCH-FIX-OPENSUSE
Patch1: 0001-Avoid-catching-SIGSEGV-defer-to-system-services.patch
# Test suite fails on 32bit and I don't want to debug that anymore
ExcludeArch: %ix86 %arm ppc s390 s390x
@ -71,7 +64,6 @@ BuildRequires: hicolor-icon-theme
# We use the internal smesh version with fixes atm
BuildRequires: smesh-devel
%endif
BuildRequires: java-devel
BuildRequires: libXerces-c-devel
BuildRequires: libXi-devel
BuildRequires: libmed-devel
@ -84,8 +76,9 @@ BuildRequires: proj-devel
BuildRequires: sqlite3-devel
# Qt5 & python3
BuildRequires: python3-devel
BuildRequires: python3-devel >= 3.6.9
BuildRequires: python3-matplotlib
BuildRequires: python3-pivy
BuildRequires: python3-ply
BuildRequires: python3-pybind11-devel
BuildRequires: python3-pycxx-devel
@ -109,6 +102,7 @@ Requires: python3-vtk
Requires: python3-pivy
# For FEM workbench
Requires: python3-PyYAML
Requires: python3-matplotlib-qt5
Requires: python3-ply
Requires: python3-six
@ -116,8 +110,6 @@ BuildRequires: swig
BuildRequires: update-desktop-files
BuildRequires: vtk-devel
BuildRequires: zlib-devel
# we need to ensure to have the minimum version from build env
Requires: libopencascade7 >= %(/bin/bash -c 'rpm -q --qf "%%{version}" libopencascade7')
Recommends: ccx
@ -182,8 +174,10 @@ rm src/3rdparty/Pivy-0.5 -fr
-DOCC_INCLUDE_DIR=%{_includedir}/opencascade \
-DRESOURCEDIR=%{_datadir}/%{name} \
-DPYTHON_EXECUTABLE=/usr/bin/python3 \
-DPYTHON_INCLUDE_DIR=%{python3_sysconfig_path include} \
-DSHIBOKEN_INCLUDE_DIR=/usr/include/shiboken2/ \
-DPYSIDE_INCLUDE_DIR=/usr/include/PySide2/ \
-DPYBIND11_FINDPYTHON:BOOL=ON \
-DFREECAD_USE_PYBIND11:BOOL=ON \
-DBUILD_ENABLE_CXX_STD:STRING="C++17" \
-DBUILD_QT5=ON \
@ -205,26 +199,6 @@ rm src/3rdparty/Pivy-0.5 -fr
%install
%cmake_install
# create parsetab.py for yacc.ply (FEM)
# https://tracker.freecadweb.org/view.php?id=4840
pushd %{buildroot}/%{_libdir}/FreeCAD/Mod/Fem
python3 -B femtools/tokrules.py
rm femtools/parser.out
# create parsetab.py for yacc.ply (OpenSCAD)
export PYTHONPATH=%{buildroot}/%{_libdir}/FreeCAD/lib
export LD_LIBRARY_PATH=%{buildroot}/%{_libdir}/FreeCAD/lib
cd ../OpenSCAD
python3 -B -c "\
import ply.lex as lex
import ply.yacc as yacc
import importCSG
import tokrules
from tokrules import tokens
lex.lex(module=tokrules)
yacc.yacc(module=importCSG,outputdir=\"./\")
"
rm parser.out
# Fix "non-executable-script" rpmlint warning
# Run after install, as CMake "install(FILES...) sets rw- permissions
chmod 755 %{buildroot}%{_libdir}/FreeCAD/Mod/AddonManager/AddonManager.py \

View File

@ -1,815 +0,0 @@
From bb9bcbd51df7c3cb76c5823038e4ea0f7e25a9ff Mon Sep 17 00:00:00 2001
From: wmayer <wmayer@users.sourceforge.net>
Date: Mon, 12 Oct 2020 17:56:03 +0200
Subject: [PATCH] Make smesh compile with vtk9
---
.../salomesmesh/inc/SMDS_MeshElement.hxx | 9 +++-
.../salomesmesh/inc/SMDS_UnstructuredGrid.hxx | 4 ++
.../salomesmesh/src/SMDS/SMDS_BallElement.cpp | 9 +++-
.../salomesmesh/src/SMDS/SMDS_Downward.cpp | 44 +++++++++----------
.../salomesmesh/src/SMDS/SMDS_Mesh.cpp | 6 ++-
.../src/SMDS/SMDS_Mesh0DElement.cpp | 12 +++++
.../salomesmesh/src/SMDS/SMDS_MeshNode.cpp | 10 ++---
.../src/SMDS/SMDS_UnstructuredGrid.cpp | 35 +++++++++++++--
.../src/SMDS/SMDS_VtkCellIterator.cpp | 7 +--
.../salomesmesh/src/SMDS/SMDS_VtkEdge.cpp | 19 +++++++-
.../salomesmesh/src/SMDS/SMDS_VtkFace.cpp | 29 ++++++++++--
.../salomesmesh/src/SMDS/SMDS_VtkVolume.cpp | 38 +++++++++++-----
.../src/SMESH/SMESH_MeshEditor.cpp | 8 ++--
src/Mod/Fem/Gui/ViewProviderFemPostObject.cpp | 7 ++-
14 files changed, 179 insertions(+), 58 deletions(-)
diff --git a/src/3rdParty/salomesmesh/inc/SMDS_MeshElement.hxx b/src/3rdParty/salomesmesh/inc/SMDS_MeshElement.hxx
index 14a6d9a763f..0e9b9e6c905 100644
--- a/src/3rdParty/salomesmesh/inc/SMDS_MeshElement.hxx
+++ b/src/3rdParty/salomesmesh/inc/SMDS_MeshElement.hxx
@@ -40,11 +40,16 @@
#include <vtkType.h>
#include <vtkCellType.h>
+#include <vtkCellArray.h>
//typedef unsigned short UShortType;
typedef short ShortType;
typedef int LongType;
-
+#ifdef VTK_CELL_ARRAY_V2
+typedef const vtkIdType* vtkIdTypePtr;
+#else
+typedef vtkIdType* vtkIdTypePtr;
+#endif
class SMDS_MeshNode;
class SMDS_MeshEdge;
class SMDS_MeshFace;
@@ -192,7 +197,7 @@ protected:
//! Element index in vector SMDS_Mesh::myNodes or SMDS_Mesh::myCells
int myID;
//! index in vtkUnstructuredGrid
- int myVtkID;
+ vtkIdType myVtkID;
//! SMDS_Mesh identification in SMESH
ShortType myMeshId;
//! SubShape and SubMesh identification in SMESHDS
diff --git a/src/3rdParty/salomesmesh/inc/SMDS_UnstructuredGrid.hxx b/src/3rdParty/salomesmesh/inc/SMDS_UnstructuredGrid.hxx
index 9e4a23eddfb..77465814541 100644
--- a/src/3rdParty/salomesmesh/inc/SMDS_UnstructuredGrid.hxx
+++ b/src/3rdParty/salomesmesh/inc/SMDS_UnstructuredGrid.hxx
@@ -95,7 +95,11 @@ public:
std::map<int, std::map<long,int> >& nodeQuadDomains);
vtkCellLinks* GetLinks()
{
+#ifdef VTK_CELL_ARRAY_V2
+ return static_cast<vtkCellLinks*>(GetCellLinks());
+#else
return Links;
+#endif
}
SMDS_Downward* getDownArray(unsigned char vtkType)
{
diff --git a/src/3rdParty/salomesmesh/src/SMDS/SMDS_BallElement.cpp b/src/3rdParty/salomesmesh/src/SMDS/SMDS_BallElement.cpp
index 299093c94f6..2680c217305 100644
--- a/src/3rdParty/salomesmesh/src/SMDS/SMDS_BallElement.cpp
+++ b/src/3rdParty/salomesmesh/src/SMDS/SMDS_BallElement.cpp
@@ -67,10 +67,16 @@ void SMDS_BallElement::SetDiameter(double diameter)
bool SMDS_BallElement::ChangeNode (const SMDS_MeshNode * node)
{
vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
+#ifdef VTK_CELL_ARRAY_V2
+ vtkNew<vtkIdList> cellPoints;
+ grid->GetCellPoints(myVtkID, cellPoints.GetPointer());
+ cellPoints->SetId(0, node->getVtkId());
+#else
vtkIdType npts = 0;
vtkIdType* pts = 0;
grid->GetCellPoints(myVtkID, npts, pts);
pts[0] = node->getVtkId();
+#endif
SMDS_Mesh::_meshList[myMeshId]->setMyModified();
return true;
}
@@ -83,7 +89,8 @@ void SMDS_BallElement::Print (std::ostream & OS) const
const SMDS_MeshNode* SMDS_BallElement::GetNode (const int ind) const
{
vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
- vtkIdType npts, *pts;
+ vtkIdType npts;
+ vtkIdTypePtr pts;
grid->GetCellPoints( myVtkID, npts, pts );
return SMDS_Mesh::_meshList[myMeshId]->FindNodeVtk( pts[ 0 ]);
}
diff --git a/src/3rdParty/salomesmesh/src/SMDS/SMDS_Downward.cpp b/src/3rdParty/salomesmesh/src/SMDS/SMDS_Downward.cpp
index d6049c0bd19..a41f5c18e78 100644
--- a/src/3rdParty/salomesmesh/src/SMDS/SMDS_Downward.cpp
+++ b/src/3rdParty/salomesmesh/src/SMDS/SMDS_Downward.cpp
@@ -303,7 +303,7 @@ int SMDS_Down1D::getNodeSet(int cellId, int* nodeSet)
void SMDS_Down1D::setNodes(int cellId, int vtkId)
{
vtkIdType npts = 0;
- vtkIdType *pts; // will refer to the point id's of the face
+ vtkIdTypePtr pts; // will refer to the point id's of the face
_grid->GetCellPoints(vtkId, npts, pts);
// MESSAGE(vtkId << " " << npts << " " << _nbDownCells);
//ASSERT(npts == _nbDownCells);
@@ -357,7 +357,7 @@ int SMDS_Down1D::computeVtkCells(int *pts, std::vector<int>& vtkIds)
{
vtkIdType point = pts[i];
int numCells = _grid->GetLinks()->GetNcells(point);
- vtkIdType *cells = _grid->GetLinks()->GetCells(point);
+ vtkIdTypePtr cells = _grid->GetLinks()->GetCells(point);
for (int j = 0; j < numCells; j++)
{
int vtkCellId = cells[j];
@@ -532,7 +532,7 @@ int SMDS_Down2D::computeVolumeIds(int cellId, int* ids)
// --- find point id's of the face
vtkIdType npts = 0;
- vtkIdType *pts; // will refer to the point id's of the face
+ vtkIdTypePtr pts; // will refer to the point id's of the face
_grid->GetCellPoints(cellId, npts, pts);
vector<int> nodes;
for (int i = 0; i < npts; i++)
@@ -577,7 +577,7 @@ int SMDS_Down2D::computeVolumeIdsFromNodesFace(int* pts, int npts, int* ids)
vtkIdType point = pts[i];
int numCells = _grid->GetLinks()->GetNcells(point);
//MESSAGE("cells pour " << i << " " << numCells);
- vtkIdType *cells = _grid->GetLinks()->GetCells(point);
+ vtkIdTypePtr cells = _grid->GetLinks()->GetCells(point);
for (int j = 0; j < numCells; j++)
{
int vtkCellId = cells[j];
@@ -627,7 +627,7 @@ int SMDS_Down2D::computeVolumeIdsFromNodesFace(int* pts, int npts, int* ids)
void SMDS_Down2D::setTempNodes(int cellId, int vtkId)
{
vtkIdType npts = 0;
- vtkIdType *pts; // will refer to the point id's of the face
+ vtkIdTypePtr pts; // will refer to the point id's of the face
_grid->GetCellPoints(vtkId, npts, pts);
// MESSAGE(vtkId << " " << npts << " " << _nbNodes);
//ASSERT(npts == _nbNodes);
@@ -795,7 +795,7 @@ void SMDS_Down3D::getNodeIds(int cellId, std::set<int>& nodeSet)
{
int vtkId = this->_vtkCellIds[cellId];
vtkIdType npts = 0;
- vtkIdType *nodes; // will refer to the point id's of the volume
+ vtkIdTypePtr nodes; // will refer to the point id's of the volume
_grid->GetCellPoints(vtkId, npts, nodes);
for (int i = 0; i < npts; i++)
nodeSet.insert(nodes[i]);
@@ -1126,7 +1126,7 @@ void SMDS_DownTetra::getOrderedNodesOfFace(int cellId, std::vector<vtkIdType>& o
//MESSAGE("cellId = " << cellId);
vtkIdType npts = 0;
- vtkIdType *nodes; // will refer to the point id's of the volume
+ vtkIdTypePtr nodes; // will refer to the point id's of the volume
_grid->GetCellPoints(this->_vtkCellIds[cellId], npts, nodes);
set<int> tofind;
@@ -1178,7 +1178,7 @@ void SMDS_DownTetra::computeFacesWithNodes(int cellId, ListElemByNodesType& face
// --- find point id's of the volume
vtkIdType npts = 0;
- vtkIdType *nodes; // will refer to the point id's of the volume
+ vtkIdTypePtr nodes; // will refer to the point id's of the volume
_grid->GetCellPoints(cellId, npts, nodes);
// --- create all the ordered list of node id's for each face
@@ -1234,7 +1234,7 @@ void SMDS_DownQuadTetra::getOrderedNodesOfFace(int cellId, std::vector<vtkIdType
//MESSAGE("cellId = " << cellId);
vtkIdType npts = 0;
- vtkIdType *nodes; // will refer to the point id's of the volume
+ vtkIdTypePtr nodes; // will refer to the point id's of the volume
_grid->GetCellPoints(this->_vtkCellIds[cellId], npts, nodes);
set<int> tofind;
@@ -1288,7 +1288,7 @@ void SMDS_DownQuadTetra::computeFacesWithNodes(int cellId, ListElemByNodesType&
// --- find point id's of the volume
vtkIdType npts = 0;
- vtkIdType *nodes; // will refer to the point id's of the volume
+ vtkIdTypePtr nodes; // will refer to the point id's of the volume
_grid->GetCellPoints(cellId, npts, nodes);
// --- create all the ordered list of node id's for each face
@@ -1357,7 +1357,7 @@ void SMDS_DownPyramid::getOrderedNodesOfFace(int cellId, std::vector<vtkIdType>&
//MESSAGE("cellId = " << cellId);
vtkIdType npts = 0;
- vtkIdType *nodes; // will refer to the point id's of the volume
+ vtkIdTypePtr nodes; // will refer to the point id's of the volume
_grid->GetCellPoints(this->_vtkCellIds[cellId], npts, nodes);
set<int> tofind;
@@ -1435,7 +1435,7 @@ void SMDS_DownPyramid::computeFacesWithNodes(int cellId, ListElemByNodesType& fa
// --- find point id's of the volume
vtkIdType npts = 0;
- vtkIdType *nodes; // will refer to the point id's of the volume
+ vtkIdTypePtr nodes; // will refer to the point id's of the volume
_grid->GetCellPoints(cellId, npts, nodes);
// --- create all the ordered list of node id's for each face
@@ -1500,7 +1500,7 @@ void SMDS_DownQuadPyramid::getOrderedNodesOfFace(int cellId, std::vector<vtkIdTy
//MESSAGE("cellId = " << cellId);
vtkIdType npts = 0;
- vtkIdType *nodes; // will refer to the point id's of the volume
+ vtkIdTypePtr nodes; // will refer to the point id's of the volume
_grid->GetCellPoints(this->_vtkCellIds[cellId], npts, nodes);
set<int> tofind;
@@ -1580,7 +1580,7 @@ void SMDS_DownQuadPyramid::computeFacesWithNodes(int cellId, ListElemByNodesType
// --- find point id's of the volume
vtkIdType npts = 0;
- vtkIdType *nodes; // will refer to the point id's of the volume
+ vtkIdTypePtr nodes; // will refer to the point id's of the volume
_grid->GetCellPoints(cellId, npts, nodes);
// --- create all the ordered list of node id's for each face
@@ -1660,7 +1660,7 @@ void SMDS_DownPenta::getOrderedNodesOfFace(int cellId, std::vector<vtkIdType>& o
//MESSAGE("cellId = " << cellId);
vtkIdType npts = 0;
- vtkIdType *nodes; // will refer to the point id's of the volume
+ vtkIdTypePtr nodes; // will refer to the point id's of the volume
_grid->GetCellPoints(this->_vtkCellIds[cellId], npts, nodes);
set<int> tofind;
@@ -1744,7 +1744,7 @@ void SMDS_DownPenta::computeFacesWithNodes(int cellId, ListElemByNodesType& face
// --- find point id's of the volume
vtkIdType npts = 0;
- vtkIdType *nodes; // will refer to the point id's of the volume
+ vtkIdTypePtr nodes; // will refer to the point id's of the volume
_grid->GetCellPoints(cellId, npts, nodes);
// --- create all the ordered list of node id's for each face
@@ -1810,7 +1810,7 @@ void SMDS_DownQuadPenta::getOrderedNodesOfFace(int cellId, std::vector<vtkIdType
//MESSAGE("cellId = " << cellId);
vtkIdType npts = 0;
- vtkIdType *nodes; // will refer to the point id's of the volume
+ vtkIdTypePtr nodes; // will refer to the point id's of the volume
_grid->GetCellPoints(this->_vtkCellIds[cellId], npts, nodes);
set<int> tofind;
@@ -1896,7 +1896,7 @@ void SMDS_DownQuadPenta::computeFacesWithNodes(int cellId, ListElemByNodesType&
// --- find point id's of the volume
vtkIdType npts = 0;
- vtkIdType *nodes; // will refer to the point id's of the volume
+ vtkIdTypePtr nodes; // will refer to the point id's of the volume
_grid->GetCellPoints(cellId, npts, nodes);
// --- create all the ordered list of node id's for each face
@@ -1981,7 +1981,7 @@ void SMDS_DownHexa::getOrderedNodesOfFace(int cellId, std::vector<vtkIdType>& or
//MESSAGE("cellId = " << cellId);
vtkIdType npts = 0;
- vtkIdType *nodes; // will refer to the point id's of the volume
+ vtkIdTypePtr nodes; // will refer to the point id's of the volume
_grid->GetCellPoints(this->_vtkCellIds[cellId], npts, nodes);
set<int> tofind;
@@ -2036,7 +2036,7 @@ void SMDS_DownHexa::computeFacesWithNodes(int cellId, ListElemByNodesType& faces
// --- find point id's of the volume
vtkIdType npts = 0;
- vtkIdType *nodes; // will refer to the point id's of the volume
+ vtkIdTypePtr nodes; // will refer to the point id's of the volume
_grid->GetCellPoints(cellId, npts, nodes);
// --- create all the ordered list of node id's for each face
@@ -2112,7 +2112,7 @@ void SMDS_DownQuadHexa::getOrderedNodesOfFace(int cellId, std::vector<vtkIdType>
//MESSAGE("cellId = " << cellId);
vtkIdType npts = 0;
- vtkIdType *nodes; // will refer to the point id's of the volume
+ vtkIdTypePtr nodes; // will refer to the point id's of the volume
_grid->GetCellPoints(this->_vtkCellIds[cellId], npts, nodes);
set<int> tofind;
@@ -2167,7 +2167,7 @@ void SMDS_DownQuadHexa::computeFacesWithNodes(int cellId, ListElemByNodesType& f
// --- find point id's of the volume
vtkIdType npts = 0;
- vtkIdType *nodes; // will refer to the point id's of the volume
+ vtkIdTypePtr nodes; // will refer to the point id's of the volume
_grid->GetCellPoints(cellId, npts, nodes);
// --- create all the ordered list of node id's for each face
diff --git a/src/3rdParty/salomesmesh/src/SMDS/SMDS_Mesh.cpp b/src/3rdParty/salomesmesh/src/SMDS/SMDS_Mesh.cpp
index 61c8e751d94..1eac2907d3d 100644
--- a/src/3rdParty/salomesmesh/src/SMDS/SMDS_Mesh.cpp
+++ b/src/3rdParty/salomesmesh/src/SMDS/SMDS_Mesh.cpp
@@ -4768,7 +4768,11 @@ void SMDS_Mesh::dumpGrid(string ficdump)
ficcon << endl;
}
ficcon << "-------------------------------- connectivity " << nbPoints << endl;
- vtkCellLinks *links = myGrid->GetCellLinks();
+#ifdef VTK_CELL_ARRAY_V2
+ vtkCellLinks *links = static_cast<vtkCellLinks*>(myGrid->GetCellLinks());
+#else
+ vtkCellLinks *links = myGrid->GetCellLinks();
+#endif
for (int i=0; i<nbPoints; i++)
{
int ncells = links->GetNcells(i);
diff --git a/src/3rdParty/salomesmesh/src/SMDS/SMDS_Mesh0DElement.cpp b/src/3rdParty/salomesmesh/src/SMDS/SMDS_Mesh0DElement.cpp
index 95438eab064..0df32e3b97c 100644
--- a/src/3rdParty/salomesmesh/src/SMDS/SMDS_Mesh0DElement.cpp
+++ b/src/3rdParty/salomesmesh/src/SMDS/SMDS_Mesh0DElement.cpp
@@ -146,6 +146,17 @@ bool SMDS_Mesh0DElement::ChangeNodes(const SMDS_MeshNode* nodes[], const int nbN
if ( nbNodes == 1 )
{
vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
+#ifdef VTK_CELL_ARRAY_V2
+ vtkNew<vtkIdList> cellPoints;
+ grid->GetCellPoints(myVtkID, cellPoints.GetPointer());
+ if (nbNodes != cellPoints->GetNumberOfIds())
+ {
+ MESSAGE("ChangeNodes problem: not the same number of nodes " << cellPoints->GetNumberOfIds() << " -> " << nbNodes);
+ return false;
+ }
+ myNode = nodes[0];
+ cellPoints->SetId(0, myNode->getVtkId());
+#else
vtkIdType npts = 0;
vtkIdType* pts = 0;
grid->GetCellPoints(myVtkID, npts, pts);
@@ -156,6 +167,7 @@ bool SMDS_Mesh0DElement::ChangeNodes(const SMDS_MeshNode* nodes[], const int nbN
}
myNode = nodes[0];
pts[0] = myNode->getVtkId();
+#endif
SMDS_Mesh::_meshList[myMeshId]->setMyModified();
return true;
diff --git a/src/3rdParty/salomesmesh/src/SMDS/SMDS_MeshNode.cpp b/src/3rdParty/salomesmesh/src/SMDS/SMDS_MeshNode.cpp
index f647a5f1b8f..5b903c8fb55 100644
--- a/src/3rdParty/salomesmesh/src/SMDS/SMDS_MeshNode.cpp
+++ b/src/3rdParty/salomesmesh/src/SMDS/SMDS_MeshNode.cpp
@@ -191,7 +191,7 @@ class SMDS_MeshNode_MyInvIterator: public SMDS_ElemIterator
SMDS_ElemIteratorPtr SMDS_MeshNode::
GetInverseElementIterator(SMDSAbs_ElementType type) const
{
- vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks()->GetLink(myVtkID);
+ vtkCellLinks::Link l = static_cast<vtkCellLinks*>(SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks())->GetLink(myVtkID);
//MESSAGE("myID " << myID << " ncells " << l.ncells);
return SMDS_ElemIteratorPtr(new SMDS_MeshNode_MyInvIterator(SMDS_Mesh::_meshList[myMeshId], l.cells, l.ncells, type));
}
@@ -251,7 +251,7 @@ elementsIterator(SMDSAbs_ElementType type) const
return SMDS_MeshElement::elementsIterator(SMDSAbs_Node);
else
{
- vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks()->GetLink(myVtkID);
+ vtkCellLinks::Link l = static_cast<vtkCellLinks*>(SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks())->GetLink(myVtkID);
return SMDS_ElemIteratorPtr(new SMDS_MeshNode_MyIterator(SMDS_Mesh::_meshList[myMeshId], l.cells, l.ncells, type));
}
}
@@ -350,7 +350,7 @@ void SMDS_MeshNode::AddInverseElement(const SMDS_MeshElement* ME)
const SMDS_MeshCell *cell = dynamic_cast<const SMDS_MeshCell*> (ME);
assert(cell);
SMDS_UnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
- vtkCellLinks *Links = grid->GetCellLinks();
+ vtkCellLinks *Links = static_cast<vtkCellLinks*>(grid->GetCellLinks());
Links->ResizeCellList(myVtkID, 1);
Links->AddCellReference(cell->getVtkId(), myVtkID);
}
@@ -366,7 +366,7 @@ void SMDS_MeshNode::ClearInverseElements()
bool SMDS_MeshNode::emptyInverseElements()
{
- vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks()->GetLink(myVtkID);
+ vtkCellLinks::Link l = static_cast<vtkCellLinks*>(SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks())->GetLink(myVtkID);
return (l.ncells == 0);
}
@@ -378,7 +378,7 @@ bool SMDS_MeshNode::emptyInverseElements()
int SMDS_MeshNode::NbInverseElements(SMDSAbs_ElementType type) const
{
- vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks()->GetLink(myVtkID);
+ vtkCellLinks::Link l = static_cast<vtkCellLinks*>(SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks())->GetLink(myVtkID);
if ( type == SMDSAbs_All )
return l.ncells;
diff --git a/src/3rdParty/salomesmesh/src/SMDS/SMDS_UnstructuredGrid.cpp b/src/3rdParty/salomesmesh/src/SMDS/SMDS_UnstructuredGrid.cpp
index fbd903b1e74..ff2b81e9694 100644
--- a/src/3rdParty/salomesmesh/src/SMDS/SMDS_UnstructuredGrid.cpp
+++ b/src/3rdParty/salomesmesh/src/SMDS/SMDS_UnstructuredGrid.cpp
@@ -139,8 +139,8 @@ int SMDS_UnstructuredGrid::InsertNextLinkedCell(int type, int npts, vtkIdType *p
for (; it != setOfNodes.end(); ++it)
{
//MESSAGE("reverse link for node " << *it << " cell " << cellid);
- this->Links->ResizeCellList(*it, 1);
- this->Links->AddCellReference(cellid, *it);
+ this->GetLinks()->ResizeCellList(*it, 1);
+ this->GetLinks()->AddCellReference(cellid, *it);
}
return cellid;
@@ -332,9 +332,13 @@ void SMDS_UnstructuredGrid::copyBloc(vtkUnsignedCharArray *newTypes,
{
newTypes->SetValue(alreadyCopied, this->Types->GetValue(j));
idCellsOldToNew[j] = alreadyCopied; // old vtkId --> new vtkId
+#ifdef VTK_CELL_ARRAY_V2
+ vtkIdType oldLoc = this->GetCellLocationsArray()->GetValue(j);
+#else
vtkIdType oldLoc = this->Locations->GetValue(j);
+#endif
vtkIdType nbpts;
- vtkIdType *oldPtsCell = 0;
+ vtkIdTypePtr oldPtsCell = 0;
this->Connectivity->GetCell(oldLoc, nbpts, oldPtsCell);
assert(nbpts < NBMAXNODESINCELL);
//MESSAGE(j << " " << alreadyCopied << " " << (int)this->Types->GetValue(j) << " " << oldLoc << " " << nbpts );
@@ -952,6 +956,21 @@ void SMDS_UnstructuredGrid::GetNodeIds(std::set<int>& nodeSet, int downId, unsig
*/
void SMDS_UnstructuredGrid::ModifyCellNodes(int vtkVolId, std::map<int, int> localClonedNodeIds)
{
+#ifdef VTK_CELL_ARRAY_V2
+ vtkNew<vtkIdList> cellPoints;
+ this->GetCellPoints(vtkVolId, cellPoints.GetPointer());
+ for (vtkIdType i = 0; i < cellPoints->GetNumberOfIds(); i++)
+ {
+ if (localClonedNodeIds.count(cellPoints->GetId(i)))
+ {
+ vtkIdType oldpt = cellPoints->GetId(i);
+ cellPoints->SetId(i, localClonedNodeIds[oldpt]);
+ //MESSAGE(oldpt << " --> " << pts[i]);
+ //this->RemoveReferenceToCell(oldpt, vtkVolId);
+ //this->AddReferenceToCell(pts[i], vtkVolId);
+ }
+ }
+#else
vtkIdType npts = 0;
vtkIdType *pts; // will refer to the point id's of the face
this->GetCellPoints(vtkVolId, npts, pts);
@@ -966,6 +985,7 @@ void SMDS_UnstructuredGrid::ModifyCellNodes(int vtkVolId, std::map<int, int> loc
//this->AddReferenceToCell(pts[i], vtkVolId);
}
}
+#endif
}
/*! reorder the nodes of a face
@@ -995,11 +1015,20 @@ void SMDS_UnstructuredGrid::BuildLinks()
this->Links->UnRegister(this);
}
+#ifdef VTK_CELL_ARRAY_V2
+ this->Links = SMDS_CellLinks::New();
+ GetLinks()->Allocate(this->GetNumberOfPoints());
+ GetLinks()->Register(this);
+//FIXME: vtk9
+ GetLinks()->BuildLinks(this);
+ GetLinks()->Delete();
+#else
this->Links = SMDS_CellLinks::New();
this->Links->Allocate(this->GetNumberOfPoints());
this->Links->Register(this);
this->Links->BuildLinks(this, this->Connectivity);
this->Links->Delete();
+#endif
}
/*! Create a volume (prism or hexahedron) by duplication of a face.
diff --git a/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkCellIterator.cpp b/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkCellIterator.cpp
index deb05985f00..63b6eabb704 100644
--- a/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkCellIterator.cpp
+++ b/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkCellIterator.cpp
@@ -33,7 +33,8 @@ SMDS_VtkCellIterator::SMDS_VtkCellIterator(SMDS_Mesh* mesh, int vtkCellId, SMDSA
}
else
{
- vtkIdType npts, *pts;
+ vtkIdType npts;
+ vtkIdTypePtr pts;
grid->GetCellPoints( _cellId, npts, pts );
_vtkIdList->SetNumberOfIds( _nbNodes = npts );
for (int i = 0; i < _nbNodes; i++)
@@ -67,7 +68,7 @@ SMDS_VtkCellIteratorToUNV::SMDS_VtkCellIteratorToUNV(SMDS_Mesh* mesh, int vtkCel
//MESSAGE("SMDS_VtkCellInterlacedIterator (UNV)" << _type);
_vtkIdList = vtkIdList::New();
- vtkIdType* pts;
+ vtkIdTypePtr pts;
vtkIdType npts;
vtkUnstructuredGrid* grid = _mesh->getGrid();
grid->GetCellPoints((vtkIdType)_cellId, npts, pts);
@@ -182,7 +183,7 @@ SMDS_VtkCellIteratorPolyH::SMDS_VtkCellIteratorPolyH(SMDS_Mesh* mesh, int vtkCel
{
//MESSAGE("SMDS_VtkCellIterator Polyhedra");
vtkIdType nFaces = 0;
- vtkIdType* ptIds = 0;
+ vtkIdTypePtr ptIds = 0;
grid->GetFaceStream(_cellId, nFaces, ptIds);
int id = 0;
_nbNodesInFaces = 0;
diff --git a/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkEdge.cpp b/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkEdge.cpp
index 9786abf9aae..6d772a3cd4a 100644
--- a/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkEdge.cpp
+++ b/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkEdge.cpp
@@ -67,6 +67,19 @@ bool SMDS_VtkEdge::ChangeNodes(const SMDS_MeshNode * node1, const SMDS_MeshNode
bool SMDS_VtkEdge::ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes)
{
vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
+#ifdef VTK_CELL_ARRAY_V2
+ vtkNew<vtkIdList> cellPoints;
+ grid->GetCellPoints(myVtkID, cellPoints.GetPointer());
+ if (nbNodes != cellPoints->GetNumberOfIds())
+ {
+ MESSAGE("ChangeNodes problem: not the same number of nodes " << cellPoints->GetNumberOfIds() << " -> " << nbNodes);
+ return false;
+ }
+ for (int i = 0; i < nbNodes; i++)
+ {
+ cellPoints->SetId(i, nodes[i]->getVtkId());
+ }
+#else
vtkIdType npts = 0;
vtkIdType* pts = 0;
grid->GetCellPoints(myVtkID, npts, pts);
@@ -79,6 +92,7 @@ bool SMDS_VtkEdge::ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes)
{
pts[i] = nodes[i]->getVtkId();
}
+#endif
SMDS_Mesh::_meshList[myMeshId]->setMyModified();
return true;
}
@@ -87,7 +101,7 @@ bool SMDS_VtkEdge::IsMediumNode(const SMDS_MeshNode* node) const
{
vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
vtkIdType npts = 0;
- vtkIdType* pts = 0;
+ vtkIdTypePtr pts = 0;
grid->GetCellPoints(myVtkID, npts, pts);
//MESSAGE("IsMediumNode " << npts << " " << (node->getVtkId() == pts[npts-1]));
return ((npts == 3) && (node->getVtkId() == pts[2]));
@@ -137,7 +151,8 @@ const SMDS_MeshNode*
SMDS_VtkEdge::GetNode(const int ind) const
{
vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
- vtkIdType npts, *pts;
+ vtkIdType npts;
+ vtkIdTypePtr pts;
grid->GetCellPoints( this->myVtkID, npts, pts );
return SMDS_Mesh::_meshList[myMeshId]->FindNodeVtk( pts[ ind ]);
}
diff --git a/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkFace.cpp b/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkFace.cpp
index 1389e0d3585..cb981bfb18e 100644
--- a/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkFace.cpp
+++ b/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkFace.cpp
@@ -101,6 +101,19 @@ void SMDS_VtkFace::initQuadPoly(const std::vector<vtkIdType>& nodeIds, SMDS_Mesh
bool SMDS_VtkFace::ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes)
{
vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
+#ifdef VTK_CELL_ARRAY_V2
+ vtkNew<vtkIdList> cellPoints;
+ grid->GetCellPoints(myVtkID, cellPoints.GetPointer());
+ if (nbNodes != cellPoints->GetNumberOfIds())
+ {
+ MESSAGE("ChangeNodes problem: not the same number of nodes " << cellPoints->GetNumberOfIds() << " -> " << nbNodes);
+ return false;
+ }
+ for (int i = 0; i < nbNodes; i++)
+ {
+ cellPoints->SetId(i, nodes[i]->getVtkId());
+ }
+#else
vtkIdType npts = 0;
vtkIdType* pts = 0;
grid->GetCellPoints(myVtkID, npts, pts);
@@ -113,6 +126,7 @@ bool SMDS_VtkFace::ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes)
{
pts[i] = nodes[i]->getVtkId();
}
+#endif
SMDS_Mesh::_meshList[myMeshId]->setMyModified();
return true;
}
@@ -173,7 +187,8 @@ const SMDS_MeshNode*
SMDS_VtkFace::GetNode(const int ind) const
{
vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
- vtkIdType npts, *pts;
+ vtkIdType npts;
+ vtkIdTypePtr pts;
grid->GetCellPoints( this->myVtkID, npts, pts );
return SMDS_Mesh::_meshList[myMeshId]->FindNodeVtk( pts[ ind ]);
}
@@ -186,7 +201,8 @@ SMDS_VtkFace::GetNode(const int ind) const
int SMDS_VtkFace::GetNodeIndex( const SMDS_MeshNode* node ) const
{
vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
- vtkIdType npts, *pts;
+ vtkIdType npts;
+ vtkIdTypePtr pts;
grid->GetCellPoints( this->myVtkID, npts, pts );
for ( vtkIdType i = 0; i < npts; ++i )
if ( pts[i] == node->getVtkId() )
@@ -251,7 +267,7 @@ bool SMDS_VtkFace::IsMediumNode(const SMDS_MeshNode* node) const
return false;
}
vtkIdType npts = 0;
- vtkIdType* pts = 0;
+ vtkIdTypePtr pts = 0;
grid->GetCellPoints(myVtkID, npts, pts);
vtkIdType nodeId = node->getVtkId();
for (int rank = 0; rank < npts; rank++)
@@ -356,11 +372,18 @@ SMDS_NodeIteratorPtr SMDS_VtkFace::interlacedNodesIterator() const
void SMDS_VtkFace::ChangeApex(SMDS_MeshNode* node)
{
vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
+#ifdef VTK_CELL_ARRAY_V2
+ vtkNew<vtkIdList> cellPoints;
+ grid->GetCellPoints(myVtkID, cellPoints.GetPointer());
+ grid->RemoveReferenceToCell(cellPoints->GetId(0), myVtkID);
+ cellPoints->SetId(0, node->getVtkId());
+#else
vtkIdType npts = 0;
vtkIdType* pts = 0;
grid->GetCellPoints(myVtkID, npts, pts);
grid->RemoveReferenceToCell(pts[0], myVtkID);
pts[0] = node->getVtkId();
+#endif
node->AddInverseElement(this),
SMDS_Mesh::_meshList[myMeshId]->setMyModified();
}
diff --git a/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkVolume.cpp b/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkVolume.cpp
index 015edf75fd2..19ebd0746c8 100644
--- a/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkVolume.cpp
+++ b/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkVolume.cpp
@@ -133,6 +133,19 @@ void SMDS_VtkVolume::initPoly(const std::vector<vtkIdType>& nodeIds,
bool SMDS_VtkVolume::ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes)
{
vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
+#ifdef VTK_CELL_ARRAY_V2
+ vtkNew<vtkIdList> cellPoints;
+ grid->GetCellPoints(myVtkID, cellPoints.GetPointer());
+ if (nbNodes != cellPoints->GetNumberOfIds())
+ {
+ MESSAGE("ChangeNodes problem: not the same number of nodes " << cellPoints->GetNumberOfIds() << " -> " << nbNodes);
+ return false;
+ }
+ for (int i = 0; i < nbNodes; i++)
+ {
+ cellPoints->SetId(i, nodes[i]->getVtkId());
+ }
+#else
vtkIdType npts = 0;
vtkIdType* pts = 0;
grid->GetCellPoints(myVtkID, npts, pts);
@@ -145,6 +158,7 @@ bool SMDS_VtkVolume::ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes
{
pts[i] = nodes[i]->getVtkId();
}
+#endif
SMDS_Mesh::_meshList[myMeshId]->setMyModified();
return true;
}
@@ -207,7 +221,7 @@ int SMDS_VtkVolume::NbFaces() const
case VTK_POLYHEDRON:
{
vtkIdType nFaces = 0;
- vtkIdType* ptIds = 0;
+ vtkIdTypePtr ptIds = 0;
grid->GetFaceStream(this->myVtkID, nFaces, ptIds);
nbFaces = nFaces;
break;
@@ -236,7 +250,7 @@ int SMDS_VtkVolume::NbNodes() const
else
{
vtkIdType nFaces = 0;
- vtkIdType* ptIds = 0;
+ vtkIdTypePtr ptIds = 0;
grid->GetFaceStream(this->myVtkID, nFaces, ptIds);
int id = 0;
for (int i = 0; i < nFaces; i++)
@@ -276,7 +290,7 @@ int SMDS_VtkVolume::NbEdges() const
case VTK_POLYHEDRON:
{
vtkIdType nFaces = 0;
- vtkIdType* ptIds = 0;
+ vtkIdTypePtr ptIds = 0;
grid->GetFaceStream(this->myVtkID, nFaces, ptIds);
nbEdges = 0;
int id = 0;
@@ -312,7 +326,7 @@ int SMDS_VtkVolume::NbFaceNodes(const int face_ind) const
if (aVtkType == VTK_POLYHEDRON)
{
vtkIdType nFaces = 0;
- vtkIdType* ptIds = 0;
+ vtkIdTypePtr ptIds = 0;
grid->GetFaceStream(this->myVtkID, nFaces, ptIds);
int id = 0;
for (int i = 0; i < nFaces; i++)
@@ -342,7 +356,7 @@ const SMDS_MeshNode* SMDS_VtkVolume::GetFaceNode(const int face_ind, const int n
if (aVtkType == VTK_POLYHEDRON)
{
vtkIdType nFaces = 0;
- vtkIdType* ptIds = 0;
+ vtkIdTypePtr ptIds = 0;
grid->GetFaceStream(this->myVtkID, nFaces, ptIds);
int id = 0;
for (int i = 0; i < nFaces; i++)
@@ -372,7 +386,7 @@ std::vector<int> SMDS_VtkVolume::GetQuantities() const
if (aVtkType == VTK_POLYHEDRON)
{
vtkIdType nFaces = 0;
- vtkIdType* ptIds = 0;
+ vtkIdTypePtr ptIds = 0;
grid->GetFaceStream(this->myVtkID, nFaces, ptIds);
int id = 0;
for (int i = 0; i < nFaces; i++)
@@ -430,7 +444,7 @@ const SMDS_MeshNode* SMDS_VtkVolume::GetNode(const int ind) const
if ( aVtkType == VTK_POLYHEDRON)
{
vtkIdType nFaces = 0;
- vtkIdType* ptIds = 0;
+ vtkIdTypePtr ptIds = 0;
grid->GetFaceStream(this->myVtkID, nFaces, ptIds);
int id = 0, nbPoints = 0;
for (int i = 0; i < nFaces; i++)
@@ -443,7 +457,8 @@ const SMDS_MeshNode* SMDS_VtkVolume::GetNode(const int ind) const
}
return 0;
}
- vtkIdType npts, *pts;
+ vtkIdType npts;
+ vtkIdTypePtr pts;
grid->GetCellPoints( this->myVtkID, npts, pts );
const std::vector<int>& interlace = SMDS_MeshCell::fromVtkOrder( VTKCellType( aVtkType ));
return SMDS_Mesh::_meshList[myMeshId]->FindNodeVtk( pts[ interlace.empty() ? ind : interlace[ind]] );
@@ -460,7 +475,7 @@ int SMDS_VtkVolume::GetNodeIndex( const SMDS_MeshNode* node ) const
if ( aVtkType == VTK_POLYHEDRON)
{
vtkIdType nFaces = 0;
- vtkIdType* ptIds = 0;
+ vtkIdTypePtr ptIds = 0;
grid->GetFaceStream(this->myVtkID, nFaces, ptIds);
int id = 0;
for (int iF = 0; iF < nFaces; iF++)
@@ -473,7 +488,8 @@ int SMDS_VtkVolume::GetNodeIndex( const SMDS_MeshNode* node ) const
}
return -1;
}
- vtkIdType npts, *pts;
+ vtkIdType npts;
+ vtkIdTypePtr pts;
grid->GetCellPoints( this->myVtkID, npts, pts );
for ( vtkIdType i = 0; i < npts; ++i )
if ( pts[i] == node->getVtkId() )
@@ -534,7 +550,7 @@ bool SMDS_VtkVolume::IsMediumNode(const SMDS_MeshNode* node) const
return false;
}
vtkIdType npts = 0;
- vtkIdType* pts = 0;
+ vtkIdTypePtr pts = 0;
grid->GetCellPoints(myVtkID, npts, pts);
vtkIdType nodeId = node->getVtkId();
for (int rank = 0; rank < npts; rank++)
diff --git a/src/3rdParty/salomesmesh/src/SMESH/SMESH_MeshEditor.cpp b/src/3rdParty/salomesmesh/src/SMESH/SMESH_MeshEditor.cpp
index fcd044b00f2..f54c24f8618 100644
--- a/src/3rdParty/salomesmesh/src/SMESH/SMESH_MeshEditor.cpp
+++ b/src/3rdParty/salomesmesh/src/SMESH/SMESH_MeshEditor.cpp
@@ -11348,7 +11348,7 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vector<TIDSorted
{
int oldId = *itn;
//MESSAGE(" node " << oldId);
- vtkCellLinks::Link l = grid->GetCellLinks()->GetLink(oldId);
+ vtkCellLinks::Link l = static_cast<vtkCellLinks*>(grid->GetCellLinks())->GetLink(oldId);
for (int i=0; i<l.ncells; i++)
{
int vtkId = l.cells[i];
@@ -11527,7 +11527,7 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vector<TIDSorted
//MESSAGE(" domain " << idom << " volume " << elem->GetID());
double values[3];
vtkIdType npts = 0;
- vtkIdType* pts = 0;
+ vtkIdTypePtr pts = 0;
grid->GetCellPoints(vtkVolIds[ivol], npts, pts);
SMDS_VtkVolume::gravityCenter(grid, pts, npts, values);
if (id ==0)
@@ -11708,7 +11708,7 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vector<TIDSorted
{
int oldId = itnod->first;
//MESSAGE(" node " << oldId);
- vtkCellLinks::Link l = grid->GetCellLinks()->GetLink(oldId);
+ vtkCellLinks::Link l = static_cast<vtkCellLinks*>(grid->GetCellLinks())->GetLink(oldId);
for (int i = 0; i < l.ncells; i++)
{
int vtkId = l.cells[i];
@@ -12165,7 +12165,7 @@ void SMESH_MeshEditor::CreateHoleSkin(double radius,
MESSAGE("volume to check, vtkId " << vtkId << " smdsId " << meshDS->fromVtkToSmds(vtkId));
bool volInside = false;
vtkIdType npts = 0;
- vtkIdType* pts = 0;
+ vtkIdTypePtr pts = 0;
grid->GetCellPoints(vtkId, npts, pts);
for (int i=0; i<npts; i++)
{

View File

@ -1,29 +0,0 @@
diff --git a/src/Mod/Test/unittestgui.py b/src/Mod/Test/unittestgui.py
index 6e93079b8..e6125a694 100755
--- a/src/Mod/Test/unittestgui.py
+++ b/src/Mod/Test/unittestgui.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
"""
GUI framework and application for use with Python unit testing framework.
Execute tests written using the framework provided by the 'unittest' module.
@@ -29,12 +29,15 @@ __version__ = "$Revision: 2.0 $"[11:-2]
import unittest
import sys
-import Tkinter
-import tkMessageBox
+if sys.version_info.major >= 3:
+ import tkinter as tk
+ from tkinter import messagebox as tkMessageBox
+else:
+ import Tkinter as tk
+ import tkMessageBox
import traceback
import string
-tk = Tkinter # Alternative to the messy 'from Tkinter import *' often seen
##############################################################################