16 #include "ScdVertexSeq.hpp"
17 #include "ScdElementSeq.hpp"
18 #include "EntitySequenceManager.hpp"
46 int main(
int argc,
char** argv )
56 std::cout <<
"Usage: <scdseq_timing> <#intervals> " << std::endl
57 <<
" where #intervals is the number of intervals on each side of each cube." << std::endl;
62 sscanf( argv[1],
"%d", &intervals );
66 bool do_scd =
true, do_ucd =
true;
70 sscanf( argv[2],
"%s", do_option );
71 if( do_option[0] ==
'u' )
73 else if( do_option[0] ==
's' )
77 std::cout <<
"Didn't understand input; doing both scd and ucd." << std::endl;
82 int total_elements = intervals * intervals * intervals;
83 std::vector< EntityHandle > connect;
90 std::cout <<
"Hit any key and return to continue...";
92 std::cout << std::endl;
101 std::cout <<
"Problem creating structured sequences." << std::endl;
108 for(
int j = 0; j < 3; j++ )
110 for(
int i = 0; i < total_elements; i++ )
118 time =
static_cast< float >( stop - start ) / CLOCKS_PER_SEC;
120 std::cout <<
"Time to get connectivity for scd mesh of " << 3 * total_elements <<
" elements: " << time
121 <<
" seconds." << std::endl;
125 std::cout <<
"Hit any key and return to continue...";
127 std::cout << std::endl;
143 std::cout <<
"Problem creating unstructured sequences." << std::endl;
148 std::vector< EntityHandle > connect;
150 for(
int j = 0; j < 3; j++ )
152 for(
int i = 0; i < total_elements; i++ )
160 time =
static_cast< float >( stop - start ) / CLOCKS_PER_SEC;
162 std::cout <<
"Time to get connectivity for ucd mesh of " << 3 * total_elements <<
" elements: " << time
163 <<
" seconds." << std::endl;
167 std::cout <<
"Hit any key and return to continue...";
169 std::cout << std::endl;
188 ScdVertexSeq* vseq[3];
189 ScdElementSeq* eseq[3];
199 EntitySequenceManager* seq_mgr =
gMB->sequence_manager();
203 vseq[0] = vseq[1] = vseq[2] = NULL;
207 seq_mgr->create_scd_sequence( vseq0_minmax[0], vseq0_minmax[1],
MBVERTEX, 1, vstart[0], dum_seq );
208 if( NULL != dum_seq ) vseq[0] =
dynamic_cast< ScdVertexSeq*
>( dum_seq );
209 assert( MB_FAILURE != result && vstart[0] != 0 && dum_seq != NULL && vseq[0] != NULL );
212 result = seq_mgr->create_scd_sequence( vseq1_minmax[0], vseq1_minmax[1],
MBVERTEX, 1, vstart[1], dum_seq );
213 if( NULL != dum_seq ) vseq[1] =
dynamic_cast< ScdVertexSeq*
>( dum_seq );
214 assert( MB_FAILURE != result && vstart[1] != 0 && dum_seq != NULL && vseq[1] != NULL );
217 result = seq_mgr->create_scd_sequence( vseq2_minmax[0], vseq2_minmax[1],
MBVERTEX, 1, vstart[2], dum_seq );
218 if( NULL != dum_seq ) vseq[2] =
dynamic_cast< ScdVertexSeq*
>( dum_seq );
219 assert( MB_FAILURE != result && vstart[2] != 0 && dum_seq != NULL && vseq[2] != NULL );
230 eseq[0] = eseq[1] = eseq[2] = NULL;
233 result = seq_mgr->create_scd_sequence( eseq0_minmax[0], eseq0_minmax[1],
MBHEX, 1, estart[0], dum_seq );
234 if( NULL != dum_seq ) eseq[0] =
dynamic_cast< ScdElementSeq*
>( dum_seq );
235 assert( MB_FAILURE != result && estart[0] != 0 && dum_seq != NULL && eseq[0] != NULL );
238 result = eseq[0]->add_vsequence( vseq[0],
241 vseq0_minmax[0], vseq0_minmax[0], vseq0_minmax[0], vseq0_minmax[0],
242 vseq0_minmax[0], vseq0_minmax[0] );
246 std::cout <<
"Couldn't add first vsequence to first element sequence in tri-composite 3d eseq." << std::endl;
251 result = seq_mgr->create_scd_sequence( eseq1_minmax[0], eseq1_minmax[1],
MBHEX, 1, estart[1], dum_seq );
252 if( NULL != dum_seq ) eseq[1] =
dynamic_cast< ScdElementSeq*
>( dum_seq );
253 assert( MB_FAILURE != result && estart[1] != 0 && dum_seq != NULL && eseq[1] != NULL );
256 result = eseq[1]->add_vsequence( vseq[0],
258 vseq0_minmax[0], eseq0_minmax[0],
262 vseq0_minmax[0], eseq0_minmax[0],
264 true, eseq[1]->min_params(),
265 HomCoord( eseq[1]->min_params().i(), eseq[1]->max_params().j(),
266 eseq[1]->max_params().k() ) );
269 std::cout <<
"Couldn't add shared vsequence to second element sequence in tri-composite 3d eseq." << std::endl;
275 eseq[1]->add_vsequence( vseq[1],
285 std::cout <<
"Couldn't add second vseq to second element sequence in tri-composite 3d eseq." << std::endl;
290 result = seq_mgr->create_scd_sequence( eseq2_minmax[0], eseq2_minmax[1],
MBHEX, 1, estart[2], dum_seq );
291 if( NULL != dum_seq ) eseq[2] =
dynamic_cast< ScdElementSeq*
>( dum_seq );
292 assert( MB_FAILURE != result && estart[2] != 0 && dum_seq != NULL && eseq[2] != NULL );
295 result = eseq[2]->add_vsequence(
305 HomCoord( eseq[2]->min_params().i(), eseq[2]->max_params().j(), eseq[2]->max_params().k() ) );
308 std::cout <<
"Couldn't add shared vsequence to third element sequence in tri-composite 3d eseq." << std::endl;
313 result = eseq[2]->add_vsequence( vseq[0],
315 vseq1_minmax[0], eseq2_minmax[0],
319 vseq1_minmax[0], eseq2_minmax[0],
321 true, eseq2_minmax[0],
322 HomCoord( eseq2_minmax[1].i(), eseq2_minmax[0].j(), eseq2_minmax[1].k() ) );
325 std::cout <<
"Couldn't add left shared vsequence to third element sequence in "
326 "tri-composite 3d eseq."
332 result = eseq[2]->add_vsequence( vseq[2],
343 std::cout <<
"Couldn't add third vseq to third element sequence in tri-composite 3d eseq." << std::endl;
356 int num_elements = intervals * intervals * intervals;
357 int num_verts = ( intervals + 1 ) * ( intervals + 1 ) * ( intervals + 1 );
359 std::vector< double* > arrays;
360 for(
int i = 0; i < 3; i++ )
369 for(
int i = 0; i < 3; i++ )
374 for(
int j = 0; j < num_elements * 8; j++ )
375 conn[i][j] = vstart[i];