beginner tutorial, example 3: Demonstrates creating sets and tagsIn this example, we read in the VTK file (mbex2.vtk) generated in example 2, and demonstrate how to create sets and tags. We will create a set for each hexahedron, and add a tag to each set with some data.
#include <iostream>
{
const unsigned NUMVTX = 27;
const double vertex_coords[3 * NUMVTX] = {
0, 0, 0, 1, 0, 0, 2, 0, 0, 0, 1, 0, 1, 1, 0, 2, 1, 0, 0, 2, 0, 1, 2, 0, 2, 2, 0,
0, 0, 1, 1, 0, 1, 2, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 1, 0, 2, 1, 1, 2, 1, 2, 2, 1,
0, 0, 2, 1, 0, 2, 2, 0, 2, 0, 1, 2, 1, 1, 2, 2, 1, 2, 0, 2, 2, 1, 2, 2, 2, 2, 2 };
scdbox ),
"scdint->construct_box failed" );
unsigned i, j, k;
for( i = 0; i < 2; ++i )
for( j = 0; j < 2; ++j )
for( k = 0; k < 2; ++k )
{
std::cout << "Hex (" << i << "," << j << "," << k << ") "
<<
"has handle: " << scdbox->
get_element( i, j, k ) << std::endl;
}
for( i = 0; i < 3; ++i )
for( j = 0; j < 3; ++j )
for( k = 0; k < 3; ++k )
{
std::cout << "Vertex (" << i << "," << j << "," << k << ") "
<<
"has handle: " << scdbox->
get_vertex( i, j, k ) << std::endl;
}
return 0;
}