[Paraview] MultiblockDataSet Global IDs

Zhanping Liu zhanping.liu at kitware.com
Thu Aug 6 11:00:28 EDT 2009


Hi Rafael:

    If my guess is not wrong, I feel you want to obtain a set of unique
point ids for each block. Then the following segment of code might be ok.


int           numPtIds = 0;
vtkIdList * ptIdList = vtkIdList::New();
ptIdList->Allocate( 1000, 1000 ); // or better estimated sizes

vtkMultiBlockDataSet * multiBlock = ...;

for ( i = 0; i < multiBlock->GetNumberOfBlocks(); i ++ )
  {
  ptIdList->Reset();
  vtkDataSet * block = vtkDataSet::SafeDownCase(  multiBlock->GetBlock( i )
);

  for ( j = 0; j < block->GetNumberOfCells(); j ++ )
    {
    vtkCell   * cell = block->GetCell( j );
    vtkIdList * list = cell->GetPointIds();
    for ( k = 0; k < list->GetNumberOfIds(); k ++ )
      {
      vtkIdType globalPtId = list->GetId( k );
      if (  ptIdList->IsId( globalPtId )  ==  -1  )
        {
        ptIdList->InsertNextId( globalPtId );
        }
      }
    cell = NULL;
    list = NULL;
    }

  block = NULL;
  numPtIds = ptIdList->GetNumberOfIds();
  // now export the point ids stored in ptIdList and the number numPtIds

  }
ptIdList->Delete();
ptIdList = NULL;

-Zhanping
-- 
Zhanping Liu, PhD
Kitware, Inc.
28 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-371-3971 x 138
http://www.zhanpingliu.org


On Thu, Aug 6, 2009 at 1:27 AM, Rafael March <rafaelmarch3 at yahoo.com> wrote:

>   Hi,
>
> how to correctly generate a Points Global IDs to a vtkMultiBlockDataSet ?
> The IDs must, of course, be unique. I tried to iterate through the blocks
> and attribute to each part a vtkIntArray with the IDs, but of course this
> does not work when the parts have points in common.
>
> Also, I'm specially interested in MultiBlock comming from Ensight files,
> and I discovered recently that the Ensight Reader does not associate the
> "true" number of points to each part. So the GetNumberOfPoints() method
> doesn't work in these cases.
>
> How to achieve this ? I really need these Global IDs in order to uniquely
> identify each node of my model, to create a finite element preprocessor.
>
> Regards,
> Rafael March.
>
>
>
>
> _______________________________________________
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20090806/5ef07775/attachment.htm>


More information about the ParaView mailing list