yt.rife /

from functools import wraps
import inspect
from yt.mods import *
from mpi4py import MPI
import time

def requires_pf(func):
    def wrap(self, *args, **kwargs):
        if is None: raise RuntimeError
        return func(self, *args, **kwargs)
    return wrap

def broadcasted_action(func):
    def sender(*args, **kwargs):
        self = args[0]
        if self.comm.rank != 0:
            return func(*args, **kwargs)
        argspec = inspect.getcallargs(func, *args, **kwargs)
        msg = dict(type = func.func_name, args = argspec)
        mylog.debug("Sending message: %s, %s", msg['type'], msg['args'])
        func(*args, **kwargs)
    return sender

class LockstepProxy(object):
    _run = True
    def __init__(self, comm = None):
        if comm is None:
            from yt.utilities.parallel_tools.parallel_analysis_interface \
                import communication_system
            comm = communication_system.communicators[-1]
        self.comm = comm

    def send(self, msg):

    def receive(self, msg):
        mylog.debug("Received message: %s, %s", msg['type'], msg['args'])
        func = getattr(self, msg['type'])
    def runwait(self):
        while self._run:
            msg = self.comm.mpi_bcast_pickled(None)
            if msg is not None: self.receive(msg)

class VolumeRenderingHandler(LockstepProxy):
    pf = None

    def load(self, fn, resolution = 1024): = load(fn)
        if is None: raise IOError(fn)
        c = ( + =, [1.0, 1.0, 1.0],
                      1.0/['unitary'], resolution, None)

    def switch_view(self, normal_vector, width, center, north_vectors):, width, center, north_vectors)

    def render(self):
        # In here is where we broadcast to all the other processors (if we have
        # them running!) what the view is, before we snapshot.
        # We can get this from cam.normal_vector, cam.width, cam.north_vector
        if is None:
            raise RuntimeError
        sn =
        return sn

    def isocontours(self, limits, nlayers, width): = ColorTransferFunction(limits), w=width)

if __name__ == "__main__":
    VRH = VolumeRenderingHandler()
    if MPI.COMM_WORLD.rank == 0:
        print 1
        snap = VRH.render()
        print 2
        snap = VRH.render()
        print 3
        snap = VRH.render()
        print 4
        snap = VRH.render()
        print 5
        snap = VRH.render()