1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2015 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, or (at your option) any later version.
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"
30 coords=DataArrayDouble([(0,0,0),(2,1,0),(1,0,0),(1,1,0),(2,0,0),(0,1,0)])
31 m=MEDCouplingUMesh("mesh",2) ; m.setCoords(coords)
33 m.insertNextCell(NORM_QUAD4,[0,5,3,2])
34 m.insertNextCell(NORM_QUAD4,[4,2,3,1])
35 m.finishInsertingCells()
36 MEDLoader.WriteMesh(fname,m,True)
38 f0=MEDCouplingFieldDouble(ON_GAUSS_NE) ; f0.setMesh(m) ; f0.setTimeUnit("ms")
40 f0.setName("myELNOField")
41 arr=DataArrayDouble([7,5,3,1,5,3,1,7]) ; arr.setInfoOnComponent(0,"Comp0")
43 MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fname,f0)
46 arr=DataArrayDouble([1,7,5,3,7,5,3,1]) ; arr.setInfoOnComponent(0,"Comp0")
48 MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fname,f0)
51 arr=DataArrayDouble([3,1,7,5,1,7,5,3]) ; arr.setInfoOnComponent(0,"Comp0")
53 MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fname,f0)
56 arr=DataArrayDouble([5,3,1,7,3,1,7,5]) ; arr.setInfoOnComponent(0,"Comp0")
58 MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fname,f0)