Cell/Point connectivity for Exodus Multiblock dataset

All,

I need to find breaks in my truss networks inside an Exodus MBD. The best way for me to identify them would be to find all the nodes that are only connected to a single element. I have no idea how to figure that out. Maybe there is a filter that I’m unaware of that could do this. I can’t figure out how to find this information for each point in a Programmable Filter either.

Any hints cheerfully accepted!
Dennis

Hi Dennis,

Can you post an example file? How big do these get? There is a likely way of doing this in Python but it would likely require a loop over all of the nodes in Python, which is slow for large datasets.

Berk,

Probably can’t get permission to post publicly. The blocks I would need to process consist of about 1Million truss elements and 1Million nodes.

Dennis

Here is the Programmable Filter code that does what you want:

import numpy
for data in output:
    npts = data.GetNumberOfPoints()
    data.BuildLinks()
    links = data.GetCellLinks()
    a = numpy.empty(npts,dtype=numpy.uint32)
    for ptid in xrange(npts):
        a[ptid] = links.GetNcells(ptid)
    data.PointData.append(a, "cell_count")

This filter will create a point centered cell_count variable. You can then use Find Data to extract all of the points that have a cell_count of 1.

Berk,

Thanks very much for that very elegant solution.

Let me reveal my ignorance here in order to get additional clarification. I’m a python guy. I’m not really a C++ guy.

I believed that any function available to the “data” in your script (which happens to be an unstructuredgrid) was available and would be revealed by either:

  1. print dir(data) or
  2. print help(data)
    Neither of these reveal the existence of “data.GetCellLinks()”. So, I am wondering what other wonderful functions might be available and how do I find them - do I need to go through the list of classes that unstructuredgrid inherits from and look through their C++ classes to find them or what?

Could you advise what I need to do to find all the functions that are actually available for use for “data” within the programmable filter

The carrot is, if I figure this out now, I’m much less likely to come back with other, similar problems later.

Thanks again and I hope I’m not being too ungracious by asking this additional question after you were so helpful with the original problem.

Dennis

Great question Dennis. To make the Python API a bit easier, we wrap the VTK objects with Python objects. If all you want is to do dir or help, you can get the VTK object with .VTKObject. So

print(dir(data.VTKObject))

At the end, to do some of the more advanced things, you will have to learn about the VTK data model and APIs a bit more. You can look at Doxygen (just search for vtkUnstructuredGrid on your favorite search engine). You can also look at the VTK text book which is now available online and updated to Python.

Berk,

Awesome!! That reveals a large number of functions that I will pursue at length.
That would be a great addition to the wiki, BTW.

Thanks again and have a great day!

Dennis