commit | author | age
|
bc14fb
|
1 |
#!/usr/bin/python3 |
SP |
2 |
|
|
3 |
import configobj |
|
4 |
|
|
5 |
''' |
|
6 |
This is a trisurf instance manager written in python |
|
7 |
|
|
8 |
|
|
9 |
Invoke with: |
|
10 |
tsmgr [-t tape | -r snapshot.vtu] [-s subdirectory] |
|
11 |
|
|
12 |
If tape is specified, the trisurf wilt start from tape with initial distribution, if snapshot is specified the trisurf will be restored from given snapshot file and simulation will continue. |
|
13 |
|
|
14 |
''' |
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
class Tape: |
|
19 |
'''Has all the info on the tape''' |
|
20 |
|
|
21 |
def __init__(self): |
|
22 |
return |
|
23 |
|
|
24 |
def readTape(self, tape='tape'): |
|
25 |
try: |
|
26 |
self.config=configobj.ConfigObj(tape) |
|
27 |
except: |
|
28 |
print("Error reading or parsing tape file!\n") |
|
29 |
exit(1) |
|
30 |
|
|
31 |
|
|
32 |
def setTape(self, string): |
|
33 |
self.tape=string |
|
34 |
return |
|
35 |
|
|
36 |
def getValue(self,key): |
|
37 |
return self.config[key] |
|
38 |
|
|
39 |
|
|
40 |
|
|
41 |
class Runner: |
|
42 |
''' |
|
43 |
Class Runner consists of a single running or terminated instance of the trisurf |
|
44 |
''' |
a99f2b
|
45 |
def initFromTape(self, tape): |
bc14fb
|
46 |
self.tape=Tape() |
SP |
47 |
self.tape.readTape(tape) |
|
48 |
pass |
|
49 |
|
|
50 |
def initFromSnapshot(self, tape='snapshot.vtu'): |
|
51 |
pass |
|
52 |
|
|
53 |
def __init__(self, subdir='run0', tape='', snapshot=''): |
|
54 |
self.subdir=subdir |
|
55 |
if(tape!=''): |
|
56 |
self.initFromTape(tape) |
|
57 |
if(snapshot!=''): |
|
58 |
self.initFromSnapshot(snapshot) |
|
59 |
|
|
60 |
return |
|
61 |
|
|
62 |
def getStatus(self): |
|
63 |
pass |
|
64 |
|
|
65 |
def start(self): |
|
66 |
pass |
|
67 |
|
|
68 |
def stop(self): |
|
69 |
pass |
|
70 |
|
|
71 |
def __str__(self): |
|
72 |
return("Running instance") |
|
73 |
|