def testFunction(self): res = pmi.reduce(add, mockFunc) if pmi.isController: self.assertEqual(res, 42 * pmi.size) else: self.assertEqual(res, None) # by string res = pmi.reduce("add", mockFunc) if pmi.isController: self.assertEqual(res, 42 * pmi.size) else: self.assertEqual(res, None)
def testLambda(self): pmi.exec_("myadd = lambda a,b: a+b") res = pmi.reduce("myadd", mockFunc) if pmi.isController: self.assertEqual(res, 42 * pmi.size) else: self.assertEqual(res, None) pmi.exec_("del myadd")
def __getattr__(self, key): value = pmi.reduce(pmi.MAX, self, 'getLocalData', key) return value
def node(self): value, node = pmi.reduce(pmi.MAXLOC, self, 'locateParticle') return node
def testReduceOp(self): res = pmi.reduce(pmi.SUM, mockFunc) if pmi.isController: self.assertEqual(res, 42 * pmi.size) else: self.assertEqual(res, None)