Back to index

salome-smesh  6.5.0
inputdata.py
Go to the documentation of this file.
00001 # -*- coding: iso-8859-1 -*-
00002 # Copyright (C) 2011-2012  EDF R&D
00003 #
00004 # This library is free software; you can redistribute it and/or
00005 # modify it under the terms of the GNU Lesser General Public
00006 # License as published by the Free Software Foundation; either
00007 # version 2.1 of the License.
00008 #
00009 # This library is distributed in the hope that it will be useful,
00010 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 # Lesser General Public License for more details.
00013 #
00014 # You should have received a copy of the GNU Lesser General Public
00015 # License along with this library; if not, write to the Free Software
00016 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00017 #
00018 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00019 #
00020 # Author : Guillaume Boulant (EDF)
00021 #
00022 
00023 from salome.kernel.enumerate import Enumerate
00024 from salome.kernel.datamodeler import DataModeler, TypeString, TypeInteger
00025 
00026 # __MEM__: Note that this module does not depend on the SPADDER
00027 # component on purpose (we could have use a derived structure of
00028 # SPADDER_ORB.MeshJobParameter). This choice is made to ease the test
00029 # and development of the gui part of the plugin. If this data
00030 # structure becomes too important, we could make another arrangement
00031 # and use directly a SPADDER_ORB.MeshJobParameter.
00032 
00033 class InputData(DataModeler):
00034     MESHTYPES=Enumerate([
00035         'CONCRETE',
00036         'STEELBAR'
00037         ])
00038 
00039     def __init__(self):
00040         DataModeler.__init__(self)
00041         self.addAttribute(
00042             name  = "meshObject",
00043             void  = True
00044             )
00045         self.addAttribute(
00046             name  = "meshName",
00047             type  = TypeString,
00048             range = None
00049             )
00050         self.addAttribute(
00051             name  = "meshType",
00052             type  = TypeInteger,
00053             range = self.MESHTYPES.listvalues()
00054             )
00055         self.addAttribute(
00056             name  = "groupName",
00057             type  = TypeString,
00058             range = None
00059             )
00060 
00061 #
00062 # ==============================================================================
00063 # Basic use cases and unit tests
00064 # ==============================================================================
00065 #
00066 def TEST_getName():
00067     testdata = InputData()
00068     testdata.meshName   = "myMesh"
00069     testdata.meshObject = None
00070     testdata.meshType   = InputData.MESHTYPES.CONCRETE
00071     if testdata.meshName != "myMesh" :
00072         return False
00073     return True
00074 
00075 if __name__ == "__main__":
00076     from salome.kernel.unittester import run
00077     run("inputdata","TEST_getName")