[vtkusers] Subdomains in vtk

Andrew E Slaughter andrew.e.slaughter at gmail.com
Tue May 22 13:04:35 EDT 2012


Jochen,

I think your solution will work great, but I the line 
grid->GetCellData()->AddArray(blockIds) is giving me the following 
error. If I remove this line the program compiles and executes fine.

I link these vtk libraries: vtkHybrid vtkIO vtkexoIIc vtkCommon vtkFiltering

And include these vtk headers:
     #include <vtkPoints.h>
     #include <vtkUnstructuredGrid.h>
     #include <vtkCellArray.h>
     #include <vtkType.h>
     #include <vtkIdTypeArray.h>

Any help would be greatly appreciated.
Thanks,
Andrew

--- ERROR ---
In file included from 
/home/slaughter/Documents/programs/source/vol2mesh/vol2mesh.cpp:19:0:
/home/slaughter/Documents/programs/include/vol2mesh/Complex_3_subdomain_in_triangulation_3_to_vtk.h: 
In function 'vtkUnstructuredGrid* 
CGAL::output_c3t3_subdomain_to_vtk_unstructured_grid(const C3T3&, 
vtkUnstructuredGrid*)':
/home/slaughter/Documents/programs/include/vol2mesh/Complex_3_subdomain_in_triangulation_3_to_vtk.h:122:21: 
error: invalid use of incomplete type 'struct vtkCellData'
/usr/include/vtk-5.8/vtkDataSet.h:43:7: error: forward declaration of 
'struct vtkCellData'
make[3]: *** [source/vol2mesh/CMakeFiles/vol2mesh.dir/vol2mesh.cpp.o] 
Error 1
make[2]: *** [source/vol2mesh/CMakeFiles/vol2mesh.dir/all] Error 2
make[1]: *** [source/vol2mesh/CMakeFiles/vol2mesh.dir/rule] Error 2
make: *** [vol2mesh] Error 2


On 05/22/2012 10:59 AM, Jochen wrote:
> 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> 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->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);
>
>    ...
>
>
>
> Hope this helps a bit and take you one step further ;-)
>
> with kind regards
> Jochen
> ------------------------------------------------------------------------
> View this message in context: Re: Subdomains in vtk 
> <http://vtk.1045678.n5.nabble.com/Subdomains-in-vtk-tp5713081p5713303.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/4e2c8048/attachment.htm>


More information about the vtkusers mailing list