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

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

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

revision 2090 by ksteube, Mon Nov 24 06:41:08 2008 UTC revision 2096 by phornby, Tue Nov 25 10:29:27 2008 UTC
# Line 44  class Design(design.Design): Line 44  class Design(design.Design):
44      DELAUNAY="iso"      DELAUNAY="iso"
45      NETGEN="netgen"      NETGEN="netgen"
46      TETGEN="tetgen"      TETGEN="tetgen"
47    
48      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):
49         """         """
50         initializes the gmsh design         initializes the gmsh design
# Line 62  class Design(design.Design): Line 63  class Design(design.Design):
63         set the filename for the gmsh input script. if no name is given a name with extension geo is generated.         set the filename for the gmsh input script. if no name is given a name with extension geo is generated.
64         """         """
65         if name == None:         if name == None:
66             self.__scriptname=tempfile.mkstemp(suffix=".geo")[1]             tmp_f_id=tempfile.mkstemp(suffix=".geo")
67               self.__scriptname=tmp_f_id[1]
68               os.close(tmp_f_id[0])
69         else:         else:
70             self.__scriptname=name             self.__scriptname=name
71             self.setKeepFilesOn()             self.setKeepFilesOn()
# Line 76  class Design(design.Design): Line 79  class Design(design.Design):
79         sets the name for the gmsh mesh file. if no name is given a name with extension msh is generated.         sets the name for the gmsh mesh file. if no name is given a name with extension msh is generated.
80         """         """
81         if name == None:         if name == None:
82             self.__mshname=tempfile.mkstemp(suffix=".msh")[1]             tmp_f_id=tempfile.mkstemp(suffix=".msh")
83               self.__mshname=tmp_f_id[1]
84               os.close(tmp_f_id[0])
85         else:         else:
86             self.__mshname=name             self.__mshname=name
87             self.setKeepFilesOn()             self.setKeepFilesOn()
# Line 98  class Design(design.Design): Line 103  class Design(design.Design):
103          """          """
104          clean up          clean up
105          """          """
106          if not self.keepFiles():          if not self.keepFiles() :
107                 os.unlink(self.getScriptFileName())              os.unlink(self.getScriptFileName())
108                 os.unlink(self.getMeshFileName())              os.unlink(self.getMeshFileName())
109    
110      def getCommandString(self):      def getCommandString(self):
111          """          """
112          returns the gmsh comand          returns the gmsh comand
# Line 128  class Design(design.Design): Line 134  class Design(design.Design):
134          returns a handle to a mesh meshing the design. In the current implementation          returns a handle to a mesh meshing the design. In the current implementation
135          a mesh file name in gmsh format is returned.          a mesh file name in gmsh format is returned.
136          """          """
137          open(self.getScriptFileName(),"w").write(self.getScriptString())          f = open(self.getScriptFileName(),"w")
138            f.write(self.getScriptString())
139            f.close()
140          cmd = self.getCommandString()          cmd = self.getCommandString()
141          ret = os.system(cmd) / 256          ret = os.system(cmd) / 256
142      if ret > 0:      if ret > 0:

Legend:
Removed from v.2090  
changed lines
  Added in v.2096

  ViewVC Help
Powered by ViewVC 1.1.26