<div dir="ltr"><div><div>Hi David,<br><br>Thanks for the help. To follow up for others that go down this path, the following is the code that I used to load the element blocks and the sides sets and then write them into a vtk file.<br>
=============<br>from vtk import *<br><br>r = vtkExodusIIReader()<br>r.SetFileName("</path/to/file>")<br>r.GenerateGlobalNodeIdArrayOn()<br>r.GenerateGlobalElementIdArrayOn()<br>r.ExodusModelMetadataOn()<br>
<br>r.UpdateInformation()<br><br>nssa = r.GetNumberOfObjects(r.SIDE_SET)<br>for i in range(nssa):<br> r.SetObjectStatus(r.SIDE_SET, i, 1)<br><br>def printblocks(mb, spacing):<br> for i in range(mb.GetNumberOfBlocks()):<br>
if mb.GetBlock(i):<br> print spacing, mb.GetBlock(i).GetClassName()<br> if mb.GetBlock(i).IsA("vtkMultiBlockDataSet") == 1:<br> printblocks(mb.GetBlock(i), spacing+" ")<br> if mb.GetBlock(i).IsA("vtkUnstructuredGrid") == 1:<br>
print 'ugrid has np ne ', mb.GetBlock(i).GetNumberOfPoints(), mb.GetBlock(i).GetNumberOfCells()<br><br>r.Update()<br>mb = r.GetOutput()<br>printblocks(mb, "")<br><br>controller = vtkDummyController()<br>
controller.SetGlobalController(controller)<br>w = vtkXMLPMultiBlockDataWriter()<br>w.SetController(vtkMultiProcessController.GetGlobalController())<br>w.SetFileName("/media/ssddrive/BUILDS/VTK/debug/testexo.vtm")<br>
w.SetInputConnection(r.GetOutputPort())<br><br>w.Update()<br>============<br><br></div>I had to use the parallel XML multiblock data writer since not all blocks in the output from the Exodus reader have grids in them and the serial XML multiblock data writer doesn't like this. <br>
<br></div>Andy<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Oct 7, 2013 at 7:48 PM, David Thompson <span dir="ltr"><<a href="mailto:david.thompson@kitware.com" target="_blank">david.thompson@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Andy,<br>
<div class="im"><br>
> Thanks for the response but I'm still a bit confused. I have an ExodusII file with 4 side sets (file attached) but when I do, in vtkpython, r.GetNumberOfObjects(r.SIDE_SET) I get 4 but when I do r.GetNumberOfObjects(r.SIDE_SET_CONN) I get 0.<br>
</div>> ... Is that correct then to use r.SIDE_SET instead of r.SIDE_SET_CONN here with r.SetObjectStatus()?<br>
<br>
I agree it is not self-consistent, but it is how the reader currently operates. The goal was to hide the existence of the *_CONN enums from users (because the context of the API call usually indicates whether the target is the connectivity array or results scalars defined over the connectivity array).<br>
<br>
The SetAllArrayStatus method should probably either<br>
1. have the "*_CONN" variants in the switch statement removed, or<br>
2. call SetObjectStatus(otyp,j,1) in addition to SetObjectArrayStatus(otyp,i,1) to guarantee that no block or set is not skipped (making it appear as if variables defined only on skipped objects were not loaded).<br>
<span class="HOEnZb"><font color="#888888"><br>
David</font></span></blockquote></div><br></div>