/[escript]/branches/split/escriptcore/src/SubWorld.cpp
ViewVC logotype

Contents of /branches/split/escriptcore/src/SubWorld.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4734 - (show annotations)
Mon Mar 10 06:38:54 2014 UTC (3 years, 9 months ago) by jfenwick
File size: 1551 byte(s)
Run skeleton jobs with no params.
1
2 /*****************************************************************************
3 *
4 * Copyright (c) 2014 by University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Open Software License version 3.0
9 * http://www.opensource.org/licenses/osl-3.0.php
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development 2012-2013 by School of Earth Sciences
13 * Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 *
15 *****************************************************************************/
16
17 #include "SubWorld.h"
18
19 using namespace escript;
20
21
22 SubWorld::SubWorld(MPI_Comm comm)
23 :communicator(comm), domain((AbstractDomain*)0)
24 {
25
26
27 }
28
29 SubWorld::~SubWorld()
30 {
31 }
32
33 MPI_Comm SubWorld::getComm()
34 {
35 return communicator;
36 }
37
38 void SubWorld::setDomain(Domain_ptr d)
39 {
40 domain=d;
41 }
42
43 Domain_ptr SubWorld::getDomain()
44 {
45 return domain;
46 }
47
48 void SubWorld::addJob(boost::python::object j)
49 {
50 jobvec.push_back(j);
51 }
52
53 // if 3, a Job threw an exception
54 // if 2, a Job did not return a bool
55 // if 1, at least one Job returned False
56 // if 0, all jobs in this world returned True
57 char SubWorld::runJobs()
58 {
59 int ret=0;
60 try
61 {
62 for (size_t i=0;i<jobvec.size();++i)
63 {
64 boost::python::object result=jobvec[i].attr("work")();
65 boost::python::extract<bool> ex(result);
66 if (!ex.check())
67 {
68 return 2;
69 }
70 if (!ex())
71 {
72 ret=1;
73 }
74 }
75 } catch (boost::python::error_already_set e)
76 {
77 return 3;
78 }
79 return ret;
80 }

  ViewVC Help
Powered by ViewVC 1.1.26