Hi Ufuk,

For the allinputsgridwriter.py you currently need to manually add in the
inputs yourself (i.e. replace the "namedinputs = ['input']" line with the
name of your inputs. That has caught me in the past as well so I decided to
fix that. Attached is my new version of that script where it doesn't
require you to specify the input names in case you want to try this new one
instead. If you do, please let us know if that solves your problem or not.

Best,
Andy


On Tue, Aug 15, 2017 at 12:40 PM, Ben Boeckel <ben.boec...@kitware.com>
wrote:

> On Tue, Aug 15, 2017 at 17:59:47 +0300, u.utku.turunco...@be.itu.edu.tr
> wrote:
> > I solved the problem and i am able to run the simulation code with
> > Catalyst support by installing PV (5.4.0 rc4 and 5.3.0) with newer
> version
> > of protobuf library (3.3.0) and compiling the model code with this
> version
> > of PV (using gcc).
> >
> > Now, the problem is that the code gives following warnings and do nothing
> > with standard allinputsgridwriter.py script. Do you think that it is
> > related with protobuf library. The same setup is working without any
> > problem in an other system using Intel compiler.
>
> It'd be better to try with one MPI process rather than…I count 10 to get
> the error? Not sure what's up though, Andy?
>
> > "/home/ext-dell-guest1/rds/hpc-work/progs/paraview-5.3.0/egl
> /lib/site-packages/paraview/coprocessing.py",
> > line 305, in CreateProducer
> >     grid = adaptorinput.GetClientSideObject().GetOutputDataObject(0)
> >     grid = adaptorinput.GetClientSideObject().GetOutputDataObject(0)
> >     if grid.IsA("vtkImageData") == True or \
> >   File
> > "/home/ext-dell-guest1/rds/hpc-work/progs/paraview-5.3.0/egl
> /lib/site-packages/paraview/coprocessing.py",
> > line 305, in CreateProducer
> > AttributeError: 'NoneType' object has no attribute 'IsA'
> >   File
> > "/home/ext-dell-guest1/rds/hpc-work/progs/paraview-5.3.0/egl
> /lib/site-packages/paraview/coprocessing.py",
> > line 305, in CreateProducer
> >     if grid.IsA("vtkImageData") == True or \
> >     if grid.IsA("vtkImageData") == True or \
> > AttributeError: 'NoneType' object has no attribute 'IsA'
> >     grid = adaptorinput.GetClientSideObject().GetOutputDataObject(0)
> >   File
> > "/home/ext-dell-guest1/rds/hpc-work/progs/paraview-5.3.0/egl
> /lib/site-packages/paraview/coprocessing.py",
> > line 305, in CreateProducer
> >     grid = adaptorinput.GetClientSideObject().GetOutputDataObject(0)
> >     if grid.IsA("vtkImageData") == True or \
> >     if grid.IsA("vtkImageData") == True or \
> > AttributeError: 'NoneType' object has no attribute 'IsA'
> > AttributeError: 'NoneType' object has no attribute 'IsA'
> >     if grid.IsA("vtkImageData") == True or \
> > AttributeError: 'NoneType' object has no attribute 'IsA'
> >   File
> > "/home/ext-dell-guest1/rds/hpc-work/progs/paraview-5.3.0/egl
> /lib/site-packages/paraview/coprocessing.py",
> > line 305, in CreateProducer
> >     if grid.IsA("vtkImageData") == True or \
> > AttributeError: 'NoneType' object has no attribute 'IsA'
> > [PERFLOG] :: COPROC          2     0.01404021SEC.
> >  Running COP Component: 2005-08-27T00:12:00 --> 2005-08-27T00:18:00 Time
> > Step:     2 [         720.00]
> > ATM-TO-COP: redist mask [CROSS] to mask [CROSS]
> > ATM-TO-COP: redist topo [CROSS] to topo [CROSS]
> > AttributeError: 'NoneType' object has no attribute 'IsA'
> >     grid = adaptorinput.GetClientSideObject().GetOutputDataObject(0)
> >   File
> > "/home/ext-dell-guest1/rds/hpc-work/progs/paraview-5.3.0/egl
> /lib/site-packages/paraview/coprocessing.py",
> > line 305, in CreateProducer
> >     if grid.IsA("vtkImageData") == True or \
>
> --Ben
>
from paraview.simple import *

from paraview import coprocessing

# the frequency to output everything
outputfrequency = 5

# ----------------------- CoProcessor definition -----------------------

def CreateCoProcessor():
  def _CreatePipeline(coprocessor, datadescription):
    class Pipeline:
      for i in range(datadescription.GetNumberOfInputDescriptions()):
        inputdescription = datadescription.GetInputDescription(i)
        name = datadescription.GetInputDescriptionName(i)
        adaptorinput = coprocessor.CreateProducer( datadescription, name )
        grid = adaptorinput.GetClientSideObject().GetOutputDataObject(0)
        extension = None
        if  grid.IsA('vtkImageData') or grid.IsA('vtkUniformGrid'):
          writer = servermanager.writers.XMLPImageDataWriter(Input=adaptorinput)
          extension = '.pvti'
        elif  grid.IsA('vtkRectilinearGrid'):
          writer = servermanager.writers.XMLPRectilinearGridWriter(Input=adaptorinput)
          extension = '.pvtr'
        elif  grid.IsA('vtkStructuredGrid'):
          writer = servermanager.writers.XMLPStructuredGridWriter(Input=adaptorinput)
          extension = '.pvts'
        elif  grid.IsA('vtkPolyData'):
          writer = servermanager.writers.XMLPPolyDataWriter(Input=adaptorinput)
          extension = '.pvtp'
        elif  grid.IsA('vtkUnstructuredGrid'):
          writer = servermanager.writers.XMLPUnstructuredGridWriter(Input=adaptorinput)
          extension = '.pvtu'
        elif  grid.IsA('vtkUniformGridAMR'):
          writer = servermanager.writers.XMLHierarchicalBoxDataWriter(Input=adaptorinput)
          extension = '.vthb'
        elif  grid.IsA('vtkMultiBlockDataSet'):
          writer = servermanager.writers.XMLMultiBlockDataWriter(Input=adaptorinput)
          extension = '.vtm'
        else:
          print "Don't know how to create a writer for a ", grid.GetClassName()

        if extension:
          coprocessor.RegisterWriter(writer, filename=name+'_%t'+extension, freq=outputfrequency)

    return Pipeline()

  class CoProcessor(coprocessing.CoProcessor):
    def CreatePipeline(self, datadescription):
      self.Pipeline = _CreatePipeline(self, datadescription)

  return CoProcessor()

#--------------------------------------------------------------
# Global variables that will hold the pipeline for each timestep
# Creating the CoProcessor object, doesn't actually create the ParaView pipeline.
# It will be automatically setup when coprocessor.UpdateProducers() is called the
# first time.
coprocessor = CreateCoProcessor()

#--------------------------------------------------------------
# Enable Live-Visualizaton with ParaView
coprocessor.EnableLiveVisualization(False)


# ---------------------- Data Selection method ----------------------

def RequestDataDescription(datadescription):
    "Callback to populate the request for current timestep"
    global coprocessor
    if datadescription.GetForceOutput() == True or datadescription.GetTimeStep() % outputfrequency == 0:
        # We are just going to request all fields and meshes from the simulation
        # code/adaptor.
        for i in range(datadescription.GetNumberOfInputDescriptions()):
            datadescription.GetInputDescription(i).AllFieldsOn()
            datadescription.GetInputDescription(i).GenerateMeshOn()
        return

    # setup requests for all inputs based on the requirements of the
    # pipeline.
    coprocessor.LoadRequestedData(datadescription)

# ------------------------ Processing method ------------------------

def DoCoProcessing(datadescription):
    "Callback to do co-processing for current timestep"
    global coprocessor

    # Update the coprocessor by providing it the newly generated simulation data.
    # If the pipeline hasn't been setup yet, this will setup the pipeline.
    coprocessor.UpdateProducers(datadescription)

    # Write output data, if appropriate.
    coprocessor.WriteData(datadescription);

    # Write image capture (Last arg: rescale lookup table), if appropriate.
    coprocessor.WriteImages(datadescription, rescale_lookuptable=False)

    # Live Visualization, if enabled.
    coprocessor.DoLiveVisualization(datadescription, "localhost", 22222)
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at: 
http://paraview.org/Wiki/ParaView

Search the list archives at: http://markmail.org/search/?q=ParaView

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview

Reply via email to