1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2015-2019 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 (EDF R&D)
23 from medcoupling import *
24 from paraview.simple import *
25 from MEDReaderHelper import WriteInTmpDir,RetriveBaseLine
28 """Non regression test for bug EDF11343. Extract group on groups mixing cells entities and node entities."""
29 fname="testMEDReader18.med"
30 arr1=DataArrayDouble(5) ; arr1.iota()
31 arr2=DataArrayDouble([0,1])
32 m=MEDCouplingCMesh() ; m.setCoords(arr1,arr2)
34 m=m.buildUnstructured()
39 grp0=DataArrayInt([1,2]) ; grp0.setName("grp0")
40 grp1=DataArrayInt([3,4,8,9]) ; grp1.setName("grp1")
50 fname = GenerateCase()
51 reader=MEDReader(FileName=fname)
52 reader.AllArrays=['TS0/mesh/ComSup0/mesh@@][@@P0']
53 ExtractGroup1 = ExtractGroup(Input=reader)
54 ExtractGroup1.AllGroups=["GRP_grp0","GRP_grp1"]
55 #ExtractGroup1.UpdatePipelineInformation()
56 res=servermanager.Fetch(ExtractGroup1,0)
57 assert(res.GetNumberOfBlocks()==2)
58 assert(res.GetBlock(1).GetNumberOfCells()==1)
59 assert(res.GetBlock(0).GetNumberOfCells()==2)
62 if __name__ == "__main__":