Salome HOME
Fix streamlines representation not working since ParaView >= 5.10. Plus: V9_11_0a1 V9_11_0a2 V9_11_0b1
authorChristophe Bourcier <christophe.bourcier@cea.fr>
Fri, 14 Apr 2023 12:06:57 +0000 (14:06 +0200)
committerChristophe Bourcier <christophe.bourcier@cea.fr>
Fri, 14 Apr 2023 12:06:57 +0000 (14:06 +0200)
- use Line seed in case of planar dataset
- add tests

src/MEDCalc/cmp/MEDPresentationStreamLines.cxx
src/MEDCalc/test/medcalc_testutils.py.in
src/MEDCalc/test/tui/streamlines.py [new file with mode: 0644]
src/MEDCalc/test/tui/streamlines_2d.py [new file with mode: 0644]
src/MEDCalc/test/tui/tests.set

index 8a071b7849fe493ac1e9892b0740684b6de82f7b..96380ab6a1851598b4bb9bfe54aceb08ad02c332 100644 (file)
@@ -130,7 +130,9 @@ MEDPresentationStreamLines::internalGeneratePipeline()
   oss << _objVar << " = " << _objStreamCalc << ";";
   oss << _objVar << ".UpdatePipeline();";
   pushAndExecPyLine(oss.str()); oss.str("");
-  oss << _objVar << " = pvs.StreamTracer(Input=" << _objVar << ", SeedType='Point Cloud' if pvs.GetParaViewVersion().GetVersion() > 5.8 else 'Point Source');";
+  oss << _objVar << " = pvs.StreamTracer(Input=" << _objVar <<
+      ", SeedType='Point Cloud' if not medcalc.IsPlanarObj(" << _objVar <<
+      ") else 'Line');";
   pushAndExecPyLine(oss.str()); oss.str("");
   oss << _objVar << ".IntegrationDirection = '" << dirType << "';";
   pushAndExecPyLine(oss.str()); oss.str("");
@@ -228,4 +230,4 @@ MEDPresentationStreamLines::scalarBarTitle()
     pushAndExecPyLine(oss.str());
   }
   MEDPresentation::scalarBarTitle();
-}
\ No newline at end of file
+}
index 21875df914311afeb3123d705e826959c24c1533..31fb15c0dd26f62ed3dd0a1bdaca047fa58ae603 100755 (executable)
@@ -46,3 +46,7 @@ def GetMEDFileDirGUI():
 def GetMEDFileDirTUI():
   relativeDir = "@SALOME_FIELDS_INSTALL_RES_DATA@/tests/tui/medfiles"
   return os.path.join(__getRootDir(), relativeDir)
+
+def GetMEDFileDirResources():
+  relativeDir = "@SALOME_FIELDS_INSTALL_RES_DATA@"
+  return os.path.join(__getRootDir(), relativeDir)
diff --git a/src/MEDCalc/test/tui/streamlines.py b/src/MEDCalc/test/tui/streamlines.py
new file mode 100644 (file)
index 0000000..52b882b
--- /dev/null
@@ -0,0 +1,41 @@
+# Copyright (C) 2016-2022  CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+import os
+from time import sleep
+
+import medcalc
+medcalc.medconsole.setConsoleGlobals(globals())
+import MEDCALC
+from medcalc.medconsole import accessField
+
+from medcalc_testutils import GetMEDFileDirTUI
+
+datafile = os.path.join(GetMEDFileDirTUI(), "agitateur.med")
+source_id = medcalc.LoadDataSource(datafile)
+
+# Field 55 = VITESSE_ELEM_DOM (ON_CELLS) at timestamp 0
+# Field 65 = VITESSE_ELEM_DOM (ON_CELLS) at timestamp 10
+presentation_id = medcalc.MakeStreamLines(accessField(65), viewMode=MEDCALC.VIEW_MODE_REPLACE,
+                                          colorMap=MEDCALC.COLOR_MAP_BLUE_TO_RED_RAINBOW,
+                                          scalarBarRange=MEDCALC.SCALAR_BAR_CURRENT_TIMESTEP
+                                          )
+sleep(1)
+medcalc.RemovePresentation(presentation_id)
+sleep(1)
diff --git a/src/MEDCalc/test/tui/streamlines_2d.py b/src/MEDCalc/test/tui/streamlines_2d.py
new file mode 100644 (file)
index 0000000..24719f0
--- /dev/null
@@ -0,0 +1,42 @@
+# Copyright (C) 2016-2022  CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+import os
+from time import sleep
+
+import medcalc
+medcalc.medconsole.setConsoleGlobals(globals())
+import MEDCALC
+from medcalc.medconsole import accessField
+
+from medcalc_testutils import GetMEDFileDirResources
+
+datafile = os.path.join(GetMEDFileDirResources(), "TimeStamps.med")
+source_id = medcalc.LoadDataSource(datafile)
+
+# Field 55 = VITESSE_ELEM_DOM (ON_CELLS) at timestamp 0
+# Field 65 = VITESSE_ELEM_DOM (ON_CELLS) at timestamp 10
+presentation_id = medcalc.MakeStreamLines(accessField(264), viewMode=MEDCALC.VIEW_MODE_REPLACE,
+                                          colorMap=MEDCALC.COLOR_MAP_BLUE_TO_RED_RAINBOW,
+                                          scalarBarRange=MEDCALC.SCALAR_BAR_CURRENT_TIMESTEP
+                                          )
+sleep(1)
+medcalc.RemovePresentation(presentation_id)
+sleep(1)
+
index 8892fc9ce7a63d62b29d6a364a1ebda3cf7b4a15..8ea87fb9da631f7c358a53a161105b49f4b956ea 100644 (file)
@@ -31,4 +31,6 @@ SET(TEST_NAMES
   deflection_shape
   elno_field
   interpolate_field_float
+  streamlines
+  streamlines_2d
 )