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

Contents of /branches/split/test.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4773 - (show annotations)
Wed Mar 19 06:19:42 2014 UTC (3 years, 8 months ago) by jfenwick
File MIME type: text/x-python
File size: 1649 byte(s)
Fixing Data to use the domain's communicator.
Like it should!


1 from esys.escript import *
2 from esys.escriptcore.splitworld import *
3
4 from esys.ripley import *
5
6
7 sw=SplitWorld(getMPISizeWorld())
8 buildDomains(sw, Brick, 3, 3, 3 )
9
10 class J1(Job):
11 def __init__(self, **kwargs):
12 super(J1,self).__init__(**kwargs)
13 print "Constructed with "+str(self.domain)+" and id="+str(self.jobid)
14 self.rounds=self.jobid+2
15 def work(self):
16 print str(self.jobid)+"is doing work "+str(self.rounds)
17 self.rounds-=1
18 return self.rounds<1
19
20 class BarrierJob(Job):
21 def __init__(self, **kwargs):
22 super(BarrierJob,self).__init__(**kwargs)
23 self.rounds=self.jobid+2
24
25 def work(self):
26 print str(self.jobid)+"is doing work "+str(self.rounds)
27 self.rounds-=1
28 #print self.domain.OnMasterProcessor()
29 print self.domain.onMasterProcessor()
30 return self.rounds<1
31
32
33 class PoissonJob(Job):
34 def __init__(self, **kwargs):
35 super(PoissonJob, self).__init__(**kwargs)
36
37 def work(self):
38 print "Starting work"
39 x = self.domain.getX()
40 print "Here"
41 q=x[0]
42 print ";;;;;;;;;;"
43 whereZero(q)
44 print "----"
45 gammaD = whereZero(x[0])+whereZero(x[1])
46 print "There"
47 # define PDE and get its solution u
48 mypde = Poisson(domain=self.domain)
49 print "Passed constructor"
50 mypde.setValue(f=1,q=gammaD)
51 print "Beginning solve"
52 u = mypde.getSolution()
53 print "Solution complete"
54
55 #addJob(sw, J1)
56 #addJob(sw, J1)
57 #for z in range(1):
58 # addJob(sw, J1)
59 # addJob(sw, BarrierJob)
60 addJob(sw, PoissonJob)
61
62 try:
63 sw.runJobs()
64 except RuntimeError as e:
65 print e

  ViewVC Help
Powered by ViewVC 1.1.26