# Contents of /trunk/finley/test/python/tp.py

Revision 1368 - (show annotations)
Wed Dec 19 03:45:20 2007 UTC (15 years, 1 month ago) by gross
File MIME type: text/x-python
File size: 1398 byte(s)
```very first step towards a pythn wrapper for the transport problem.
```
 1 from esys.escript import * 2 3 class TransportPDE(object): 4 def __init__(domain,num_equations=1,theta=0.,dt_max=-1.,trace=True): 5 self.__domain=domain 6 self.__num_equations=num_equations 7 self.__theta=theta 8 self.__dt_max=dt_max 9 self.__transport_problem=None 10 11 def getDomain(self): 12 return self.__domain 13 def getTheta(self): 14 return self.__theta 15 def getDt_max(self): 16 return self.__dt_max 17 def getNumEquations(self): 18 return self.__getNumEquations 19 def getFunctionSpace(self): 20 if self.redueced(): 21 return ReducedSolution(self.getDomain()) 22 else: 23 return Solution(self.getDomain()) 24 25 26 def __getNewTransportProblem(self): 27 """ 28 returns an instance of a new operator 29 """ 30 self.trace("New Transport problem is allocated.") 31 return self.getDomain().newTransportProblem( \ 32 self.getTheta(), 33 self.getDt_max(), 34 self.getNumEquations(), \ 35 self.getFunctionSpace(), \ 36 self.__matrix_type) 37 38 def setValue(M=Data(),A=Data(),B=Data(),C=Data(),D=Data(),X=Data(),Y=Data()): 39 self.__transport_problem=self.__getNewTransportProblem() 40 self.getDomain(). 41 42 def solve(X=Data(),Y=Data()):