111 sscanf( argv[1],
"%d", &nelem );
113 std::cout <<
"number of elements: " << nelem << std::endl;
117 int nnodes = nelem + 1;
119 double* coords = NULL;
128 assert( NULL != connect && NULL != coords );
130 double ttime0, ttime1, ttime2, ttime3, utime, stime;
132 int nodes_tot = nnodes * nnodes * nnodes;
133 CubitNode** node_array =
new CubitNode*[nodes_tot];
135 for( i = 0; i < nodes_tot; i++ )
136 node_array[i] =
new CubitNode( coords[3 * i], coords[3 * i + 1], coords[3 * i + 2] );
138 int nelem_tot = nelem * nelem * nelem;
139 NodeHex** hex_array =
new NodeHex*[nelem_tot];
142 for( i = 0; i < nelem_tot; i++ )
144 conn[0] = node_array[connect[j]];
145 conn[1] = node_array[connect[j + 1]];
146 conn[2] = node_array[connect[j + 2]];
147 conn[3] = node_array[connect[j + 3]];
148 conn[4] = node_array[connect[j + 4]];
149 conn[5] = node_array[connect[j + 5]];
150 conn[6] = node_array[connect[j + 6]];
151 conn[7] = node_array[connect[j + 7]];
154 hex_array[i] =
new NodeHex( conn );
161 for( i = 0; i < nelem_tot; i++ )
163 double centroid[3] = { 0.0, 0.0, 0.0 };
164 hex_array[i]->hex_nodes( conn[0], conn[1], conn[2], conn[3], conn[4], conn[5], conn[6], conn[7] );
165 for( j = 0; j < 8; j++ )
167 centroid[0] += conn[j]->node_x();
168 centroid[1] += conn[j]->node_y();
169 centroid[2] += conn[j]->node_z();
176 for( i = 0; i < nelem_tot; i++ )
177 hex_array[i]->add_hex_to_nodes();
179 DLIList< CubitHex* > hexes;
180 for( i = 0; i < nodes_tot; i++ )
182 node_array[i]->all_hexes( hexes );
187 std::cout <<
"CUBIT: nelem, construct, e_to_v query, v_to_e query = " << nelem <<
", " << ttime1 - ttime0 <<
", "
188 << ttime2 - ttime1 <<
", " << ttime3 - ttime2 <<
" seconds" << std::endl;