Salome HOME
Fix test problem - wrong path to med file
[modules/paravis.git] / src / Plugins / MEDReader / Test / testMEDReader1.py
1 #  -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2014  CEA/DEN, EDF R&D
3 #
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
8 #
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.
13 #
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
17 #
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20 # Author : Anthony Geay
21
22 from MEDLoader import *
23
24 """
25 This test focused on ELNO. Here a 2 QUAD4 cells and a single ELNO field 
26 is defined.
27 """
28 fname="testMEDReader1.med"
29 outImgName="testMEDReader1.png"
30
31 coords=DataArrayDouble([(0,0,0),(2,1,0),(1,0,0),(1,1,0),(2,0,0),(0,1,0)])
32 m=MEDCouplingUMesh("mesh",2) ; m.setCoords(coords)
33 m.allocateCells()
34 m.insertNextCell(NORM_QUAD4,[0,5,3,2])
35 m.insertNextCell(NORM_QUAD4,[4,2,3,1])
36 m.finishInsertingCells()
37 MEDLoader.WriteMesh(fname,m,True)
38 #
39 f0=MEDCouplingFieldDouble(ON_GAUSS_NE) ; f0.setMesh(m) ; f0.setTimeUnit("ms")
40 f0.setTime(1.1,1,1)
41 f0.setName("myELNOField")
42 arr=DataArrayDouble([7,5,3,1,5,3,1,7]) ; arr.setInfoOnComponent(0,"Comp0")
43 f0.setArray(arr)
44 MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fname,f0)
45 #
46 f0.setTime(2.2,2,1)
47 arr=DataArrayDouble([1,7,5,3,7,5,3,1]) ; arr.setInfoOnComponent(0,"Comp0")
48 f0.setArray(arr)
49 MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fname,f0)
50 #
51 f0.setTime(3.3,3,1)
52 arr=DataArrayDouble([3,1,7,5,1,7,5,3]) ; arr.setInfoOnComponent(0,"Comp0")
53 f0.setArray(arr)
54 MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fname,f0)
55 #
56 f0.setTime(4.4,4,1)
57 arr=DataArrayDouble([5,3,1,7,3,1,7,5]) ; arr.setInfoOnComponent(0,"Comp0")
58 f0.setArray(arr)
59 MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fname,f0)