Back to index

salome-med  6.5.0
MEDLoaderDataForTest.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 MEDLoader import *
00022 from math import pi,e,sqrt
00023 
00024 class MEDLoaderDataForTest:
00025     def build1DMesh_1(cls):
00026         coords=[ 0.0, 0.3, 0.75, 1.0, 1.4, 1.3 ]
00027         conn=[ 0,1, 1,2, 2,3 , 3,4,5]
00028         mesh=MEDCouplingUMesh.New();
00029         mesh.setName("1DMesh_1");
00030         mesh.setMeshDimension(1);
00031         mesh.allocateCells(4);
00032         mesh.insertNextCell(NORM_SEG2,2,conn[0:2])
00033         mesh.insertNextCell(NORM_SEG2,2,conn[2:4])
00034         mesh.insertNextCell(NORM_SEG2,2,conn[4:6])
00035         mesh.insertNextCell(NORM_SEG3,3,conn[6:9])
00036         mesh.finishInsertingCells();
00037         myCoords=DataArrayDouble.New();
00038         myCoords.setValues(coords,6,1);
00039         myCoords.setInfoOnComponent(0,"tototototototot [m*m*m*m*m*m*m*m]");
00040         mesh.setCoords(myCoords);
00041         return mesh;
00042 
00043     def build2DCurveMesh_1(cls):
00044         coords=[ 0.0,0.0, 0.3,0.3, 0.75,0.75, 1.0,1.0, 1.4,1.4, 1.3,1.3 ]
00045         conn=[ 0,1, 1,2, 2,3 , 3,4,5]
00046         mesh=MEDCouplingUMesh.New();
00047         mesh.setName("2DCurveMesh_1");
00048         mesh.setMeshDimension(1);
00049         mesh.allocateCells(4);
00050         mesh.insertNextCell(NORM_SEG2,2,conn[0:2])
00051         mesh.insertNextCell(NORM_SEG2,2,conn[2:4])
00052         mesh.insertNextCell(NORM_SEG2,2,conn[4:6])
00053         mesh.insertNextCell(NORM_SEG3,3,conn[6:9])
00054         mesh.finishInsertingCells();
00055         myCoords=DataArrayDouble.New();
00056         myCoords.setValues(coords,6,2);
00057         mesh.setCoords(myCoords);
00058         return mesh;
00059 
00060     def build2DMesh_1(cls):
00061         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,
00062                       -0.05,0.95, 0.2,1.2, 0.45,0.95]
00063         targetConn=[1,4,2, 4,5,2, 6,10,8,9,11,7, 0,3,4,1, 6,7,4,3, 7,8,5,4]
00064         targetMesh=MEDCouplingUMesh.New();
00065         targetMesh.setMeshDimension(2);
00066         targetMesh.allocateCells(6);
00067         targetMesh.setName("2DMesh_1");
00068         targetMesh.insertNextCell(NORM_TRI3,3,targetConn[0:3])
00069         targetMesh.insertNextCell(NORM_TRI3,3,targetConn[3:6])
00070         targetMesh.insertNextCell(NORM_TRI6,6,targetConn[6:12])
00071         targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[12:16])
00072         targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[16:20])
00073         targetMesh.insertNextCell(NORM_POLYGON,4,targetConn[20:24])
00074         targetMesh.finishInsertingCells();
00075         myCoords=DataArrayDouble.New();
00076         myCoords.setValues(targetCoords,12,2);
00077         myCoords.setInfoOnComponent(0,"tototototototot [m]");
00078         myCoords.setInfoOnComponent(1,"energie [kW]");
00079         targetMesh.setCoords(myCoords)
00080         return targetMesh;
00081 
00082     def build2DMesh_2(cls):
00083         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,
00084                       -0.05,0.95, 0.2,1.2, 0.45,0.95]
00085         targetConn=[1,4,2, 4,5,2, 6,10,8,9,11,7, 0,3,4,1, 6,7,4,3, 7,8,5,4]
00086         targetMesh=MEDCouplingUMesh.New();
00087         targetMesh.setMeshDimension(2);
00088         targetMesh.allocateCells(5);
00089         targetMesh.setName("2DMesh_2");
00090         targetMesh.insertNextCell(NORM_TRI3,3,targetConn[0:3])
00091         targetMesh.insertNextCell(NORM_TRI3,3,targetConn[3:6])
00092         targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[12:16])
00093         targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[16:20])
00094         targetMesh.insertNextCell(NORM_TRI6,6,targetConn[6:12])
00095         targetMesh.finishInsertingCells();
00096         myCoords=DataArrayDouble.New();
00097         myCoords.setValues(targetCoords,12,2);
00098         myCoords.setInfoOnComponent(0,"toto [m]");
00099         myCoords.setInfoOnComponent(1,"energie [kW]");
00100         targetMesh.setCoords(myCoords);
00101         return targetMesh;
00102 
00103     #this mesh has several cells duplicated ! it is not beautiful but efficient to test file WR.
00104     def build2DMesh_3(cls):
00105         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,
00106                       -0.05,0.95, 0.2,1.2, 0.45,0.95]
00107         targetConn=[1,4,2, 4,5,2, 6,10,8,9,11,7, 0,3,4,1, 6,7,4,3, 7,8,5,4]
00108         targetMesh=MEDCouplingUMesh.New();
00109         targetMesh.setMeshDimension(2);
00110         targetMesh.allocateCells(13);
00111         targetMesh.setName("2DMesh_3");
00112         targetMesh.insertNextCell(NORM_TRI3,3,targetConn[0:3])
00113         targetMesh.insertNextCell(NORM_TRI3,3,targetConn[3:6])
00114         targetMesh.insertNextCell(NORM_TRI3,3,targetConn[0:3])
00115         targetMesh.insertNextCell(NORM_TRI3,3,targetConn[3:6])
00116         targetMesh.insertNextCell(NORM_TRI3,3,targetConn[0:3])
00117         targetMesh.insertNextCell(NORM_TRI3,3,targetConn[3:6])
00118         targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[12:16])
00119         targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[16:20])
00120         targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[12:16])
00121         targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[16:20])
00122         targetMesh.insertNextCell(NORM_TRI6,6,targetConn[6:12])
00123         targetMesh.insertNextCell(NORM_TRI6,6,targetConn[6:12])
00124         targetMesh.insertNextCell(NORM_TRI6,6,targetConn[6:12])
00125         targetMesh.finishInsertingCells();
00126         myCoords=DataArrayDouble.New();
00127         myCoords.setValues(targetCoords,12,2);
00128         myCoords.setInfoOnComponent(0,"toto [m]");
00129         myCoords.setInfoOnComponent(1,"energie [kW]");
00130         targetMesh.setCoords(myCoords);
00131         return targetMesh;
00132 
00133     def build3DMesh_1(cls):
00134         coords=[0.,0.,0., 1.,1.,0., 1.,1.25,0., 0.,1.,0., 1.,1.5,0., 2.,0.,0., 2.,1.,0., 1.,2.,0., 0.,2.,0., 3.,1.,0.,
00135                 3.,2.,0., 0.,1.,0., 1.,3.,0., 2.,2.,0., 2.,3.,0.,
00136                 0.,0.,1., 1.,1.,1., 1.,1.25,1., 0.,1.,1., 1.,1.5,1., 2.,0.,1., 2.,1.,1., 1.,2.,1., 0.,2.,1., 3.,1.,1.,
00137                 3.,2.,1., 0.,1.,1., 1.,3.,1., 2.,2.,1., 2.,3.,1.,
00138                 0.,0.,2., 1.,1.,2., 1.,1.25,2., 0.,1.,2., 1.,1.5,2., 2.,0.,2., 2.,1.,2., 1.,2.,2., 0.,2.,2., 3.,1.,2.,
00139         3.,2.,2., 0.,1.,2., 1.,3.,2., 2.,2.,2., 2.,3.,2.,
00140                 0.,0.,3., 1.,1.,3., 1.,1.25,3., 0.,1.,3., 1.,1.5,3., 2.,0.,3., 2.,1.,3., 1.,2.,3., 0.,2.,3., 3.,1.,3.,
00141                 3.,2.,3., 0.,1.,3., 1.,3.,3., 2.,2.,3., 2.,3.,3.]
00142         conn=[
00143             # 0
00144             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,
00145             1,6,5,3,16,21,20,18,   13,10,9,6,28,25,24,21,
00146             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,
00147             7,12,14,13,22,27,29,28,
00148             # 1
00149             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,
00150             16,21,20,18,31,36,35,33,   28,25,24,21,43,40,39,36,
00151             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,
00152             22,27,29,28,37,42,44,43,
00153             # 2
00154             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,
00155             31,36,35,33,46,51,50,48,  43,40,39,36,58,55,54,51,
00156             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,
00157             37,42,44,43,52,57,59,58]
00158         #
00159         ret=MEDCouplingUMesh.New();
00160         ret.setName("3DMesh_1");
00161         ret.setMeshDimension(3);
00162         ret.allocateCells(18);
00163         #
00164         ret.insertNextCell(NORM_HEXA8,8,conn[0:8])
00165         ret.insertNextCell(NORM_HEXA8,8,conn[51:59])
00166         ret.insertNextCell(NORM_HEXA8,8,conn[59:67])
00167         ret.insertNextCell(NORM_HEXA8,8,conn[110:118])
00168         #
00169         ret.insertNextCell(NORM_HEXA8,8,conn[118:126])
00170         ret.insertNextCell(NORM_HEXA8,8,conn[169:177])
00171         ret.insertNextCell(NORM_HEXA8,8,conn[177:185])
00172         ret.insertNextCell(NORM_HEXA8,8,conn[228:236])
00173         #
00174         ret.insertNextCell(NORM_HEXA8,8,conn[236:244])
00175         ret.insertNextCell(NORM_HEXA8,8,conn[287:295])
00176         ret.insertNextCell(NORM_HEXA8,8,conn[295:303])
00177         ret.insertNextCell(NORM_HEXA8,8,conn[346:354])
00178         #
00179         ret.insertNextCell(NORM_POLYHED,43,conn[8:51])
00180         ret.insertNextCell(NORM_POLYHED,43,conn[67:110])
00181         ret.insertNextCell(NORM_POLYHED,43,conn[126:169])
00182         ret.insertNextCell(NORM_POLYHED,43,conn[185:228])
00183         ret.insertNextCell(NORM_POLYHED,43,conn[244:287])
00184         ret.insertNextCell(NORM_POLYHED,43,conn[303:346])
00185         #
00186         ret.finishInsertingCells();
00187         myCoords=DataArrayDouble.New();
00188         myCoords.setValues(coords,60,3);
00189         myCoords.setInfoOnComponent(0,"titi [m]");
00190         myCoords.setInfoOnComponent(1,"density power [MW/m^3]");
00191         myCoords.setInfoOnComponent(2,"t [kW]");
00192         ret.setCoords(myCoords);
00193         return ret;
00194     
00195     def build3DSurfMesh_1(cls):
00196         targetCoords=[-0.3,-0.3,-0.3, 0.2,-0.3,-0.3, 0.7,-0.3,-0.3, -0.3,0.2,-0.3, 0.2,0.2,-0.3, 0.7,0.2,-0.3, -0.3,0.7,-0.3, 0.2,0.7,-0.3, 0.7,0.7,-0.3
00197                       ,-0.05,0.95,-0.3, 0.2,1.2,-0.3, 0.45,0.95,-0.3]
00198         targetConn=[1,4,2, 4,5,2, 6,10,8,9,11,7, 0,3,4,1, 6,7,4,3, 7,8,5,4]
00199         targetMesh=MEDCouplingUMesh.New();
00200         targetMesh.setMeshDimension(2);
00201         targetMesh.allocateCells(6);
00202         targetMesh.setName("3DSurfMesh_1");
00203         targetMesh.insertNextCell(NORM_TRI3,3,targetConn[0:3])
00204         targetMesh.insertNextCell(NORM_TRI3,3,targetConn[3:6])
00205         targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[12:16])
00206         targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[16:20])
00207         targetMesh.insertNextCell(NORM_TRI6,6,targetConn[6:12])
00208         targetMesh.insertNextCell(NORM_POLYGON,4,targetConn[20:24])
00209         targetMesh.finishInsertingCells();
00210         myCoords=DataArrayDouble.New();
00211         myCoords.setValues(targetCoords,12,3);
00212         myCoords.setInfoOnComponent(0,"toto [m]");
00213         myCoords.setInfoOnComponent(2,"ff [km]");#component 1 is not set for test
00214         targetMesh.setCoords(myCoords);
00215         return targetMesh;
00216     
00217     def build3DMesh_2(cls):
00218         m3dsurfBase=MEDLoaderDataForTest.build3DSurfMesh_1();
00219         numbers=[0,1,2,3,5]
00220         m3dsurf=m3dsurfBase.buildPartOfMySelf(numbers,False);
00221         m1dBase=MEDLoaderDataForTest.build1DMesh_1();
00222         numbers2=[0,1,2,3]
00223         m1d=m1dBase.buildPartOfMySelf(numbers2,False);
00224         m1d.changeSpaceDimension(3);
00225         vec=[0.,1.,0.]
00226         pt=[0.,0.,0.]
00227         m1d.rotate(pt,vec,-pi/2.);
00228         ret=m3dsurf.buildExtrudedMesh(m1d,0);
00229         return ret;
00230 
00231     def buildMultiLevelMesh_1(cls):
00232         coo=[10.,0.,10.,1.25,10.,2.5,10.,3.75,10.,5.,8.75,0.,8.75,1.25,8.75,2.5,8.75,3.75,8.75,5.,7.5,0.,7.5,1.25,7.5,2.5,7.5,3.75,7.5,5.,6.25,0.,6.25,1.25,6.25,2.5,6.25,3.75,6.25,5.,5.,0.,5.,1.25,5.,2.5,5.,3.75,5.,5.,3.75,0.,3.75,1.25,3.75,2.5,3.75,3.75,3.75,5.,2.5,0.,2.5,1.25,2.5,2.5,2.5,3.75,2.5,5.,1.25,0.,1.25,1.25,1.25,2.5,1.25,3.75,1.25,5.,0.,1.25,0.,2.5,0.,3.75,0.,5.,0.,0.,0.,5.,10.,5.,0.,10.,10.,10.,5.,5.,5.,5.,5.,10.,5.,10.,0.625,5.,1.25,5.,1.875,5.,2.5,5.,3.125,5.,3.75,5.,4.375,5.,5.,6.25,5.,7.5,5.,8.75,4.375,10.,3.75,10.,3.125,10.,2.5,10.,1.875,10.,1.25,10.,0.625,10.,0.,8.75,0.,7.5,0.,6.25,4.375,6.25,4.375,7.5,4.375,8.75,3.75,6.25,3.75,7.5,3.75,8.75,3.125,6.25,3.125,7.5,3.125,8.75,2.5,6.25,2.5,7.5,2.5,8.75,1.875,6.25,1.875,7.5,1.875,8.75,1.25,6.25,1.25,7.5,1.25,8.75,0.625,6.25,0.625,7.5,0.625,8.75,5.625,5.,6.25,5.,6.875,5.,7.5,5.,8.125,5.,8.75,5.,9.375,5.,10.,6.25,10.,7.5,10.,8.75,9.375,10.,8.75,10.,8.125,10.,7.5,10.,6.875,10.,6.25,10.,5.625,10.,5.,8.75,5.,7.5,5.,6.25,9.375,6.25,9.375,7.5,9.375,8.75,8.75,6.25,8.75,7.5,8.75,8.75,8.125,6.25,8.125,7.5,8.125,8.75,7.5,6.25,7.5,7.5,7.5,8.75,6.875,6.25,6.875,7.5,6.875,8.75,6.25,6.25,6.25,7.5,6.25,8.75,5.625,6.25,5.625,7.5,5.625,8.75]
00233         coo2=DataArrayDouble.New()
00234         coo2.setValues(coo,135,2)
00235         coo2=coo2.changeNbOfComponents(3,0.)
00236         coo2.setInfoOnComponent(0,"X [INCONNUE]")
00237         coo2.setInfoOnComponent(1,"Y [INCONNUE]")
00238         coo2.setInfoOnComponent(2,"Z [INCONNUE]")
00239         c2tri=[0,1,6,0,6,5,1,2,6,2,7,6,2,3,8,2,8,7,3,4,8,4,9,8,5,6,11,5,11,10,6,7,11,7,12,11,7,8,13,7,13,12,8,9,13,9,14,13,10,11,16,10,16,15,11,12,16,12,17,16,12,13,18,12,18,17,13,14,18,14,19,18,15,16,21,15,21,20,16,17,21,17,22,21,17,18,23,17,23,22,18,19,23,19,24,23,20,21,26,20,26,25,21,22,26,22,27,26,22,23,28,22,28,27,23,24,28,24,29,28,25,26,31,25,31,30,26,27,31,27,32,31,27,28,33,27,33,32,28,29,33,29,34,33,30,31,36,30,36,35,31,32,36,32,37,36,32,33,38,32,38,37,33,34,38,34,39,38,35,36,40,35,40,44,36,37,40,37,41,40,37,38,42,37,42,41,38,39,42,39,43,42]
00240         c2quad4=[46,101,114,100,101,102,115,114,102,103,116,115,103,48,104,116,100,114,117,99,114,115,118,117,115,116,119,118,116,104,105,119,99,117,120,98,117,118,121,120,118,119,122,121,119,105,106,122,98,120,123,97,120,121,124,123,121,122,125,124,122,106,107,125,97,123,126,96,123,124,127,126,124,125,128,127,125,107,108,128,96,126,129,95,126,127,130,129,127,128,131,130,128,108,109,131,95,129,132,94,129,130,133,132,130,131,134,133,131,109,110,134,94,132,113,50,132,133,112,113,133,134,111,112,134,110,51,111,49,60,73,59,60,61,74,73,61,62,75,74,62,52,63,75,59,73,76,58,73,74,77,76,74,75,78,77,75,63,64,78,58,76,79,57,76,77,80,79,77,78,81,80,78,64,65,81,57,79,82,56,79,80,83,82,80,81,84,83,81,65,66,84,56,82,85,55,82,83,86,85,83,84,87,86,84,66,67,87,55,85,88,54,85,86,89,88,86,87,90,89,87,67,68,90,54,88,91,53,88,89,92,91,89,90,93,92,90,68,69,93,53,91,72,45,91,92,71,72,92,93,70,71,93,69,47,70]
00241         m2=MEDCouplingUMesh.New("ma",2)
00242         m2.setCoords(coo2)
00243         m2.allocateCells(128)
00244         nbTri=len(c2tri)/3
00245         for i in xrange(nbTri):
00246             m2.insertNextCell(NORM_TRI3,3,c2tri[3*i:3*i+3])
00247             pass
00248         nbQua=len(c2quad4)/4
00249         for i in xrange(nbQua):
00250             m2.insertNextCell(NORM_QUAD4,4,c2quad4[4*i:4*i+4])
00251             pass
00252         m2.finishInsertingCells()
00253         m2.setDescription("CREE PAR CODE_ASTER")
00254         m1=MEDCouplingUMesh.New("ma",1)
00255         m1.setCoords(coo2)
00256         c1seg=[0,1,1,2,2,3,3,4,4,9,9,14,14,19,19,24,24,29,29,34,34,39,39,43,43,42,42,41,41,40,40,44,44,35,35,30,30,25,25,20,20,15,15,10,10,5,5,0,43,39,39,34,34,29,29,24,24,19,19,14,14,9,9,4,45,53,53,54,54,55,55,56,56,57,57,58,58,59,59,49,49,60,60,61,61,62,62,52,52,63,63,64,64,65,65,66,66,67,67,68,68,69,69,47,47,70,70,71,71,72,72,45,50,94,94,95,95,96,96,97,97,98,98,99,99,100,100,46,46,101,101,102,102,103,103,48,48,104,104,105,105,106,106,107,107,108,108,109,109,110,110,51,51,111,111,112,112,113,113,50]
00257         m1.allocateCells(80)
00258         for i in xrange(80):
00259             m1.insertNextCell(NORM_SEG2,2,c1seg[2*i:2*i+2])
00260             pass
00261         m1.finishInsertingCells()
00262         m1.setDescription("CREE PAR CODE_ASTER")
00263         m0=MEDCouplingUMesh.New("ma",0)
00264         m0.setCoords(coo2)
00265         c0pt=[44,0,47,48]
00266         m0.allocateCells(4)
00267         for i in xrange(4):
00268             m0.insertNextCell(NORM_POINT1,1,[c0pt[i]])
00269             pass
00270         m0.finishInsertingCells()
00271         f2=DataArrayInt.New()
00272         f2.alloc(128,1)
00273         f2[:64]=-1
00274         f2[64:96]=-2
00275         f2[96:]=-3
00276         f1=DataArrayInt.New()
00277         f1.alloc(80,1)
00278         f1[:4]=-8
00279         f1[4:12]=-9
00280         f1[12:16]=-10
00281         f1[16:24]=-11
00282         f1[24:28]=-12
00283         f1[28:32]=-13
00284         f1[32:40]=-14
00285         f1[40:44]=-15
00286         f1[44:52]=-16
00287         f1[52:56]=-17
00288         f1[56:64]=-18
00289         f1[64:68]=-19
00290         f1[68:76]=-20
00291         f1[76:]=-21
00292         f0=DataArrayInt.New()
00293         f0.setValues([-4,-5,-6,-7],4,1)
00294         p=DataArrayInt.New()
00295         p.alloc(135,1)
00296         p.fillWithZero()
00297         p1=DataArrayInt.New()
00298         p1.alloc(13,1)
00299         p1.iota(1)
00300         p[[0,4,24,43,44,45,46,47,48,49,50,51,52]]=p1
00301         n2=DataArrayInt.New()
00302         n2.alloc(128,1)
00303         n2.iota(1)
00304         n1=DataArrayInt.New()
00305         n1.alloc(80,1)
00306         n1.iota(133)
00307         n0=DataArrayInt.New()
00308         n0.alloc(4,1)
00309         n0.iota(129)
00310         fns=['A1A2____________________________', 'A1______________________________', 'A2A4____________________________', 'A2______________________________', 'A3A1____________________________', 'A3C5____________________________', 'A3______________________________', 'A4A3____________________________', 'A4______________________________', 'B1C1____________________________', 'B1______________________________', 'B2B4____________________________', 'B2______________________________', 'B3B1____________________________', 'B3______________________________', 'B4C3____________________________', 'B4______________________________', 'C1C4____________________________', 'C1______________________________', 'C2B2____________________________', 'C2______________________________', 'C3C2____________________________', 'C3______________________________', 'C4B3____________________________', 'C4______________________________', 'C5A4____________________________', 'C5______PMMA____________________', 'FAMILLE_ZERO', 'MESH____APPS____AP1_____________', 'MESH____APPS____AP2_____________', 'MESH____APPS____AP3_____________', 'MESH____APPS____AP4_____________', 'MESH____DALQ1___DALLE___________', 'MESH____DALQ2___DALLE___________', 'MESH____DALT3___DALLE___________']
00311         fids=[-11, 5, -8, 1, -10, -12, 4, -9, 2, -14, 6, -19, 7, -17, 8, -20, 9, -15, 10, -18, 11, -21, 12, -16, 13, -13, 3, 0, -4, -5, -6, -7, -3, -2, -1]
00312         grpns=['A1', 'A1A2', 'A2', 'A2A4', 'A3', 'A3A1', 'A3C5', 'A4', 'A4A3', 'AP1', 'AP2', 'AP3', 'AP4', 'APPS', 'B1', 'B1C1', 'B2', 'B2B4', 'B3', 'B3B1', 'B4', 'B4C3', 'C1', 'C1C4', 'C2', 'C2B2', 'C3', 'C3C2', 'C4', 'C4B3', 'C5', 'C5A4', 'DALLE', 'DALQ1', 'DALQ2', 'DALT3', 'MESH', 'PMMA']
00313         famIdsPerGrp=[[5],[-11],[1],[-8],[4],[-10],[-12],[2],[-9],[-4],[-5],[-6],[-7],[-4,-5,-6,-7],[6],[-14],[7],[-19],[8],[-17],[9],[-20],[10],[-15],[11],[-18],[12],[-21],[13],[-16],[3],[-13],[-3,-2,-1],[-3],[-2],[-1],[-4,-5,-6,-7,-3,-2,-1],[3]]
00314         return m2,m1,m0,f2,f1,f0,p,n2,n1,n0,fns,fids,grpns,famIdsPerGrp
00315 
00316     def buildVecFieldOnCells_1(cls):
00317         mesh=MEDLoaderDataForTest.build3DSurfMesh_1();
00318         nbOfCells=mesh.getNumberOfCells();
00319         f1=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME);
00320         f1.setName("VectorFieldOnCells");
00321         f1.setMesh(mesh);
00322         array=DataArrayDouble.New();
00323         arr1=[0.,10.,20.,1.,11.,21.,2.,12.,22.,3.,13.,23.,4.,14.,24.,5.,15.,25.]
00324         array.setValues(arr1,nbOfCells,3);
00325         array.setInfoOnComponent(0,"power [MW/m^3]");
00326         array.setInfoOnComponent(1,"density [g/cm^3]");
00327         array.setInfoOnComponent(2,"temperature [K]");
00328         f1.setArray(array);
00329         tmp=array.getPointer();
00330         f1.setTime(2.,0,1);
00331         f1.checkCoherency();
00332         return f1;
00333 
00334     def buildVecFieldOnNodes_1(cls):
00335         mesh=MEDLoaderDataForTest.build3DSurfMesh_1();
00336         nbOfNodes=mesh.getNumberOfNodes();
00337         f1=MEDCouplingFieldDouble.New(ON_NODES,ONE_TIME);
00338         f1.setName("VectorFieldOnNodes");
00339         f1.setMesh(mesh);
00340         array=DataArrayDouble.New();
00341         f1.setArray(array);
00342         arr1=[70.,80.,90.,71.,81.,91.,72.,82.,92.,73.,83.,93.,74.,84.,94.,75.,85.,95.,
00343         1000.,10010.,10020.,1001.,10011.,10021.,1002.,10012.,10022.,1003.,10013.,10023.,1004.,10014.,10024.,1005.,10015.,10025.]
00344         array.setValues(arr1,nbOfNodes,3);
00345         array.setInfoOnComponent(0,"power [MW/m^3]");
00346         array.setInfoOnComponent(1,"density [g/cm^3]");
00347         array.setInfoOnComponent(2,"temperature [K]");
00348         f1.setTime(2.12,2,3);
00349         f1.checkCoherency();
00350         return f1;
00351 
00352     def buildVecFieldOnGauss_1(cls):
00353         _a=0.446948490915965;
00354         _b=0.091576213509771;
00355         _p1=0.11169079483905;
00356         _p2=0.0549758718227661;
00357         refCoo1=[ 0.,0., 1.,0., 0.,1. ]
00358         gsCoo1=[ 2*_b-1, 1-4*_b, 2*_b-1, 2.07*_b-1, 1-4*_b,
00359                  2*_b-1, 1-4*_a, 2*_a-1, 2*_a-1, 1-4*_a, 2*_a-1, 2*_a-1 ];
00360         wg1=[ 4*_p2, 4*_p2, 4*_p2, 4*_p1, 4*_p1, 4*_p1 ]
00361         _refCoo1=refCoo1;
00362         _gsCoo1=gsCoo1;
00363         _wg1=wg1;
00364         m=MEDLoaderDataForTest.build2DMesh_2();
00365         f=MEDCouplingFieldDouble.New(ON_GAUSS_PT,ONE_TIME);
00366         f.setTime(3.14,1,5);
00367         f.setMesh(m);
00368         f.setGaussLocalizationOnType(NORM_TRI3,_refCoo1,_gsCoo1,_wg1);
00369         refCoo2=[-1.0,1.0, -1.0,-1.0, 1.0,-1.0, -1.0,0.0, 0.0,-1.0, 0.0,0.0 ]
00370         _refCoo2=refCoo2;
00371         _gsCoo1=_gsCoo1[0:6];
00372         _gsCoo2=_gsCoo1
00373         _wg1=_wg1[0:3];
00374         _wg2=_wg1
00375         refCoo3=[ 0.,0., 1.,0., 1.,1., 0.,1. ]
00376         _refCoo3=refCoo3;
00377         _gsCoo1=_gsCoo1[0:4];
00378         _wg1=_wg1[0:2];
00379         f.setGaussLocalizationOnType(NORM_QUAD4,_refCoo3,_gsCoo1,_wg1);
00380         f.setGaussLocalizationOnType(NORM_TRI6,_refCoo2,_gsCoo2,_wg2);
00381         array=DataArrayDouble.New();
00382         array.alloc(19,2);
00383         ptr=array.getPointer();
00384         for i in xrange(19*2):
00385             array.setIJ(0,i,float(i+7));
00386             pass
00387         f.setArray(array);
00388         f.setName("MyFirstFieldOnGaussPoint");
00389         array.setInfoOnComponent(0,"power [MW/m^3]");
00390         array.setInfoOnComponent(1,"density");
00391         f.checkCoherency();
00392         return f;
00393 
00394     def buildVecFieldOnGauss_2(cls):
00395         _a=0.446948490915965;
00396         _b=0.091576213509771;
00397         _p1=0.11169079483905;
00398         _p2=0.0549758718227661;
00399         refCoo1=[ 0.,0., 1.,0., 0.,1. ]
00400         gsCoo1=[ 2*_b-1, 1-4*_b, 2*_b-1, 2.07*_b-1, 1-4*_b,
00401                  2*_b-1, 1-4*_a, 2*_a-1, 2*_a-1, 1-4*_a, 2*_a-1, 2*_a-1 ];
00402         wg1=[ 4*_p2, 4*_p2, 4*_p2, 4*_p1, 4*_p1, 4*_p1 ]
00403         _refCoo1=refCoo1;
00404         _gsCoo1=gsCoo1;
00405         _wg1=wg1;
00406         m=MEDLoaderDataForTest.build2DMesh_3();
00407         f=MEDCouplingFieldDouble.New(ON_GAUSS_PT,ONE_TIME);
00408         f.setTime(3.14,1,5);
00409         f.setMesh(m);
00410         di=DataArrayInt.New(); di.setValues([0,2,3],3,1)
00411         f.setGaussLocalizationOnCells(di,_refCoo1,_gsCoo1,_wg1)
00412         _wg1[-1]*=2
00413         f.setGaussLocalizationOnCells([1,5],_refCoo1,_gsCoo1,_wg1);
00414         _wg1[-1]*=2
00415         f.setGaussLocalizationOnCells([4],_refCoo1,_gsCoo1,_wg1);
00416         refCoo2=[-1.0,1.0, -1.0,-1.0, 1.0,-1.0, -1.0,0.0, 0.0,-1.0, 0.0,0.0 ]
00417         _refCoo2=refCoo2;
00418         _gsCoo1=_gsCoo1[0:6];
00419         _gsCoo2=_gsCoo1
00420         _wg1=_wg1[0:3];
00421         _wg2=_wg1
00422         refCoo3=[ 0.,0., 1.,0., 1.,1., 0.,1. ]
00423         _refCoo3=refCoo3;
00424         _gsCoo1=_gsCoo1[0:4];
00425         _wg1=_wg1[0:2];
00426         f.setGaussLocalizationOnCells([6,7,8],_refCoo3,_gsCoo1,_wg1);
00427         _wg1[-1]*=2
00428         f.setGaussLocalizationOnCells([9],_refCoo3,_gsCoo1,_wg1);
00429         f.setGaussLocalizationOnType(NORM_TRI6,_refCoo2,_gsCoo2,_wg2);
00430         array=DataArrayDouble.New();
00431         array.alloc(53,2);
00432         ptr=array.getPointer();
00433         for i in xrange(53*2):
00434             array.setIJ(0,i,float(i+7));
00435             pass
00436         f.setArray(array);
00437         f.setName("MyFirstFieldOnGaussPoint");
00438         array.setInfoOnComponent(0,"power [MW/m^3]");
00439         array.setInfoOnComponent(1,"density");
00440         f.checkCoherency();
00441         return f;
00442 
00443     # idem buildVecFieldOnGauss_2 except that different discretizations are sorted inside one type
00444     def buildVecFieldOnGauss_2_Simpler(cls):
00445         _a=0.446948490915965;
00446         _b=0.091576213509771;
00447         _p1=0.11169079483905;
00448         _p2=0.0549758718227661;
00449         refCoo1=[ 0.,0., 1.,0., 0.,1. ]
00450         gsCoo1=[ 2*_b-1, 1-4*_b, 2*_b-1, 2.07*_b-1, 1-4*_b,
00451                  2*_b-1, 1-4*_a, 2*_a-1, 2*_a-1, 1-4*_a, 2*_a-1, 2*_a-1 ];
00452         wg1=[ 4*_p2, 4*_p2, 4*_p2, 4*_p1, 4*_p1, 4*_p1 ]
00453         _refCoo1=refCoo1;
00454         _gsCoo1=gsCoo1;
00455         _wg1=wg1;
00456         m=MEDLoaderDataForTest.build2DMesh_3();
00457         f=MEDCouplingFieldDouble.New(ON_GAUSS_PT,ONE_TIME);
00458         f.setTime(3.14,1,5);
00459         f.setMesh(m);
00460         di=DataArrayInt.New(); di.setValues([0,1,2],3,1)
00461         f.setGaussLocalizationOnCells(di,_refCoo1,_gsCoo1,_wg1)
00462         _wg1[-1]*=2
00463         f.setGaussLocalizationOnCells([3,4],_refCoo1,_gsCoo1,_wg1);
00464         _wg1[-1]*=2
00465         f.setGaussLocalizationOnCells([5],_refCoo1,_gsCoo1,_wg1);
00466         refCoo2=[-1.0,1.0, -1.0,-1.0, 1.0,-1.0, -1.0,0.0, 0.0,-1.0, 0.0,0.0 ]
00467         _refCoo2=refCoo2;
00468         _gsCoo1=_gsCoo1[0:6];
00469         _gsCoo2=_gsCoo1
00470         _wg1=_wg1[0:3];
00471         _wg2=_wg1
00472         refCoo3=[ 0.,0., 1.,0., 1.,1., 0.,1. ]
00473         _refCoo3=refCoo3;
00474         _gsCoo1=_gsCoo1[0:4];
00475         _wg1=_wg1[0:2];
00476         f.setGaussLocalizationOnCells([6,7,8],_refCoo3,_gsCoo1,_wg1);
00477         _wg1[-1]*=2
00478         f.setGaussLocalizationOnCells([9],_refCoo3,_gsCoo1,_wg1);
00479         f.setGaussLocalizationOnType(NORM_TRI6,_refCoo2,_gsCoo2,_wg2);
00480         array=DataArrayDouble.New();
00481         array.alloc(53,2);
00482         ptr=array.getPointer();
00483         for i in xrange(53*2):
00484             array.setIJ(0,i,float(i+7));
00485             pass
00486         f.setArray(array);
00487         f.setName("MyFirstFieldOnGaussPoint");
00488         array.setInfoOnComponent(0,"power [MW/m^3]");
00489         array.setInfoOnComponent(1,"density");
00490         f.checkCoherency();
00491         return f;
00492 
00493     def buildVecFieldOnGaussNE_1(cls):
00494         m=MEDLoaderDataForTest.build2DMesh_2();
00495         f=MEDCouplingFieldDouble.New(ON_GAUSS_NE,ONE_TIME);
00496         f.setTime(3.14,1,5);
00497         f.setMesh(m);
00498         array=DataArrayDouble.New();
00499         array.alloc(20,2);
00500         for i in xrange(2*20):
00501             array.setIJ(0,i,float(i+8));
00502         f.setArray(array);
00503         array.setInfoOnComponent(0,"power [W]");
00504         array.setInfoOnComponent(1,"temperature");
00505         f.setName("MyFieldOnGaussNE");
00506         f.checkCoherency();
00507         return f;
00508     
00509     build1DMesh_1=classmethod(build1DMesh_1)
00510     build2DCurveMesh_1=classmethod(build2DCurveMesh_1)
00511     build2DMesh_1=classmethod(build2DMesh_1)
00512     build2DMesh_2=classmethod(build2DMesh_2)
00513     build2DMesh_3=classmethod(build2DMesh_3)
00514     build3DMesh_1=classmethod(build3DMesh_1)
00515     build3DSurfMesh_1=classmethod(build3DSurfMesh_1)
00516     build3DMesh_2=classmethod(build3DMesh_2)
00517     buildMultiLevelMesh_1=classmethod(buildMultiLevelMesh_1)
00518     buildVecFieldOnCells_1=classmethod(buildVecFieldOnCells_1)
00519     buildVecFieldOnNodes_1=classmethod(buildVecFieldOnNodes_1)
00520     buildVecFieldOnGauss_1=classmethod(buildVecFieldOnGauss_1)
00521     buildVecFieldOnGauss_2=classmethod(buildVecFieldOnGauss_2)
00522     buildVecFieldOnGauss_2_Simpler=classmethod(buildVecFieldOnGauss_2_Simpler)
00523     buildVecFieldOnGaussNE_1=classmethod(buildVecFieldOnGaussNE_1)
00524     pass