예제 #1
0
파일: Dump.py 프로젝트: hiker/stan
 def __init__(self, objFile, lLineFrom, lLineTo, lWhenDump=[],
              sCond="", bDoMPI = 0):
     if not sCond and not lWhenDump:
         print "Error: one condition must be specified"
         return
     if sCond and lWhenDump:
         print "Error: don't specify both conditions"
         return
     self.objFile     = objFile
     self.nLineFrom   = nLineFrom
     self.nLineTo     = nLineTo
     self.lWhenDump   = lWhenDump
     self.bDoMPI      = bDoMPI
     self.nUnit       = 1234
     try:
         filename,ext = splitext(basename(objFile.sGetFilename()))
     except:
         # in case that something went wrong
         filename = objFile.sGetFilename()
         ext      = ""
     self.sDumpFile   = "%s.dump"%filename
     self.sDumpWriteName = "%s.write%s"%(filename, ext)
     self.sDumpReadName  = "%s.driver%s" %(filename, ext)
     self.sDumpPrefix = "DUMP"
     if objFile.sGetFormat()=="fixed":
         self.stylesheet  = f77()
     else:
         self.stylesheet  = DefaultStylesheet()
         self.stylesheet  = f77()
     self.GenerateWriter()
     self.GenerateDriver()
예제 #2
0
파일: File.py 프로젝트: hiker/stan
 def sFormatObject(self, obj, bIgnoreAttributes=0, stylesheet=None):
     if not stylesheet:
         # avoid creating a stylesheet over and over again
         if not self.stylesheet:
             if self.sFormat == "fixed":
                 self.stylesheet = f77()
             else:
                 self.stylesheet = DefaultStylesheet()
         stylesheet = self.stylesheet
     return stylesheet.ToString(obj, bIgnoreAttributes)