/[escript]/trunk/pycad/py_src/design.py
ViewVC logotype

Diff of /trunk/pycad/py_src/design.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2716 by gross, Tue Sep 29 02:20:22 2009 UTC revision 2717 by gross, Wed Oct 14 03:41:20 2009 UTC
# Line 204  class TagMap(object): Line 204  class TagMap(object):
204  class Design(object):  class Design(object):
205      """      """
206      Template for a design which defines the input for a mesh generator.      Template for a design which defines the input for a mesh generator.
207    
208        :cvar GMSH: U{gmsh<http://www.geuz.org/gmsh/>} file formatt
209        :cvar IDEAS: U{I_DEAS<http://www.plm.automation.siemens.com/en_us/products/nx/>} universal file format
210        :cvar VRML: U{VRML<http://www.w3.org/MarkUp/VRML/>} file format
211        :cvar STL: U{STL<http://en.wikipedia.org/wiki/STL_(file_format)>} file format
212        :cvar NASTRAN: U{Nastran<http://simcompanion.mscsoftware.com/infocenter/index?page=content&channel=DOCUMENTATION>} bulk data format
213        :cvar MEDIT: U{Medit<http://www-rocq.inria.fr/OpenFEM/Doc/>} file format
214        :cvar CGNS: U{CGNS<http://cgns.sourceforge.net/>} file format
215        :cvar PLOT3D:  U{Plot3D<http://www.plot3d.net/>} file format
216        :cvar DIFFPACK: U{Diffpack<http://www.diffpack.com/>} file format
217      """      """
218        GMSH="msh"
219        IDEAS="unv"
220        VRML="vrml"
221        STL="stl"
222        NASTRAN="bdf"
223        MEDIT="mesh"
224        CGNS="cgns"
225        PLOT3D="p3d"
226        DIFFPACK="diff"
227      def __init__(self,dim=3,element_size=1.,order=1,keep_files=False):      def __init__(self,dim=3,element_size=1.,order=1,keep_files=False):
228         """         """
229         Initializes a design.         Initializes a design.
# Line 218  class Design(object): Line 237  class Design(object):
237         self.setElementSize(element_size)         self.setElementSize(element_size)
238         self.setDim(dim)         self.setDim(dim)
239         self.setElementOrder(order)         self.setElementOrder(order)
240           self.setFileFormat()
241           self.setMeshFileName()
242         if keep_files:         if keep_files:
243            self.setKeepFilesOn()            self.setKeepFilesOn()
244         else:         else:
# Line 335  class Design(object): Line 356  class Design(object):
356                 implementation.                 implementation.
357          """          """
358          pass          pass
359        def generate(self):
360            """
361            generate output file
362            
363            :note: this method may be overwritten by a particular design
364                   implementation.
365            """
366            self.getMeshHandler()
367    
368      def getMeshHandler(self):      def getMeshHandler(self):
369          """          """
# Line 354  class Design(object): Line 383  class Design(object):
383             if isinstance(p, PropertySet): m[ p.getTag() ] = p.getName()             if isinstance(p, PropertySet): m[ p.getTag() ] = p.getName()
384          return TagMap(m)          return TagMap(m)
385    
386        def setFileFormat(self,format='msh'):
387           """
388           Sets the file format to be used.
389    
390           :param format: format to be used. needs to be one of
391    
392           """
393           if not format in [ self.GMSH, self.IDEAS, self.VRML, self.STL, self.NASTRAN, self.MEDIT, self.CGNS, self.PLOT3D, self.DIFFPACK] :
394               raise ValueError,"unknown file format %s."%format
395           self.__fileformat=format
396              
397        def getFileFormat(self):
398           """
399           Returns the file format
400           """
401           return self.__fileformat
402    
403        def setMeshFileName(self, name=None):
404           """
405           Sets the name for the mesh file. If no name is given a name is generated.
406           """
407           if name == None:
408               tmp_f_id=tempfile.mkstemp(suffix="."+self.getFileFormat())
409               self.__mshname=tmp_f_id[1]
410               os.close(tmp_f_id[0])
411           else:
412               self.__mshname=name
413               self.setKeepFilesOn()
414    
415        def getMeshFileName(self):
416           """
417           Returns the name of the mesh file.
418           """
419           return self.__mshname
420    
421    
422    

Legend:
Removed from v.2716  
changed lines
  Added in v.2717

  ViewVC Help
Powered by ViewVC 1.1.26