Back to index

salome-med  6.5.0
MEDCouplingDataForTest.py
Go to the documentation of this file.
00001 #  -*- coding: iso-8859-1 -*-
00002 # Copyright (C) 2007-2012  CEA/DEN, EDF R&D
00003 #
00004 # This library is free software; you can redistribute it and/or
00005 # modify it under the terms of the GNU Lesser General Public
00006 # License as published by the Free Software Foundation; either
00007 # version 2.1 of the License.
00008 #
00009 # This library is distributed in the hope that it will be useful,
00010 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 # Lesser General Public License for more details.
00013 #
00014 # You should have received a copy of the GNU Lesser General Public
00015 # License along with this library; if not, write to the Free Software
00016 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00017 #
00018 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00019 #
00020 
00021 from MEDCoupling import *
00022 
00023 class MEDCouplingDataForTest:
00024     def build2DTargetMesh_1(cls):
00025         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 ];
00026         targetConn=[0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4];
00027         targetMesh=MEDCouplingUMesh.New();
00028         targetMesh.setMeshDimension(2);
00029         targetMesh.allocateCells(5);
00030         targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[0:4]);
00031         targetMesh.insertNextCell(NORM_TRI3,3,targetConn[4:7]);
00032         targetMesh.insertNextCell(NORM_TRI3,3,targetConn[7:10]);
00033         targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[10:14]);
00034         targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[14:18]);
00035         targetMesh.finishInsertingCells();
00036         myCoords=DataArrayDouble.New();
00037         myCoords.setValues(targetCoords,9,2);
00038         targetMesh.setCoords(myCoords);
00039         return targetMesh;
00040     
00041     def build2DSourceMesh_1(cls):
00042         sourceCoords=[-0.3,-0.3, 0.7,-0.3, -0.3,0.7, 0.7,0.7]
00043         sourceConn=[0,3,1,0,2,3]
00044         sourceMesh=MEDCouplingUMesh.New("my name of mesh 2D",2);
00045         sourceMesh.allocateCells(2);
00046         sourceMesh.insertNextCell(NORM_TRI3,3,sourceConn[0:3]);
00047         sourceMesh.insertNextCell(NORM_TRI3,3,sourceConn[3:6]);
00048         sourceMesh.finishInsertingCells();
00049         myCoords=DataArrayDouble.New();
00050         myCoords.setValues(sourceCoords,4,2);
00051         sourceMesh.setCoords(myCoords);
00052         return sourceMesh;
00053         
00054     def build3DTargetMesh_1(cls):
00055         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. ,
00056                        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. ,
00057                        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. ];
00058         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,
00059                     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];
00060         targetMesh=MEDCouplingUMesh.New();
00061         targetMesh.setMeshDimension(3);
00062         targetMesh.allocateCells(12);
00063         for i in xrange(8):
00064             targetMesh.insertNextCell(NORM_HEXA8,8,targetConn[8*i:8*i+8]);
00065             pass
00066         targetMesh.finishInsertingCells();
00067         myCoords=DataArrayDouble.New();
00068         myCoords.setValues(targetCoords,27,3);
00069         targetMesh.setCoords(myCoords);
00070         return targetMesh
00071 
00072     def build3DSourceMesh_1(self):
00073         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,
00074                        200.0, 0.0, 0.0, 200.0, 200.0, 200.0, 200.0, 200.0, 0.0, 100.0, 100.0, 100.0]
00075         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]
00076         sourceMesh=MEDCouplingUMesh.New();
00077         sourceMesh.setMeshDimension(3);
00078         sourceMesh.allocateCells(12);
00079         sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[0:4])
00080         sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[4:8])
00081         sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[8:12])
00082         sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[12:16])
00083         sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[16:20])
00084         sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[20:24])
00085         sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[24:28])
00086         sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[28:32])
00087         sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[32:36])
00088         sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[36:40])
00089         sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[40:44])
00090         sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[44:48])
00091         sourceMesh.finishInsertingCells();
00092         myCoords=DataArrayDouble.New();
00093         myCoords.setValues(sourceCoords,9,3);
00094         sourceMesh.setCoords(myCoords);
00095         return sourceMesh;
00096         
00097 
00098     def build3DSurfTargetMesh_1(self):
00099         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]
00100         targetConn=[0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4]
00101         targetMesh=MEDCouplingUMesh.New();
00102         targetMesh.setMeshDimension(2);
00103         targetMesh.allocateCells(5);
00104         targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[0:4])
00105         targetMesh.insertNextCell(NORM_TRI3,3,targetConn[4:7])
00106         targetMesh.insertNextCell(NORM_TRI3,3,targetConn[7:10])
00107         targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[10:14])
00108         targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[14:18])
00109         targetMesh.finishInsertingCells();
00110         myCoords=DataArrayDouble.New();
00111         myCoords.setValues(targetCoords,9,3);
00112         targetMesh.setCoords(myCoords);
00113         return targetMesh;
00114 
00115     def build3DExtrudedUMesh_1(self):
00116         coords=[
00117             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.,
00118             3.,2.,0., 0.,1.,0., 1.,3.,0., 2.,2.,0., 2.,3.,0.,
00119             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.,
00120             3.,2.,1., 0.,1.,1., 1.,3.,1., 2.,2.,1., 2.,3.,1.,
00121             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.,
00122             3.,2.,2., 0.,1.,2., 1.,3.,2., 2.,2.,2., 2.,3.,2.,
00123             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.,
00124             3.,2.,3., 0.,1.,3., 1.,3.,3., 2.,2.,3., 2.,3.,3.]
00125 
00126         conn=[
00127             # 0
00128             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,
00129             1,6,5,3,16,21,20,18,   13,10,9,6,28,25,24,21,
00130             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,
00131             7,12,14,13,22,27,29,28,
00132             # 1
00133             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,
00134             16,21,20,18,31,36,35,33,   28,25,24,21,43,40,39,36,
00135             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,
00136             22,27,29,28,37,42,44,43,
00137             # 2
00138             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,
00139             31,36,35,33,46,51,50,48,  43,40,39,36,58,55,54,51,
00140             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,
00141             37,42,44,43,52,57,59,58]            
00142         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]
00143         #
00144         ret=MEDCouplingUMesh.New();
00145         ret.setMeshDimension(3);
00146         ret.allocateCells(18);
00147         #
00148         ret.insertNextCell(NORM_HEXA8,8,conn[0:8]);
00149         ret.insertNextCell(NORM_POLYHED,43,conn[8:51]);
00150         ret.insertNextCell(NORM_HEXA8,8,conn[51:59]);
00151         ret.insertNextCell(NORM_HEXA8,8,conn[59:67]);
00152         ret.insertNextCell(NORM_POLYHED,43,conn[67:110]);
00153         ret.insertNextCell(NORM_HEXA8,8,conn[110:118]);
00154         #
00155         ret.insertNextCell(NORM_HEXA8,8,conn[118:126]);
00156         ret.insertNextCell(NORM_POLYHED,43,conn[126:169]);
00157         ret.insertNextCell(NORM_HEXA8,8,conn[169:177]);
00158         ret.insertNextCell(NORM_HEXA8,8,conn[177:185]);
00159         ret.insertNextCell(NORM_POLYHED,43,conn[185:228]);
00160         ret.insertNextCell(NORM_HEXA8,8,conn[228:236]);
00161         #
00162         ret.insertNextCell(NORM_HEXA8,8,conn[236:244]);
00163         ret.insertNextCell(NORM_POLYHED,43,conn[244:287]);
00164         ret.insertNextCell(NORM_HEXA8,8,conn[287:295]);
00165         ret.insertNextCell(NORM_HEXA8,8,conn[295:303]);
00166         ret.insertNextCell(NORM_POLYHED,43,conn[303:346]);
00167         ret.insertNextCell(NORM_HEXA8,8,conn[346:354]);
00168         #
00169         ret.finishInsertingCells();
00170         myCoords=DataArrayDouble.New();
00171         myCoords.setValues(coords,60,3);
00172         ret.setCoords(myCoords);
00173         #
00174         mesh2D=MEDCouplingUMesh.New();
00175         mesh2D.setMeshDimension(2);
00176         mesh2D.allocateCells(6);
00177         mesh2D.insertNextCell(NORM_QUAD4,4,conn2[0:4]);
00178         mesh2D.insertNextCell(NORM_POLYGON,6,conn2[4:10]);
00179         mesh2D.insertNextCell(NORM_QUAD4,4,conn2[10:14]);
00180         mesh2D.insertNextCell(NORM_QUAD4,4,conn2[14:18]);
00181         mesh2D.insertNextCell(NORM_POLYGON,6,conn2[18:24]);
00182         mesh2D.insertNextCell(NORM_QUAD4,4,conn2[24:28]);
00183         mesh2D.setCoords(myCoords);
00184         return ret,mesh2D
00185     
00186     def buildCU1DMesh_U(self):
00187         coords=[ 0.0, 0.3, 0.75, 1.0 ]
00188         conn=[ 0,1, 1,2, 2,3 ]
00189         mesh=MEDCouplingUMesh.New();
00190         mesh.setMeshDimension(1);
00191         mesh.allocateCells(3);
00192         mesh.insertNextCell(NORM_SEG2,2,conn[0:2]);
00193         mesh.insertNextCell(NORM_SEG2,2,conn[2:4]);
00194         mesh.insertNextCell(NORM_SEG2,2,conn[4:6]);
00195         mesh.finishInsertingCells();
00196         myCoords=DataArrayDouble.New();
00197         myCoords.setValues(coords,4,1);
00198         mesh.setCoords(myCoords);
00199         return mesh;
00200 
00201     def build2DTargetMeshMergeNode_1(self):
00202         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 ]
00203         targetConn=[0,9,7,5, 4,6,2, 10,11,8, 9,14,15,7, 17,16,13,6]
00204         targetMesh=MEDCouplingUMesh.New();
00205         targetMesh.setMeshDimension(2);
00206         targetMesh.allocateCells(5);
00207         targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[0:4]);
00208         targetMesh.insertNextCell(NORM_TRI3,3,targetConn[4:7]);
00209         targetMesh.insertNextCell(NORM_TRI3,3,targetConn[7:10]);
00210         targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[10:14]);
00211         targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[14:18]);
00212         targetMesh.finishInsertingCells();
00213         myCoords=DataArrayDouble.New();
00214         myCoords.setValues(targetCoords,18,2);
00215         targetMesh.setCoords(myCoords);
00216         return targetMesh;
00217 
00218     def build3DTargetMeshMergeNode_1(self):
00219         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. ,
00220                        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. ,
00221                        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.]
00222         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,
00223                     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]
00224         targetMesh=MEDCouplingUMesh.New();
00225         targetMesh.setMeshDimension(3);
00226         targetMesh.allocateCells(12);
00227         for i in xrange(8):
00228             targetMesh.insertNextCell(NORM_HEXA8,8,targetConn[8*i:8*(i+1)]);
00229             pass
00230         targetMesh.finishInsertingCells();
00231         myCoords=DataArrayDouble.New();
00232         myCoords.setValues(targetCoords,31,3);
00233         targetMesh.setCoords(myCoords);
00234         return targetMesh;
00235 
00236     def build2DTargetMeshMerged_1(self):
00237         targetCoords=[
00238             -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,
00239             0.7,-0.3, 1.7,-0.3, 0.7,0.7, 1.7,0.7
00240             ]
00241         targetConn=[
00242             0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4,
00243             9,12,10,9,11,12
00244             ]
00245         targetMesh=MEDCouplingUMesh.New();
00246         targetMesh.setName("merge");
00247         targetMesh.setMeshDimension(2);
00248         targetMesh.allocateCells(10);
00249         targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[0:4])
00250         targetMesh.insertNextCell(NORM_TRI3,3,targetConn[4:7])
00251         targetMesh.insertNextCell(NORM_TRI3,3,targetConn[7:10])
00252         targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[10:14])
00253         targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[14:18])
00254         targetMesh.insertNextCell(NORM_TRI3,3,targetConn[18:21])
00255         targetMesh.insertNextCell(NORM_TRI3,3,targetConn[21:24])
00256         targetMesh.finishInsertingCells();
00257         myCoords=DataArrayDouble.New();
00258         myCoords.setValues(targetCoords,13,2);
00259         targetMesh.setCoords(myCoords);
00260         return targetMesh;
00261 
00262     def build2DTargetMesh_2(cls):
00263         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 ]
00264         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 ]
00265         targetMesh=MEDCouplingUMesh.New();
00266         targetMesh.setMeshDimension(2);
00267         targetMesh.allocateCells(8);
00268         targetMesh.insertNextCell(NORM_TRI3,3,targetConn[0:3])
00269         targetMesh.insertNextCell(NORM_TRI3,3,targetConn[3:6])
00270         targetMesh.insertNextCell(NORM_TRI3,3,targetConn[6:9])
00271         targetMesh.insertNextCell(NORM_TRI3,3,targetConn[9:12])
00272         targetMesh.insertNextCell(NORM_TRI3,3,targetConn[12:15])
00273         targetMesh.insertNextCell(NORM_TRI3,3,targetConn[15:18])
00274         targetMesh.insertNextCell(NORM_TRI3,3,targetConn[18:21])
00275         targetMesh.insertNextCell(NORM_TRI3,3,targetConn[21:24])
00276         targetMesh.finishInsertingCells();
00277         myCoords=DataArrayDouble.New();
00278         myCoords.setValues(targetCoords,9,2);
00279         targetMesh.setCoords(myCoords);
00280         return targetMesh;
00281     
00282     def build1DSourceMesh_2(cls):
00283         ret=MEDCouplingUMesh.New("1DSourceMesh",1);
00284         ret.allocateCells(4);
00285         conn=[0,1,2,3,1,2,3,4]
00286         for i in xrange(4):
00287             ret.insertNextCell(NORM_SEG2,2,conn[2*i:2*i+2]);
00288             pass
00289         ret.finishInsertingCells();
00290         myCoords=DataArrayDouble.New([0.3,0.7,0.9,1.0,1.12],5,1);
00291         ret.setCoords(myCoords);
00292         return ret
00293 
00294     def build1DTargetMesh_3(cls):
00295         ret=MEDCouplingUMesh.New("1DMesh_3",1);
00296         ret.allocateCells(4);
00297         conn=[0,1,2, 3,4, 6,5,7 ,9,8]
00298         ret.insertNextCell(NORM_SEG3,3,conn[0:3])
00299         ret.insertNextCell(NORM_SEG2,2,conn[3:5])
00300         ret.insertNextCell(NORM_SEG3,3,conn[5:8])
00301         ret.insertNextCell(NORM_SEG2,2,conn[8:10])
00302         ret.finishInsertingCells();
00303         coords=[0.5,1.,0.8,5.,5.21,0.5,1.1,0.7,5.,5.31]
00304         myCoords=DataArrayDouble.New();
00305         myCoords.setValues(coords,10,1);
00306         ret.setCoords(myCoords);
00307         return ret;
00308 
00309     def build2DCurveTargetMesh_3(cls):
00310         ret=MEDCouplingUMesh.New("2DCurveMesh_3",1);
00311         ret.allocateCells(4);
00312         conn=[0,1,2, 3,4, 6,5,7 ,9,8]
00313         ret.insertNextCell(NORM_SEG3,3,conn[0:3])
00314         ret.insertNextCell(NORM_SEG2,2,conn[3:5])
00315         ret.insertNextCell(NORM_SEG3,3,conn[5:8])
00316         ret.insertNextCell(NORM_SEG2,2,conn[8:10])
00317         ret.finishInsertingCells();
00318         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]
00319         myCoords=DataArrayDouble.New();
00320         myCoords.setValues(coords,10,2);
00321         ret.setCoords(myCoords);
00322         return ret;
00323 
00324     def build2DTargetMesh_3(cls):
00325         ret=MEDCouplingUMesh.New("2DMesh_3",2);
00326         ret.allocateCells(10);
00327         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]
00328         ret.insertNextCell(NORM_TRI3,3,conn[0:3])
00329         ret.insertNextCell(NORM_QUAD4,4,conn[3:7])
00330         ret.insertNextCell(NORM_POLYGON,5,conn[7:12])
00331         ret.insertNextCell(NORM_TRI6,6,conn[12:18])
00332         ret.insertNextCell(NORM_QUAD8,8,conn[18:26])
00333         ret.insertNextCell(NORM_TRI3,3,conn[26:29])
00334         ret.insertNextCell(NORM_QUAD4,4,conn[29:33])
00335         ret.insertNextCell(NORM_POLYGON,5,conn[33:38])
00336         ret.insertNextCell(NORM_TRI6,6,conn[38:44])
00337         ret.insertNextCell(NORM_QUAD8,8,conn[44:52])
00338         ret.finishInsertingCells();
00339         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]
00340         myCoords=DataArrayDouble.New();
00341         myCoords.setValues(coords,11,2);
00342         ret.setCoords(myCoords);
00343         ret.checkCoherency();
00344         return ret;
00345 
00346     def build2DTargetMesh_4(cls):
00347         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 ]
00348         targetConn=[0,4,5,1, 1,5,3, 5,6,2, 7,8,5,4, 8,9,6,5]
00349         targetMesh=MEDCouplingUMesh.New();
00350         targetMesh.setMeshDimension(2);
00351         targetMesh.allocateCells(5);
00352         targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[0:4])
00353         targetMesh.insertNextCell(NORM_TRI3,3,targetConn[4:7])
00354         targetMesh.insertNextCell(NORM_TRI3,3,targetConn[7:10])
00355         targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[10:14])
00356         targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[14:18])
00357         targetMesh.finishInsertingCells();
00358         myCoords=DataArrayDouble.New();
00359         myCoords.setValues(targetCoords,10,2);
00360         targetMesh.setCoords(myCoords);
00361         return targetMesh;
00362 
00363     def buildMultiFields_1(cls):
00364         m1=MEDCouplingDataForTest.build2DTargetMesh_1();
00365         m1.setName("m1");
00366         m2=MEDCouplingDataForTest.build2DTargetMesh_1();
00367         m2.setName("m2");
00368         vals0=[-0.7,-1.,-2.,-3.,-4.];
00369         vals1=[0.,1.,2.,3.,4.,0.1,0.2,0.3,0.4];
00370         vals1_1=[170.,171.,172.,173.,174.,170.1,170.2,170.3,170.4];
00371         vals2=[5.,6.,7.,8.,9.];
00372         vals4=[15.,16.,17.,18.,19.];
00373         d0=DataArrayDouble.New();
00374         d0.setValues(vals0,5,1);
00375         d1=DataArrayDouble.New();
00376         d1.setValues(vals1,9,1);
00377         d1_1=DataArrayDouble.New();
00378         d1_1.setValues(vals1_1,9,1);
00379         d2=DataArrayDouble.New();
00380         d2.setValues(vals2,5,1);
00381         d4=DataArrayDouble.New();
00382         d4.setValues(vals4,5,1);
00383         d0.setName("d0"); d1.setName("d1"); d1_1.setName("d1_1"); d2.setName("d2"); d4.setName("d4");
00384         d0.setInfoOnComponent(0,"c1");
00385         d1.setInfoOnComponent(0,"c6");
00386         d1_1.setInfoOnComponent(0,"c9");
00387         d2.setInfoOnComponent(0,"c5");
00388         d4.setInfoOnComponent(0,"c7");
00389         f0=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME);
00390         f0.setMesh(m1);
00391         f0.setArray(d0);
00392         f0.setTime(0.2,5,6);
00393         f0.setName("f0");
00394         f1=MEDCouplingFieldDouble.New(ON_NODES,LINEAR_TIME);
00395         f1.setMesh(m1);
00396         f1.setArrays([d1,d1_1]);
00397         f1.setStartTime(0.7,7,8);
00398         f1.setEndTime(1.2,9,10);
00399         f1.setName("f1");
00400         f2=MEDCouplingFieldDouble.New(ON_CELLS,CONST_ON_TIME_INTERVAL);
00401         f2.setMesh(m2);
00402         f2.setArray(d2);
00403         f2.setTime(1.2,11,12);
00404         f2.setEndTime(1.5,13,14);
00405         f2.setName("f2");
00406         f3=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME);
00407         f3.setMesh(m1);
00408         f3.setArray(d2);
00409         f3.setTime(1.7,15,16);
00410         f3.setName("f3");
00411         f4=MEDCouplingFieldDouble.New(ON_CELLS,NO_TIME);
00412         f4.setMesh(m2);
00413         f4.setArray(d4);
00414         f4.setName("f4");
00415         ret=MEDCouplingMultiFields.New([f0,f1,f2,f3,f4]);
00416         return ret;
00417 
00418     def buildMultiFields_2(cls):
00419         m1=MEDCouplingDataForTest.build2DTargetMesh_1();
00420         m1.setName("m1");
00421         m2=MEDCouplingDataForTest.build2DTargetMesh_1();
00422         m2.setName("m2");
00423         vals0=[-0.7,-1.,-2.,-3.,-4.];
00424         vals1=[0.,1.,2.,3.,4.];
00425         vals1_1=[170.,171.,172.,173.,174.];
00426         vals2=[5.,6.,7.,8.,9.];
00427         vals4=[15.,16.,17.,18.,19.];
00428         d0=DataArrayDouble.New();
00429         d0.setValues(vals0,5,1);
00430         d1=DataArrayDouble.New();
00431         d1.setValues(vals1,5,1);
00432         d1_1=DataArrayDouble.New();
00433         d1_1.setValues(vals1_1,5,1);
00434         d2=DataArrayDouble.New();
00435         d2.setValues(vals2,5,1);
00436         d4=DataArrayDouble.New();
00437         d4.setValues(vals4,5,1);
00438         d0.setName("d0"); d1.setName("d1"); d1_1.setName("d1_1"); d2.setName("d2"); d4.setName("d4");
00439         d0.setInfoOnComponent(0,"c1");
00440         d1.setInfoOnComponent(0,"c6");
00441         d1_1.setInfoOnComponent(0,"c9");
00442         d2.setInfoOnComponent(0,"c5");
00443         d4.setInfoOnComponent(0,"c7");
00444         f0=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME);
00445         f0.setMesh(m1);
00446         f0.setArray(d0);
00447         f0.setTime(0.2,5,6);
00448         f0.setName("f0");
00449         f1=MEDCouplingFieldDouble.New(ON_CELLS,LINEAR_TIME);
00450         f1.setMesh(m1);
00451         f1.setArrays([d1,d1_1]);
00452         f1.setStartTime(0.7,7,8);
00453         f1.setEndTime(1.2,9,10);
00454         f1.setName("f1");
00455         f2=MEDCouplingFieldDouble.New(ON_CELLS,CONST_ON_TIME_INTERVAL);
00456         f2.setMesh(m2);
00457         f2.setArray(d2);
00458         f2.setTime(1.2,11,12);
00459         f2.setEndTime(1.5,13,14);
00460         f2.setName("f2");
00461         f3=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME);
00462         f3.setMesh(m1);
00463         f3.setArray(d2);
00464         f3.setTime(1.7,15,16);
00465         f3.setName("f3");
00466         f4=MEDCouplingFieldDouble.New(ON_CELLS,NO_TIME);
00467         f4.setMesh(m2);
00468         f4.setArray(d4);
00469         f4.setName("f4");
00470         return [f0,f1,f2,f3,f4]
00471 
00472     def build1DMultiTypes_1(self):
00473         mesh=MEDCouplingUMesh.New("Multi1DMesh",1);
00474         coo=MEDCouplingDataForTest.buildCoordsForMultiTypes_1();
00475         conn=[0,2, 0,2,1]
00476         mesh.allocateCells(2);
00477         mesh.insertNextCell(NORM_SEG2,2,conn[0:2])
00478         mesh.insertNextCell(NORM_SEG3,3,conn[2:5])
00479         mesh.finishInsertingCells();
00480         mesh.setCoords(coo);
00481         return mesh;
00482 
00483     def build2DMultiTypes_1(self):
00484         mesh=MEDCouplingUMesh.New("Multi2DMesh",2);
00485         coo=MEDCouplingDataForTest.buildCoordsForMultiTypes_1();
00486         conn=[3,4,5, 3,4,5,6,7,8, 0,9,10,11, 0,9,10,11,12,13,14,15]
00487         mesh.allocateCells(4);
00488         mesh.insertNextCell(NORM_TRI3,3,conn[0:3])
00489         mesh.insertNextCell(NORM_TRI6,6,conn[3:9])
00490         mesh.insertNextCell(NORM_QUAD4,4,conn[9:13])
00491         mesh.insertNextCell(NORM_QUAD8,8,conn[13:21])
00492         mesh.finishInsertingCells();
00493         mesh.setCoords(coo);
00494         return mesh;
00495 
00496     def build3DMultiTypes_1(self):
00497         mesh=MEDCouplingUMesh.New("Multi3DMesh",3);
00498         coo=MEDCouplingDataForTest.buildCoordsForMultiTypes_1();
00499         conn=[0,16,17,18,
00500               0,16,17,18,19,20,21,22,23,24,
00501               0,11,10,9,25,
00502               0,11,10,9,25,15,14,13,12,26,27,28,29,
00503               0,30,31,32,33,34,
00504               0,30,31,32,33,34,35,36,37,38,39,40,41,42,43,
00505               0,9,10,11,44,45,46,47,
00506               0,9,10,11,44,45,46,47,12,13,14,15,48,49,50,51,52,53,54,55 ];
00507         mesh.allocateCells(8);
00508         mesh.insertNextCell(NORM_TETRA4,4,conn[0:4])
00509         mesh.insertNextCell(NORM_TETRA10,10,conn[4:14])
00510         mesh.insertNextCell(NORM_PYRA5,5,conn[14:19])
00511         mesh.insertNextCell(NORM_PYRA13,13,conn[19:32])
00512         mesh.insertNextCell(NORM_PENTA6,6,conn[32:38])
00513         mesh.insertNextCell(NORM_PENTA15,15,conn[38:53])
00514         mesh.insertNextCell(NORM_HEXA8,8,conn[53:61])
00515         mesh.insertNextCell(NORM_HEXA20,20,conn[61:81])
00516         mesh.finishInsertingCells();
00517         mesh.setCoords(coo);
00518         return mesh;
00519 
00520     def buildCoordsForMultiTypes_1(self):
00521         coords=DataArrayDouble.New();
00522         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]
00523         coords.setValues(data,56,3);
00524         coords.setInfoOnComponent(0,"X (cm)");
00525         coords.setInfoOnComponent(1,"Y (cm)");
00526         coords.setInfoOnComponent(2,"Z (cm)");
00527         return coords
00528 
00529     def buildHexa8Mesh_1(self):
00530         mesh=MEDCouplingUMesh.New("Hexa8Only",3);
00531         coo=DataArrayDouble.New();
00532         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]
00533         coo.setValues(coords,27,3);
00534         conn=[3,12,13,4,0,9,10,1,
00535               4,13,14,5,1,10,11,2,
00536               6,15,16,7,3,12,13,4,
00537               7,16,17,8,4,13,14,5,
00538               12,21,22,13,9,18,19,10,
00539               13,22,23,14,10,19,20,11,
00540               15,24,25,16,12,21,22,13,
00541               16,25,26,17,13,22,23,14];
00542         mesh.allocateCells(8);
00543         for i in xrange(8):
00544             mesh.insertNextCell(NORM_HEXA8,8,conn[8*i:8*(i+1)])
00545             pass
00546         mesh.finishInsertingCells();
00547         mesh.setCoords(coo);
00548         return mesh;
00549 
00550     def buildPointe_1(self):
00551         mesh=MEDCouplingUMesh.New("Pointe.med",3);
00552         mesh2=MEDCouplingUMesh.New("Pointe.med",2);
00553         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]
00554         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]
00555         coo=DataArrayDouble.New();
00556         coo.setValues(coords,19,3);
00557         mesh.setCoords(coo);
00558         mesh2.setCoords(coo);
00559         mesh.allocateCells(16);
00560         for i in xrange(12):
00561             mesh.insertNextCell(NORM_TETRA4,4,conn[4*i:4*i+4])
00562             pass
00563         mesh.insertNextCell(NORM_PYRA5,5,conn[48:53])
00564         mesh.insertNextCell(NORM_PYRA5,5,conn[53:58])
00565         mesh.insertNextCell(NORM_HEXA8,8,conn[58:66])
00566         mesh.insertNextCell(NORM_HEXA8,8,conn[66:74])
00567         mesh.finishInsertingCells();
00568         #[1,34,29,23,41,32]
00569         conn2=[0,5,1,14,18,17,8,7,4,9,5,2, 12,8,9,13,6,7,8,9]
00570         mesh2.allocateCells(6);
00571         for i in xrange(4):
00572             mesh2.insertNextCell(NORM_TRI3,3,conn2[3*i:3*i+3])
00573             pass
00574         mesh2.insertNextCell(NORM_QUAD4,4,conn2[12:16])
00575         mesh2.insertNextCell(NORM_QUAD4,4,conn2[16:20])
00576         mesh2.finishInsertingCells();
00577         return [mesh,mesh2]
00578 
00579     build2DTargetMesh_1=classmethod(build2DTargetMesh_1)
00580     build2DSourceMesh_1=classmethod(build2DSourceMesh_1)
00581     build3DTargetMesh_1=classmethod(build3DTargetMesh_1)
00582     build3DSourceMesh_1=classmethod(build3DSourceMesh_1)
00583     build3DSurfTargetMesh_1=classmethod(build3DSurfTargetMesh_1)
00584     build3DExtrudedUMesh_1=classmethod(build3DExtrudedUMesh_1)
00585     buildCU1DMesh_U=classmethod(buildCU1DMesh_U)
00586     build2DTargetMeshMergeNode_1=classmethod(build2DTargetMeshMergeNode_1)
00587     build3DTargetMeshMergeNode_1=classmethod(build3DTargetMeshMergeNode_1)
00588     build2DTargetMeshMerged_1=classmethod(build2DTargetMeshMerged_1)
00589     build2DTargetMesh_2=classmethod(build2DTargetMesh_2)
00590     build1DSourceMesh_2=classmethod(build1DSourceMesh_2)
00591     build1DTargetMesh_3=classmethod(build1DTargetMesh_3)
00592     build2DCurveTargetMesh_3=classmethod(build2DCurveTargetMesh_3)
00593     build2DTargetMesh_3=classmethod(build2DTargetMesh_3)
00594     build2DTargetMesh_4=classmethod(build2DTargetMesh_4)
00595     buildMultiFields_1=classmethod(buildMultiFields_1)
00596     buildMultiFields_2=classmethod(buildMultiFields_2)
00597     build1DMultiTypes_1=classmethod(build1DMultiTypes_1)
00598     build2DMultiTypes_1=classmethod(build2DMultiTypes_1)
00599     build3DMultiTypes_1=classmethod(build3DMultiTypes_1)
00600     buildCoordsForMultiTypes_1=classmethod(buildCoordsForMultiTypes_1)
00601     buildHexa8Mesh_1=classmethod(buildHexa8Mesh_1)
00602     buildPointe_1=classmethod(buildPointe_1)
00603     pass