1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2014 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
20 # Author : Anthony Geay
22 from MEDLoader import *
25 This test focused on ELNO. Here a 2 QUAD4 cells and a single ELNO field
28 fname="testMEDReader1.med"
29 outImgName="testMEDReader1.png"
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)
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)
39 f0=MEDCouplingFieldDouble(ON_GAUSS_NE) ; f0.setMesh(m) ; f0.setTimeUnit("ms")
41 f0.setName("myELNOField")
42 arr=DataArrayDouble([7,5,3,1,5,3,1,7]) ; arr.setInfoOnComponent(0,"Comp0")
44 MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fname,f0)
47 arr=DataArrayDouble([1,7,5,3,7,5,3,1]) ; arr.setInfoOnComponent(0,"Comp0")
49 MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fname,f0)
52 arr=DataArrayDouble([3,1,7,5,1,7,5,3]) ; arr.setInfoOnComponent(0,"Comp0")
54 MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fname,f0)
57 arr=DataArrayDouble([5,3,1,7,3,1,7,5]) ; arr.setInfoOnComponent(0,"Comp0")
59 MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fname,f0)