Package PyFoam :: Package Applications :: Module EchoDictionary
[hide private]
[frames] | no frames]

Source Code for Module PyFoam.Applications.EchoDictionary

 1  #  ICE Revision: $Id: /local/openfoam/Python/PyFoam/PyFoam/Applications/EchoDictionary.py 7660 2012-01-07T16:44:40.128256Z bgschaid  $  
 2  """ 
 3  Application class that implements pyFoamEchoDictionary 
 4  """ 
 5   
 6  import sys,re 
 7   
 8  from PyFoamApplication import PyFoamApplication 
 9   
10  from PyFoam.RunDictionary.ParsedParameterFile import ParsedParameterFile 
11   
12  from CommonParserOptions import CommonParserOptions 
13   
14  from PyFoam.Error import PyFoamException 
15   
16 -class EchoDictionary(PyFoamApplication, 17 CommonParserOptions):
18 - def __init__(self,args=None):
19 description="""\ 20 Reads a Foam-Dictionary and prints it to the screen. Mainly for 21 reformatting unformated dictionaries and debugging the parser 22 """ 23 24 PyFoamApplication.__init__(self, 25 args=args, 26 description=description, 27 usage="%prog [options] <dictfile>", 28 nr=1, 29 changeVersion=False, 30 interspersed=True)
31
32 - def addOptions(self):
34
35 - def run(self):
36 fName=self.parser.getArgs()[0] 37 try: 38 dictFile=ParsedParameterFile(fName, 39 backup=False, 40 debug=self.opts.debugParser, 41 noHeader=self.opts.noHeader, 42 noBody=self.opts.noBody, 43 preserveComments=self.opts.preserveComments, 44 boundaryDict=self.opts.boundaryDict, 45 listDict=self.opts.listDict, 46 listDictWithHeader=self.opts.listDictWithHeader, 47 doMacroExpansion=self.opts.doMacros) 48 except IOError,e: 49 self.error("Problem with file",fName,":",e) 50 51 print dictFile
52