/[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 5329 by sshaw, Thu May 22 03:35:41 2014 UTC revision 5330 by jfenwick, Wed Dec 10 00:20:05 2014 UTC
# Line 159  class Design(design.AbstractDesign): Line 159  class Design(design.AbstractDesign):
159          """          """
160          Cleans up.          Cleans up.
161          """          """
162          if not self.keepFiles():          try:
163              if not self.keepFiles():
164              if not self.__scriptname_set: #i.e. it's a tempfile              if not self.__scriptname_set: #i.e. it's a tempfile
165                  os.unlink(self.getScriptFileName())                  os.unlink(self.getScriptFileName())
166              if not self.__mshname_set: #i.e. it's a tempfile              if not self.__mshname_set: #i.e. it's a tempfile
167                  os.unlink(self.getMeshFileName())                  os.unlink(self.getMeshFileName())
168            except OSError:
169          pass  # The file might not have been created and there is nothing
170          # to do about a "failure" here anyway
171    
172      def getCommandString(self):      def getCommandString(self):
173          """          """
# Line 192  class Design(design.AbstractDesign): Line 196  class Design(design.AbstractDesign):
196          import shlex          import shlex
197          args=shlex.split(self.getCommandString())          args=shlex.split(self.getCommandString())
198          args[-1]=args[-1]%self.getScriptHandler()          args[-1]=args[-1]%self.getScriptHandler()
199          # TODO: use gmshpy if available, e.g.:          
200          #from gmshpy import *          try:
201          #GmshOpenProject(self.getScriptHandler())             import gmshpy
202          #model=GModel_current()             havepy=True
203          #Msg_SetVerbosity(3)          except ImportError:
204          #model.mesh(self.getDim())             havepy=False
205          #model.writeMSH(self.getMeshFileName())          if havepy:    
206          ret=runGmsh(args)             gmshpy.GModel_readGEO(self.getScriptHandler())
207          if ret > 0:             model=gmshpy.GModel_current()
208              self.setKeepFilesOn() #no files to delete, so don't try to             gmshpy.Msg_SetVerbosity(3)
209              raise RuntimeError("Could not build mesh using: " + \             model.mesh(self.getDim())
210               model.writeMSH(self.getMeshFileName())
211               return self.getMeshFileName()
212            else:
213               ret=runGmsh(args)
214               if ret > 0:
215                   self.setKeepFilesOn() #no files to delete, so don't try to
216                   raise RuntimeError("Could not build mesh using: " + \
217                      "%s"%" ".join(args) + "\nCheck gmsh is available")                      "%s"%" ".join(args) + "\nCheck gmsh is available")
218          return self.getMeshFileName()             return self.getMeshFileName()
219    
220                    
221      def getScriptString(self):      def getScriptString(self):

Legend:
Removed from v.5329  
changed lines
  Added in v.5330

  ViewVC Help
Powered by ViewVC 1.1.26