/[escript]/branches/split/test.py
ViewVC logotype

Annotation of /branches/split/test.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4790 - (hide annotations)
Fri Mar 21 01:46:38 2014 UTC (5 years, 1 month ago) by jfenwick
File MIME type: text/x-python
File size: 1554 byte(s)
Subworld changes to dudley
1 jfenwick 4745 from esys.escript import *
2     from esys.escriptcore.splitworld import *
3    
4 jfenwick 4784 from esys.finley import *
5 jfenwick 4774 from esys.escript.linearPDEs import Poisson
6 jfenwick 4745
7 jfenwick 4746 sw=SplitWorld(getMPISizeWorld())
8 jfenwick 4790 buildDomains(sw, Brick, 3, 3, 3 )
9     #buildDomains(sw, Rectangle, 3, 3)
10 jfenwick 4745
11     class J1(Job):
12     def __init__(self, **kwargs):
13     super(J1,self).__init__(**kwargs)
14     print "Constructed with "+str(self.domain)+" and id="+str(self.jobid)
15     self.rounds=self.jobid+2
16     def work(self):
17     print str(self.jobid)+"is doing work "+str(self.rounds)
18     self.rounds-=1
19     return self.rounds<1
20    
21     class BarrierJob(Job):
22     def __init__(self, **kwargs):
23     super(BarrierJob,self).__init__(**kwargs)
24     self.rounds=self.jobid+2
25    
26     def work(self):
27     print str(self.jobid)+"is doing work "+str(self.rounds)
28     self.rounds-=1
29 jfenwick 4773 #print self.domain.OnMasterProcessor()
30 jfenwick 4774 #print self.domain.onMasterProcessor()
31 jfenwick 4745 return self.rounds<1
32 jfenwick 4773
33    
34     class PoissonJob(Job):
35     def __init__(self, **kwargs):
36     super(PoissonJob, self).__init__(**kwargs)
37    
38     def work(self):
39     x = self.domain.getX()
40     gammaD = whereZero(x[0])+whereZero(x[1])
41     # define PDE and get its solution u
42     mypde = Poisson(domain=self.domain)
43 jfenwick 4774 mypde.setValue(f=self.jobid, q=gammaD)
44 jfenwick 4773 u = mypde.getSolution()
45 jfenwick 4774 print "Lsup solution=",Lsup(u)
46     return True
47 jfenwick 4746
48 jfenwick 4774 addJob(sw, J1)
49     addJob(sw, J1)
50     for z in range(10):
51     addJob(sw, J1)
52     addJob(sw, BarrierJob)
53     addJob(sw, PoissonJob)
54 jfenwick 4746
55     try:
56     sw.runJobs()
57     except RuntimeError as e:
58 jfenwick 4774 print e

  ViewVC Help
Powered by ViewVC 1.1.26