[vtkusers] Subdomains in vtk

Jochen jochen.kling at email.de
Tue May 22 14:08:26 EDT 2012


Andrew,


I guess my code do have a bug, isn't it? Sorry for that. But I'm using C#
and 
ActiViz

and do not have a working environment for C++/VTK. 

So the shown code was just out of my mind without testing.

Accidently I missed a line ( see bold line in the code segement below).

 

   ...

  
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;SetNumberOfComponents(1);*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
// &lt;------------- sorry, I forgot this line

&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;


To make things clear to me did it fail to 
compile or did it fail during execution?

with best regards

Jochen



--
View this message in context: http://vtk.1045678.n5.nabble.com/Subdomains-in-vtk-tp5713081p5713312.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/6c09c525/attachment.htm>


More information about the vtkusers mailing list