[vtkusers] Subdomains in vtk

Jochen jochen.kling at email.de
Tue May 22 10:59:45 EDT 2012


Hi Andrew,


I'm not very experienced with the exodus file format but I found out from
the source vtkExodusIIWriter.cxx
that the block ids are written if an array named "ElementBlockIds" exists by
default and
how you said before WriteOutBlockIdArrayOn() is called.

So you probably could do something like this:

     
   ...

  
vtkSmartPointer<vtkUnstructuredGrid&gt; grid = 
vtkSmartPointer<vtkUnstructuredGrid&gt;::New();

&nbsp;&nbsp;
...


&nbsp;&nbsp;
vtkSmartPointer<vtkIdTypeArray&gt; blockIds = 
vtkSmartPointer<vtkIdTypeArray&gt;::New();

&nbsp;&nbsp; /* you can set another name, but then you must call

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
myVtkExodusIIWriter-&gt;SetBlockIdArrayName(&quot;yourElementBlockIdsName&quot;) 

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; in your IO-method. */

&nbsp;&nbsp;
blockIds-&gt;SetName(&quot;ElementBlockIds&quot;); 


&nbsp;&nbsp;
for (vtkIdType i = 0; i &lt; grid-&gt;GetNumberOfCells(); i++) {

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
blockIds-&gt;InsertNextValue(blockId[i]); // blockId is a c++ integer array
which 
contains your block ids

&nbsp;&nbsp;
}

&nbsp;&nbsp;
grid-&gt;GetCellData()-&gt;AddArray(blockIds);

&nbsp;&nbsp;
...

&nbsp;


Hope this helps a bit and take you one step further ;-)

with kind regards

Jochen

--
View this message in context: http://vtk.1045678.n5.nabble.com/Subdomains-in-vtk-tp5713081p5713303.html
Sent from the VTK - Users mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120522/b3793e4d/attachment.htm>


More information about the vtkusers mailing list