1 # Copyright (C) 2011 EDF R&D
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.
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.
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
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 # Author(s): Guillaume Boulant (23/03/2011)
22 # TODO: put all this stuff in the unitests package
27 This returns the root directory where the module SPADDER is
28 installed. All test files are looked up from this location.
30 return os.environ['SMESH_ROOT_DIR']
34 This function gives the absolute path to the directory containing
35 the data files for test (realistic med files).
37 datadir=os.path.join(getRootDir(),"share/salome/resources/smesh/padderexe")
40 import MESHJOB # to get the enum constant values
41 from MESHJOB import MeshJobParameter, MeshJobParameterList
43 DEFAULT_CONCRETE_FILENAME=os.path.join(getTestDataDir(),'concrete.med')
44 DEFAULT_STEELBAR_LISTFILENAME=[
45 os.path.join(getTestDataDir(),'ferraill.med')
48 def getMeshJobParameterList(concrete_filename=DEFAULT_CONCRETE_FILENAME,
49 steelbar_listfilename=DEFAULT_STEELBAR_LISTFILENAME):
51 This helper function creates a complete set of parameters (a
52 MeshJobParameterList) for a simple test case, i.e. a case with a
53 concrete filename and a single steelbar filename.
55 # Note that a CORBA sequence (MeshJobParameterList) is mapped on a
56 # simple list in python
57 meshJobParameterList = []
58 # We can add some parameters
59 param = MeshJobParameter(
60 file_name = concrete_filename,
61 file_type = MESHJOB.MED_CONCRETE,
62 group_name = "concrete")
63 meshJobParameterList.append(param)
65 for steelbar_filename in steelbar_listfilename:
66 param = MeshJobParameter(
67 file_name = steelbar_filename,
68 file_type = MESHJOB.MED_STEELBAR,
69 group_name = "steelbar")
70 meshJobParameterList.append(param)
72 return meshJobParameterList
75 def getSpadderCatalogFilename():
76 filename=os.path.join(getRootDir(),"share/salome/resources/smesh/SPADDERCatalog.xml")
79 def loadSpadderCatalog():
82 obj = salome.naming_service.Resolve('Kernel/ModulCatalog')
83 import SALOME_ModuleCatalog
84 catalog = obj._narrow(SALOME_ModuleCatalog.ModuleCatalog)
86 raise RuntimeError, "Can't accesss module catalog"
88 filename = getSpadderCatalogFilename()
89 catalog.ImportXmlCatalogFile(filename)
91 from salome.kernel import services
92 print "The list of SALOME components is now:"
93 print services.getComponentList()