Esempio n. 1
0
 def testSolutionFileZippedReadWrite(self):
     test=SolutionFile(path.dirname(self.theFile),path.basename(self.theFile))
     self.assertEqual(test.readInternalUniform(),"0")
     self.assertEqual(test.readBoundary("atmosphere"),"0")
     self.assertEqual(test.readDimension(),"0 0 0 0 0 0 0")
     test.replaceBoundary("atmosphere",2.3)
     self.assertEqual(test.readBoundary("atmosphere"),"2.3")
     test.replaceInternal(3.14)
     self.assertEqual(test.readInternalUniform(),"3.14")
Esempio n. 2
0
from PyFoam.RunDictionary.SolutionFile import SolutionFile
from PyFoam.RunDictionary.SolutionDirectory import SolutionDirectory

import sys

file=sys.argv[1]
name=sys.argv[2]
bc =sys.argv[3]
neu=sys.argv[4]

dire=SolutionDirectory(file,archive="TestArchive")
sol=SolutionFile(dire.initialDir(),name)

print "Old internal",sol.readInternal()

sol.replaceInternal(neu)

print "New internal",sol.readInternal()

sol.purgeFile()

print "Reset internal",sol.readInternal()

print "Old boundary",sol.readBoundary(bc)

sol.replaceBoundary(bc,neu)

print "New boundary",sol.readBoundary(bc)

sol.purgeFile()