19 if( MB_SUCCESS != err ) std::cerr << ( a ) << std::endl; \
21 #define ERRORR( a, b ) \
23 if( MB_SUCCESS != ( b ) ) \
25 std::cerr << ( a ) << std::endl; \
29 #define ERRORMPI( a, b ) \
31 if( MPI_SUCCESS != ( b ) ) \
33 std::cerr << ( a ) << std::endl; \
53 : mbImpl( impl ), myPc( pc ), myId( coupler_id ), numIts( 3 ), max_dim( max_ent_dim ), _ntot( 0 ),
56 assert( NULL != impl && ( pc || !local_elems.
empty() ) );
92 if( local_ents.
empty() )
103 std::cout <<
"Problems getting source entities" << std::endl;
108 int max_per_leaf = 6;
109 for(
int i = 0; i <
numIts; i++ )
111 std::ostringstream str;
112 str <<
"PLANE_SET=0;"
113 <<
"MAX_PER_LEAF=" << max_per_leaf <<
";";
123 double radius = pos0.
length();
124 str <<
"SPHERICAL=true;RADIUS=" << radius <<
";";
131 std::cout <<
"Problems building tree";
136 std::cout <<
"; increasing elements/leaf to " << max_per_leaf << std::endl;
140 std::cout <<
"; exiting" << std::endl;
165 #if( MPI_VERSION >= 2 )
167 mpi_err = MPI_Allgather( MPI_IN_PLACE, 0, MPI_DATATYPE_NULL, &
allBoxes[0], 6, MPI_DOUBLE,
172 mpi_err = MPI_Allgather( &
allBoxes[6 * my_rank], 6, MPI_DOUBLE, &allBoxes_tmp[0], 6, MPI_DOUBLE,
177 if( MPI_SUCCESS != mpi_err )
return MB_FAILURE;
186 double min[3] = { 0, 0, 0 }, max[3] = { 0, 0, 0 };
189 std::cout <<
"Proc " << my_rank <<
": box min/max, tree depth = (" << min[0] <<
"," << min[1] <<
"," << min[2]
190 <<
"), (" << max[0] <<
"," << max[1] <<
"," << max[2] <<
"), " << dep << std::endl;
210 std::cout <<
"Can't find tag, no spectral set\n";
215 std::cout <<
"Can't get sem set on source\n";
222 if( sem_dims[0] != sem_dims[1] || sem_dims[0] != sem_dims[2] )
224 std::cout <<
" dimensions are different. bail out\n";
228 spectral_sets.
empty();
236 std::cout <<
"Can't get sem set on target\n";
243 if( sem_dims[0] != sem_dims[1] || sem_dims[0] != sem_dims[2] )
245 std::cout <<
" dimensions are different. bail out\n";
249 spectral_sets.
empty();
255 _ntot = sem_dims[0] * sem_dims[1] * sem_dims[2];
259 std::cout <<
"Can't get xm1tag \n";
265 std::cout <<
"Can't get ym1tag \n";
271 std::cout <<
"Can't get zm1tag \n";
281 std::vector< double > locs( 3 * targ_ents.
size() );
286 unsigned int num_verts = verts.
size();
287 verts =
subtract( targ_ents, verts );
293 double* coords = &locs[num_verts];
301 coords[0] = coords[1] = coords[2] = 0.0;
302 for(
int i = 0; i < num_conn; i++ )
304 coords[0] += dum_pos[3 * i];
305 coords[1] += dum_pos[3 * i + 1];
306 coords[2] += dum_pos[3 * i + 2];
308 coords[0] /= num_conn;
309 coords[1] /= num_conn;
310 coords[2] /= num_conn;
316 return locate_points( &locs[0], targ_ents.
size(), rel_eps, abs_eps, tl, store_local );
320 unsigned int num_points,
326 assert( tl || store_local );
334 target_pts.
initialize( 2, 0, 0, 3, num_points );
345 source_pts.
set_n( 0 );
356 for(
unsigned int i = 0; i < 3 * num_points; i += 3 )
359 std::vector< int > procs_to_send_to;
363 if( (
allBoxes[6 * j] <= xyz[i] + abs_eps ) && ( xyz[i] <=
allBoxes[6 * j + 3] + abs_eps ) &&
364 (
allBoxes[6 * j + 1] <= xyz[i + 1] + abs_eps ) && ( xyz[i + 1] <=
allBoxes[6 * j + 4] + abs_eps ) &&
365 (
allBoxes[6 * j + 2] <= xyz[i + 2] + abs_eps ) && ( xyz[i + 2] <=
allBoxes[6 * j + 5] + abs_eps ) )
368 procs_to_send_to.push_back( j );
371 if( procs_to_send_to.empty() )
374 std::cout <<
" point index " << i / 3 <<
": " << xyz[i] <<
" " << xyz[i + 1] <<
" " << xyz[i + 2]
375 <<
" not found in any box\n";
378 double min_dist = 1.e+20;
383 double distance = box.
distance( &xyz[i] );
384 if( distance < min_dist )
393 assert(
"cannot locate any box for some points" );
397 std::cout <<
" point index " << i / 3 <<
" added to box for proc j:" << index <<
"\n";
399 procs_to_send_to.push_back( index );
402 for(
size_t k = 0; k < procs_to_send_to.size(); k++ )
404 unsigned int j = procs_to_send_to[k];
407 target_pts.
resize( std::max( 10.0, 1.5 * target_pts.
get_max() ) );
410 target_pts.
vi_wr[2 * target_pts.
get_n() + 1] = i / 3;
412 target_pts.
vr_wr[3 * target_pts.
get_n()] = xyz[i];
413 target_pts.
vr_wr[3 * target_pts.
get_n() + 1] = xyz[i + 1];
414 target_pts.
vr_wr[3 * target_pts.
get_n() + 2] = xyz[i + 2];
422 for(
unsigned int i = 0; i < target_pts.
get_n(); i++ )
423 if( target_pts.
vi_rd[2 * i] == (
int)my_rank ) num_to_me++;
424 printf(
"rank: %u local points: %u, nb sent target pts: %u mappedPts: %u num to me: %d \n", my_rank, num_points,
434 for(
unsigned int i = 0; i < target_pts.
get_n(); i++ )
436 if( target_pts.
vi_rd[2 * i] == (
int)my_rank ) num_to_me++;
438 printf(
"rank: %u after first gs nb received_pts: %u; num_from_me = %d\n", my_rank, target_pts.
get_n(),
459 for(
unsigned i = 0; i < target_pts.
get_n(); i++ )
462 point_located, rel_eps, abs_eps, &source_pts );
469 printf(
"rank: %u nb sent source pts: %u, mappedPts now: %u\n", my_rank, source_pts.
get_n(),
476 printf(
"rank: %u nb received source pts: %u\n", my_rank, source_pts.
get_n() );
501 tl_tmp->
set_n( num_points );
503 std::fill( tl_tmp->
vi_wr, tl_tmp->
vi_wr + 3 * num_points, -1 );
505 unsigned int local_pts = 0;
506 for(
unsigned int i = 0; i < source_pts.
get_n(); i++ )
508 if( -1 != source_pts.
vi_rd[3 * i + 2] )
510 int tgt_index = 3 * source_pts.
vi_rd[3 * i + 1];
515 if( tl_tmp->
vi_wr[tgt_index] != (
int)my_rank )
517 tl_tmp->
vi_wr[tgt_index] = source_pts.
vi_rd[3 * i];
518 tl_tmp->
vi_wr[tgt_index + 1] = source_pts.
vi_rd[3 * i + 1];
519 tl_tmp->
vi_wr[tgt_index + 2] = source_pts.
vi_rd[3 * i + 2];
525 unsigned int missing_pts = 0;
526 for(
unsigned int i = 0; i < num_points; i++ )
528 if( tl_tmp->
vi_rd[3 * i + 1] == -1 )
532 printf(
"missing point at index i: %d -> %15.10f %15.10f %15.10f\n", i, xyz[3 * i], xyz[3 * i + 1],
536 else if( tl_tmp->
vi_rd[3 * i] == (
int)my_rank )
539 printf(
"rank: %u point location: wanted %u got %u locally, %u remote, missing %u\n", my_rank, num_points,
540 local_pts, num_points - missing_pts - local_pts, missing_pts );
541 assert( 0 == missing_pts );
547 if( tl && store_local )
551 memcpy( tl->
vi_wr, tl_tmp->
vi_rd, 3 * tl_tmp->
get_n() *
sizeof(
int ) );
571 std::vector< EntityHandle >
entities;
572 std::vector< CartVect > nat_coords;
573 bool canWrite =
false;
584 if( rel_eps && !abs_eps )
601 tl->
vi_wr[3 * tl->
get_n() + 1] = remote_index;
605 point_located =
false;
613 std::vector< EntityHandle >::iterator eit =
entities.begin();
614 std::vector< CartVect >::iterator ncit = nat_coords.begin();
617 for( ; eit !=
entities.end(); ++eit, ++ncit )
631 tl->
vi_wr[3 * tl->
get_n() + 1] = remote_index;
636 point_located =
true;
644 const std::string& interp_tag,
665 int* points_per_method,
679 unsigned int pts_total = 0;
680 for(
int i = 0; i < num_methods; i++ )
681 pts_total += points_per_method[i];
685 if( pts_total != tl_tmp->
get_n() )
return MB_FAILURE;
691 for(
int i = 0; i < num_methods; i++ )
693 for(
int j = 0; j < points_per_method[i]; j++ )
696 tinterp.
vi_wr[5 * t + 1] = tl_tmp->
vi_rd[3 * t + 1];
697 tinterp.
vi_wr[5 * t + 2] = tl_tmp->
vi_rd[3 * t + 2];
698 tinterp.
vi_wr[5 * t + 3] = methods[i];
699 tinterp.
vi_wr[5 * t + 4] = i;
700 tinterp.
vr_wr[t] = 0.0;
715 for(
unsigned int i = 0; i < tinterp.
get_n(); i++ )
717 int mindex = tinterp.
vi_rd[5 * i + 2];
719 Tag tag = tags[tinterp.
vi_rd[5 * i + 4]];
740 for(
unsigned int i = 0; i < tinterp.
get_n(); i++ )
741 interp_vals[tinterp.
vi_rd[5 * i + 1]] = tinterp.
vr_rd[i];
748 std::vector< EntityHandle >&
entities,
749 std::vector< CartVect >& nat_coords,
752 if( !
myTree )
return MB_FAILURE;
758 std::cout <<
"Problems getting iterator" << std::endl;
765 std::vector< double > dists;
766 std::vector< EntityHandle > leaves;
771 10 * epsilon, &dists, NULL, &
localRoot );
776 double min_dist = *dists.begin();
777 closest_leaf = *leaves.begin();
778 std::vector< EntityHandle >::iterator vit = leaves.begin() + 1;
779 std::vector< double >::iterator dit = dists.begin() + 1;
780 for( ; vit != leaves.end() && min_dist; ++vit, ++dit )
782 if( *dit < min_dist )
796 std::cout <<
"Problems getting leaf \n";
799 closest_leaf = treeiter.
handle();
806 if(
MB_SUCCESS != result ) std::cout <<
"Problem getting leaf in a range" << std::endl;
824 std::cout <<
"Can't get xm1 values \n";
830 std::cout <<
"Can't get ym1 values \n";
836 std::cout <<
"Can't get zm1 values \n";
841 spcHex->
set_gl_points( (
double*)xval, (
double*)yval, (
double*)zval );
849 std::cout <<
"point " << xyz[0] <<
" " << xyz[1] <<
" " << xyz[2]
870 std::vector< CartVect > coords_vert( num_connect );
871 result =
mbImpl->
get_coords( connect, num_connect, &( coords_vert[0][0] ) );
874 std::cout <<
"Problems getting coordinates of vertices\n";
880 if( 8 == num_connect )
883 if( !hexmap.
inside_box( pos, epsilon ) )
continue;
886 tmp_nat_coords = hexmap.
ievaluate( pos, epsilon );
888 if( !inside )
continue;
895 else if( 27 == num_connect )
898 if( !hexmap.
inside_box( pos, epsilon ) )
continue;
901 tmp_nat_coords = hexmap.
ievaluate( pos, epsilon );
903 if( !inside )
continue;
913 else if(
MBTET == etype )
917 tmp_nat_coords = tetmap.
ievaluate( pos );
919 if( !inside )
continue;
929 tmp_nat_coords = sphermap.
ievaluate( pos, epsilon );
931 if( !inside )
continue;
946 tmp_nat_coords = sphermap.
ievaluate( pos, epsilon );
948 if( !inside )
continue;
956 else if(
MBQUAD == etype )
959 if( !quadmap.
inside_box( pos, epsilon ) )
continue;
962 tmp_nat_coords = quadmap.
ievaluate( pos, epsilon );
964 if( !inside )
continue;
989 else if( etype ==
MBEDGE )
1004 std::cout <<
"Entity not Hex/Tet/Quad/Tri/Edge. Please verify." << std::endl;
1011 nat_coords.push_back( tmp_nat_coords );
1028 std::cout <<
"Can't get field values for the tag \n";
1046 if(
MBHEX == etype )
1048 if( 8 == num_connect )
1059 else if(
MBTET == etype )
1064 else if(
MBQUAD == etype )
1069 else if(
MBTRI == etype )
1077 result =
mbImpl->
tag_get_data( tag, connect, std::min( num_verts, num_connect ), vfields );
1088 assert( num_connect >= num_verts );
1124 const char* norm_tag,
1132 std::vector< std::vector< EntityHandle > > entity_sets;
1133 std::vector< std::vector< EntityHandle > > entity_groups;
1136 std::vector< EntityHandle > ent_set;
1137 ent_set.push_back( root_set );
1138 entity_sets.push_back( ent_set );
1141 std::vector< EntityHandle >
entities;
1144 entity_groups.push_back(
entities );
1147 err =
do_normalization( norm_tag, entity_sets, entity_groups, integ_type, num_integ_pts );
ERRORR(
"Failure in do_normalization().", err );
1155 const char* norm_tag,
1156 const char** tag_names,
1158 const char** tag_values,
1163 std::vector< Tag > tag_handles;
1166 for(
int t = 0; t < num_tags; t++ )
1171 tag_handles.push_back( th );
1174 return normalize_subset( root_set, norm_tag, &tag_handles[0], num_tags, tag_values, integ_type, num_integ_pts );
1178 const char* norm_tag,
1181 const char** tag_values,
1189 std::vector< std::vector< EntityHandle > > entity_sets;
1190 std::vector< std::vector< EntityHandle > > entity_groups;
1192 err =
get_matching_entities( root_set, tag_handles, tag_values, num_tags, &entity_sets, &entity_groups );
ERRORR(
"Failed to get matching entities.", err );
1195 err =
do_normalization( norm_tag, entity_sets, entity_groups, integ_type, num_integ_pts );
ERRORR(
"Failure in do_normalization().", err );
1202 std::vector< std::vector< EntityHandle > >& entity_sets,
1203 std::vector< std::vector< EntityHandle > >& entity_groups,
1213 ierr = MPI_Comm_size( MPI_COMM_WORLD, &nprocs );
1214 ERRORMPI(
"Getting number of procs failed.", ierr );
1215 ierr = MPI_Comm_rank( MPI_COMM_WORLD, &rank );
1216 ERRORMPI(
"Getting rank failed.", ierr );
1221 unsigned int num_ent_grps = entity_groups.size();
1222 std::vector< double > integ_vals( num_ent_grps );
1224 err =
get_group_integ_vals( entity_groups, integ_vals, norm_tag, num_integ_pts, integ_type );
ERRORR(
"Failed to get integrated field values for groups in mesh.", err );
1232 std::vector< double > sum_integ_vals( num_ent_grps );
1237 ierr = MPI_Reduce( &integ_vals[0], &sum_integ_vals[0], num_ent_grps, MPI_DOUBLE, MPI_SUM,
MASTER_PROC,
1239 ERRORMPI(
"Transfer and reduction of integrated values failed.", ierr );
1244 sum_integ_vals = integ_vals;
1252 for(
unsigned int i = 0; i < num_ent_grps; i++ )
1254 double val = sum_integ_vals[i];
1255 if( fabs( val ) > 1e-8 )
1256 sum_integ_vals[i] = 1.0 / val;
1259 sum_integ_vals[i] = 0.0;
1273 ERRORMPI(
"Broadcast of normalization factors failed.", ierr );
1282 err =
apply_group_norm_factor( entity_sets, sum_integ_vals, norm_tag, integ_type );
ERRORR(
"Failed to set the normalization factor for groups in mesh.", err );
1292 const char** tag_names,
1293 const char** tag_values,
1295 std::vector< std::vector< EntityHandle > >* entity_sets,
1296 std::vector< std::vector< EntityHandle > >* entity_groups )
1299 std::vector< Tag > tag_handles;
1301 for(
int t = 0; t < num_tags; t++ )
1306 tag_handles.push_back( th );
1309 return get_matching_entities( root_set, &tag_handles[0], tag_values, num_tags, entity_sets, entity_groups );
1315 const char** tag_values,
1317 std::vector< std::vector< EntityHandle > >* entity_sets,
1318 std::vector< std::vector< EntityHandle > >* entity_groups )
1326 ierr = MPI_Comm_size( MPI_COMM_WORLD, &nprocs );
1327 ERRORMPI(
"Getting number of procs failed.", ierr );
1328 ierr = MPI_Comm_rank( MPI_COMM_WORLD, &rank );
1329 ERRORMPI(
"Getting rank failed.", ierr );
1337 err =
create_tuples( ent_sets, tag_handles, num_tags, &tag_list );
ERRORR(
"Failed to create tuples from entity sets.", err );
1353 tuple_buf_len =
pack_tuples( tag_list, (
void**)&tuple_buf );
1359 int* recv_cnts = (
int*)malloc( nprocs *
sizeof(
int ) );
1360 int* offsets = (
int*)malloc( nprocs *
sizeof(
int ) );
1361 uint* all_tuples_buf = NULL;
1364 ERRORMPI(
"Gathering buffer sizes failed.", err );
1369 int all_tuples_len = recv_cnts[0];
1371 for(
int i = 1; i < nprocs; i++ )
1373 offsets[i] = offsets[i - 1] + recv_cnts[i - 1];
1374 all_tuples_len += recv_cnts[i];
1377 all_tuples_buf = (
uint*)malloc( all_tuples_len *
sizeof(
uint ) );
1381 MPI_Gatherv( (
void*)tuple_buf, tuple_buf_len, MPI_INT, (
void*)all_tuples_buf, recv_cnts, offsets, MPI_INT,
1383 ERRORMPI(
"Gathering tuple_lists failed.", err );
1390 for(
int i = 0; i < nprocs; i++ )
1391 unpack_tuples( (
void*)&all_tuples_buf[offsets[i]], &tl_array[i] );
1394 free( all_tuples_buf );
1401 for(
int i = 0; i < nprocs; i++ )
1402 tl_array[i]->reset();
1419 ERRORMPI(
"Broadcasting tuple_list size failed.", ierr );
1425 ERRORMPI(
"Broadcasting tuple_list failed.", ierr );
1432 cons_tuples = tag_list;
1436 uint mi, ml, mul, mr;
1439 for(
unsigned int i = 0; i < cons_tuples->
get_n(); i++ )
1445 int** vals = (
int**)malloc( mi *
sizeof(
int* ) );
1446 for(
unsigned int j = 0; j < mi; j++ )
1447 vals[j] = (
int*)&( cons_tuples->
vi_rd[( i * mi ) + j] );
1452 if(
debug ) std::cout <<
"ent_sets_size=" << ent_sets.size() << std::endl;
1458 std::vector< EntityHandle > ent_set_hdls;
1459 std::vector< EntityHandle > ent_hdls;
1460 for(
unsigned int j = 0; j < ent_sets.size(); j++ )
1463 ent_set_hdls.push_back( ent_sets[j] );
1470 if(
debug ) std::cout <<
"ents_size=" << ents.
size() << std::endl;
1473 for(
unsigned int k = 0; k < ents.
size(); k++ )
1475 ent_hdls.push_back( ents[k] );
1478 if(
debug ) std::cout <<
"ent_hdls.size=" << ent_hdls.size() << std::endl;
1486 entity_sets->push_back( ent_set_hdls );
1487 ent_set_hdls.clear();
1488 entity_groups->push_back( ent_hdls );
1491 std::cout <<
"entity_sets->size=" << entity_sets->size()
1492 <<
", entity_groups->size=" << entity_groups->size() << std::endl;
1495 cons_tuples->
reset();
1505 const char** tag_names,
1506 unsigned int num_tags,
1510 std::vector< Tag > tag_handles;
1512 for(
unsigned int t = 0; t < num_tags; t++ )
1517 tag_handles.push_back( th );
1520 return create_tuples( ent_sets, &tag_handles[0], num_tags, tuple_list );
1534 uint mi, ml, mul, mr;
1538 if( mi == 0 )
ERRORR(
"Failed to initialize tuple_list.", MB_FAILURE );
1542 for(
unsigned int i = 0; i < ent_sets.
size(); i++ )
1544 for(
unsigned int j = 0; j < num_tags; j++ )
1547 err =
mbImpl->
tag_get_data( tag_handles[j], &set_handle, 1, &val );
ERRORR(
"Failed to get integer tag data.", err );
1548 tag_tuples->
vi_wr[i * mi + j] = val;
1552 tag_tuples->
inc_n();
1555 *tuples = tag_tuples;
1563 int total_rcv_tuples = 0;
1564 int offset = 0, copysz = 0;
1565 unsigned num_tags = 0;
1568 uint* mi = (
uint*)malloc(
sizeof(
uint ) * num_tuples );
1570 for(
unsigned int i = 0; i < num_tuples; i++ )
1575 for(
unsigned int i = 0; i < num_tuples; i++ )
1577 if( all_tuples[i] != NULL )
1579 total_rcv_tuples += all_tuples[i]->
get_n();
1583 const unsigned int_size =
sizeof(
sint );
1584 const unsigned int_width = num_tags * int_size;
1587 for(
unsigned int i = 0; i < num_tuples; i++ )
1589 if( all_tuples[i] != NULL ) total_rcv_tuples += all_tuples[i]->
get_n();
1596 for(
unsigned int i = 0; i < num_tuples; i++ )
1598 if( all_tuples[i] != NULL )
1600 copysz = all_tuples[i]->
get_n() * int_width;
1601 memcpy( all_tuples_list->
vi_wr + offset, all_tuples[i]->
vi_rd, copysz );
1602 offset = offset + ( all_tuples[i]->
get_n() * mi[i] );
1603 all_tuples_list->
set_n( all_tuples_list->
get_n() + all_tuples[i]->
get_n() );
1610 sort_buffer.buffer_init( 2 * total_rcv_tuples * int_width );
1611 for(
int i = num_tags - 1; i >= 0; i-- )
1613 all_tuples_list->
sort( i, &sort_buffer );
1618 unsigned int end_idx = 0, last_idx = 1;
1619 while( last_idx < all_tuples_list->get_n() )
1621 if( memcmp( all_tuples_list->
vi_rd + ( end_idx * num_tags ), all_tuples_list->
vi_rd + ( last_idx * num_tags ),
1632 memcpy( all_tuples_list->
vi_wr + ( end_idx * num_tags ), all_tuples_list->
vi_rd + ( last_idx * num_tags ),
1638 all_tuples_list->
set_n( end_idx + 1 );
1641 all_tuples_list->
resize( all_tuples_list->
get_n() );
1644 *unique_tuples = all_tuples_list;
1651 std::vector< double >& integ_vals,
1652 const char* norm_tag,
1658 std::vector< std::vector< EntityHandle > >::iterator iter_i;
1659 std::vector< EntityHandle >::iterator iter_j;
1660 double grp_intrgr_val, intgr_val;
1668 if( integ_vals.size() != groups.size() ) integ_vals.resize( groups.size() );
1672 for( i = 0, iter_i = groups.begin(); iter_i != groups.end(); i++, ++iter_i )
1678 for( iter_j = ( *iter_i ).begin(); iter_j != ( *iter_i ).end(); ++iter_j )
1687 if( ( integ_type ==
VOLUME ) && ( j_type < MBTET || j_type >=
MBENTITYSET ) )
continue;
1693 int connectivity_size = 0;
1698 double* coords = (
double*)malloc(
sizeof(
double ) * ( 3 * connectivity_size ) );
1701 err =
mbImpl->
get_coords( verts, connectivity_size, coords );
ERRORR(
"Failed to get vertex coordinates.", err );
1704 double* vfield = (
double*)malloc(
sizeof(
double ) * ( connectivity_size ) );
1710 ERRORR(
"Failed to get vertex coordinates.", err );
1714 std::vector< CartVect > vertices( connectivity_size );
1718 for(
int j = 0; j < connectivity_size; j++, x += 3 )
1725 if( j_type ==
MBHEX )
1727 if( connectivity_size == 8 )
1732 else if( j_type ==
MBTET )
1736 else if( j_type ==
MBQUAD )
1745 else if( j_type ==
MBEDGE )
1762 grp_intrgr_val += intgr_val;
1766 std::cerr <<
"Failed to set vertices on Element::Map." << std::endl;
1770 std::cerr <<
"Failed to get inverse evaluation of coordinate on Element::Map." << std::endl;
1778 integ_vals[i] = grp_intrgr_val;
1786 std::vector< double >& norm_factors,
1787 const char* norm_tag,
1794 int norm_tag_len = strlen( norm_tag );
1795 const char* normf_appd =
"_normf";
1796 int normf_appd_len = strlen( normf_appd );
1798 char* normf_tag = (
char*)malloc( norm_tag_len + normf_appd_len + 1 );
1799 char* tmp_ptr = normf_tag;
1801 memcpy( tmp_ptr, norm_tag, norm_tag_len );
1802 tmp_ptr += norm_tag_len;
1803 memcpy( tmp_ptr, normf_appd, normf_appd_len );
1804 tmp_ptr += normf_appd_len;
1811 if( normf_hdl == NULL )
1813 std::string msg(
"Failed to create normalization factor tag named '" );
1814 msg += std::string( normf_tag ) + std::string(
"'" );
ERRORR( msg.c_str(), MB_FAILURE );
1818 std::vector< std::vector< EntityHandle > >::iterator iter_i;
1819 std::vector< EntityHandle >::iterator iter_j;
1820 std::vector< double >::iterator iter_f;
1821 double grp_norm_factor = 0.0;
1824 for( iter_i = entity_sets.begin(), iter_f = norm_factors.begin();
1825 ( iter_i != entity_sets.end() ) && ( iter_f != norm_factors.end() ); ++iter_i, ++iter_f )
1827 grp_norm_factor = *iter_f;
1831 for( iter_j = ( *iter_i ).begin(); iter_j != ( *iter_i ).end(); ++iter_j )
1835 std::cout <<
"Coupler: applying normalization for entity set=" << entset
1836 <<
", normalization_factor=" << grp_norm_factor << std::endl;
1838 err =
mbImpl->
tag_set_data( normf_hdl, &entset, 1, &grp_norm_factor );
ERRORR(
"Failed to set normalization factor on entity set.", err );
1845 #define UINT_PER_X( X ) ( ( sizeof( X ) + sizeof( uint ) - 1 ) / sizeof( uint ) )
1846 #define UINT_PER_REAL UINT_PER_X( realType )
1847 #define UINT_PER_LONG UINT_PER_X( slong )
1848 #define UINT_PER_UNSIGNED UINT_PER_X( unsigned )
1853 uint mi, ml, mul, mr;
1865 memcpy( buf, &n,
sizeof(
uint ) ), buf += 1;
1893 unsigned mit, mlt, mult, mrt;
1897 memcpy( &nt, buf,
sizeof(
uint ) ), buf += 1;
1912 uint mi, ml, mul, mr;
1930 numPointsOfInterest = targ_elems.
size() *
_ntot;
1931 vpos.resize( 3 * numPointsOfInterest );
1942 std::cout <<
"Can't get xm1 values \n";
1948 std::cout <<
"Can't get ym1 values \n";
1954 std::cout <<
"Can't get zm1 values \n";
1958 for(
int i = 0; i <
_ntot; i++ )
1960 vpos[ielem + 3 * i] = xval[i];
1961 vpos[ielem + 3 * i + 1] = yval[i];
1962 vpos[ielem + 3 * i + 2] = zval[i];