There is also ghost cell generator for image data that does not convert to multi block. It's called SQImageGhosts and resides in the SciberQuestToolKit pluign.

You would need to ensure the plugin is loaded and insert this filter upstream of your python filter.

In your filter's RequestUpdateExtent you'll need to set both UPDATE_NUMBER_OF_GHOST_LEVELS() and UPDATE_EXTENT() to reflect the number of ghost cells that you need. When you set UPDATE_EXTENT() to include ghost cells you must ensure that it is contained by WHOLE_EXTENT().

In your filter's RequestData you'll need to give PV the extent he initially asked for and process the input and output arrays according to the modified input extents and requested output extents respectively. The following c++ code illustrates. You'll have to build PV from source and turn on the plugin during the build. I would recommend pulling the sources from PV git repo since a number of windows and mac build issues were recently fixed.

Burlen

this illustrates how ghost cells are requested in a filter:

//-----------------------------------------------------------------------------
int vtkSQKernelConvolution::RequestUpdateExtent(
      vtkInformation *req,
      vtkInformationVector **inInfos,
      vtkInformationVector *outInfos)
{
  // ...

  // We will modify the extents we request from our input so
  // that we will have a layers of ghost cells. We also pass
  // the number of ghosts through the piece based key.
  int nGhosts = this->KernelWidth/2;

  inInfo->Set(
        vtkSDDPipeline::UPDATE_NUMBER_OF_GHOST_LEVELS(),
        nGhosts);

  CartesianExtent outputExt;
  outInfo->Get(
        vtkSDDPipeline::UPDATE_EXTENT(),
        outputExt.GetData());

  CartesianExtent wholeExt;
  inInfo->Get(
        vtkSDDPipeline::WHOLE_EXTENT(),
        wholeExt.GetData());

  outputExt = CartesianExtent::Grow(
        outputExt,
        wholeExt,
        nGhosts,
        this->Mode);

  inInfo->Set(
        vtkSDDPipeline::UPDATE_EXTENT(),
        outputExt.GetData(),
        6);

  int piece
    = outInfo->Get(vtkSDDPipeline::UPDATE_PIECE_NUMBER());

  int numPieces
    = outInfo->Get(vtkSDDPipeline::UPDATE_NUMBER_OF_PIECES());

  inInfo->Set(vtkSDDPipeline::UPDATE_PIECE_NUMBER(), piece);
  inInfo->Set(vtkSDDPipeline::UPDATE_NUMBER_OF_PIECES(), numPieces);
  inInfo->Set(vtkSDDPipeline::EXACT_EXTENT(), 1);

  return 1;
}

//-----------------------------------------------------------------------------
int vtkSQKernelConvolution::RequestData(
    vtkInformation * /*req*/,
    vtkInformationVector **inInfoVec,
    vtkInformationVector *outInfoVec)
{

  // ...

  // Get the input and output extents.
  CartesianExtent inputExt;
  inInfo->Get(
        vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT(),
        inputExt.GetData());

  CartesianExtent inputDom;
  inInfo->Get(
        vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(),
        inputDom.GetData());

  CartesianExtent outputExt;
  outInfo->Get(
        vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT(),
        outputExt.GetData());

  CartesianExtent domainExt;
  outInfo->Get(
        vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(),
        domainExt.GetData());

  // Check that we have the ghost cells that we need (more is OK).
  int nGhost = this->KernelWidth/2;

  CartesianExtent inputBox(inputExt);
  CartesianExtent outputBox
    = CartesianExtent::Grow(outputExt, nGhost, this->Mode);

  if (!inputBox.Contains(outputBox))
    {
    vtkErrorMacro(
<< "This filter requires ghost cells to function correctly. "
<< "The input must contain the output plus " << nGhost
<< " layers of ghosts. The input is " << inputBox
<< ", but it must be at least "
<< outputBox << ".");
    return 1;
    }

  // NOTE You can't do a shallow copy because the array dimensions are
  // different on output and input because of the ghost layers.

  vtkImageData *inImData=dynamic_cast<vtkImageData *>(inData);
  vtkImageData *outImData=dynamic_cast<vtkImageData *>(outData);

  // set up the output.
  double X0[3];
  outInfo->Get(vtkDataObject::ORIGIN(),X0);
  outImData->SetOrigin(X0);

  double dX[3];
  outInfo->Get(vtkDataObject::SPACING(),dX);
  outImData->SetSpacing(dX);

  outImData->SetExtent(outputExt.GetData());

  // ...
}


On 07/17/2012 10:24 AM, George Zagaris wrote:
Since you have structured grids, one other possibility is using:
vtkPUniformGridGhostDataGenerator
(http://www.vtk.org/doc/nightly/html/classvtkPUniformGridGhostDataGenerator.html)

Each process constructs a vtkMultiBlockDataSet instance consisting of
the grids/blocks owned by the process with NULL entries for all remote
blocks.
The resulting output of the filter is a vtkMultiBlockDataSet
consisting of the ghosted grid/block instances. Make sure that you
specify the whole-extent for the entire dataset and that for each
block you attach PIECE_EXTENT() in the corresponding vtkInformation.

Let me know if you need more help on this.

Best,
George


On Tue, Jul 17, 2012 at 12:22 PM, Jesus Pulido<jpul...@ucdavis.edu>  wrote
Thank you Berk.

I was under the impression that this command would trigger the reader to
automatically load in the additional # of requested ghost levels. I tested
the command and each data piece still has the same extents as before.

Is there any additional way to load in ghost level that's parallel friendly?
I am aware of the D3 filter but, from the memory usage, it seems that it
will load in the entire dataset into each processor and this is not feasible
for large datasets.

I am using binary, "raw" vti piece files each with their own extent of the
data and a header pvti file.
The data has no encoded ghost layers between pieces so I was hoping to have
paraview do that for me.

Jesus


On Tue, Jul 17, 2012 at 7:29 AM, Berk Geveci<berk.gev...@kitware.com>
wrote:

self.GetExecutive().GetOutputInformation(0).Set(vtk.vtkStreamingDemandDrivenPipeline.UPDATE_NUMBER_OF_GHOST_LEVELS(),
1)


in RequestUpdateExtent script. Of course, this requires that the reader or
a filter before the programmable filter is able to provide ghost levels.


-berk


On Wed, Jul 11, 2012 at 3:04 PM, Jesus Pulido<jpul...@ucdavis.edu>  wrote:
Hello,

I am trying to request ghost data in my python programmable filter but I
am not sure how to go about and do so. I am assuming the call would go into
the RequestUpdateExtent Script.

In the C++ equivalent filters that do request ghost data, the call to is
something along the lines of
vtkStreamingDemandDrivenPipeline::UPDATE_NUMBER_OF_GHOST_LEVELS() , and
there are examples of that in the Paraview source but the way the objects
are defined and called does not translate into Paraview VTK Python. What
would be the appropriate call?

Thank you,
Jesus


_______________________________________________
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

Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview


_______________________________________________
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

Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview

_______________________________________________
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

Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview

_______________________________________________
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

Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview

Reply via email to