| | |
| | | #!/usr/bin/python3 |
| | | |
| | | import configobj |
| | | import xml.etree.ElementTree as ET |
| | | import base64 |
| | | import zlib |
| | | import io |
| | | |
| | | |
| | | ''' |
| | | This is a trisurf instance manager written in python |
| | |
| | | |
| | | |
| | | def setTape(self, string): |
| | | self.tape=string |
| | | self.config=configobj.ConfigObj(io.StringIO(string)) |
| | | return |
| | | |
| | | def getValue(self,key): |
| | |
| | | ''' |
| | | Class Runner consists of a single running or terminated instance of the trisurf |
| | | ''' |
| | | def initFromTape(self, tape='tape'): |
| | | def initFromTape(self, tape): |
| | | self.tape=Tape() |
| | | self.tape.readTape(tape) |
| | | pass |
| | | |
| | | def initFromSnapshot(self, tape='snapshot.vtu'): |
| | | pass |
| | | def initFromSnapshot(self, snapshotfile): |
| | | try: |
| | | tree = ET.parse(snapshotfile) |
| | | except: |
| | | print("Error reading snapshot file") |
| | | exit(1) |
| | | |
| | | root = tree.getroot() |
| | | tapetxt=root.find('tape') |
| | | version=root.find('trisurfversion') |
| | | #print("Reading snapshot made from: "+version.text) |
| | | self.tape=Tape() |
| | | #print(tapetxt.text) |
| | | self.tape.setTape(tapetxt.text) |
| | | |
| | | def __init__(self, subdir='run0', tape='', snapshot=''): |
| | | self.subdir=subdir |