1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2013 CEA/DEN, EDF R&D
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.
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
21 from MEDCoupling import *
23 class MEDCouplingDataForTest:
24 def build2DTargetMesh_1(cls):
25 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 ];
26 targetConn=[0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4];
27 targetMesh=MEDCouplingUMesh.New();
28 targetMesh.setMeshDimension(2);
29 targetMesh.allocateCells(5);
30 targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[0:4]);
31 targetMesh.insertNextCell(NORM_TRI3,3,targetConn[4:7]);
32 targetMesh.insertNextCell(NORM_TRI3,3,targetConn[7:10]);
33 targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[10:14]);
34 targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[14:18]);
35 targetMesh.finishInsertingCells();
36 myCoords=DataArrayDouble.New();
37 myCoords.setValues(targetCoords,9,2);
38 targetMesh.setCoords(myCoords);
41 def build2DSourceMesh_1(cls):
42 sourceCoords=[-0.3,-0.3, 0.7,-0.3, -0.3,0.7, 0.7,0.7]
43 sourceConn=[0,3,1,0,2,3]
44 sourceMesh=MEDCouplingUMesh.New("my name of mesh 2D",2);
45 sourceMesh.allocateCells(2);
46 sourceMesh.insertNextCell(NORM_TRI3,3,sourceConn[0:3]);
47 sourceMesh.insertNextCell(NORM_TRI3,3,sourceConn[3:6]);
48 sourceMesh.finishInsertingCells();
49 myCoords=DataArrayDouble.New();
50 myCoords.setValues(sourceCoords,4,2);
51 sourceMesh.setCoords(myCoords);
54 def build3DTargetMesh_1(cls):
55 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. ,
56 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. ,
57 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. ];
58 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,
59 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];
60 targetMesh=MEDCouplingUMesh.New();
61 targetMesh.setMeshDimension(3);
62 targetMesh.allocateCells(12);
64 targetMesh.insertNextCell(NORM_HEXA8,8,targetConn[8*i:8*i+8]);
66 targetMesh.finishInsertingCells();
67 myCoords=DataArrayDouble.New();
68 myCoords.setValues(targetCoords,27,3);
69 targetMesh.setCoords(myCoords);
72 def build3DSourceMesh_1(self):
73 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,
74 200.0, 0.0, 0.0, 200.0, 200.0, 200.0, 200.0, 200.0, 0.0, 100.0, 100.0, 100.0]
75 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]
76 sourceMesh=MEDCouplingUMesh.New();
77 sourceMesh.setMeshDimension(3);
78 sourceMesh.allocateCells(12);
79 sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[0:4])
80 sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[4:8])
81 sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[8:12])
82 sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[12:16])
83 sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[16:20])
84 sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[20:24])
85 sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[24:28])
86 sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[28:32])
87 sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[32:36])
88 sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[36:40])
89 sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[40:44])
90 sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[44:48])
91 sourceMesh.finishInsertingCells();
92 myCoords=DataArrayDouble.New();
93 myCoords.setValues(sourceCoords,9,3);
94 sourceMesh.setCoords(myCoords);
98 def build3DSurfTargetMesh_1(self):
99 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]
100 targetConn=[0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4]
101 targetMesh=MEDCouplingUMesh.New();
102 targetMesh.setMeshDimension(2);
103 targetMesh.allocateCells(5);
104 targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[0:4])
105 targetMesh.insertNextCell(NORM_TRI3,3,targetConn[4:7])
106 targetMesh.insertNextCell(NORM_TRI3,3,targetConn[7:10])
107 targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[10:14])
108 targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[14:18])
109 targetMesh.finishInsertingCells();
110 myCoords=DataArrayDouble.New();
111 myCoords.setValues(targetCoords,9,3);
112 targetMesh.setCoords(myCoords);
115 def build3DExtrudedUMesh_1(self):
117 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.,
118 3.,2.,0., 0.,1.,0., 1.,3.,0., 2.,2.,0., 2.,3.,0.,
119 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.,
120 3.,2.,1., 0.,1.,1., 1.,3.,1., 2.,2.,1., 2.,3.,1.,
121 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.,
122 3.,2.,2., 0.,1.,2., 1.,3.,2., 2.,2.,2., 2.,3.,2.,
123 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.,
124 3.,2.,3., 0.,1.,3., 1.,3.,3., 2.,2.,3., 2.,3.,3.]
128 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,
129 1,6,5,3,16,21,20,18, 13,10,9,6,28,25,24,21,
130 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,
131 7,12,14,13,22,27,29,28,
133 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,
134 16,21,20,18,31,36,35,33, 28,25,24,21,43,40,39,36,
135 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,
136 22,27,29,28,37,42,44,43,
138 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,
139 31,36,35,33,46,51,50,48, 43,40,39,36,58,55,54,51,
140 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,
141 37,42,44,43,52,57,59,58]
142 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]
144 ret=MEDCouplingUMesh.New();
145 ret.setMeshDimension(3);
146 ret.allocateCells(18);
148 ret.insertNextCell(NORM_HEXA8,8,conn[0:8]);
149 ret.insertNextCell(NORM_POLYHED,43,conn[8:51]);
150 ret.insertNextCell(NORM_HEXA8,8,conn[51:59]);
151 ret.insertNextCell(NORM_HEXA8,8,conn[59:67]);
152 ret.insertNextCell(NORM_POLYHED,43,conn[67:110]);
153 ret.insertNextCell(NORM_HEXA8,8,conn[110:118]);
155 ret.insertNextCell(NORM_HEXA8,8,conn[118:126]);
156 ret.insertNextCell(NORM_POLYHED,43,conn[126:169]);
157 ret.insertNextCell(NORM_HEXA8,8,conn[169:177]);
158 ret.insertNextCell(NORM_HEXA8,8,conn[177:185]);
159 ret.insertNextCell(NORM_POLYHED,43,conn[185:228]);
160 ret.insertNextCell(NORM_HEXA8,8,conn[228:236]);
162 ret.insertNextCell(NORM_HEXA8,8,conn[236:244]);
163 ret.insertNextCell(NORM_POLYHED,43,conn[244:287]);
164 ret.insertNextCell(NORM_HEXA8,8,conn[287:295]);
165 ret.insertNextCell(NORM_HEXA8,8,conn[295:303]);
166 ret.insertNextCell(NORM_POLYHED,43,conn[303:346]);
167 ret.insertNextCell(NORM_HEXA8,8,conn[346:354]);
169 ret.finishInsertingCells();
170 myCoords=DataArrayDouble.New();
171 myCoords.setValues(coords,60,3);
172 ret.setCoords(myCoords);
174 mesh2D=MEDCouplingUMesh.New();
175 mesh2D.setMeshDimension(2);
176 mesh2D.allocateCells(6);
177 mesh2D.insertNextCell(NORM_QUAD4,4,conn2[0:4]);
178 mesh2D.insertNextCell(NORM_POLYGON,6,conn2[4:10]);
179 mesh2D.insertNextCell(NORM_QUAD4,4,conn2[10:14]);
180 mesh2D.insertNextCell(NORM_QUAD4,4,conn2[14:18]);
181 mesh2D.insertNextCell(NORM_POLYGON,6,conn2[18:24]);
182 mesh2D.insertNextCell(NORM_QUAD4,4,conn2[24:28]);
183 mesh2D.finishInsertingCells();
184 mesh2D.setCoords(myCoords);
187 def buildCU1DMesh_U(self):
188 coords=[ 0.0, 0.3, 0.75, 1.0 ]
189 conn=[ 0,1, 1,2, 2,3 ]
190 mesh=MEDCouplingUMesh.New();
191 mesh.setMeshDimension(1);
192 mesh.allocateCells(3);
193 mesh.insertNextCell(NORM_SEG2,2,conn[0:2]);
194 mesh.insertNextCell(NORM_SEG2,2,conn[2:4]);
195 mesh.insertNextCell(NORM_SEG2,2,conn[4:6]);
196 mesh.finishInsertingCells();
197 myCoords=DataArrayDouble.New();
198 myCoords.setValues(coords,4,1);
199 mesh.setCoords(myCoords);
202 def build2DTargetMeshMergeNode_1(self):
203 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 ]
204 targetConn=[0,9,7,5, 4,6,2, 10,11,8, 9,14,15,7, 17,16,13,6]
205 targetMesh=MEDCouplingUMesh.New();
206 targetMesh.setMeshDimension(2);
207 targetMesh.allocateCells(5);
208 targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[0:4]);
209 targetMesh.insertNextCell(NORM_TRI3,3,targetConn[4:7]);
210 targetMesh.insertNextCell(NORM_TRI3,3,targetConn[7:10]);
211 targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[10:14]);
212 targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[14:18]);
213 targetMesh.finishInsertingCells();
214 myCoords=DataArrayDouble.New();
215 myCoords.setValues(targetCoords,18,2);
216 targetMesh.setCoords(myCoords);
219 def build3DTargetMeshMergeNode_1(self):
220 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. ,
221 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. ,
222 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.]
223 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,
224 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]
225 targetMesh=MEDCouplingUMesh.New();
226 targetMesh.setMeshDimension(3);
227 targetMesh.allocateCells(12);
229 targetMesh.insertNextCell(NORM_HEXA8,8,targetConn[8*i:8*(i+1)]);
231 targetMesh.finishInsertingCells();
232 myCoords=DataArrayDouble.New();
233 myCoords.setValues(targetCoords,31,3);
234 targetMesh.setCoords(myCoords);
237 def build2DTargetMeshMerged_1(self):
239 -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,
240 0.7,-0.3, 1.7,-0.3, 0.7,0.7, 1.7,0.7
243 0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4,
246 targetMesh=MEDCouplingUMesh.New();
247 targetMesh.setName("merge");
248 targetMesh.setMeshDimension(2);
249 targetMesh.allocateCells(10);
250 targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[0:4])
251 targetMesh.insertNextCell(NORM_TRI3,3,targetConn[4:7])
252 targetMesh.insertNextCell(NORM_TRI3,3,targetConn[7:10])
253 targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[10:14])
254 targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[14:18])
255 targetMesh.insertNextCell(NORM_TRI3,3,targetConn[18:21])
256 targetMesh.insertNextCell(NORM_TRI3,3,targetConn[21:24])
257 targetMesh.finishInsertingCells();
258 myCoords=DataArrayDouble.New();
259 myCoords.setValues(targetCoords,13,2);
260 targetMesh.setCoords(myCoords);
263 def build2DTargetMesh_2(cls):
264 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 ]
265 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 ]
266 targetMesh=MEDCouplingUMesh.New();
267 targetMesh.setMeshDimension(2);
268 targetMesh.allocateCells(8);
269 targetMesh.insertNextCell(NORM_TRI3,3,targetConn[0:3])
270 targetMesh.insertNextCell(NORM_TRI3,3,targetConn[3:6])
271 targetMesh.insertNextCell(NORM_TRI3,3,targetConn[6:9])
272 targetMesh.insertNextCell(NORM_TRI3,3,targetConn[9:12])
273 targetMesh.insertNextCell(NORM_TRI3,3,targetConn[12:15])
274 targetMesh.insertNextCell(NORM_TRI3,3,targetConn[15:18])
275 targetMesh.insertNextCell(NORM_TRI3,3,targetConn[18:21])
276 targetMesh.insertNextCell(NORM_TRI3,3,targetConn[21:24])
277 targetMesh.finishInsertingCells();
278 myCoords=DataArrayDouble.New();
279 myCoords.setValues(targetCoords,9,2);
280 targetMesh.setCoords(myCoords);
283 def build1DSourceMesh_2(cls):
284 ret=MEDCouplingUMesh.New("1DSourceMesh",1);
285 ret.allocateCells(4);
286 conn=[0,1,2,3,1,2,3,4]
288 ret.insertNextCell(NORM_SEG2,2,conn[2*i:2*i+2]);
290 ret.finishInsertingCells();
291 myCoords=DataArrayDouble.New([0.3,0.7,0.9,1.0,1.12],5,1);
292 ret.setCoords(myCoords);
295 def build1DTargetMesh_3(cls):
296 ret=MEDCouplingUMesh.New("1DMesh_3",1);
297 ret.allocateCells(4);
298 conn=[0,1,2, 3,4, 6,5,7 ,9,8]
299 ret.insertNextCell(NORM_SEG3,3,conn[0:3])
300 ret.insertNextCell(NORM_SEG2,2,conn[3:5])
301 ret.insertNextCell(NORM_SEG3,3,conn[5:8])
302 ret.insertNextCell(NORM_SEG2,2,conn[8:10])
303 ret.finishInsertingCells();
304 coords=[0.5,1.,0.8,5.,5.21,0.5,1.1,0.7,5.,5.31]
305 myCoords=DataArrayDouble.New();
306 myCoords.setValues(coords,10,1);
307 ret.setCoords(myCoords);
310 def build2DCurveTargetMesh_3(cls):
311 ret=MEDCouplingUMesh.New("2DCurveMesh_3",1);
312 ret.allocateCells(4);
313 conn=[0,1,2, 3,4, 6,5,7 ,9,8]
314 ret.insertNextCell(NORM_SEG3,3,conn[0:3])
315 ret.insertNextCell(NORM_SEG2,2,conn[3:5])
316 ret.insertNextCell(NORM_SEG3,3,conn[5:8])
317 ret.insertNextCell(NORM_SEG2,2,conn[8:10])
318 ret.finishInsertingCells();
319 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]
320 myCoords=DataArrayDouble.New();
321 myCoords.setValues(coords,10,2);
322 ret.setCoords(myCoords);
325 def build2DTargetMesh_3(cls):
326 ret=MEDCouplingUMesh.New("2DMesh_3",2);
327 ret.allocateCells(10);
328 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]
329 ret.insertNextCell(NORM_TRI3,3,conn[0:3])
330 ret.insertNextCell(NORM_QUAD4,4,conn[3:7])
331 ret.insertNextCell(NORM_POLYGON,5,conn[7:12])
332 ret.insertNextCell(NORM_TRI6,6,conn[12:18])
333 ret.insertNextCell(NORM_QUAD8,8,conn[18:26])
334 ret.insertNextCell(NORM_TRI3,3,conn[26:29])
335 ret.insertNextCell(NORM_QUAD4,4,conn[29:33])
336 ret.insertNextCell(NORM_POLYGON,5,conn[33:38])
337 ret.insertNextCell(NORM_TRI6,6,conn[38:44])
338 ret.insertNextCell(NORM_QUAD8,8,conn[44:52])
339 ret.finishInsertingCells();
340 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]
341 myCoords=DataArrayDouble.New();
342 myCoords.setValues(coords,11,2);
343 ret.setCoords(myCoords);
344 ret.checkCoherency();
347 def build2DTargetMesh_4(cls):
348 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 ]
349 targetConn=[0,4,5,1, 1,5,3, 5,6,2, 7,8,5,4, 8,9,6,5]
350 targetMesh=MEDCouplingUMesh.New();
351 targetMesh.setMeshDimension(2);
352 targetMesh.allocateCells(5);
353 targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[0:4])
354 targetMesh.insertNextCell(NORM_TRI3,3,targetConn[4:7])
355 targetMesh.insertNextCell(NORM_TRI3,3,targetConn[7:10])
356 targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[10:14])
357 targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[14:18])
358 targetMesh.finishInsertingCells();
359 myCoords=DataArrayDouble.New();
360 myCoords.setValues(targetCoords,10,2);
361 targetMesh.setCoords(myCoords);
364 def buildMultiFields_1(cls):
365 m1=MEDCouplingDataForTest.build2DTargetMesh_1();
367 m2=MEDCouplingDataForTest.build2DTargetMesh_1();
369 vals0=[-0.7,-1.,-2.,-3.,-4.];
370 vals1=[0.,1.,2.,3.,4.,0.1,0.2,0.3,0.4];
371 vals1_1=[170.,171.,172.,173.,174.,170.1,170.2,170.3,170.4];
372 vals2=[5.,6.,7.,8.,9.];
373 vals4=[15.,16.,17.,18.,19.];
374 d0=DataArrayDouble.New();
375 d0.setValues(vals0,5,1);
376 d1=DataArrayDouble.New();
377 d1.setValues(vals1,9,1);
378 d1_1=DataArrayDouble.New();
379 d1_1.setValues(vals1_1,9,1);
380 d2=DataArrayDouble.New();
381 d2.setValues(vals2,5,1);
382 d4=DataArrayDouble.New();
383 d4.setValues(vals4,5,1);
384 d0.setName("d0"); d1.setName("d1"); d1_1.setName("d1_1"); d2.setName("d2"); d4.setName("d4");
385 d0.setInfoOnComponent(0,"c1");
386 d1.setInfoOnComponent(0,"c6");
387 d1_1.setInfoOnComponent(0,"c9");
388 d2.setInfoOnComponent(0,"c5");
389 d4.setInfoOnComponent(0,"c7");
390 f0=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME);
395 f1=MEDCouplingFieldDouble.New(ON_NODES,LINEAR_TIME);
397 f1.setArrays([d1,d1_1]);
398 f1.setStartTime(0.7,7,8);
399 f1.setEndTime(1.2,9,10);
401 f2=MEDCouplingFieldDouble.New(ON_CELLS,CONST_ON_TIME_INTERVAL);
404 f2.setTime(1.2,11,12);
405 f2.setEndTime(1.5,13,14);
407 f3=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME);
410 f3.setTime(1.7,15,16);
412 f4=MEDCouplingFieldDouble.New(ON_CELLS,NO_TIME);
416 ret=MEDCouplingMultiFields.New([f0,f1,f2,f3,f4]);
419 def buildMultiFields_2(cls):
420 m1=MEDCouplingDataForTest.build2DTargetMesh_1();
422 m2=MEDCouplingDataForTest.build2DTargetMesh_1();
424 vals0=[-0.7,-1.,-2.,-3.,-4.];
425 vals1=[0.,1.,2.,3.,4.];
426 vals1_1=[170.,171.,172.,173.,174.];
427 vals2=[5.,6.,7.,8.,9.];
428 vals4=[15.,16.,17.,18.,19.];
429 d0=DataArrayDouble.New();
430 d0.setValues(vals0,5,1);
431 d1=DataArrayDouble.New();
432 d1.setValues(vals1,5,1);
433 d1_1=DataArrayDouble.New();
434 d1_1.setValues(vals1_1,5,1);
435 d2=DataArrayDouble.New();
436 d2.setValues(vals2,5,1);
437 d4=DataArrayDouble.New();
438 d4.setValues(vals4,5,1);
439 d0.setName("d0"); d1.setName("d1"); d1_1.setName("d1_1"); d2.setName("d2"); d4.setName("d4");
440 d0.setInfoOnComponent(0,"c1");
441 d1.setInfoOnComponent(0,"c6");
442 d1_1.setInfoOnComponent(0,"c9");
443 d2.setInfoOnComponent(0,"c5");
444 d4.setInfoOnComponent(0,"c7");
445 f0=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME);
450 f1=MEDCouplingFieldDouble.New(ON_CELLS,LINEAR_TIME);
452 f1.setArrays([d1,d1_1]);
453 f1.setStartTime(0.7,7,8);
454 f1.setEndTime(1.2,9,10);
456 f2=MEDCouplingFieldDouble.New(ON_CELLS,CONST_ON_TIME_INTERVAL);
459 f2.setTime(1.2,11,12);
460 f2.setEndTime(1.5,13,14);
462 f3=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME);
465 f3.setTime(1.7,15,16);
467 f4=MEDCouplingFieldDouble.New(ON_CELLS,NO_TIME);
471 return [f0,f1,f2,f3,f4]
473 def build1DMultiTypes_1(self):
474 mesh=MEDCouplingUMesh.New("Multi1DMesh",1);
475 coo=MEDCouplingDataForTest.buildCoordsForMultiTypes_1();
477 mesh.allocateCells(2);
478 mesh.insertNextCell(NORM_SEG2,2,conn[0:2])
479 mesh.insertNextCell(NORM_SEG3,3,conn[2:5])
480 mesh.finishInsertingCells();
484 def build2DMultiTypes_1(self):
485 mesh=MEDCouplingUMesh.New("Multi2DMesh",2);
486 coo=MEDCouplingDataForTest.buildCoordsForMultiTypes_1();
487 conn=[3,4,5, 3,4,5,6,7,8, 0,9,10,11, 0,9,10,11,12,13,14,15]
488 mesh.allocateCells(4);
489 mesh.insertNextCell(NORM_TRI3,3,conn[0:3])
490 mesh.insertNextCell(NORM_TRI6,6,conn[3:9])
491 mesh.insertNextCell(NORM_QUAD4,4,conn[9:13])
492 mesh.insertNextCell(NORM_QUAD8,8,conn[13:21])
493 mesh.finishInsertingCells();
497 def build3DMultiTypes_1(self):
498 mesh=MEDCouplingUMesh.New("Multi3DMesh",3);
499 coo=MEDCouplingDataForTest.buildCoordsForMultiTypes_1();
501 0,16,17,18,19,20,21,22,23,24,
503 0,11,10,9,25,15,14,13,12,26,27,28,29,
505 0,30,31,32,33,34,35,36,37,38,39,40,41,42,43,
506 0,9,10,11,44,45,46,47,
507 0,9,10,11,44,45,46,47,12,13,14,15,48,49,50,51,52,53,54,55 ];
508 mesh.allocateCells(8);
509 mesh.insertNextCell(NORM_TETRA4,4,conn[0:4])
510 mesh.insertNextCell(NORM_TETRA10,10,conn[4:14])
511 mesh.insertNextCell(NORM_PYRA5,5,conn[14:19])
512 mesh.insertNextCell(NORM_PYRA13,13,conn[19:32])
513 mesh.insertNextCell(NORM_PENTA6,6,conn[32:38])
514 mesh.insertNextCell(NORM_PENTA15,15,conn[38:53])
515 mesh.insertNextCell(NORM_HEXA8,8,conn[53:61])
516 mesh.insertNextCell(NORM_HEXA20,20,conn[61:81])
517 mesh.finishInsertingCells();
521 def buildCoordsForMultiTypes_1(self):
522 coords=DataArrayDouble.New();
523 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]
524 coords.setValues(data,56,3);
525 coords.setInfoOnComponent(0,"X (cm)");
526 coords.setInfoOnComponent(1,"Y (cm)");
527 coords.setInfoOnComponent(2,"Z (cm)");
530 def buildHexa8Mesh_1(self):
531 mesh=MEDCouplingUMesh.New("Hexa8Only",3);
532 coo=DataArrayDouble.New();
533 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]
534 coo.setValues(coords,27,3);
535 conn=[3,12,13,4,0,9,10,1,
539 12,21,22,13,9,18,19,10,
540 13,22,23,14,10,19,20,11,
541 15,24,25,16,12,21,22,13,
542 16,25,26,17,13,22,23,14];
543 mesh.allocateCells(8);
545 mesh.insertNextCell(NORM_HEXA8,8,conn[8*i:8*(i+1)])
547 mesh.finishInsertingCells();
551 def buildPointe_1(self):
552 mesh=MEDCouplingUMesh.New("Pointe.med",3);
553 mesh2=MEDCouplingUMesh.New("Pointe.med",2);
554 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]
555 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]
556 coo=DataArrayDouble.New();
557 coo.setValues(coords,19,3);
559 mesh2.setCoords(coo);
560 mesh.allocateCells(16);
562 mesh.insertNextCell(NORM_TETRA4,4,conn[4*i:4*i+4])
564 mesh.insertNextCell(NORM_PYRA5,5,conn[48:53])
565 mesh.insertNextCell(NORM_PYRA5,5,conn[53:58])
566 mesh.insertNextCell(NORM_HEXA8,8,conn[58:66])
567 mesh.insertNextCell(NORM_HEXA8,8,conn[66:74])
568 mesh.finishInsertingCells();
570 conn2=[0,5,1,14,18,17,8,7,4,9,5,2, 12,8,9,13,6,7,8,9]
571 mesh2.allocateCells(6);
573 mesh2.insertNextCell(NORM_TRI3,3,conn2[3*i:3*i+3])
575 mesh2.insertNextCell(NORM_QUAD4,4,conn2[12:16])
576 mesh2.insertNextCell(NORM_QUAD4,4,conn2[16:20])
577 mesh2.finishInsertingCells();
580 # 2D usecase1 for interpolation Gauss Pt-> Gauss Pt. Coming from ASTER : Please, do not touch
581 def buildFieldOnGauss_1(self):
582 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)
583 coo.setInfoOnComponents(["X [INCONNUE]","Y [INCONNUE]"])
584 m=MEDCouplingUMesh("MA1",2)
585 m.setDescription("CREE PAR CODE_ASTER") ; m.setTimeUnit("SANS UNITES") ; m.setTime(-1.,-1,-1)
588 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]]
589 for i in xrange(0,12):
590 m.insertNextCell(NORM_TRI3,conn[i])
592 for i in xrange(12,18):
593 m.insertNextCell(NORM_QUAD4,conn[i])
595 for i in xrange(18,30):
596 m.insertNextCell(NORM_TRI6,conn[i])
598 for i in xrange(30,36):
599 m.insertNextCell(NORM_QUAD8,conn[i])
601 fff=MEDCouplingFieldDouble.New(ON_GAUSS_PT) ; fff.setName("CH1RB") ; fff.setNature(ConservativeVolumic)
603 fff.setGaussLocalizationOnCells(range(0,12),[0.,0.,1.,0.,0.,1.],[0.3333333333333333,0.3333333333333333],[0.5])
604 fff.setGaussLocalizationOnCells(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.])
605 fff.setGaussLocalizationOnCells(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])
606 fff.setGaussLocalizationOnCells(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])
607 return MEDCouplingFieldTemplate(fff)
609 # 2D usecase2 for interpolation Gauss Pt-> Gauss Pt. Coming from ASTER : Please, do not touch
610 def buildFieldOnGauss_2(self):
611 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)
612 coo.setInfoOnComponents(["X [INCONNUE]","Y [INCONNUE]"])
613 m=MEDCouplingUMesh("MA2",2)
614 m.setDescription("CREE PAR CODE_ASTER") ; m.setTimeUnit("SANS UNITES") ; m.setTime(-1.,-1,-1)
617 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]]
618 for i in xrange(0,40):
619 m.insertNextCell(NORM_TRI3,conn[i])
621 for i in xrange(40,60):
622 m.insertNextCell(NORM_QUAD4,conn[i])
624 for i in xrange(60,100):
625 m.insertNextCell(NORM_TRI6,conn[i])
627 for i in xrange(100,120):
628 m.insertNextCell(NORM_QUAD8,conn[i])
630 fff=MEDCouplingFieldDouble.New(ON_GAUSS_PT) ; fff.setName("CH2RB") ; fff.setNature(ConservativeVolumic)
632 fff.setGaussLocalizationOnCells(range(0,40),[0.,0.,1.,0.,0.,1.],[0.3333333333333333,0.3333333333333333],[0.5])
633 fff.setGaussLocalizationOnCells(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.])
634 fff.setGaussLocalizationOnCells(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])
635 fff.setGaussLocalizationOnCells(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])
636 return MEDCouplingFieldTemplate(fff)
638 # 3D usecase1 for interpolation Gauss Pt-> Gauss Pt. Coming from ASTER : Please, do not touch
639 def buildFieldOnGauss_3(self):
640 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)
641 coo.setInfoOnComponents(["X [INCONNUE]","Y [INCONNUE]","Z [INCONNUE]"])
642 m=MEDCouplingUMesh("MA1",3)
643 m.setDescription("CREE PAR CODE_ASTER") ; m.setTimeUnit("SANS UNITES") ; m.setTime(-1.,-1,-1)
646 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]]
647 m.insertNextCell(NORM_TETRA4,conn[0])
648 m.insertNextCell(NORM_PYRA5,conn[1])
649 for i in xrange(2,6):
650 m.insertNextCell(NORM_PENTA6,conn[i])
652 m.insertNextCell(NORM_HEXA8,conn[6])
653 m.insertNextCell(NORM_HEXA8,conn[7])
654 fff=MEDCouplingFieldDouble.New(ON_GAUSS_PT) ; fff.setName("CH13") ; fff.setNature(ConservativeVolumic)
656 fff.setGaussLocalizationOnCells([0],[0.,1.,0.,0.,0.,0.,0.,0.,1.,1.,0.,0.],[0.25,0.25,0.25],[0.16666666666666666])
657 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])
658 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])
659 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.])
660 return MEDCouplingFieldTemplate(fff)
662 # 3D usecase2 for interpolation Gauss Pt-> Gauss Pt. Coming from ASTER : Please, do not touch
663 def buildFieldOnGauss_4(self):
664 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)
665 coo.setInfoOnComponents(["X [INCONNUE]","Y [INCONNUE]","Z [INCONNUE]"])
666 m=MEDCouplingUMesh("MA2",3)
667 m.setDescription("CREE PAR CODE_ASTER") ; m.setTimeUnit("SANS UNITES") ; m.setTime(-1.,-1,-1)
670 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]]
671 m.insertNextCell(NORM_TETRA4,conn[0])
672 m.insertNextCell(NORM_PYRA5,conn[1])
673 for i in xrange(2,6):
674 m.insertNextCell(NORM_PENTA6,conn[i])
676 m.insertNextCell(NORM_HEXA8,conn[6])
677 m.insertNextCell(NORM_HEXA8,conn[7])
678 fff=MEDCouplingFieldDouble.New(ON_GAUSS_PT) ; fff.setName("CH23") ; fff.setNature(ConservativeVolumic)
680 fff.setGaussLocalizationOnCells([0],[0.,1.,0.,0.,0.,0.,0.,0.,1.,1.,0.,0.],[0.25,0.25,0.25],[0.16666666666666666])
681 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])
682 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])
683 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.])
684 return MEDCouplingFieldTemplate(fff)
686 def buildCircle(self, center_X, center_Y, radius):
687 from cmath import rect
690 c = [rect(radius, i*pi/4.0) for i in range(8)]
691 coords = [c[-1].real,c[-1].imag, c[3].real,c[3].imag,
692 c[5].real,c[5].imag, c[1].real,c[1].imag]
694 baseMesh = MEDCouplingUMesh.New("circle", 2)
695 baseMesh.allocateCells(1)
696 meshCoords = DataArrayDouble.New(coords, len(coords)/2, 2)
697 meshCoords += (center_X, center_Y)
698 baseMesh.setCoords(meshCoords)
700 baseMesh.insertNextCell(NORM_QPOLYG, connec)
701 baseMesh.finishInsertingCells()
704 build2DTargetMesh_1=classmethod(build2DTargetMesh_1)
705 build2DSourceMesh_1=classmethod(build2DSourceMesh_1)
706 build3DTargetMesh_1=classmethod(build3DTargetMesh_1)
707 build3DSourceMesh_1=classmethod(build3DSourceMesh_1)
708 build3DSurfTargetMesh_1=classmethod(build3DSurfTargetMesh_1)
709 build3DExtrudedUMesh_1=classmethod(build3DExtrudedUMesh_1)
710 buildCU1DMesh_U=classmethod(buildCU1DMesh_U)
711 build2DTargetMeshMergeNode_1=classmethod(build2DTargetMeshMergeNode_1)
712 build3DTargetMeshMergeNode_1=classmethod(build3DTargetMeshMergeNode_1)
713 build2DTargetMeshMerged_1=classmethod(build2DTargetMeshMerged_1)
714 build2DTargetMesh_2=classmethod(build2DTargetMesh_2)
715 build1DSourceMesh_2=classmethod(build1DSourceMesh_2)
716 build1DTargetMesh_3=classmethod(build1DTargetMesh_3)
717 build2DCurveTargetMesh_3=classmethod(build2DCurveTargetMesh_3)
718 build2DTargetMesh_3=classmethod(build2DTargetMesh_3)
719 build2DTargetMesh_4=classmethod(build2DTargetMesh_4)
720 buildMultiFields_1=classmethod(buildMultiFields_1)
721 buildMultiFields_2=classmethod(buildMultiFields_2)
722 build1DMultiTypes_1=classmethod(build1DMultiTypes_1)
723 build2DMultiTypes_1=classmethod(build2DMultiTypes_1)
724 build3DMultiTypes_1=classmethod(build3DMultiTypes_1)
725 buildCoordsForMultiTypes_1=classmethod(buildCoordsForMultiTypes_1)
726 buildHexa8Mesh_1=classmethod(buildHexa8Mesh_1)
727 buildPointe_1=classmethod(buildPointe_1)
728 buildFieldOnGauss_1=classmethod(buildFieldOnGauss_1)
729 buildFieldOnGauss_2=classmethod(buildFieldOnGauss_2)
730 buildFieldOnGauss_3=classmethod(buildFieldOnGauss_3)
731 buildFieldOnGauss_4=classmethod(buildFieldOnGauss_4)
732 buildCircle=classmethod(buildCircle)