22 string output = string(
"polyhedra.vtk" );
26 int main(
int argc,
char** argv )
30 if( NULL ==
mb )
return 1;
38 if( argc > 2 )
output = argv[2];
40 if( argc > 3 )
layers = atoi( argv[3] );
56 cout <<
"Number of vertices is " << verts.
size() << endl;
57 cout <<
"Number of faces is " << faces.
size() << endl;
63 cout <<
"Number of edges is " << edges.
size() << endl;
65 std::vector< double > coords;
66 int nvPerLayer = (int)verts.
size();
67 coords.resize( 3 * nvPerLayer );
73 for(
int ii = 0; ii <
layers; ii++ )
75 for(
int i = 0; i < nvPerLayer; i++ )
88 int nedges = (int)edges.
size();
91 for(
int j = 0; j < nedges; j++ )
100 int i0 = verts.
index( conn2[0] );
101 int i1 = verts.
index( conn2[1] );
102 for(
int ii = 0; ii <
layers; ii++ )
104 connect[indexConn++] = newVerts[ii][i0];
105 connect[indexConn++] = newVerts[ii][i1];
106 connect[indexConn++] = newVerts[ii + 1][i1];
107 connect[indexConn++] = newVerts[ii + 1][i0];
111 int nfaces = (int)faces.
size();
113 for(
int i = 0; i < nfaces; i++ )
114 allPolygons[i] = faces[i];
123 for(
int j = 0; j < nfaces; j++ )
131 for(
int i = 0; i < num_nodes; i++ )
133 indexVerts[i] = verts.
index( connp[i] );
134 int i1 = ( i + 1 ) % num_nodes;
140 indexEdges[i] = edges.
index( adjEdges[0] );
141 if( indexEdges[i] < 0 )
MB_CHK_SET_ERR( MB_FAILURE,
"did not find edge in range" );
144 for(
int ii = 0; ii <
layers; ii++ )
147 for(
int i = 0; i < num_nodes; i++ )
148 newConn[i] = newVerts[ii + 1][indexVerts[i]];
154 polyhedronConn[0] = allPolygons[nfaces * ii + j];
156 polyhedronConn[1] = allPolygons[nfaces * ( ii + 1 ) + j];
161 for(
int i = 0; i < num_nodes; i++ )
163 polyhedronConn[2 + i] = start_elem + ii +
layers * indexEdges[i];