[vtkusers] Subdomains in vtk
Andrew E Slaughter
andrew.e.slaughter at gmail.com
Tue May 22 14:10:02 EDT 2012
Jochen,
I figured it out, and the SetNumberOfCompoents was not required. I was
missing a header: vtkCellData.h.
Thanks again for the help, you saved me some time.
Peace,
Andrew
On 05/22/2012 02:08 PM, Jochen wrote:
>
> 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> grid =
> vtkSmartPointer<vtkUnstructuredGrid>::New();
> ...
>
> vtkSmartPointer<vtkIdTypeArray> blockIds =
> vtkSmartPointer<vtkIdTypeArray>::New();
> /* you can set another name, but then you must call
> myVtkExodusIIWriter->SetBlockIdArrayName("yourElementBlockIdsName")
> in your IO-method. */
>
> *blockIds->SetNumberOfComponents(1);* // <-------------
> sorry, I forgot this line
> blockIds->SetName("ElementBlockIds");
>
> for (vtkIdType i = 0; i < grid->GetNumberOfCells(); i++) {
> blockIds->InsertNextValue(blockId[i]); // blockId is a c++
> integer array which contains your block ids
> }
> grid->GetCellData()->AddArray(blockIds);
>
> ...
>
> 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: Re: Subdomains in vtk
> <http://vtk.1045678.n5.nabble.com/Subdomains-in-vtk-tp5713081p5713312.html>
> Sent from the VTK - Users mailing list archive
> <http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html> at Nabble.com.
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120522/48cd8ede/attachment.htm>
More information about the vtkusers
mailing list