<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none"><!--P{margin-top:0;margin-bottom:0;} p
        {margin-top:0;
        margin-bottom:0}--></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<p>I have an exodus mesh file that contains numbered element blocks.  I want to be able to determine which element block (if any) any (x, y, z) coordinate is in.  To do this, I read the mesh in with vtkExodusiiMeshReader, attempt to generate a vtkSurfaceFilter
 for each element block, and use vtkSelectEnclosedPoints to find the element block the point is in.  Unfortunately, I'm doing something wrong when reading the nodes for each element block, the data structure that is supposed to have the node coordinates seems
 to be empty, it throws this error:<br>
<br>
ERROR: In /home/joe/Downloads/VTK-6.1.0/Common/ExecutionModel/vtkDemandDrivenPipeline.cxx, line 715<br>
vtkCompositeDataPipeline (0x35181a0): Input port 1 of algorithm vtkSelectEnclosedPoints(0x1c31480) has 0 connections but is not optional.<br>
<br>
<br>
A small piece of the code I have is:<br>
<br>
<br>
#define Instantiate(obj, class) vtkSmartPointer<class> obj = vtkSmartPointer<class>::New()<br>
<br>
//I want to store the vtkPolyData for each element block in a vector, will be passed to vtkSelectEnclosedPoints later:<br>
std::vector<vtkSmartPointer<vtkPolyData> > element_blocks_surface_filter_vector;<br>
<br>
<br>
std::string exodusMesh = "foo.exo";<br>
exodusiiReader->SetFileName(exodusMesh.c_str());<br>
exodusiiReader->Update();</p>
<p><br>
</p>
<p>// get the metadata from the mesh:<br>
exodusiiReader->UpdateInformation();<br>
<br>
// read in the element blocks, make a surface filter for each, push_back into vector:<br>
for (int z = 0; z < exodusiiReader->GetNumberOfElementBlockArrays(); z++)<br>
{<br>
    const char* nname = exodusiiReader->GetElementBlockArrayName(z);<br>
<br>
/*<br>
 *  I think my mistake is in the following line<br>
 */<br>
    exodusiiReader->SetObjectArrayStatus(exodusiiReader->ELEM_BLOCK, nname, 1);<br>
    exodusiiReader->Update();<br>
<br>
    Instantiate( surfaceFilter,vtkDataSetSurfaceFilter );<br>
    Instantiate( MultiBlockData, vtkMultiBlockDataSet );<br>
    Instantiate( DataObject, vtkDataObject );<br>
<br>
    MultiBlockData = exodusiiReader->GetOutput();<br>
    DataObject= MultiBlockData->GetBlock(0);<br>
<br>
<br>
/*<br>
 * everything below here should be fine (except the DataObject generated above isn't correct).</p>
<p> * it works when I just send it the whole mesh<br>
 */<br>
<br>
    #if VTK_MAJOR_VERSION <= 5<br>
      surfaceFilter->SetInput(DataObject);<br>
    #else<br>
      surfaceFilter->SetInputData(DataObject);<br>
    #endif<br>
      surfaceFilter->Update();<br>
<br>
    element_blocks_surface_filter_vector.push_back(surfaceFilter->GetOutput());<br>
<br>
}</p>
<p><br>
</p>
<p>Any information about what I'm doing wrong above would be greatly appreciated. Thanks!</p>
<p><br>
</p>
<p>Joe<br>
</p>
</div>
</body>
</html>