]> SALOME platform Git repositories - modules/paravis.git/blob - src/Plugins/GaussToCell/TestCase.py
Salome HOME
Add missing MEDFile dependency in DevelopedSurface filter CMakeLists.txt
[modules/paravis.git] / src / Plugins / GaussToCell / TestCase.py
1 from MEDLoader import *
2
3 fname="VoroGauss1.med"
4 meshName="mesh"
5 mm=MEDFileUMesh()
6 coords=DataArrayDouble([0,0, 1,0, 2,0, 3,0, 4,0, 5,0, 0,1, 1,1, 2,1, 0,2, 1,2, 3,1, 4,1],13,2)
7 m0=MEDCouplingUMesh(meshName,2)
8 m0.setCoords(coords)
9 m0.allocateCells()
10 m0.insertNextCell(NORM_TRI3,[2,3,8])
11 m0.insertNextCell(NORM_TRI3,[3,4,11])
12 m0.insertNextCell(NORM_TRI3,[4,5,12])
13 m0.insertNextCell(NORM_TRI3,[6,7,9])
14 m0.insertNextCell(NORM_TRI3,[7,8,10])
15 m0.insertNextCell(NORM_QUAD4,[0,1,7,6])
16 m0.insertNextCell(NORM_QUAD4,[1,2,8,7])
17 mm[0]=m0
18 m1=MEDCouplingUMesh(meshName,1)
19 m1.setCoords(coords)
20 m1.allocateCells()
21 m1.insertNextCell(NORM_SEG2,[0,1])
22 m1.insertNextCell(NORM_SEG2,[1,2])
23 m1.insertNextCell(NORM_SEG2,[2,3])
24 m1.insertNextCell(NORM_SEG2,[3,4])
25 m1.insertNextCell(NORM_SEG2,[4,5])
26 mm[-1]=m1
27 mm.setFamilyFieldArr(0,DataArrayInt([-1,-1,-2,-3,-3,-1,-3]))
28 mm.setFamilyFieldArr(-1,DataArrayInt([-1,-4,-4,-4,-1]))
29 for i in [-1,-2,-3,-4]:
30     mm.setFamilyId("Fam_%d"%i,i)
31     mm.setFamiliesOnGroup("G%d"%(abs(i)),["Fam_%d"%i])
32     pass
33 mm.write(fname,2)
34 #
35 f0=MEDCouplingFieldDouble(ON_GAUSS_PT)
36 f0.setMesh(m0)
37 f0.setName("MyFieldPG") ; f0.setMesh(m0)
38 f0.setGaussLocalizationOnType(NORM_TRI3,[0,0, 1,0, 0,1],[0.1,0.1, 0.8,0.1, 0.1,0.8],[0.3,0.3,0.4])
39 f0.setGaussLocalizationOnType(NORM_QUAD4,[-1,-1, 1,-1, 1,1, -1,1],[-0.57735,-0.57735,0.57735,-0.57735,0.57735,0.57735,-0.57735,0.57735],[0.25,0.25,0.25,0.25])
40 arr=DataArrayDouble(f0.getNumberOfTuplesExpected()) ; arr.iota()
41 arr=DataArrayDouble.Meld(arr,arr)
42 arr.setInfoOnComponents(["comp0","comp1"])
43 f0.setArray(arr)
44 WriteFieldUsingAlreadyWrittenMesh(fname,f0)
45 #
46 f1=MEDCouplingFieldDouble(ON_CELLS)
47 f1.setMesh(m0)
48 f1.setName("MyFieldCell") ; f1.setMesh(m0)
49 arr=DataArrayDouble(f1.getNumberOfTuplesExpected()) ; arr.iota()
50 arr=DataArrayDouble.Meld(arr,arr)
51 arr.setInfoOnComponents(["comp2","comp3"])
52 f1.setArray(arr)
53 WriteFieldUsingAlreadyWrittenMesh(fname,f1)
54