]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Fix failure of UsersGuideExamplesTest in MICROMED mode
authoreap <eap@opencascade.com>
Thu, 26 Jul 2018 14:40:31 +0000 (17:40 +0300)
committereap <eap@opencascade.com>
Thu, 26 Jul 2018 14:40:31 +0000 (17:40 +0300)
src/MEDCoupling_Swig/UsersGuideExamplesTest.py
src/RENUMBER_Swig/CMakeLists.txt
src/RENUMBER_Swig/UsersGuideExamplesTest.py [new file with mode: 0644]

index adbab4748fbcce93c53601f495c0ef6113d2286d..cad12285f8f61e6221d344ec2e89f836e7fd5fac 100755 (executable)
@@ -574,43 +574,3 @@ rem.setMinDotBtwPlane3DSurfIntersect( 0.8 )
 rem.prepare(src,tgt,"P0P0")
 print(rem.getCrudeMatrix())
 #! [UG_Projection_10]
-
-from MEDCouplingDataForTest import MEDCouplingDataForTest
-m=MEDCouplingDataForTest.build2DTargetMesh_1();
-#! [UG_Optimization_0]
-from MEDRenumber import RenumberingFactory
-ren=RenumberingFactory("BOOST")
-a,b=m.computeNeighborsOfCells()
-n2o,_=ren.renumber(a,b)
-mrenum=m[n2o]
-#! [UG_Optimization_0]
-
-#! [UG_Optimization_1]
-from MEDCoupling import MEDCouplingSkyLineArray
-import MEDPartitioner
-# prepare a MEDPartitioner
-a,b=m.computeNeighborsOfCells()
-sk=MEDCouplingSkyLineArray(b,a)
-g=MEDPartitioner.MEDPartitioner.Graph(sk)
-# compute partitioning into 4 parts
-g.partGraph(4)
-# get the 1st of parts of m
-procIdOnCells=g.getPartition().getValuesArray()
-p0=procIdOnCells.findIdsEqual(0)
-part0=m[p0]
-#! [UG_Optimization_1]
-#! [UG_Optimization_2]
-boundary_nodes_part0=part0.findBoundaryNodes()
-boundary_cells_part0=p0[part0.getCellIdsLyingOnNodes(boundary_nodes_part0,False)]
-# starting from knowledge of neighborhood it s possible to know the neighbors of boundary_cells_part0
-neighbors_boundary_cells_part0=MEDCouplingUMesh.ExtractFromIndexedArrays(boundary_cells_part0,a,b)[0]
-neighbors_boundary_cells_part0.sort()
-neighbors_boundary_cells_part0=neighbors_boundary_cells_part0.buildUnique()
-#
-layer_of_part0=neighbors_boundary_cells_part0.buildSubstraction(p0)
-#
-whole_part_with_layer=DataArrayInt.Aggregate([p0,layer_of_part0])
-whole_part_with_layer.sort()
-part0_with_layer=m[whole_part_with_layer]
-#! [UG_Optimization_2]
-
index 0ec67e031bd7c90fed2717fd8d9f4a1fa52e15a2..8cd351a3a7d590c8f1b115ca96cb62755c7405f7 100644 (file)
@@ -67,6 +67,8 @@ SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH ${CMAKE_CURRENT_BINARY_DIR}/../MEDCoupl
 SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
 ADD_TEST(MEDRenumberTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDRenumberTest.py)
 SET_TESTS_PROPERTIES(MEDRenumberTest PROPERTIES ENVIRONMENT "${tests_env}")
+ADD_TEST(MEDRenumberUserGuide ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/UsersGuideExamplesTest.py)
+SET_TESTS_PROPERTIES(MEDRenumberUserGuide PROPERTIES ENVIRONMENT "${tests_env}")
 
 # Application tests
 
diff --git a/src/RENUMBER_Swig/UsersGuideExamplesTest.py b/src/RENUMBER_Swig/UsersGuideExamplesTest.py
new file mode 100644 (file)
index 0000000..d61b674
--- /dev/null
@@ -0,0 +1,64 @@
+#  -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2016  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
+#
+
+from MEDCoupling import *
+from math import pi, sqrt
+
+import MEDCoupling
+
+from MEDCouplingDataForTest import MEDCouplingDataForTest
+m=MEDCouplingDataForTest.build2DTargetMesh_1();
+#! [UG_Optimization_0]
+from MEDRenumber import RenumberingFactory
+ren=RenumberingFactory("BOOST")
+a,b=m.computeNeighborsOfCells()
+n2o,_=ren.renumber(a,b)
+mrenum=m[n2o]
+#! [UG_Optimization_0]
+
+#! [UG_Optimization_1]
+from MEDCoupling import MEDCouplingSkyLineArray
+import MEDPartitioner
+# prepare a MEDPartitioner
+a,b=m.computeNeighborsOfCells()
+sk=MEDCouplingSkyLineArray(b,a)
+g=MEDPartitioner.MEDPartitioner.Graph(sk)
+# compute partitioning into 4 parts
+g.partGraph(4)
+# get the 1st of parts of m
+procIdOnCells=g.getPartition().getValuesArray()
+p0=procIdOnCells.findIdsEqual(0)
+part0=m[p0]
+#! [UG_Optimization_1]
+#! [UG_Optimization_2]
+boundary_nodes_part0=part0.findBoundaryNodes()
+boundary_cells_part0=p0[part0.getCellIdsLyingOnNodes(boundary_nodes_part0,False)]
+# starting from knowledge of neighborhood it s possible to know the neighbors of boundary_cells_part0
+neighbors_boundary_cells_part0=MEDCouplingUMesh.ExtractFromIndexedArrays(boundary_cells_part0,a,b)[0]
+neighbors_boundary_cells_part0.sort()
+neighbors_boundary_cells_part0=neighbors_boundary_cells_part0.buildUnique()
+#
+layer_of_part0=neighbors_boundary_cells_part0.buildSubstraction(p0)
+#
+whole_part_with_layer=DataArrayInt.Aggregate([p0,layer_of_part0])
+whole_part_with_layer.sort()
+part0_with_layer=m[whole_part_with_layer]
+#! [UG_Optimization_2]
+