예제 #1
0
def add_pipeline_legacy(scriptname):
    global coprocessor
    assert coprocessor is not None

    pipeline = vtkCPPythonScriptPipeline()
    if not pipeline.Initialize(scriptname):
        raise RuntimeError("Initialization failed!")

    coprocessor.AddPipeline(pipeline)
예제 #2
0
# with the -sym argument which acts exactly like we're running
# Catalyst from a simulation code.
#catalyst.Initialize()

for script in sys.argv[2:]:
    import os.path
    if rank == 0:
        print("Adding script ", script)
    if os.path.splitext(script)[1] == ".zip":
        pipeline = vtkPVPythonCatalyst.vtkCPPythonScriptV2Pipeline()
        pipeline.Initialize(script)
    elif os.path.isdir(script):
        pipeline = vtkPVPythonCatalyst.vtkCPPythonScriptV2Pipeline()
        pipeline.InitializeFromDirectory(script)
    else:
        pipeline = vtkPVPythonCatalyst.vtkCPPythonScriptPipeline()
        pipeline.Initialize(script)
    catalyst.AddPipeline(pipeline)

# we get the channel name here from the reader's dataset. if there
# isn't a channel name there we just assume that the channel name
# is 'input' since that's the convention for a single input
reader.UpdatePipeline()
dataset = pvsimple.servermanager.Fetch(reader)
array = dataset.GetFieldData().GetArray(catalyst.GetInputArrayName())
if array:
    channelname = array.GetValue(0)
else:
    channelname = 'input'

if rank == 0:
def addscript(name):
    global coProcessor
    from paraview.modules import vtkPVPythonCatalyst as pythoncatalyst
    pipeline = pythoncatalyst.vtkCPPythonScriptPipeline()
    pipeline.Initialize(name)
    coProcessor.AddPipeline(pipeline)