Salome HOME
Update copyright information
[modules/filter.git] / src / FILTER / test_filter.py
1 #  Copyright (C) 2007-2008  CEA/DEN, EDF R&D
2 #
3 #  This library is free software; you can redistribute it and/or
4 #  modify it under the terms of the GNU Lesser General Public
5 #  License as published by the Free Software Foundation; either
6 #  version 2.1 of the License.
7 #
8 #  This library is distributed in the hope that it will be useful,
9 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
10 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 #  Lesser General Public License for more details.
12 #
13 #  You should have received a copy of the GNU Lesser General Public
14 #  License along with this library; if not, write to the Free Software
15 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 #
17 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19 # Author: Bernard Secher 2008 january
20 #
21 import os
22 import salome
23 import SALOME_FILTER
24 import libSALOME_LifeCycleCORBA
25 lcc=libSALOME_LifeCycleCORBA.SALOME_LifeCycleCORBA()
26 # load FILTER module
27 filter=lcc.FindOrLoad_Component("","FILTER")
28 inputFile=os.getenv("FILTER_ROOT_DIR")+"/share/salome/resources/filter/xx.aa.med"
29 outputFile="filtered.med"
30 # load input MED file
31 filter.loadMED(inputFile)
32 # read reference field for filtering
33 filter.readReferenceField("MeshFromEnsight","FieldFromEnsight",0)
34 # generate filtering criteria from thersholds on reference filed
35 filter.generateCriteria(1,2.2,0.,True,SALOME_FILTER.F_FIELD)
36 # create ensight input files for DISTENE filtoo tool
37 filter.createEnsightInputFiles()
38 # call DISTENNE filtoo tool
39 filter.filtering()
40 # project input fileds on new mesh
41 filter.projectFieldsOnDecimateMesh()
42 # create output MED file
43 filter.createMedOutputFile(outputFile)
44 # unload MED object
45 filter.unloadMED()