Salome HOME
c8c74fc4b1cfcdf028134a9d7ecb71a4cf8aae63
[modules/hexablock.git] / doc / pyplots / test_disconnect.py
1 # Copyright (C) 2009-2023  CEA, EDF
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 #
21
22 import os
23 import GEOM
24 import SALOMEDS
25 import hexablock
26
27 # differents cas possibles de remplissage possibles :
28
29
30 print("test disconnect elements...")
31 doc = hexablock.addDocument()
32
33 size_x = 2;
34 size_y = 2;
35 size_z = 1;
36
37 orig1 = doc.addVertex(0, 0, 0);
38 orig2 = doc.addVertex(4, 0, 0);
39 orig3 = doc.addVertex(8, 0, 0);
40
41
42 dirVr = doc.addVector(1, 1, 1);
43
44 grid1 = doc.makeCartesian1(orig1, dirVr, size_x, size_y, size_z, 0, 0,
45                            0)
46 grid2 = doc.makeCartesian1(orig2, dirVr, size_x, size_y, size_z, 0, 0,
47                            0)
48 grid3 = doc.makeCartesian1(orig3, dirVr, size_x, size_y, size_z, 0, 0,
49                            0)
50
51
52 nvtk = 0
53 #doc.setLevel(1)
54
55 # matrice =  ???
56 # ecart = doc.addVector(0.5, 0.5, 0)
57
58 hexa1 = grid1.getHexaIJK(1, 1, 0)
59 hexa2 = grid2.getHexaIJK(1, 1, 0)
60 hexa3 = grid3.getHexaIJK(1, 1, 0)
61
62 quad = grid1.getQuadJK(1, 1, 0)
63 edge = grid2.getEdgeK(1, 2, 0)
64 vertex = grid3.getVertexIJK(1, 1, 1)
65
66 quad.setScalar(5)
67 edge.setScalar(5)
68 vertex.setScalar(5)
69
70 file_name = os.path.join(os.environ['TMP'], 'disconnect1.vtk')
71 ####  doc.saveVtk(file_name)
72
73 doc.disconnectQuad(hexa1, quad)
74
75 file_name = os.path.join(os.environ['TMP'], 'disconnect2.vtk')
76 ####  doc.saveVtk(file_name)
77
78
79 print("...test disconnect elements OK")
80
81