75 : mbImpl( impl ), mWriteIface( NULL ), sequenceManager( NULL ), dU(), DAMSEL_FLAGS( DAMSEL_IS_TRACKING )
77 assert( impl != NULL );
131 const std::vector< std::string >& ,
145 DMSLmodel_create(
sizeof(
EntityHandle ) == 8 ? DAMSEL_HANDLE_TYPE_HANDLE64 : DAMSEL_HANDLE_TYPE_HANDLE32 );
148 MPI_Comm comm = MPI_COMM_WORLD;
150 err = DMSLmodel_attach(
dU.
dmslModel, file_name, comm, NULL );
180 err = DMSLmodel_transfer_sync(
dU.
dmslModel, DAMSEL_TRANSFER_TYPE_WRITE );
181 CHK_DMSL_ERR( err,
"DMSLmodel_transfer_asynch failed" );
197 std::vector< Tag > tmp_mtags;
203 for( std::vector< Tag >::iterator vit = tmp_mtags.begin(); vit != tmp_mtags.end(); ++vit )
208 std::cerr <<
"Warning: tag " << ( *vit )->get_name()
209 <<
"is not of type dense or sparse, and is not currently supported by the "
215 std::vector< DamselUtil::tinfo >::iterator vit2 =
226 err = DMSLtag_define(
dU.
dmslModel, (damsel_handle_ptr)&thandle,
228 CHK_DMSL_ERR( err,
"Failure to get Damsel tag for MOAB tag" );
234 assert( ( *vit2 ).mTagh );
243 CHK_DMSL_ERR( err,
"Failure to get Damsel tag for MOAB tag" );
249 CHK_DMSL_ERR( err,
"Failure to get Damsel tag for MOAB tag" );
255 CHK_DMSL_ERR( err,
"Failure to get Damsel tag for MOAB tag" );
261 CHK_DMSL_ERR( err,
"Failure to get Damsel tag for MOAB tag" );
287 std::vector< Tag > moab_taghs;
288 moab_taghs.reserve( num_tags );
289 for( std::vector< DamselUtil::tinfo >::iterator vit =
dU.
tagMap.begin(); vit !=
dU.
tagMap.end(); ++vit )
291 moab_taghs.push_back( ( *vit ).mTagh );
294 damsel_container mtags =
295 DMSLcontainer_create_vector(
dU.
dmslModel, (damsel_handle_ptr)&moab_taghs[0], moab_taghs.size() );
296 std::cerr <<
"MOAB: created model container: mtags = " << mtags << std::endl;
298 err = DMSLmodel_map_handles_inventing_file_handles( mtags );
301 err = DMSLcontainer_release( mtags );
302 CHK_DMSL_ERR( err,
"Problem releasing tag handle container" );
314 damsel_container vertex_cont =
315 DMSLcontainer_create_sequence(
dU.
dmslModel, start_vert, (
int)( end_vert - start_vert + 1 ), 1 );
316 std::cerr <<
"MOAB: created model container: vertex_cont = " << vertex_cont << std::endl;
317 if( DAMSEL_CONTAINER_INVALID == vertex_cont )
319 "Failed to create vertex sequence for vertices starting with handle " << rsi.
get_start_handle() );
321 damsel_err_t err = DMSLmodel_map_handles_inventing_file_handles( vertex_cont );
325 err = DMSLentity_define( vertex_cont, DAMSEL_ENTITY_TYPE_VERTEX, 1, vertex_cont );
329 Range vert_range( start_vert, end_vert );
330 double *xcoords = NULL, *ycoords = NULL, *zcoords = NULL;
333 "Failed to get coordinate iterator for vertices starting with handle " << rsi.
get_start_handle() );
334 if( count != (
int)vert_range.
size() )
336 MB_SET_ERR( MB_FAILURE,
"Vertex subrange not in the same sequence for vertices starting with handle "
340 if( xcoords && !ycoords && !zcoords )
345 err = DMSLmodel_map_tag( xcoords, vertex_cont, (damsel_handle_ptr)&
dU.
xcoordsTag.
mTagh );
346 CHK_DMSL_ERR( err,
"Failed to assign vertex coordinates tag for vertices starting with handle "
352 err = DMSLmodel_map_tag( xcoords, vertex_cont, (damsel_handle_ptr)&
dU.
xcoordsTag.
mTagh );
353 CHK_DMSL_ERR( err,
"Failed to assign vertex x coordinates tag for vertices starting with handle "
355 err = DMSLmodel_map_tag( ycoords, vertex_cont, (damsel_handle_ptr)&
dU.
ycoordsTag.
mTagh );
356 CHK_DMSL_ERR( err,
"Failed to assign vertex y coordinates tag for vertices starting with handle "
358 err = DMSLmodel_map_tag( zcoords, vertex_cont, (damsel_handle_ptr)&
dU.
zcoordsTag.
mTagh );
359 CHK_DMSL_ERR( err,
"Failed to assign vertex z coordinates tag for vertices starting with handle "
366 err = DMSLcontainer_release( vertex_cont );
367 CHK_DMSL_ERR( err,
"Problem releasing vertex handle container" );
379 damsel_container ent_cont;
380 ent_cont = DMSLcontainer_create_sequence(
dU.
dmslModel, start_ent, (
int)( end_ent - start_ent + 1 ), 1 );
381 std::cerr <<
"MOAB: created model container: ent_cont = " << ent_cont << std::endl;
382 if( DAMSEL_CONTAINER_INVALID == ent_cont )
MB_SET_ERR( MB_FAILURE,
"Bad sequence returned by Damsel" );
384 damsel_err_t err = DMSLmodel_map_handles_inventing_file_handles( ent_cont );
391 assert( 0 < num_connect );
394 Range ent_range( start_ent, end_ent );
399 "Failed to get connect iterator for entities starting with handle " << rsi.
get_start_handle() );
400 if( count != (
int)ent_range.
size() )
401 MB_SET_ERR( MB_FAILURE,
"Entity subrange not in the same sequence for entities starting with handle "
411 err = DMSLcontainer_release( ent_cont );
412 CHK_DMSL_ERR( err,
"Problem releasing entity handle container" );
421 const unsigned char* val_ptr;
423 std::vector< DamselUtil::tinfo >::iterator tagit;
436 if( !val_ptr )
continue;
439 err = DMSLmodel_map_tag( (
void*)val_ptr, ent_cont, (damsel_handle_ptr)&dtag );
441 "Failed to write coordinates tag for vertices starting with handle " << rsi.
get_start_handle() );
453 std::vector< DamselUtil::tinfo >::iterator tagit;
454 std::vector< unsigned char > tag_values;
455 std::vector< EntityHandle > tagged_ents;
456 damsel_container ent_cont;
467 if( output_ents.
empty() )
continue;
471 tag_values.resize( stag->
get_size() * output_ents.
size() );
475 tagged_ents.resize( output_ents.
size() );
476 std::copy( output_ents.
begin(), output_ents.
end(), tagged_ents.begin() );
477 ent_cont = DMSLcontainer_create_vector(
dU.
dmslModel, (damsel_handle_ptr)&tagged_ents[0], tagged_ents.size() );
478 std::cerr <<
"MOAB: created model container: sparse_tag_ent_cont = " << ent_cont << std::endl;
479 if( DAMSEL_CONTAINER_INVALID == ent_cont )
480 MB_SET_ERR( MB_FAILURE,
"Trouble creating entity handle container for tag " << stag->
get_name() );
483 err = DMSLmodel_map_tag( (
void*)&tag_values[0], ent_cont, (damsel_handle_ptr)&stag );
486 err = DMSLcontainer_release( ent_cont );
487 CHK_DMSL_ERR( err,
"Problem releasing entity handle container" );
497 std::vector< EntityHandle > ents;
498 damsel_container mcont;
501 std::vector< unsigned int > set_flags( num_sets, 0 );
510 mcont = DMSLcontainer_create_vector(
dU.
dmslModel, (damsel_handle*)&ents[0], ents.size() );
514 mcont = DMSLcontainer_create_vector(
dU.
dmslModel, (damsel_handle*)NULL, 0 );
516 std::cerr <<
"MOAB: created model container: sets_cont = " << mcont << std::endl;
521 damsel_collection_type coll_type =
522 ( opts &
MESHSET_SET ? DAMSEL_HANDLE_COLLECTION_TYPE_SET : DAMSEL_HANDLE_COLLECTION_TYPE_VECTOR );
533 DMSLcoll_create(
dU.
dmslModel, (damsel_handle_ptr)&seth, mcont, coll_type );
536 err = DMSLcontainer_release( mcont );
537 CHK_DMSL_ERR( err,
"Problem releasing set entity handle container" );
543 std::cerr <<
"MOAB: created model container: sets_cont = " << mcont << std::endl;
546 err = DMSLmodel_map_tag( &set_flags[0], mcont, ( damsel_handle_ptr ) & (
dU.
collFlagsTag.
mTagh ) );
547 CHK_DMSL_ERR( err,
"Failed to assign COLL_FLAGS tag for sets" );
550 err = DMSLmodel_map_handles_inventing_file_handles( mcont );