1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2023 CEA, EDF
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 from medcoupling import *
25 class MEDCouplingDataForTest:
26 def build2DTargetMesh_1(cls):
27 targetCoords=[-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 ];
28 targetConn=[0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4];
29 targetMesh=MEDCouplingUMesh.New();
30 targetMesh.setMeshDimension(2);
31 targetMesh.allocateCells(5);
32 targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[0:4]);
33 targetMesh.insertNextCell(NORM_TRI3,3,targetConn[4:7]);
34 targetMesh.insertNextCell(NORM_TRI3,3,targetConn[7:10]);
35 targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[10:14]);
36 targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[14:18]);
37 targetMesh.finishInsertingCells();
38 myCoords=DataArrayDouble.New();
39 myCoords.setValues(targetCoords,9,2);
40 targetMesh.setCoords(myCoords);
43 def build2DSourceMesh_1(cls):
44 sourceCoords=[-0.3,-0.3, 0.7,-0.3, -0.3,0.7, 0.7,0.7]
45 sourceConn=[0,3,1,0,2,3]
46 sourceMesh=MEDCouplingUMesh.New("my name of mesh 2D",2);
47 sourceMesh.allocateCells(2);
48 sourceMesh.insertNextCell(NORM_TRI3,3,sourceConn[0:3]);
49 sourceMesh.insertNextCell(NORM_TRI3,3,sourceConn[3:6]);
50 sourceMesh.finishInsertingCells();
51 myCoords=DataArrayDouble.New();
52 myCoords.setValues(sourceCoords,4,2);
53 sourceMesh.setCoords(myCoords);
56 def build3DTargetMesh_1(cls):
57 targetCoords=[ 0., 0., 0., 50., 0., 0. , 200., 0., 0. , 0., 50., 0., 50., 50., 0. , 200., 50., 0., 0., 200., 0., 50., 200., 0. , 200., 200., 0. ,
58 0., 0., 50., 50., 0., 50. , 200., 0., 50. , 0., 50., 50., 50., 50., 50. , 200., 50., 50., 0., 200., 50., 50., 200., 50. , 200., 200., 50. ,
59 0., 0., 200., 50., 0., 200. , 200., 0., 200. , 0., 50., 200., 50., 50., 200. , 200., 50., 200., 0., 200., 200., 50., 200., 200. , 200., 200., 200. ];
60 targetConn=[0,1,4,3,9,10,13,12, 1,2,5,4,10,11,14,13, 3,4,7,6,12,13,16,15, 4,5,8,7,13,14,17,16,
61 9,10,13,12,18,19,22,21, 10,11,14,13,19,20,23,22, 12,13,16,15,21,22,25,24, 13,14,17,16,22,23,26,25];
62 targetMesh=MEDCouplingUMesh.New();
63 targetMesh.setMeshDimension(3);
64 targetMesh.allocateCells(12);
66 targetMesh.insertNextCell(NORM_HEXA8,8,targetConn[8*i:8*i+8]);
68 targetMesh.finishInsertingCells();
69 myCoords=DataArrayDouble.New();
70 myCoords.setValues(targetCoords,27,3);
71 targetMesh.setCoords(myCoords);
74 def build3DSourceMesh_1(self):
75 sourceCoords=[ 0.0, 0.0, 200.0, 0.0, 0.0, 0.0, 0.0, 200.0, 200.0, 0.0, 200.0, 0.0, 200.0, 0.0, 200.0,
76 200.0, 0.0, 0.0, 200.0, 200.0, 200.0, 200.0, 200.0, 0.0, 100.0, 100.0, 100.0]
77 sourceConn=[8,1,7,3, 6,0,8,2, 7,4,5,8, 6,8,4,7, 6,8,0,4, 6,8,7,3, 8,1,3,0, 4,1,5,8, 1,7,5,8, 0,3,8,2, 8,1,0,4, 3,6,8,2]
78 sourceMesh=MEDCouplingUMesh.New();
79 sourceMesh.setMeshDimension(3);
80 sourceMesh.allocateCells(12);
81 sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[0:4])
82 sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[4:8])
83 sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[8:12])
84 sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[12:16])
85 sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[16:20])
86 sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[20:24])
87 sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[24:28])
88 sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[28:32])
89 sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[32:36])
90 sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[36:40])
91 sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[40:44])
92 sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[44:48])
93 sourceMesh.finishInsertingCells();
94 myCoords=DataArrayDouble.New();
95 myCoords.setValues(sourceCoords,9,3);
96 sourceMesh.setCoords(myCoords);
100 def build3DSurfTargetMesh_1(self):
101 targetCoords=[-0.3,-0.3,0.5, 0.2,-0.3,1., 0.7,-0.3,1.5, -0.3,0.2,0.5, 0.2,0.2,1., 0.7,0.2,1.5, -0.3,0.7,0.5, 0.2,0.7,1., 0.7,0.7,1.5]
102 targetConn=[0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4]
103 targetMesh=MEDCouplingUMesh.New();
104 targetMesh.setMeshDimension(2);
105 targetMesh.allocateCells(5);
106 targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[0:4])
107 targetMesh.insertNextCell(NORM_TRI3,3,targetConn[4:7])
108 targetMesh.insertNextCell(NORM_TRI3,3,targetConn[7:10])
109 targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[10:14])
110 targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[14:18])
111 targetMesh.finishInsertingCells();
112 myCoords=DataArrayDouble.New();
113 myCoords.setValues(targetCoords,9,3);
114 targetMesh.setCoords(myCoords);
117 def build3DExtrudedUMesh_1(self):
119 0.,0.,0., 1.,1.,0., 1.,1.25,0., 1.,0.,0., 1.,1.5,0., 2.,0.,0., 2.,1.,0., 1.,2.,0., 0.,2.,0., 3.,1.,0.,
120 3.,2.,0., 0.,1.,0., 1.,3.,0., 2.,2.,0., 2.,3.,0.,
121 0.,0.,1., 1.,1.,1., 1.,1.25,1., 1.,0.,1., 1.,1.5,1., 2.,0.,1., 2.,1.,1., 1.,2.,1., 0.,2.,1., 3.,1.,1.,
122 3.,2.,1., 0.,1.,1., 1.,3.,1., 2.,2.,1., 2.,3.,1.,
123 0.,0.,2., 1.,1.,2., 1.,1.25,2., 1.,0.,2., 1.,1.5,2., 2.,0.,2., 2.,1.,2., 1.,2.,2., 0.,2.,2., 3.,1.,2.,
124 3.,2.,2., 0.,1.,2., 1.,3.,2., 2.,2.,2., 2.,3.,2.,
125 0.,0.,3., 1.,1.,3., 1.,1.25,3., 1.,0.,3., 1.,1.5,3., 2.,0.,3., 2.,1.,3., 1.,2.,3., 0.,2.,3., 3.,1.,3.,
126 3.,2.,3., 0.,1.,3., 1.,3.,3., 2.,2.,3., 2.,3.,3.]
130 0,11,1,3,15,26,16,18, 1,2,4,7,13,6,-1,1,16,21,6,-1,6,21,28,13,-1,13,7,22,28,-1,7,4,19,22,-1,4,2,17,19,-1,2,1,16,17,-1,16,21,28,22,19,17,
131 1,6,5,3,16,21,20,18, 13,10,9,6,28,25,24,21,
132 11,8,7,4,2,1,-1,11,26,16,1,-1,1,16,17,2,-1,2,17,19,4,-1,4,19,22,7,-1,7,8,23,22,-1,8,11,26,23,-1,26,16,17,19,22,23,
133 7,12,14,13,22,27,29,28,
135 15,26,16,18,30,41,31,33, 16,17,19,22,28,21,-1,16,31,36,21,-1,21,36,43,28,-1,28,22,37,43,-1,22,19,34,37,-1,19,17,32,34,-1,17,16,31,32,-1,31,36,43,37,34,32,
136 16,21,20,18,31,36,35,33, 28,25,24,21,43,40,39,36,
137 26,23,22,19,17,16,-1,26,41,31,16,-1,16,31,32,17,-1,17,32,34,19,-1,19,34,37,22,-1,22,23,38,37,-1,23,26,41,38,-1,41,31,32,34,37,38,
138 22,27,29,28,37,42,44,43,
140 30,41,31,33,45,56,46,48, 31,32,34,37,43,36,-1,31,46,51,36,-1,36,51,58,43,-1,43,37,52,58,-1,37,34,49,52,-1,34,32,47,49,-1,32,31,46,47,-1,46,51,58,52,49,47,
141 31,36,35,33,46,51,50,48, 43,40,39,36,58,55,54,51,
142 41,38,37,34,32,31,-1,41,56,46,31,-1,31,46,47,32,-1,32,47,49,34,-1,34,49,52,37,-1,37,38,53,52,-1,38,41,56,53,-1,56,46,47,49,52,53,
143 37,42,44,43,52,57,59,58]
144 conn2=[7,12,14,13, 11,8,7,4,2,1, 13,10,9,6, 1,6,5,3, 1,2,4,7,13,6, 0,11,1,3]
146 ret=MEDCouplingUMesh.New();
147 ret.setMeshDimension(3);
148 ret.allocateCells(18);
150 ret.insertNextCell(NORM_HEXA8,8,conn[0:8]);
151 ret.insertNextCell(NORM_POLYHED,43,conn[8:51]);
152 ret.insertNextCell(NORM_HEXA8,8,conn[51:59]);
153 ret.insertNextCell(NORM_HEXA8,8,conn[59:67]);
154 ret.insertNextCell(NORM_POLYHED,43,conn[67:110]);
155 ret.insertNextCell(NORM_HEXA8,8,conn[110:118]);
157 ret.insertNextCell(NORM_HEXA8,8,conn[118:126]);
158 ret.insertNextCell(NORM_POLYHED,43,conn[126:169]);
159 ret.insertNextCell(NORM_HEXA8,8,conn[169:177]);
160 ret.insertNextCell(NORM_HEXA8,8,conn[177:185]);
161 ret.insertNextCell(NORM_POLYHED,43,conn[185:228]);
162 ret.insertNextCell(NORM_HEXA8,8,conn[228:236]);
164 ret.insertNextCell(NORM_HEXA8,8,conn[236:244]);
165 ret.insertNextCell(NORM_POLYHED,43,conn[244:287]);
166 ret.insertNextCell(NORM_HEXA8,8,conn[287:295]);
167 ret.insertNextCell(NORM_HEXA8,8,conn[295:303]);
168 ret.insertNextCell(NORM_POLYHED,43,conn[303:346]);
169 ret.insertNextCell(NORM_HEXA8,8,conn[346:354]);
171 ret.finishInsertingCells();
172 myCoords=DataArrayDouble.New();
173 myCoords.setValues(coords,60,3);
174 ret.setCoords(myCoords);
176 mesh2D=MEDCouplingUMesh.New();
177 mesh2D.setMeshDimension(2);
178 mesh2D.allocateCells(6);
179 mesh2D.insertNextCell(NORM_QUAD4,4,conn2[0:4]);
180 mesh2D.insertNextCell(NORM_POLYGON,6,conn2[4:10]);
181 mesh2D.insertNextCell(NORM_QUAD4,4,conn2[10:14]);
182 mesh2D.insertNextCell(NORM_QUAD4,4,conn2[14:18]);
183 mesh2D.insertNextCell(NORM_POLYGON,6,conn2[18:24]);
184 mesh2D.insertNextCell(NORM_QUAD4,4,conn2[24:28]);
185 mesh2D.finishInsertingCells();
186 mesh2D.setCoords(myCoords);
189 def buildCU1DMesh_U(self):
190 coords=[ 0.0, 0.3, 0.75, 1.0 ]
191 conn=[ 0,1, 1,2, 2,3 ]
192 mesh=MEDCouplingUMesh.New();
193 mesh.setMeshDimension(1);
194 mesh.allocateCells(3);
195 mesh.insertNextCell(NORM_SEG2,2,conn[0:2]);
196 mesh.insertNextCell(NORM_SEG2,2,conn[2:4]);
197 mesh.insertNextCell(NORM_SEG2,2,conn[4:6]);
198 mesh.finishInsertingCells();
199 myCoords=DataArrayDouble.New();
200 myCoords.setValues(coords,4,1);
201 mesh.setCoords(myCoords);
204 def build2DTargetMeshMergeNode_1(self):
205 targetCoords=[-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,-0.3, 0.2,-0.3, 0.2,-0.3, 0.2,0.2, 0.2,0.2, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7, 0.2,0.7 ]
206 targetConn=[0,9,7,5, 4,6,2, 10,11,8, 9,14,15,7, 17,16,13,6]
207 targetMesh=MEDCouplingUMesh.New();
208 targetMesh.setMeshDimension(2);
209 targetMesh.allocateCells(5);
210 targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[0:4]);
211 targetMesh.insertNextCell(NORM_TRI3,3,targetConn[4:7]);
212 targetMesh.insertNextCell(NORM_TRI3,3,targetConn[7:10]);
213 targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[10:14]);
214 targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[14:18]);
215 targetMesh.finishInsertingCells();
216 myCoords=DataArrayDouble.New();
217 myCoords.setValues(targetCoords,18,2);
218 targetMesh.setCoords(myCoords);
221 def build3DTargetMeshMergeNode_1(self):
222 targetCoords=[ 0., 0., 0., 50., 0., 0. , 200., 0., 0. , 0., 50., 0., 50., 50., 0. , 200., 50., 0., 0., 200., 0., 50., 200., 0. , 200., 200., 0. ,
223 0., 0., 50., 50., 0., 50. , 200., 0., 50. , 0., 50., 50., 50., 50., 50. , 200., 50., 50., 0., 200., 50., 50., 200., 50. , 200., 200., 50. ,
224 0., 0., 200., 50., 0., 200. , 200., 0., 200. , 0., 50., 200., 50., 50., 200. , 200., 50., 200., 0., 200., 200., 50., 200., 200. , 200., 200., 200., 50.,0.,0., 50.,0.,0., 50.,0.,0., 200., 50., 200.]
225 targetConn=[0,29,4,3,9,10,13,12, 28,2,5,4,10,11,14,13, 3,4,7,6,12,13,16,15, 4,5,8,7,13,14,17,16,
226 9,10,13,12,18,19,22,21, 10,11,14,13,19,20,23,22, 12,13,16,15,21,22,25,24, 13,14,17,16,22,30,26,25]
227 targetMesh=MEDCouplingUMesh.New();
228 targetMesh.setMeshDimension(3);
229 targetMesh.allocateCells(12);
231 targetMesh.insertNextCell(NORM_HEXA8,8,targetConn[8*i:8*(i+1)]);
233 targetMesh.finishInsertingCells();
234 myCoords=DataArrayDouble.New();
235 myCoords.setValues(targetCoords,31,3);
236 targetMesh.setCoords(myCoords);
239 def build2DTargetMeshMerged_1(self):
241 -0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7,
242 0.7,-0.3, 1.7,-0.3, 0.7,0.7, 1.7,0.7
245 0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4,
248 targetMesh=MEDCouplingUMesh.New();
249 targetMesh.setName("merge");
250 targetMesh.setMeshDimension(2);
251 targetMesh.allocateCells(10);
252 targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[0:4])
253 targetMesh.insertNextCell(NORM_TRI3,3,targetConn[4:7])
254 targetMesh.insertNextCell(NORM_TRI3,3,targetConn[7:10])
255 targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[10:14])
256 targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[14:18])
257 targetMesh.insertNextCell(NORM_TRI3,3,targetConn[18:21])
258 targetMesh.insertNextCell(NORM_TRI3,3,targetConn[21:24])
259 targetMesh.finishInsertingCells();
260 myCoords=DataArrayDouble.New();
261 myCoords.setValues(targetCoords,13,2);
262 targetMesh.setCoords(myCoords);
265 def build2DTargetMesh_2(cls):
266 targetCoords=[-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 ]
267 targetConn=[0,3,4, 0,4,1, 1,4,2, 4,5,2, 3,6,4, 6,7,4, 4,7,5, 7,8,5 ]
268 targetMesh=MEDCouplingUMesh.New();
269 targetMesh.setMeshDimension(2);
270 targetMesh.allocateCells(8);
271 targetMesh.insertNextCell(NORM_TRI3,3,targetConn[0:3])
272 targetMesh.insertNextCell(NORM_TRI3,3,targetConn[3:6])
273 targetMesh.insertNextCell(NORM_TRI3,3,targetConn[6:9])
274 targetMesh.insertNextCell(NORM_TRI3,3,targetConn[9:12])
275 targetMesh.insertNextCell(NORM_TRI3,3,targetConn[12:15])
276 targetMesh.insertNextCell(NORM_TRI3,3,targetConn[15:18])
277 targetMesh.insertNextCell(NORM_TRI3,3,targetConn[18:21])
278 targetMesh.insertNextCell(NORM_TRI3,3,targetConn[21:24])
279 targetMesh.finishInsertingCells();
280 myCoords=DataArrayDouble.New();
281 myCoords.setValues(targetCoords,9,2);
282 targetMesh.setCoords(myCoords);
285 def build1DSourceMesh_2(cls):
286 ret=MEDCouplingUMesh.New("1DSourceMesh",1);
287 ret.allocateCells(4);
288 conn=[0,1,2,3,1,2,3,4]
290 ret.insertNextCell(NORM_SEG2,2,conn[2*i:2*i+2]);
292 ret.finishInsertingCells();
293 myCoords=DataArrayDouble.New([0.3,0.7,0.9,1.0,1.12],5,1);
294 ret.setCoords(myCoords);
297 def build1DTargetMesh_3(cls):
298 ret=MEDCouplingUMesh.New("1DMesh_3",1);
299 ret.allocateCells(4);
300 conn=[0,1,2, 3,4, 6,5,7 ,9,8]
301 ret.insertNextCell(NORM_SEG3,3,conn[0:3])
302 ret.insertNextCell(NORM_SEG2,2,conn[3:5])
303 ret.insertNextCell(NORM_SEG3,3,conn[5:8])
304 ret.insertNextCell(NORM_SEG2,2,conn[8:10])
305 ret.finishInsertingCells();
306 coords=[0.5,1.,0.8,5.,5.21,0.5,1.1,0.7,5.,5.31]
307 myCoords=DataArrayDouble.New();
308 myCoords.setValues(coords,10,1);
309 ret.setCoords(myCoords);
312 def build2DCurveTargetMesh_3(cls):
313 ret=MEDCouplingUMesh.New("2DCurveMesh_3",1);
314 ret.allocateCells(4);
315 conn=[0,1,2, 3,4, 6,5,7 ,9,8]
316 ret.insertNextCell(NORM_SEG3,3,conn[0:3])
317 ret.insertNextCell(NORM_SEG2,2,conn[3:5])
318 ret.insertNextCell(NORM_SEG3,3,conn[5:8])
319 ret.insertNextCell(NORM_SEG2,2,conn[8:10])
320 ret.finishInsertingCells();
321 coords=[0.5,0.5,1.,1.,0.8,0.8,5.,5.,5.21,5.21,0.5,0.5,1.1,1.1,0.7,0.7,5.,5.,5.31,5.31]
322 myCoords=DataArrayDouble.New();
323 myCoords.setValues(coords,10,2);
324 ret.setCoords(myCoords);
327 def build2DTargetMesh_3(cls):
328 ret=MEDCouplingUMesh.New("2DMesh_3",2);
329 ret.allocateCells(10);
330 conn=[0,1,2, 0,1,3,4, 0,1,3,5,4, 0,1,2,6,7,8, 0,1,3,4,6,9,2,10, 0,2,1, 0,4,3,1, 0,4,5,3,1, 0,2,1,8,7,6, 0,4,3,1,10,2,9,6]
331 ret.insertNextCell(NORM_TRI3,3,conn[0:3])
332 ret.insertNextCell(NORM_QUAD4,4,conn[3:7])
333 ret.insertNextCell(NORM_POLYGON,5,conn[7:12])
334 ret.insertNextCell(NORM_TRI6,6,conn[12:18])
335 ret.insertNextCell(NORM_QUAD8,8,conn[18:26])
336 ret.insertNextCell(NORM_TRI3,3,conn[26:29])
337 ret.insertNextCell(NORM_QUAD4,4,conn[29:33])
338 ret.insertNextCell(NORM_POLYGON,5,conn[33:38])
339 ret.insertNextCell(NORM_TRI6,6,conn[38:44])
340 ret.insertNextCell(NORM_QUAD8,8,conn[44:52])
341 ret.finishInsertingCells();
342 coords=[0.,0.,1.,0.,0.5,1.,1.,1.,0.,1.,0.5,2.,0.5,0.,0.75,0.5,0.25,0.5,1.,0.5,0.,0.5]
343 myCoords=DataArrayDouble.New();
344 myCoords.setValues(coords,11,2);
345 ret.setCoords(myCoords);
346 ret.checkConsistencyLight();
349 def build2DTargetMesh_4(cls):
350 targetCoords=[-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 ]
351 targetConn=[0,4,5,1, 1,5,3, 5,6,2, 7,8,5,4, 8,9,6,5]
352 targetMesh=MEDCouplingUMesh.New();
353 targetMesh.setMeshDimension(2);
354 targetMesh.allocateCells(5);
355 targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[0:4])
356 targetMesh.insertNextCell(NORM_TRI3,3,targetConn[4:7])
357 targetMesh.insertNextCell(NORM_TRI3,3,targetConn[7:10])
358 targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[10:14])
359 targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[14:18])
360 targetMesh.finishInsertingCells();
361 myCoords=DataArrayDouble.New();
362 myCoords.setValues(targetCoords,10,2);
363 targetMesh.setCoords(myCoords);
366 def buildMultiFields_1(cls):
367 m1=MEDCouplingDataForTest.build2DTargetMesh_1();
369 m2=MEDCouplingDataForTest.build2DTargetMesh_1();
371 vals0=[-0.7,-1.,-2.,-3.,-4.];
372 vals1=[0.,1.,2.,3.,4.,0.1,0.2,0.3,0.4];
373 vals1_1=[170.,171.,172.,173.,174.,170.1,170.2,170.3,170.4];
374 vals2=[5.,6.,7.,8.,9.];
375 vals4=[15.,16.,17.,18.,19.];
376 d0=DataArrayDouble.New();
377 d0.setValues(vals0,5,1);
378 d1=DataArrayDouble.New();
379 d1.setValues(vals1,9,1);
380 d1_1=DataArrayDouble.New();
381 d1_1.setValues(vals1_1,9,1);
382 d2=DataArrayDouble.New();
383 d2.setValues(vals2,5,1);
384 d4=DataArrayDouble.New();
385 d4.setValues(vals4,5,1);
386 d0.setName("d0"); d1.setName("d1"); d1_1.setName("d1_1"); d2.setName("d2"); d4.setName("d4");
387 d0.setInfoOnComponent(0,"c1");
388 d1.setInfoOnComponent(0,"c6");
389 d1_1.setInfoOnComponent(0,"c9");
390 d2.setInfoOnComponent(0,"c5");
391 d4.setInfoOnComponent(0,"c7");
392 f0=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME);
397 f1=MEDCouplingFieldDouble.New(ON_NODES,LINEAR_TIME);
399 f1.setArrays([d1,d1_1]);
400 f1.setStartTime(0.7,7,8);
401 f1.setEndTime(1.2,9,10);
403 f2=MEDCouplingFieldDouble.New(ON_CELLS,CONST_ON_TIME_INTERVAL);
406 f2.setTime(1.2,11,12);
407 f2.setEndTime(1.5,13,14);
409 f3=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME);
412 f3.setTime(1.7,15,16);
414 f4=MEDCouplingFieldDouble.New(ON_CELLS,NO_TIME);
418 ret=MEDCouplingMultiFields.New([f0,f1,f2,f3,f4]);
421 def buildMultiFields_2(cls):
422 m1=MEDCouplingDataForTest.build2DTargetMesh_1();
424 m2=MEDCouplingDataForTest.build2DTargetMesh_1();
426 vals0=[-0.7,-1.,-2.,-3.,-4.];
427 vals1=[0.,1.,2.,3.,4.];
428 vals1_1=[170.,171.,172.,173.,174.];
429 vals2=[5.,6.,7.,8.,9.];
430 vals4=[15.,16.,17.,18.,19.];
431 d0=DataArrayDouble.New();
432 d0.setValues(vals0,5,1);
433 d1=DataArrayDouble.New();
434 d1.setValues(vals1,5,1);
435 d1_1=DataArrayDouble.New();
436 d1_1.setValues(vals1_1,5,1);
437 d2=DataArrayDouble.New();
438 d2.setValues(vals2,5,1);
439 d4=DataArrayDouble.New();
440 d4.setValues(vals4,5,1);
441 d0.setName("d0"); d1.setName("d1"); d1_1.setName("d1_1"); d2.setName("d2"); d4.setName("d4");
442 d0.setInfoOnComponent(0,"c1");
443 d1.setInfoOnComponent(0,"c6");
444 d1_1.setInfoOnComponent(0,"c9");
445 d2.setInfoOnComponent(0,"c5");
446 d4.setInfoOnComponent(0,"c7");
447 f0=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME);
452 f1=MEDCouplingFieldDouble.New(ON_CELLS,LINEAR_TIME);
454 f1.setArrays([d1,d1_1]);
455 f1.setStartTime(0.7,7,8);
456 f1.setEndTime(1.2,9,10);
458 f2=MEDCouplingFieldDouble.New(ON_CELLS,CONST_ON_TIME_INTERVAL);
461 f2.setTime(1.2,11,12);
462 f2.setEndTime(1.5,13,14);
464 f3=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME);
467 f3.setTime(1.7,15,16);
469 f4=MEDCouplingFieldDouble.New(ON_CELLS,NO_TIME);
473 return [f0,f1,f2,f3,f4]
475 def build1DMultiTypes_1(self):
476 mesh=MEDCouplingUMesh.New("Multi1DMesh",1);
477 coo=MEDCouplingDataForTest.buildCoordsForMultiTypes_1();
479 mesh.allocateCells(2);
480 mesh.insertNextCell(NORM_SEG2,2,conn[0:2])
481 mesh.insertNextCell(NORM_SEG3,3,conn[2:5])
482 mesh.finishInsertingCells();
486 def build2DMultiTypes_1(self):
487 mesh=MEDCouplingUMesh.New("Multi2DMesh",2);
488 coo=MEDCouplingDataForTest.buildCoordsForMultiTypes_1();
489 conn=[3,4,5, 3,4,5,6,7,8, 0,9,10,11, 0,9,10,11,12,13,14,15]
490 mesh.allocateCells(4);
491 mesh.insertNextCell(NORM_TRI3,3,conn[0:3])
492 mesh.insertNextCell(NORM_TRI6,6,conn[3:9])
493 mesh.insertNextCell(NORM_QUAD4,4,conn[9:13])
494 mesh.insertNextCell(NORM_QUAD8,8,conn[13:21])
495 mesh.finishInsertingCells();
499 def build3DMultiTypes_1(self):
500 mesh=MEDCouplingUMesh.New("Multi3DMesh",3);
501 coo=MEDCouplingDataForTest.buildCoordsForMultiTypes_1();
503 0,16,17,18,19,20,21,22,23,24,
505 0,11,10,9,25,15,14,13,12,26,27,28,29,
507 0,30,31,32,33,34,35,36,37,38,39,40,41,42,43,
508 0,9,10,11,44,45,46,47,
509 0,9,10,11,44,45,46,47,12,13,14,15,48,49,50,51,52,53,54,55 ];
510 mesh.allocateCells(8);
511 mesh.insertNextCell(NORM_TETRA4,4,conn[0:4])
512 mesh.insertNextCell(NORM_TETRA10,10,conn[4:14])
513 mesh.insertNextCell(NORM_PYRA5,5,conn[14:19])
514 mesh.insertNextCell(NORM_PYRA13,13,conn[19:32])
515 mesh.insertNextCell(NORM_PENTA6,6,conn[32:38])
516 mesh.insertNextCell(NORM_PENTA15,15,conn[38:53])
517 mesh.insertNextCell(NORM_HEXA8,8,conn[53:61])
518 mesh.insertNextCell(NORM_HEXA20,20,conn[61:81])
519 mesh.finishInsertingCells();
523 def buildCoordsForMultiTypes_1(self):
524 coords=DataArrayDouble.New();
525 data=[0.0,0.0,0.0, 0.5,0.5,0.5, 1.0,1.0,1.0, 1.0,1.0,0.0, 2.0,2.5,0.0, 6.0,1.5,0.0, 1.0,2.0,0.0, 4.5,2.5,0.0, 4.0,0.5,0.0, 0.0,4.0,0.0, 4.0,4.0,0.0, 4.0,0.0,0.0, 0.0,2.0,0.0, 2.0,4.0,0.0, 4.0,2.0,0.0, 2.0,0.0,0.0, 0.0,6.0,0.0, 3.0,3.0,0.0, 1.3,3.0,3.0, 0.0,3.0,0.0, 1.5,4.5,0.0, 1.5,1.5,0.0, 0.65,1.5,1.5, 0.65,4.5,1.5, 2.15,3.0,1.5, 2.0,2.0,2.0, 3.0,1.0,1.0, 3.0,3.0,1.0, 1.0,3.0,1.0, 1.0,1.0,1.0, 0.0,3.0,0.0, 2.0,0.0,0.0, 0.0,0.0,6.0, 0.0,3.0,6.0, 3.0,0.0,6.0, 0.0,1.5,0.0, 1.5,1.5,0.0, 1.5,0.0,0.0, 0.0,1.5,6.0, 1.5,1.5,6.0, 1.5,0.0,6.0, 0.0,0.0,3.0, 0.0,3.0,3.0, 3.0,0.0,3.0, 0.0,0.0,4.0, 0.0,4.0,4.0, 4.0,4.0,4.0, 4.0,0.0,4.0, 0.0,2.0,4.0, 2.0,4.0,4.0, 4.0,2.0,4.0, 2.0,0.0,4.0, 0.0,0.0,2.0, 0.0,4.0,2.0, 4.0,4.0,2.0, 4.0,0.0,2.0]
526 coords.setValues(data,56,3);
527 coords.setInfoOnComponent(0,"X (cm)");
528 coords.setInfoOnComponent(1,"Y (cm)");
529 coords.setInfoOnComponent(2,"Z (cm)");
532 def buildHexa8Mesh_1(self):
533 mesh=MEDCouplingUMesh.New("Hexa8Only",3);
534 coo=DataArrayDouble.New();
535 coords=[0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.0, 1.0, 0.5, 0.0, 0.0, 1.0, 0.0, 0.5, 1.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.5, 0.5, 0.0, 0.5, 1.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.5, 0.5, 0.5, 1.0, 0.5, 0.5, 0.0, 1.0, 0.5, 0.5, 1.0, 0.5, 1.0, 1.0, 0.5, 0.0, 0.0, 1.0, 0.5, 0.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.5, 1.0, 0.5, 0.5, 1.0, 1.0, 0.5, 1.0, 0.0, 1.0, 1.0, 0.5, 1.0, 1.0, 1.0, 1.0, 1.0]
536 coo.setValues(coords,27,3);
537 conn=[3,12,13,4,0,9,10,1,
541 12,21,22,13,9,18,19,10,
542 13,22,23,14,10,19,20,11,
543 15,24,25,16,12,21,22,13,
544 16,25,26,17,13,22,23,14];
545 mesh.allocateCells(8);
547 mesh.insertNextCell(NORM_HEXA8,8,conn[8*i:8*(i+1)])
549 mesh.finishInsertingCells();
553 def buildPointe_1(self):
554 mesh=MEDCouplingUMesh.New("Pointe.med",3);
555 mesh2=MEDCouplingUMesh.New("Pointe.med",2);
556 coords=[0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 2.0, 0.0, 1.0, 0.0, 2.0, 1.0, -2.0, 0.0, 1.0, 0.0, -2.0, 1.0, 1.0, 1.0, 2.0, -1.0, 1.0, 2.0, -1.0, -1.0, 2.0, 1.0, -1.0, 2.0, 1.0, 1.0, 3.0, -1.0, 1.0, 3.0, -1.0, -1.0, 3.0, 1.0, -1.0, 3.0, 1.0, 1.0, 4.0, -1.0, 1.0, 4.0, -1.0, -1.0, 4.0, 1.0, -1.0, 4.0, 0.0, 0.0, 5.0]
557 conn=[0,1,2,5,0,1,3,2,0,1,4,3,0,1,5,4,1,6,3,2,1,7,4,3,1,8,5,4,1,9,2,5,1,6,2,9,1,7,3,6,1,8,4,7,1,9,5,8, 6,7,8,9,1,14,17,16,15,18, 10,11,12,13,6,7,8,9,14,15,16,17,10,11,12,13]
558 coo=DataArrayDouble.New();
559 coo.setValues(coords,19,3);
561 mesh2.setCoords(coo);
562 mesh.allocateCells(16);
564 mesh.insertNextCell(NORM_TETRA4,4,conn[4*i:4*i+4])
566 mesh.insertNextCell(NORM_PYRA5,5,conn[48:53])
567 mesh.insertNextCell(NORM_PYRA5,5,conn[53:58])
568 mesh.insertNextCell(NORM_HEXA8,8,conn[58:66])
569 mesh.insertNextCell(NORM_HEXA8,8,conn[66:74])
570 mesh.finishInsertingCells();
572 conn2=[0,5,1,14,18,17,8,7,4,9,5,2, 12,8,9,13,6,7,8,9]
573 mesh2.allocateCells(6);
575 mesh2.insertNextCell(NORM_TRI3,3,conn2[3*i:3*i+3])
577 mesh2.insertNextCell(NORM_QUAD4,4,conn2[12:16])
578 mesh2.insertNextCell(NORM_QUAD4,4,conn2[16:20])
579 mesh2.finishInsertingCells();
582 # 2D usecase1 for interpolation Gauss Pt-> Gauss Pt. Coming from ASTER : Please, do not touch
583 def buildFieldOnGauss_1(self):
584 coo=DataArrayDouble([1.0,0.0,1.33333333333333,0.0,1.66666666666667,0.0,0.923879532511287,0.38268343236509006,1.23183937668172,0.510244576486786,1.53979922085214,0.6378057206084831,2.0,0.0,1.8477590650225701,0.7653668647301801,0.9428090415820631,0.9428090415820631,1.1785113019775801,1.1785113019775801,1.4142135623731,1.41421356237309,0.707106781186548,0.707106781186547,0.38268343236509006,0.923879532511287,0.510244576486786,1.23183937668172,0.6378057206084831,1.53979922085214,0.7653668647301801,1.8477590650225701,3.1550283219328204e-17,1.33333333333333,1.16009632455949e-17,1.66666666666667,-2.7620050344068196e-16,2.0,-1.3810025172034098e-16,1.0,-2.0,0.0,-1.53979922085214,0.6378057206084831,-1.66666666666667,0.0,-1.33333333333333,0.0,-0.923879532511287,0.38268343236509006,-1.8477590650225701,0.7653668647301801,-0.9428090415820631,0.9428090415820631,-1.23183937668172,0.510244576486786,-1.83333333333333,0.0,-1.6937791429373599,0.701586292669331,-1.5,0.0,-1.30771370720431,0.26012042935483803,-1.16666666666667,0.0,-1.0778594545965,0.44646400442593803,-1.38578268717091,0.9259503883660041,-1.38581929876693,0.574025148547635,-1.06066017177982,1.06066017177982,-0.8314696123025451,0.5555702330196021,-1.0,0.0,-1.1785113019775801,1.1785113019775801,-0.707106781186548,0.707106781186547,-1.63464213400538,0.325150536693547,-1.9615705608064598,0.390180644032256,-1.47117792060485,0.292635483024192,-0.9807852804032301,0.19509032201612803,-1.524360955888,1.0185454272026,-1.2963624321753402,1.2963624321753402,-1.10862614973673,0.740760310692803,-0.970047881019636,0.6481652718562021,-0.824957911384305,0.824957911384305,-1.4142135623731,1.41421356237309,-1.7981063474059198,0.357665590362902,-1.1442494938037702,0.227605375685483,-1.66293922460509,1.1111404660392,-1.24720441845382,0.833355349529403,-0.7653668647301801,1.8477590650225701,-0.6378057206084831,1.53979922085214,-0.510244576486786,1.23183937668172,-0.701586292669331,1.6937791429373599,-0.574025148547635,1.38581929876693,-0.44646400442593803,1.0778594545965,-0.38268343236509006,0.923879532511287,-0.9259503883660041,1.38578268717091,-0.740760310692803,1.10862614973673,-0.5555702330196021,0.8314696123025451,-0.325150536693547,1.63464213400538,-0.26012042935483803,1.30771370720431,-0.19509032201612803,0.9807852804032301,1.6805133673525298e-18,1.83333333333333,-2.4643915380595496e-16,1.5,-1.4799359654427099e-16,1.16666666666667,-1.1111404660392,1.66293922460509,-0.39018064403225705,1.9615705608064598],73,2)
585 coo.setInfoOnComponents(["X [INCONNUE]","Y [INCONNUE]"])
586 m=MEDCouplingUMesh("MA1",2)
587 m.setDescription("CREE PAR CODE_ASTER") ; m.setTimeUnit("SANS UNITES") ; m.setTime(-1.,-1,-1)
590 conn=[[11,8,13],[11,13,12],[8,9,13],[9,14,13],[9,10,15],[9,15,14],[12,13,19],[13,16,19],[13,14,17],[13,17,16],[14,15,17],[15,18,17],[0,1,4,3],[1,2,5,4],[2,6,7,5],[3,4,8,11],[4,5,9,8],[5,7,10,9],[20,22,21,28,41,51],[21,25,20,29,42,51],[22,23,21,30,43,41],[23,27,21,31,35,43],[23,38,24,32,44,52],[24,27,23,33,31,52],[25,21,50,29,45,53],[21,39,50,34,46,45],[21,27,26,35,47,54],[26,39,21,36,34,54],[27,24,26,33,48,47],[24,40,26,37,49,48],[50,39,56,55,46,62,58,71],[39,26,57,56,36,63,59,62],[26,40,61,57,49,64,60,63],[55,56,17,18,58,65,68,72],[56,57,16,17,59,66,69,65],[57,61,19,16,60,67,70,66]]
591 for i in range(0, 12):
592 m.insertNextCell(NORM_TRI3,conn[i])
594 for i in range(12, 18):
595 m.insertNextCell(NORM_QUAD4,conn[i])
597 for i in range(18, 30):
598 m.insertNextCell(NORM_TRI6,conn[i])
600 for i in range(30, 36):
601 m.insertNextCell(NORM_QUAD8,conn[i])
603 fff=MEDCouplingFieldDouble.New(ON_GAUSS_PT) ; fff.setName("CH1RB") ; fff.setNature(IntensiveMaximum)
605 fff.setGaussLocalizationOnCells(list(range(0, 12)), [0., 0., 1., 0., 0., 1.], [0.3333333333333333, 0.3333333333333333], [0.5])
606 fff.setGaussLocalizationOnCells(list(range(12, 18)), [-1., -1., 1., -1., 1., 1., -1., 1.], [-0.577350269189626, -0.577350269189626, 0.577350269189626, -0.577350269189626, 0.577350269189626, 0.577350269189626, -0.577350269189626, 0.577350269189626], [1., 1., 1., 1.])
607 fff.setGaussLocalizationOnCells(list(range(18, 30)), [0., 0., 1., 0., 0., 1., 0.5, 0., 0.5, 0.5, 0., 0.5], [0.16666666666666666, 0.16666666666666666, 0.6666666666666666, 0.16666666666666666, 0.16666666666666666, 0.6666666666666666], [0.16666666666666666, 0.16666666666666666, 0.16666666666666666])
608 fff.setGaussLocalizationOnCells(list(range(30, 36)), [-1., -1., 1., -1., 1., 1., -1., 1., 0., -1., 1., 0., 0., 1., -1., 0.], [-0.774596669241483, -0.774596669241483, 0.774596669241483, -0.774596669241483, 0.774596669241483, 0.774596669241483, -0.774596669241483, 0.774596669241483, 0.0, -0.774596669241483, 0.774596669241483, 0.0, 0.0, 0.774596669241483, -0.774596669241483, 0.0, 0.0, 0.0], [0.30864197530864196, 0.30864197530864196, 0.30864197530864196, 0.30864197530864196, 0.49382716049382713, 0.49382716049382713, 0.49382716049382713, 0.49382716049382713, 0.7901234567901234])
609 return MEDCouplingFieldTemplate(fff)
611 # 2D usecase2 for interpolation Gauss Pt-> Gauss Pt. Coming from ASTER : Please, do not touch
612 def buildFieldOnGauss_2(self):
613 coo=DataArrayDouble([1.0,0.0,1.24068268955165,0.15233667925643402,1.25,0.0,1.5,0.0,1.73695576537231,0.21327135095900804,1.75,0.0,2.0,0.0,0.9925461516413221,0.12186934340514702,1.212869657845,0.302402369499585,1.48881922746198,0.182804015107721,1.6980175209829897,0.423363317299419,1.9850923032826397,0.243738686810295,0.9702957262759959,0.241921895599668,1.1669755331215,0.447959936931625,1.4554435894139899,0.362882843399502,1.6337657463701,0.627143911704275,1.94059145255199,0.483843791199335,0.9335804264972021,0.35836794954530005,1.10368449107366,0.586839453482364,1.4003706397458,0.5375519243179501,1.5451582875031202,0.8215752348753091,1.8671608529944002,0.716735899090601,0.882947592858927,0.46947156278589103,1.02394005536124,0.716970545438808,1.32442138928839,0.704207344178836,1.43351607750574,1.00375876361433,1.76589518571785,0.9389431255717821,1.125,0.0,1.11661442059649,0.137103011330791,1.375,0.0,1.4972021976328,0.09157280930228531,1.625,0.0,1.61288749641715,0.198037683033365,1.875,0.0,1.9962695968437298,0.12209707906971401,1.0915826920605,0.272162132549626,1.36475095850682,0.167570347182078,1.47488236134593,0.27335328823822097,1.5767305551984903,0.39312308034946003,1.8610240343274802,0.228505018884652,1.96650981512791,0.364471050984295,1.05027797980935,0.403163943238463,1.3341566236295,0.332642606449543,1.43057542612234,0.45105869925641007,1.5170681930579497,0.5823479180111131,1.8193044867674901,0.45360355424937704,1.9074339014964499,0.601411599008546,0.993316041966293,0.528155508134127,1.28367308643365,0.492755930624788,1.36494190631481,0.6220398639843591,1.43478983839576,0.7628912895270731,1.7504632996822498,0.671939905397438,1.81992254175309,0.8293864853124782,0.921546049825116,0.645273490894927,1.21405294018102,0.6455233988306001,1.27896024653114,0.783747847073923,1.33112207196961,0.93206170907045,1.65552673661049,0.8802591802235451,1.70528032870818,1.0449971294319,0.8191520442889921,0.5735764363510459,1.22872806643349,0.8603646545265691,1.6383040885779798,1.14715287270209,1.24766849802733,0.0763106744185711,0.9981347984218671,0.0610485395348569,1.37243534783007,0.0839417418604282,1.74673589723827,0.106834944186,1.871502747041,0.114466011627857,1.22906863445494,0.227794406865184,0.9832549075639551,0.18223552549214703,1.3519754979004401,0.25057384755170303,1.7206960882369198,0.318912169611258,1.84360295168241,0.341691610297777,1.19214618843528,0.37588224938034104,0.953716950748227,0.300705799504273,1.31136080727881,0.413470474318376,1.6690046638094,0.526235149132478,1.7882192826529297,0.563823374070512,1.13745158859568,0.518366553320299,0.9099612708765431,0.4146932426562391,1.25119674745525,0.570203208652329,1.5924322240339497,0.725713174648418,1.7061773828935198,0.777549829980448,1.06580020544262,0.6531232058949361,0.8526401643540921,0.522498564715949,1.17238022598688,0.7184355264844301,1.12633406089736,0.7886675999826881,1.49212028761966,0.91437248825291,1.59870030816392,0.979684808842404,1.53591008304186,1.07545581815821,1.1229016482246,0.068679606976714,1.6219690474355302,0.0992038767441424,1.10616177100945,0.205014966178666,1.59778922479143,0.29613272892474,1.07293156959176,0.338294024442307,1.5497900449658701,0.488646924194444,1.02370642973611,0.466529897988269,1.47868706517438,0.673876519316388,0.9592201848983541,0.587810885305442,1.3855402670754,0.8490601676634171,0.743144825477394,0.669130606358858,0.9289310318467431,0.836413257948573,1.11471723821609,1.00369590953829,1.30050344458544,1.170978561128,0.656059028990507,0.7547095802227721,0.820073786238134,0.943386975278465,0.984088543485761,1.13206437033416,1.14810330073339,1.32074176538985,0.559192903470747,0.8290375725550421,0.6989911293384331,1.0362969656938,0.8387893552061201,1.24355635883256,0.978587581073807,1.45081575197132,0.453990499739547,0.8910065241883681,0.567488124674433,1.11375815523546,0.6809857496093201,1.3365097862825501,0.794483374544207,1.55926141732964,0.8360379286620679,0.7527719321537151,1.0218241350314199,0.92005458374343,1.20761034140077,1.08733723533314,1.39339654777011,1.25461988692286,0.7380664076143211,0.8490482777506181,0.902081164861948,1.03772567280631,1.06609592210957,1.226403067862,1.2301106793572,1.4150804629177,0.6290920164045901,0.932667269124422,0.7688902422722771,1.13992666226318,0.9086884681399641,1.34718605540194,1.04848669400765,1.5544454485407,0.51073931220699,1.00238233971191,0.624236937141877,1.22513397075901,0.737734562076764,1.4478856018061,0.85123218701165,1.6706372328531902,1.48628965095479,1.33826121271772,1.31211805798101,1.5094191604455398,1.11838580694149,1.6580751451100801,0.907980999479094,1.7820130483767398,0.978260196065517,0.778143295797024,1.17391223527862,0.9337719549564292,1.36956427449172,1.08940061411583,1.56521631370483,1.24502927327524,0.876136580374814,0.891563061442727,1.05136389644978,1.06987567373127,1.22659121252474,1.2481882860198201,1.4018185285997,1.42650089830836,0.7609517862609011,0.991691675364044,0.913142143513081,1.19003001043685,1.06533250076526,1.38836834550966,1.21752285801744,1.5867066805824699,0.6344229537008801,1.07703645055191,0.7613075444410561,1.29244374066229,0.8881921351812321,1.50785103077267,1.01507672592141,1.7232583208830499,0.498436336156558,1.1463250929814,0.5981236033878691,1.37559011157769,0.697810870619181,1.60485513017397,0.7974981378504931,1.8341201487702499,0.42752517915708604,1.17461577598239,0.513030214988503,1.4095389311788602,0.59853525081992,1.6444620863753399,0.6840402866513371,1.87938524157182,0.38477266124137705,1.05715419838415,0.470277697072795,1.29207735358062,0.5557827329042121,1.5270005087771,0.6412877687356291,1.76192366397358,0.34202014332566905,0.9396926207859091,0.782608156852414,0.6225146366376201,0.7009092642998511,0.713250449154182,0.608761429008721,0.7933533402912349,0.507538362960704,0.861629160441526,0.398749068925246,0.917060074385124,-2.0,0.0,-1.75,0.0,-1.5,0.0,-1.25,0.0,-1.9632543668953297,0.38161799075309005,-1.71784757103341,0.333915741908953,-1.4724407751715,0.286213493064817,-1.22703397930958,0.23851124422068104,-1.85436770913357,0.749213186831824,-1.62257174549188,0.655561538477846,-1.39077578185018,0.561909890123868,-1.15897981820848,0.46825824176988995,-1.6773411358908499,1.08927807003005,-1.4676734939044902,0.953118311276297,-1.25800585191814,0.816958552522541,-1.04833820993178,0.680798793768784,-1.4386796006773,1.38931674091799,-1.25884465059264,1.21565214830325,-1.07900970050798,1.0419875556885,-0.8991747504233141,0.868322963073747,-1.0,0.0,-0.981627183447664,0.19080899537654503,-0.9271838545667871,0.374606593415912,-0.838670567945424,0.544639035015027,-0.7193398003386511,0.694658370458997,-1.00375876361433,1.43351607750574,-0.8603646545265691,1.22872806643349,-0.716970545438808,1.02394005536124,-0.5735764363510459,0.8191520442889921,-1.14715287270209,1.6383040885779798,-0.8134732861516011,1.8270909152852002,-0.71178912538265,1.59870455087455,-0.6101049646137,1.3703181864639,-0.50842080384475,1.14193182205325,-0.4067366430758,0.9135454576426011,-0.44990210868773,1.9487401295704703,-0.39366434510176407,1.70514761337416,-0.337426581515798,1.4615550971778501,-0.281188817929831,1.21796258098154,-0.224951054343865,0.974370064785235,-0.06979899340500181,1.9987816540381902,-0.0610741192293767,1.74893394728342,-0.0523492450537515,1.49908624052864,-0.0436243708781263,1.24923853377387,-0.03489949670250091,0.9993908270190961,0.312868930080462,1.97537668119028,0.27376031382040406,1.72845459604149,0.23465169756034704,1.48153251089271,0.19554308130028902,1.23461042574392,0.156434465040231,0.9876883405951381],219,2)
614 coo.setInfoOnComponents(["X [INCONNUE]","Y [INCONNUE]"])
615 m=MEDCouplingUMesh("MA2",2)
616 m.setDescription("CREE PAR CODE_ASTER") ; m.setTimeUnit("SANS UNITES") ; m.setTime(-1.,-1,-1)
619 conn=[[198,194,200],[198,200,199],[194,195,200],[195,201,200],[195,196,202],[195,202,201],[196,197,202],[197,203,202],[199,200,205],[199,205,204],[200,201,205],[201,206,205],[201,202,207],[201,207,206],[202,203,207],[203,208,207],[204,205,210],[204,210,209],[205,206,210],[206,211,210],[206,207,212],[206,212,211],[207,208,212],[208,213,212],[209,210,215],[209,215,214],[210,211,215],[211,216,215],[211,212,217],[211,217,216],[212,213,217],[213,218,217],[214,215,157],[214,157,158],[215,216,157],[216,156,157],[216,217,155],[216,155,156],[217,218,155],[218,163,155],[169,170,174,173],[170,171,175,174],[171,172,176,175],[172,189,190,176],[173,174,178,177],[174,175,179,178],[175,176,180,179],[176,190,191,180],[177,178,182,181],[178,179,183,182],[179,180,184,183],[180,191,192,184],[181,182,186,185],[182,183,187,186],[183,184,188,187],[184,192,193,188],[185,186,194,198],[186,187,195,194],[187,188,196,195],[188,193,197,196],[0,2,1,27,62,89],[1,7,0,28,63,89],[2,3,1,29,64,62],[3,9,1,30,36,64],[3,5,4,31,65,90],[4,9,3,32,30,90],[5,6,4,33,66,65],[6,11,4,34,39,66],[7,1,8,28,67,91],[8,12,7,35,68,91],[1,9,8,36,69,67],[9,14,8,37,42,69],[9,4,10,32,70,92],[10,14,9,38,37,92],[4,11,10,39,71,70],[11,16,10,40,45,71],[12,8,13,35,72,93],[13,17,12,41,73,93],[8,14,13,42,74,72],[14,19,13,43,48,74],[14,10,15,38,75,94],[15,19,14,44,43,94],[10,16,15,45,76,75],[16,21,15,46,51,76],[17,13,18,41,77,95],[18,22,17,47,78,95],[13,19,18,48,79,77],[19,24,18,49,54,79],[19,15,20,44,80,96],[20,24,19,50,49,96],[15,21,20,51,81,80],[21,26,20,52,57,81],[22,18,23,47,82,97],[23,59,22,53,83,97],[18,24,23,54,84,82],[24,60,23,55,85,84],[24,20,25,50,86,98],[25,60,24,56,55,98],[20,26,25,57,87,86],[26,61,25,58,88,87],[59,23,100,99,53,135,115,164],[23,60,101,100,85,136,116,135],[60,25,102,101,56,137,117,136],[25,61,131,102,88,138,118,137],[99,100,104,103,115,139,119,165],[100,101,105,104,116,140,120,139],[101,102,106,105,117,141,121,140],[102,131,132,106,118,142,122,141],[103,104,108,107,119,143,123,166],[104,105,109,108,120,144,124,143],[105,106,110,109,121,145,125,144],[106,132,133,110,122,146,126,145],[107,108,112,111,123,147,127,167],[108,109,113,112,124,148,128,147],[109,110,114,113,125,149,129,148],[110,133,134,114,126,150,130,149],[111,112,155,163,127,151,159,168],[112,113,156,155,128,152,160,151],[113,114,157,156,129,153,161,152],[114,134,158,157,130,154,162,153]]
620 for i in range(0, 40):
621 m.insertNextCell(NORM_TRI3,conn[i])
623 for i in range(40, 60):
624 m.insertNextCell(NORM_QUAD4,conn[i])
626 for i in range(60, 100):
627 m.insertNextCell(NORM_TRI6,conn[i])
629 for i in range(100, 120):
630 m.insertNextCell(NORM_QUAD8,conn[i])
632 fff=MEDCouplingFieldDouble.New(ON_GAUSS_PT) ; fff.setName("CH2RB") ; fff.setNature(IntensiveMaximum)
634 fff.setGaussLocalizationOnCells(list(range(0, 40)), [0., 0., 1., 0., 0., 1.], [0.3333333333333333, 0.3333333333333333], [0.5])
635 fff.setGaussLocalizationOnCells(list(range(40, 60)), [-1., -1., 1., -1., 1., 1., -1., 1.], [-0.577350269189626, -0.577350269189626, 0.577350269189626, -0.577350269189626, 0.577350269189626, 0.577350269189626, -0.577350269189626, 0.577350269189626], [1., 1., 1., 1.])
636 fff.setGaussLocalizationOnCells(list(range(60, 100)), [0., 0., 1., 0., 0., 1., 0.5, 0., 0.5, 0.5, 0., 0.5], [0.16666666666666666, 0.16666666666666666, 0.6666666666666666, 0.16666666666666666, 0.16666666666666666, 0.6666666666666666], [0.16666666666666666, 0.16666666666666666, 0.16666666666666666])
637 fff.setGaussLocalizationOnCells(list(range(100, 120)), [-1., -1., 1., -1., 1., 1., -1., 1., 0., -1., 1., 0., 0., 1., -1., 0.], [-0.774596669241483, -0.774596669241483, 0.774596669241483, -0.774596669241483, 0.774596669241483, 0.774596669241483, -0.774596669241483, 0.774596669241483, 0.0, -0.774596669241483, 0.774596669241483, 0.0, 0.0, 0.774596669241483, -0.774596669241483, 0.0, 0.0, 0.0], [0.30864197530864196, 0.30864197530864196, 0.30864197530864196, 0.30864197530864196, 0.49382716049382713, 0.49382716049382713, 0.49382716049382713, 0.49382716049382713, 0.7901234567901234])
638 return MEDCouplingFieldTemplate(fff)
640 # 3D usecase1 for interpolation Gauss Pt-> Gauss Pt. Coming from ASTER : Please, do not touch
641 def buildFieldOnGauss_3(self):
642 coo=DataArrayDouble([0.,1.,0.,0.,2.,0.,0.,3.,0.,1.,1.,0.,1.,2.,0.,1.,3.,0.,0.,1.,1.,0.,3.,1.,0.5,1.,1.,0.5,3.,1.,1.,1.,1.,1.,3.,1.,0.,0.,0.,0.,1.,0.,1.,0.,0.,1.,1.,0.,0.,0.,1.,0.,0.5,1.,0.,1.,1.,0.5,0.,1.,0.5,0.5,1.,0.5,1.,1.,1.,0.,1.,1.,0.5,1.,1.,1.,1.0],25,3)
643 coo.setInfoOnComponents(["X [INCONNUE]","Y [INCONNUE]","Z [INCONNUE]"])
644 m=MEDCouplingUMesh("MA1",3)
645 m.setDescription("CREE PAR CODE_ASTER") ; m.setTimeUnit("SANS UNITES") ; m.setTime(-1.,-1,-1)
648 conn=[[3,10,8,4],[19,22,23,20,14],[0,6,1,3,8,4],[4,8,10,5,9,11],[12,16,17,14,19,20],[14,20,23,15,21,24],[1,2,5,4,6,7,9,8],[12,13,15,14,17,18,21,20]]
649 m.insertNextCell(NORM_TETRA4,conn[0])
650 m.insertNextCell(NORM_PYRA5,conn[1])
651 for i in range(2, 6):
652 m.insertNextCell(NORM_PENTA6,conn[i])
654 m.insertNextCell(NORM_HEXA8,conn[6])
655 m.insertNextCell(NORM_HEXA8,conn[7])
656 fff=MEDCouplingFieldDouble.New(ON_GAUSS_PT) ; fff.setName("CH13") ; fff.setNature(IntensiveMaximum)
658 fff.setGaussLocalizationOnCells([0],[0.,1.,0.,0.,0.,0.,0.,0.,1.,1.,0.,0.],[0.25,0.25,0.25],[0.16666666666666666])
659 fff.setGaussLocalizationOnCells([1],[1.,0.,0.,0.,-1.,0.,-1.,0.,0.,0.,1.,0.,0.,0.,1.],[0.5,0.,0.1531754163448146,0.,0.5,0.1531754163448146,-0.5,0.,0.1531754163448146,0.,-0.5,0.1531754163448146,0.,0.,0.6372983346207416],[0.1333333333333333,0.1333333333333333,0.1333333333333333,0.1333333333333333,0.1333333333333333])
660 fff.setGaussLocalizationOnCells([2,3,4,5],[-1.,1.,0.,-1.,0.,0.,-1.,0.,1.,1.,1.,0.,1.,0.,0.,1.,0.,1.],[-0.577350269189626,0.5,0.5,-0.577350269189626,0.,0.5,-0.577350269189626,0.5,0.,0.577350269189626,0.5,0.5,0.577350269189626,0.,0.5,0.577350269189626,0.5,0.],[0.16666666666666666,0.16666666666666666,0.16666666666666666,0.16666666666666666,0.16666666666666666,0.16666666666666666])
661 fff.setGaussLocalizationOnCells([6,7],[-1.,-1.,-1.,-1.,1.,-1.,1.,1.,-1.,1.,-1.,-1.,-1.,-1.,1.,-1.,1.,1.,1.,1.,1.,1.,-1.,1.],[-0.577350269189626,-0.577350269189626,-0.577350269189626,-0.577350269189626,-0.577350269189626,0.577350269189626,-0.577350269189626,0.577350269189626,-0.577350269189626,-0.577350269189626,0.577350269189626,0.577350269189626,0.577350269189626,-0.577350269189626,-0.577350269189626,0.577350269189626,-0.577350269189626,0.577350269189626,0.577350269189626,0.577350269189626,-0.577350269189626,0.577350269189626,0.577350269189626,0.577350269189626],[1.,1.,1.,1.,1.,1.,1.,1.])
662 return MEDCouplingFieldTemplate(fff)
664 # 3D usecase2 for interpolation Gauss Pt-> Gauss Pt. Coming from ASTER : Please, do not touch
665 def buildFieldOnGauss_4(self):
666 coo=DataArrayDouble([0.,2.,0.,0.,1.,0.,0.,0.,0.,1.,2.,0.,1.,1.,0.,1.,0.,0.,0.,2.,1.,0.,0.,1.,0.5, 2.,1.,0.5, 0.,1.,1.,2.,1.,1.,0.,1.,0.,3.,0.,0.,2.,0.,1.,3.,0.,1.,2.,0.,0.,3.,1.,0.,2.5, 1.,0.,2.,1.,0.5, 3.,1.,0.5, 2.5, 1.,0.5, 2.,1.,1.,3.,1.,1.,2.5, 1.,1.,2.,1.0],25,3)
667 coo.setInfoOnComponents(["X [INCONNUE]","Y [INCONNUE]","Z [INCONNUE]"])
668 m=MEDCouplingUMesh("MA2",3)
669 m.setDescription("CREE PAR CODE_ASTER") ; m.setTimeUnit("SANS UNITES") ; m.setTime(-1.,-1,-1)
672 conn=[[3,10,8,4],[19,22,23,20,14],[0,6,1,3,8,4],[4,8,10,5,9,11],[12,16,17,14,19,20],[14,20,23,15,21,24],[1,2,5,4,6,7,9,8],[12,13,15,14,17,18,21,20]]
673 m.insertNextCell(NORM_TETRA4,conn[0])
674 m.insertNextCell(NORM_PYRA5,conn[1])
675 for i in range(2, 6):
676 m.insertNextCell(NORM_PENTA6,conn[i])
678 m.insertNextCell(NORM_HEXA8,conn[6])
679 m.insertNextCell(NORM_HEXA8,conn[7])
680 fff=MEDCouplingFieldDouble.New(ON_GAUSS_PT) ; fff.setName("CH23") ; fff.setNature(IntensiveMaximum)
682 fff.setGaussLocalizationOnCells([0],[0.,1.,0.,0.,0.,0.,0.,0.,1.,1.,0.,0.],[0.25,0.25,0.25],[0.16666666666666666])
683 fff.setGaussLocalizationOnCells([1],[1.,0.,0.,0.,-1.,0.,-1.,0.,0.,0.,1.,0.,0.,0.,1.],[0.5,0.,0.1531754163448146,0.,0.5,0.1531754163448146,-0.5,0.,0.1531754163448146,0.,-0.5,0.1531754163448146,0.,0.,0.6372983346207416],[0.1333333333333333,0.1333333333333333,0.1333333333333333,0.1333333333333333,0.1333333333333333])
684 fff.setGaussLocalizationOnCells([2,3,4,5],[-1.,1.,0.,-1.,0.,0.,-1.,0.,1.,1.,1.,0.,1.,0.,0.,1.,0.,1.],[-0.577350269189626,0.5,0.5,-0.577350269189626,0.,0.5,-0.577350269189626,0.5,0.,0.577350269189626,0.5,0.5,0.577350269189626,0.,0.5,0.577350269189626,0.5,0.],[0.16666666666666666,0.16666666666666666,0.16666666666666666,0.16666666666666666,0.16666666666666666,0.16666666666666666])
685 fff.setGaussLocalizationOnCells([6,7],[-1.,-1.,-1.,-1.,1.,-1.,1.,1.,-1.,1.,-1.,-1.,-1.,-1.,1.,-1.,1.,1.,1.,1.,1.,1.,-1.,1.],[-0.577350269189626,-0.577350269189626,-0.577350269189626,-0.577350269189626,-0.577350269189626,0.577350269189626,-0.577350269189626,0.577350269189626,-0.577350269189626,-0.577350269189626,0.577350269189626,0.577350269189626,0.577350269189626,-0.577350269189626,-0.577350269189626,0.577350269189626,-0.577350269189626,0.577350269189626,0.577350269189626,0.577350269189626,-0.577350269189626,0.577350269189626,0.577350269189626,0.577350269189626],[1.,1.,1.,1.,1.,1.,1.,1.])
686 return MEDCouplingFieldTemplate(fff)
688 def buildCircle(self, center_X, center_Y, radius):
689 from cmath import rect
692 c = [rect(radius, i * pi / 4.0) for i in range(8)]
693 coords = [c[-1].real,c[-1].imag, c[3].real,c[3].imag,
694 c[5].real,c[5].imag, c[1].real,c[1].imag]
695 connec = list(range(4))
696 baseMesh = MEDCouplingUMesh.New("circle", 2)
697 baseMesh.allocateCells(1)
698 meshCoords = DataArrayDouble.New(coords, len(coords) // 2, 2)
699 meshCoords += (center_X, center_Y)
700 baseMesh.setCoords(meshCoords)
702 baseMesh.insertNextCell(NORM_QPOLYG, connec)
703 baseMesh.finishInsertingCells()
706 def buildCircle2(self, center_X, center_Y, radius):
707 from cmath import rect
710 c = [rect(radius, i * pi / 4.0) for i in range(8)]
713 coords.extend([c[i].real,c[i].imag])
714 connec = [7,5,3,1, 6,4,2,0]
715 baseMesh = MEDCouplingUMesh.New("circle", 2)
716 baseMesh.allocateCells(1)
717 meshCoords = DataArrayDouble.New(coords, len(coords) // 2, 2)
718 meshCoords += (center_X, center_Y)
719 baseMesh.setCoords(meshCoords)
721 baseMesh.insertNextCell(NORM_QPOLYG, connec)
722 baseMesh.finishInsertingCells()
725 build2DTargetMesh_1=classmethod(build2DTargetMesh_1)
726 build2DSourceMesh_1=classmethod(build2DSourceMesh_1)
727 build3DTargetMesh_1=classmethod(build3DTargetMesh_1)
728 build3DSourceMesh_1=classmethod(build3DSourceMesh_1)
729 build3DSurfTargetMesh_1=classmethod(build3DSurfTargetMesh_1)
730 build3DExtrudedUMesh_1=classmethod(build3DExtrudedUMesh_1)
731 buildCU1DMesh_U=classmethod(buildCU1DMesh_U)
732 build2DTargetMeshMergeNode_1=classmethod(build2DTargetMeshMergeNode_1)
733 build3DTargetMeshMergeNode_1=classmethod(build3DTargetMeshMergeNode_1)
734 build2DTargetMeshMerged_1=classmethod(build2DTargetMeshMerged_1)
735 build2DTargetMesh_2=classmethod(build2DTargetMesh_2)
736 build1DSourceMesh_2=classmethod(build1DSourceMesh_2)
737 build1DTargetMesh_3=classmethod(build1DTargetMesh_3)
738 build2DCurveTargetMesh_3=classmethod(build2DCurveTargetMesh_3)
739 build2DTargetMesh_3=classmethod(build2DTargetMesh_3)
740 build2DTargetMesh_4=classmethod(build2DTargetMesh_4)
741 buildMultiFields_1=classmethod(buildMultiFields_1)
742 buildMultiFields_2=classmethod(buildMultiFields_2)
743 build1DMultiTypes_1=classmethod(build1DMultiTypes_1)
744 build2DMultiTypes_1=classmethod(build2DMultiTypes_1)
745 build3DMultiTypes_1=classmethod(build3DMultiTypes_1)
746 buildCoordsForMultiTypes_1=classmethod(buildCoordsForMultiTypes_1)
747 buildHexa8Mesh_1=classmethod(buildHexa8Mesh_1)
748 buildPointe_1=classmethod(buildPointe_1)
749 buildFieldOnGauss_1=classmethod(buildFieldOnGauss_1)
750 buildFieldOnGauss_2=classmethod(buildFieldOnGauss_2)
751 buildFieldOnGauss_3=classmethod(buildFieldOnGauss_3)
752 buildFieldOnGauss_4=classmethod(buildFieldOnGauss_4)
753 buildCircle=classmethod(buildCircle)
754 buildCircle2=classmethod(buildCircle2)