23 #define MBERRORR( rval, STR ) \
25 if( MB_SUCCESS != ( rval ) ) \
27 std::cout << ( STR ) << std::endl; \
61 double dd = -normPlane % p1;
62 double valFrom = normPlane % from + dd;
63 double valTo = normPlane % to + dd;
69 double proj1 = ( intx_point - p1 ) % ( p2 - p1 );
70 double proj2 = ( intx_point - p2 ) % ( p1 - p2 );
72 if(
debug_splits ) std::cout <<
"intx : " << intx_point <<
"\n";
79 double proj1 = ( intx_point - p1 ) % ( p2 - p1 );
80 double proj2 = ( intx_point - p2 ) % ( p1 - p2 );
82 if(
debug_splits ) std::cout <<
"intx : " << intx_point <<
"\n";
85 if( valFrom * valTo > 0 )
return false;
87 parPos = valFrom / ( valFrom - valTo );
88 intx_point = from + ( to - from ) * parPos;
90 double proj1 = ( intx_point - p1 ) % ( p2 - p1 );
91 double proj2 = ( intx_point - p2 ) % ( p1 - p2 );
94 if(
debug_splits ) std::cout <<
"intx : " << intx_point <<
"\n";
108 MBERRORR( rval,
"Failed to get connectivity" );
109 assert( 3 == nnodes );
111 rval = mbi->
get_coords( conn3, nnodes, (
double*)&P[0] );
112 MBERRORR( rval,
"Failed to get coordinates" );
119 std::cout <<
" nodes:" << conn3[0] <<
" " << conn3[1] <<
" " << conn3[2] <<
"\n";
120 std::cout <<
" distances: " << r0.
length() <<
" " << r1.
length() <<
" " << r2.
length() <<
"\n";
127 boundary_handle = conn3[0];
135 boundary_handle = conn3[1];
143 boundary_handle = conn3[2];
150 double areaDouble = ( v1 * v2 ).
length();
153 MBERRORR( MB_FAILURE,
"area of triangle too small" );
155 area_coord[0] = ( r1 * r2 ).
length() / areaDouble;
156 area_coord[1] = ( r2 * r0 ).
length() / areaDouble;
157 area_coord[2] = ( r0 * r1 ).
length() / areaDouble;
159 if( fabs( area_coord[0] + area_coord[1] + area_coord[2] - 1 ) >
tolerance_segment )
161 MBERRORR( MB_FAILURE,
"point outside triangle" );
168 if( !side0 && !side1 && !side2 )
return MB_SUCCESS;
171 std::vector< EntityHandle > edges;
173 for(
int i = 0; i < 3; i++ )
175 nn2[0] = conn3[( i + 1 ) % 3];
176 nn2[1] = conn3[( i + 2 ) % 3];
177 std::vector< EntityHandle > adjacent;
179 MBERRORR( rval,
"Failed to get edges" );
180 if( adjacent.size() != 1 )
MBERRORR( MB_FAILURE,
"Failed to get adjacent edges" );
182 edges.push_back( adjacent[0] );
185 if( side0 ) boundary_handle = edges[0];
186 if( side1 ) boundary_handle = edges[1];
187 if( side2 ) boundary_handle = edges[2];
193 : _mbImpl( impl ), _my_geomTopoTool( topoTool ), _t_created( false ), _smooth( smooth ), _initialized( false ),
194 _smthFace( NULL ), _smthCurve( NULL )
218 for( i = 0; i < size1; i++ )
223 for( i = 0; i < size1; i++ )
230 for(
int j = 0; j < 5; j++ )
273 MBERRORR( rval,
"can't get geom tag" );
306 for( i = 0; i < numSurfaces; i++ )
317 unsigned char value = 0;
329 double defCtrlPoints[9] = { 0., 0., 0., 0., 0., 0., 0., 0., 0. };
336 double defControls[18] = { 0. };
341 Tag facetEdgeCtrlTag;
342 double defControls2[27] = { 0. };
348 double min_dot = -1.0;
349 for( i = 0; i < numCurves; i++ )
359 for( i = 0; i < numSurfaces; i++ )
367 for( i = 0; i < numSurfaces; i++ )
380 for( i = 0; i < numSurfaces; i++ )
394 std::vector< Tag > smoothTags;
397 for(
int i = 0; i < size1; i++ )
421 for(
unsigned int k = 0; k < smoothTags.size(); k++ )
444 ErrorCode rval =
MBI->num_contained_meshsets( set, all_sets, num_hops + 1 );
453 rval =
MBI->create_meshset( MESHSET_ORDERED, *pSet );
463 if( 0 > entity_type || 4 < entity_type )
467 else if( entity_type < 4 )
474 for( i = 0; i < 4; i++ )
482 MBERRORR( rval,
"can't get sets in the initial set" );
483 gentities =
intersect( gentities, sets );
490 return MBI->add_entities( set, entities );
495 return MBI->add_entities( entity_set_handle, &entity_set_to_add, 1 );
500 if( 0 > ent_type || 4 < ent_type )
502 std::cout <<
"Invalid type\n";
513 MBERRORR( rval,
"Failed to get geom tag." );
515 MBERRORR( rval,
"Failed to get gentities from set" );
520 for(
int k = 0; k <= 3; k++ )
523 *pNum += (int)gEntsOfTypeK.
size();
529 *pNum = (int)gEntsOfType.
size();
538 for(
int i = 0; i < 4; i++ )
560 MBERRORR( rval,
"Failed to get entity type." );
565 MBERRORR( rval,
"Failed to get vertex coordinates." );
572 MBERRORR( MB_FAILURE,
"iGeom_getEntBoundBox is not supported for Edge entity type." );
574 else if( type == 2 || type == 3 )
580 MBERRORR( rval,
"Failed to get tree root in iGeom_getEntBoundBox." );
583 MBERRORR( rval,
"Failed to get closest point in iGeom_getEntBoundBox." );
586 for(
int i = 0; i < 3; i++ )
588 absv[i] =
CartVect( fabs( axis[i][0] ), fabs( axis[i][1] ), fabs( axis[i][2] ) );
591 min =
center - absv[0] - absv[1] - absv[2];
592 max =
center + absv[0] + absv[1] + absv[2];
616 MBERRORR( rval,
"Failed to get entity type." );
621 MBERRORR( rval,
"Failed to get vertex coordinates." );
623 else if(
_smooth && type == 1 )
632 else if( type == 2 || type == 3 )
634 double point[3] = { near_x, near_y, near_z };
648 MBERRORR( rval,
"Failed to get tree root in iGeom_getEntClosestPt." );
650 MBERRORR( rval,
"Failed to get closest point in iGeom_getEntClosestPt." );
652 *on_x = point_out[0];
653 *on_y = point_out[1];
654 *on_z = point_out[2];
667 MBERRORR( rval,
"Failed to get entity type in getVtxCoord." );
671 MBERRORR( MB_FAILURE,
"Entity is not a vertex type." );
675 rval =
MBI->get_entities_by_type( vertex_handle,
MBVERTEX, entities );
676 MBERRORR( rval,
"can't get nodes in vertex set." );
678 if( entities.
size() != 1 )
680 MBERRORR( MB_FAILURE,
"Vertex has multiple points." );
684 rval =
MBI->get_coords( &node, 1, coords );
685 MBERRORR( rval,
"can't get coordinates." );
698 MBERRORR( rval,
"can't get entities from set 1." );
700 rval =
MBI->get_entities_by_type( entity_set_2,
MBENTITYSET, ents2 );
701 MBERRORR( rval,
"can't get entities from set 2." );
704 rval =
MBI->clear_meshset( &result_entity_set, 1 );
705 MBERRORR( rval,
"can't empty set." );
707 rval =
MBI->add_entities( result_entity_set, ents1 );
708 MBERRORR( rval,
"can't add result to set." );
724 MBERRORR( rval,
"Failed to get entity type in iGeom_getEntNrmlXYZ." );
726 if( type != 2 && type != 3 )
728 MBERRORR( MB_FAILURE,
"Entities passed into gentityNormal must be face or volume." );
735 smthFace->
normal_at( x, y, z, *nrml_i, *nrml_j, *nrml_k );
740 double point[3] = { x, y, z };
745 MBERRORR( rval,
"Failed to get closest location in iGeom_getEntNrmlXYZ." );
751 rval =
MBI->get_connectivity( facet_out, conn, len );
752 MBERRORR( rval,
"Failed to get triangle connectivity in iGeom_getEntNrmlXYZ." );
753 if( len != 3 )
MBERRORR( MB_FAILURE,
" not a triangle, error " );
755 rval =
MBI->get_coords( conn, len, coords[0].array() );
756 MBERRORR( rval,
"Failed to get triangle coordinates in iGeom_getEntNrmlXYZ." );
758 coords[1] -= coords[0];
759 coords[2] -= coords[0];
760 normal = coords[1] * coords[2];
775 std::vector< EntityHandle >& intersect_entity_handles,
777 std::vector< double >& intersect_coords,
778 std::vector< double >& param_coords )
787 const double point[] = { x, y, z };
788 const double dir[] = { dir_x, dir_y, dir_z };
793 std::vector< EntityHandle > facets;
796 for( i = 0; i < numfaces; i++ )
801 MBERRORR( rval,
"Failed to get root of face." );
802 std::vector< double > distances_out;
803 std::vector< EntityHandle > sets_out;
804 std::vector< EntityHandle > facets_out;
808 for( j = 0; j < distances_out.size(); j++ )
809 param_coords.push_back( distances_out[j] );
810 for( j = 0; j < sets_out.size(); j++ )
811 intersect_entity_handles.push_back( sets_out[j] );
812 for( j = 0; j < facets_out.size(); j++ )
813 facets.push_back( facets_out[j] );
815 MBERRORR( rval,
"Failed to get ray intersections." );
818 for( i = 0; i < param_coords.size(); i++ )
820 CartVect intx = P + param_coords[i] * V;
821 for(
int j = 0; j < 3; j++ )
822 intersect_coords.push_back( intx[j] );
827 for( i = 0; i < intersect_entity_handles.size(); i++ )
836 CartVect pos( &( intersect_coords[3 * i] ) );
837 double dist = param_coords[i];
838 bool outside =
false;
840 MBERRORR( rval,
"Failed to get better point on ray." );
841 param_coords[i] = dist;
843 for(
int j = 0; j < 3; j++ )
844 intersect_coords[3 * i + j] = pos[j];
853 for(
int i = 0; i < 4; i++ )
868 else if( 0 > to_dim || 3 < to_dim )
873 else if( to_dim == this_dim )
881 if( to_dim > this_dim )
883 int diffDim = to_dim - this_dim;
884 rval =
MBI->get_parent_meshsets( from, adjs, diffDim );
890 rval =
MBI->get_parent_meshsets( from, extra, diffDim - 1 );
897 int diffDim = this_dim - to_dim;
898 rval =
MBI->get_child_meshsets( from, adjs, diffDim );
904 rval =
MBI->get_child_meshsets( from, extra, diffDim - 1 );
927 MBI->tag_get_handle( tag_name, tag_size, mb_data_type_table2[tag_type], tag_handle_out, storage |
MB_TAG_EXCL );
931 std::string msg(
"createTag: " );
934 msg +=
"Tag already exists with name: \"";
936 std::cout << msg <<
"\n";
940 std::cout <<
"Failed to create tag with name: " << tag_name <<
"\n";
949 int entity_handles_size,
951 void* tag_values_out )
955 return MBI->tag_get_data( tag_handle, entity_handles, entity_handles_size, tag_values_out );
959 int entity_handles_size,
961 const void* tag_values )
965 return MBI->tag_set_data( tag_handle, entity_handles, entity_handles_size, tag_values );
978 std::vector< EntityHandle > faces;
979 std::vector< int > senses;
983 for(
unsigned int i = 0; i < faces.size(); i++ )
985 if( faces[i] == mbface )
987 sense_out = senses[i];
997 for(
int i = 0; i < entities_size; i++ )
1008 rval =
MBI->get_entities_by_type( gset,
MBEDGE, entities );
1017 rval =
MBI->get_connectivity(
edge, conn2, num_nodes );
1018 if(
MB_SUCCESS != rval || num_nodes != 2 )
return MB_FAILURE;
1019 rval =
MBI->get_coords( conn2, 2, (
double*)&( vv[0][0] ) );
1022 vv[0] = vv[1] - vv[0];
1023 measures[i] += vv[0].
length();
1030 rval =
MBI->get_entities_by_type( gset,
MBTRI, entities );
1039 rval =
MBI->get_connectivity( tri, conn3, num_nodes );
1040 if(
MB_SUCCESS != rval || num_nodes != 3 )
return MB_FAILURE;
1041 rval =
MBI->get_coords( conn3, 3, (
double*)&( vv[0][0] ) );
1044 vv[1] = vv[1] - vv[0];
1045 vv[2] = vv[2] - vv[0];
1046 vv[0] = vv[1] * vv[2];
1047 measures[i] += vv[0].
length() / 2;
1103 if(
MB_SUCCESS != rval || type != 0 )
return MB_FAILURE;
1106 rval =
MBI->get_entities_by_type( vtx1,
MBVERTEX, entities );
1108 if( entities.
size() < 1 )
return MB_FAILURE;
1112 if(
MB_SUCCESS != rval || type != 0 )
return MB_FAILURE;
1113 rval =
MBI->get_entities_by_type( vtx2,
MBVERTEX, entities );
1115 if( entities.
size() < 1 )
return MB_FAILURE;
1121 std::vector< EntityHandle > ents;
1124 if( ents.size() < 1 )
return MB_FAILURE;
1129 rval =
MBI->get_connectivity( ents[0], conn, len );
1131 startNode = conn[0];
1132 rval =
MBI->get_connectivity( ents[ents.size() - 1], conn, len );
1137 if( ( startNode == endNode ) && ( v1 == startNode ) )
1141 if( ( startNode == v1 ) && ( endNode == v2 ) )
1145 if( ( startNode == v2 ) && ( endNode == v1 ) )
1191 rval =
MBI->get_parent_meshsets( entity1, adjs, type2 - type1 );
1197 rval =
MBI->get_child_meshsets( entity1, adjs, type1 - type2 );
1203 adjacent_out = adjs.
find( entity2 ) != adjs.
end();
1209 std::vector< double >& xyz,
1224 int numIniPoints = (int)xyz.size() / 3;
1225 if( ( closed && numIniPoints < 3 ) || ( !closed && numIniPoints < 2 ) )
1226 MBERRORR( MB_FAILURE,
"not enough polyline points " );
1230 MBERRORR( rval,
"Failed to get root of face." );
1232 const double dir[] = { direction[0], direction[1], direction[2] };
1233 std::vector< EntityHandle > nodes;
1239 std::vector< CartVect > b_pos;
1240 std::vector< EntityHandle > boundary_nodes;
1241 std::vector< EntityHandle > splittingNodes;
1242 Range boundary_mesh_edges;
1246 MBERRORR( rval,
"Failed to get boundary nodes." );
1247 b_pos.resize( boundary_nodes.size() );
1248 rval =
_mbImpl->
get_coords( &( boundary_nodes[0] ), boundary_nodes.size(), (
double*)( &b_pos[0][0] ) );
1249 MBERRORR( rval,
"Failed to get coordinates for boundary nodes." );
1251 MBERRORR( rval,
"Failed to get mesh boundary edges for face." );
1257 for( ; i < numIniPoints; i++ )
1260 const double point[] = { xyz[3 * i], xyz[3 * i + 1], xyz[3 * i + 2] };
1262 if( !closed && ( ( 0 == i ) || ( numIniPoints - 1 == i ) ) )
1269 if( i == numIniPoints - 1 ) i1 = i - 1;
1271 const double point1[] = { xyz[3 * i1], xyz[3 * i1 + 1], xyz[3 * i1 + 2] };
1273 CartVect normPlane = ( p2 - p1 ) * dirct;
1277 CartVect perpDir = dirct * normPlane;
1282 std::cout <<
" p1:" << p1 <<
"\n";
1283 std::cout <<
" p2:" << p2 <<
"\n";
1284 std::cout <<
" perpDir:" << perpDir <<
"\n";
1285 std::cout <<
" boundary edges size:" << boundary_mesh_edges.
size() <<
"\n";
1287 for( ; ite != boundary_mesh_edges.
end(); ++ite )
1293 MBERRORR( rval,
"Failed to get conn for boundary edge" );
1296 MBERRORR( rval,
"Failed to get coords of nodes for boundary edge" );
1306 std::cout <<
" Intersect bool:" <<
intersect <<
"\n";
1310 double proj1 = ( intx_point - p1 ) % perpDir;
1311 double proj2 = ( intx_point - p2 ) % perpDir;
1312 if( ( fabs( proj1 ) > fabs( proj2 ) )
1320 nodes.push_back( conn2[0] );
1321 splittingNodes.push_back( conn2[0] );
1323 else if( parPos == 1. )
1326 nodes.push_back( conn2[1] );
1327 splittingNodes.push_back( conn2[1] );
1335 MBERRORR( rval,
"can't create vertex" );
1336 nodes.push_back( newVertex );
1338 splittingNodes.push_back( newVertex );
1347 if( ite == boundary_mesh_edges.
end() )
1348 MBERRORR( MB_FAILURE,
"Failed to find boundary intersection edge. Bail out" );
1352 std::vector< double > distances_out;
1353 std::vector< EntityHandle > sets_out;
1354 std::vector< EntityHandle > facets_out;
1357 MBERRORR( rval,
"Failed to get ray intersections." );
1358 if( distances_out.size() < 1 )
1359 MBERRORR( MB_FAILURE,
"Failed to get one intersection point, bad direction." );
1361 if( distances_out.size() > 1 )
1363 std::cout <<
" too many intersection points. Only the first one considered\n";
1365 std::vector< EntityHandle >::iterator pFace = std::find( sets_out.begin(), sets_out.end(),
face );
1367 if( pFace == sets_out.end() )
MBERRORR( MB_FAILURE,
"Failed to intersect given face, bad direction." );
1368 unsigned int index = pFace - sets_out.begin();
1376 double area_coord[3];
1379 MBERRORR( rval,
"Failed to get area coordinates" );
1383 std::cout <<
" int point:" << newPoint <<
" area coord " << area_coord[0] <<
" " << area_coord[1] <<
" "
1384 << area_coord[2] <<
"\n";
1386 <<
" boundary:" << boundary_handle <<
"\n";
1390 if( boundary_handle && ( type ==
MBVERTEX ) )
1393 nodes.push_back( boundary_handle );
1402 if( boundary_handle )
1410 nodes.push_back( newVertex );
1422 std::vector< EntityHandle > chainedEdges;
1424 for( i = 0; i < numIniPoints - 1 + closed; i++ )
1426 int nextIndex = ( i + 1 ) % numIniPoints;
1427 std::vector< EntityHandle > trianglesAlong;
1428 std::vector< CartVect > points;
1430 std::vector< EntityHandle > entities;
1433 MBERRORR( rval,
"can't get intersection points along a line" );
1434 std::vector< EntityHandle > nodesAlongPolyline;
1436 nodesAlongPolyline.push_back( entities[0] );
1437 int num_points = (int)points.size();
1438 for(
int j = 0; j < num_points - 1; j++ )
1449 nodesAlongPolyline.push_back( e2 );
1453 CartVect coord_vert = points[j + 1];
1456 MBERRORR( rval,
"can't create vertex" );
1457 nodesAlongPolyline.push_back( newVertex );
1474 rval =
BreakTriangle2( tri, e1, e2, nodesAlongPolyline[j], nodesAlongPolyline[j + 1] );
1475 MBERRORR( rval,
"can't break triangle 2" );
1482 std::cout <<
"nodesAlongPolyline: " << nodesAlongPolyline.size() <<
"\n";
1483 std::cout <<
"points: " << num_points <<
"\n";
1489 MBERRORR( rval,
"can't create a new edge" );
1490 chainedEdges.push_back( new_geo_edge );
1497 MBERRORR( rval,
"can't split surface" );
1500 MBERRORR( rval,
"can't chain edges" );
1510 std::vector< EntityHandle >& chainedEdges,
1511 std::vector< EntityHandle >& splittingNodes,
1522 MBERRORR( rval,
"can't get initial triangles" );
1527 bool closed = splittingNodes.size() == 0;
1531 if( splittingNodes.size() != 2 )
MBERRORR( MB_FAILURE,
"need to have exactly 2 nodes for splitting" );
1536 MBERRORR( rval,
"can't split with first node" );
1538 MBERRORR( rval,
"can't split with second node)" );
1550 MBERRORR( rval,
"can't smooth new points" );
1555 MBERRORR( rval,
"can't create a new face" );
1561 MBERRORR( rval,
"can't add first range triangles to new face" );
1563 for(
unsigned int j = 0; j < chainedEdges.size(); j++ )
1568 MBERRORR( rval,
"can't add parent child relations for new edge" );
1571 MBERRORR( rval,
"can't add parent child relations for new edge" );
1575 MBERRORR( rval,
"can't set sense for new edge" );
1578 MBERRORR( rval,
"can't set sense for new edge in original face" );
1582 MBERRORR( rval,
"can't set NEUMANN set tags" );
1586 MBERRORR( rval,
"can't remove original tris from initial face set" );
1589 MBERRORR( rval,
"can't add second range to the original set" );
1594 MBERRORR( rval,
"fail to reset the proper boundary faces" );
1607 MBERRORR( rval,
"can't delete triangles" );
1611 MBERRORR( rval,
"can't delete edges" );
1630 MBERRORR( rval,
"can't get triangles" );
1634 MBERRORR( rval,
"can't get connectivities" );
1640 for(
unsigned int j = 0; j < chainedEdges.size(); j++ )
1644 MBERRORR( rval,
"can't get mesh edges" );
1647 Range nodes_on_polyline;
1649 MBERRORR( rval,
"can't get nodes on the polyline" );
1651 Range new_intx_nodes =
subtract( nodes_on_polyline, ini_nodes );
1653 std::vector< double > ini_coords;
1654 int num_points = (int)new_intx_nodes.
size();
1655 ini_coords.resize( 3 * num_points );
1657 MBERRORR( rval,
"can't get coordinates" );
1664 smthFace->
move_to_surface( ini_coords[i3], ini_coords[i3 + 1], ini_coords[i3 + 2] );
1669 MBERRORR( rval,
"can't set smoothed coordinates for the new nodes" );
1677 std::vector< EntityHandle >& chainedEdges,
1697 for(
unsigned int j = 0; j < chainedEdges.size(); j++ )
1702 MBERRORR( rval,
"can't get new polyline edges" );
1706 <<
" mesh_edges Range size:" << mesh_edges.
size() <<
"\n";
1722 MBERRORR( rval,
"can't create temp tag for separation" );
1729 MBERRORR( rval,
"can't set delete tag value" );
1739 MBERRORR( rval,
"can't get adj_tris to mesh edge" );
1746 int num1, sense, offset;
1748 MBERRORR( rval,
"edge not adjacent" );
1768 MBERRORR( rval,
"can't get boundary edges" );
1771 Range initialBoundaryEdges;
1778 Range doNotCrossEdges =
unite( initialBoundaryEdges, mesh_edges );
1782 std::queue< EntityHandle > queue1;
1783 queue1.push( seed1 );
1784 std::vector< EntityHandle > arr1;
1785 while( !queue1.empty() )
1790 arr1.push_back( currentTriangle );
1794 MBERRORR( rval,
"can't get adjacencies" );
1798 if( doNotCrossEdges.
find( frontEdge ) == doNotCrossEdges.
end() )
1803 MBERRORR( rval,
"can't get adj_tris" );
1810 MBERRORR( rval,
"can't get tag value" );
1815 MBERRORR( rval,
"can't get tag value" );
1817 queue1.push( tri2 );
1823 std::sort( arr1.begin(), arr1.end() );
1840 MBERRORR( rval,
"can't get tris " );
1847 std::cout <<
"\n second.size() " << second.
size() <<
" first.size(): " <<
first.size() <<
"\n";
1864 MBERRORR( rval,
"can't delete tag " );
1872 MBERRORR( rval,
"can't create geo edge" );
1875 std::vector< EntityHandle > mesh_edges;
1876 for(
unsigned int i = 0; i < nodesAlongPolyline.size() - 1; i++ )
1878 EntityHandle n1 = nodesAlongPolyline[i], n2 = nodesAlongPolyline[i + 1];
1884 std::vector< EntityHandle > adjacent;
1887 bool new_edge =
true;
1888 if( adjacent.size() >= 1 )
1894 MBERRORR( rval,
"can't get connectivity" );
1895 if( conn2[0] == nn2[0] && conn2[1] == nn2[1] )
1898 mesh_edges.push_back( adjacent[0] );
1911 MBERRORR( rval,
"Failed to create a new edge" );
1912 mesh_edges.push_back( mesh_edge );
1918 mesh_edges.size() );
1919 MBERRORR( rval,
"can't add edges to new_geo_set" );
1923 Range ends_geo_edge;
1924 ends_geo_edge.
insert( nodesAlongPolyline[0] );
1925 ends_geo_edge.
insert( nodesAlongPolyline[nodesAlongPolyline.size() - 1] );
1927 for(
unsigned int k = 0; k < ends_geo_edge.
size(); k++ )
1938 MBERRORR( rval,
"Failed to create a new vertex set" );
1941 MBERRORR( rval,
"Failed to add the node to the set" );
1944 MBERRORR( rval,
"Failed to commit the node set" );
1955 MBERRORR( rval,
"Failed to add parent child relation" );
1972 std::cout <<
" nodes:" << conn3[0] <<
" " << conn3[1] <<
" " << conn3[2] <<
"\n";
1974 PP[0] = P[1] - P[0];
1975 PP[1] = P[2] - P[1];
1976 PP[2] = P[0] - P[2];
1978 std::cout <<
" pos:" << P[0] <<
" " << P[1] <<
" " << P[2] <<
"\n";
1979 std::cout <<
" x,y diffs " << PP[0][0] <<
" " << PP[0][1] <<
", " << PP[1][0] <<
" " << PP[1][1] <<
", "
1980 << PP[2][0] <<
" " << PP[2][1] <<
"\n";
1987 std::cout <<
"FBEngine::BreakTriangle not implemented yet\n";
2002 MBERRORR( rval,
"Failed to get connectivity" );
2003 assert( 3 == nnodes );
2014 if( conn3[
index] == e1 )
2017 if(
index == 3 )
return MB_FAILURE;
2022 MBERRORR( rval,
"Failed to create a new triangle" );
2026 MBERRORR( rval,
"Failed to create a new triangle" );
2035 if( conn3[
index] == e2 )
2038 if(
index == 3 )
return MB_FAILURE;
2043 MBERRORR( rval,
"Failed to create a new triangle" );
2047 MBERRORR( rval,
"Failed to create a new triangle" );
2055 int num1, num2, sense, offset;
2057 MBERRORR( rval,
"edge not adjacent" );
2060 MBERRORR( rval,
"edge not adjacent" );
2066 MBERRORR( rval,
"Failed to get connectivity of edge 1" );
2067 assert( 2 == nnodes );
2069 MBERRORR( rval,
"Failed to get connectivity of edge 2" );
2070 assert( 2 == nnodes );
2074 std::cout <<
"tri conn3:" << conn3[0] <<
" " << conn3[1] <<
" " << conn3[2] <<
"\n";
2075 std::cout <<
" edge1: conn12:" << conn12[0] <<
" " << conn12[1] <<
" side: " << num1 <<
"\n";
2076 std::cout <<
" edge2: conn22:" << conn22[0] <<
" " << conn22[1] <<
" side: " << num2 <<
"\n";
2078 int unaffectedSide = 3 - num1 - num2;
2079 int i3 = ( unaffectedSide + 2 ) % 3;
2093 int i1 = ( i3 + 1 ) % 3;
2094 int i2 = ( i3 + 2 ) % 3;
2096 EntityHandle conn[9] = { conn3[i3], v1, v2, v1, conn3[i1], conn3[i2], v2, v1, conn3[i2] };
2100 MBERRORR( rval,
"Failed to create a new triangle" );
2104 MBERRORR( rval,
"Failed to create a new triangle" );
2108 MBERRORR( rval,
"Failed to create a new triangle" );
2124 std::vector< CartVect >& points,
2125 std::vector< EntityHandle >& entities,
2126 std::vector< EntityHandle >& triangles )
2133 MBERRORR( rval,
"failed to get 'from' coordinates" );
2135 MBERRORR( rval,
"failed to get 'from' coordinates" );
2138 double dist2 = vect.
length();
2146 std::set< EntityHandle > visitedTriangles;
2149 if( points.size() == 0 )
2151 points.push_back( p1 );
2152 entities.push_back( from );
2162 vect = p2 - currentPoint;
2163 while( vect.
length() > 0. )
2169 std::vector< EntityHandle > adj_tri;
2173 for( ; j < adj_tri.size(); j++ )
2176 if( visitedTriangles.find( tri ) != visitedTriangles.end() )
2186 MBERRORR( rval,
"Failed to get connectivity" );
2189 if( conn3[0] == to || conn3[1] == to || conn3[2] == to )
2191 visitedTriangles.insert( tri );
2192 triangles.push_back( tri );
2194 points.push_back( p2 );
2195 entities.push_back( to );
2205 if( nn2[0] == currentBoundary ) nn2[0] = conn3[2];
2206 if( nn2[1] == currentBoundary ) nn2[1] = conn3[2];
2211 MBERRORR( rval,
"Failed to get coordinates" );
2217 currentBoundary = nn2[0];
2221 currentBoundary = nn2[1];
2225 std::vector< EntityHandle > edges1;
2230 MBERRORR( rval,
"Failed to get edges" );
2231 if( edges1.size() != 1 )
MBERRORR( MB_FAILURE,
"Failed to get adjacent edges to 2 nodes" );
2232 currentBoundary = edges1[0];
2235 visitedTriangles.insert( tri );
2236 currentPoint = intx;
2237 points.push_back( intx );
2238 entities.push_back( currentBoundary );
2239 triangles.push_back( tri );
2252 MBERRORR( rval,
"Failed to get connectivity" );
2253 int thirdIndex = -1;
2254 for(
int tj = 0; tj < 3; tj++ )
2256 if( ( conn3[tj] != conn2[0] ) && ( conn3[tj] != conn2[1] ) )
2262 if( -1 == thirdIndex )
MBERRORR( MB_FAILURE,
" can't get third node" );
2265 MBERRORR( rval,
"Failed to get coords" );
2266 int indexFirst = ( thirdIndex + 1 ) % 3;
2267 int indexSecond = ( thirdIndex + 2 ) % 3;
2268 int index[2] = { indexFirst, indexSecond };
2269 for(
int k = 0; k < 2; k++ )
2271 nn2[0] = conn3[
index[k]], nn2[1] = conn3[thirdIndex];
2273 normPlane, intx, param ) )
2277 currentBoundary = conn3[
index[k]];
2281 currentBoundary = conn3[thirdIndex];
2285 std::vector< EntityHandle > edges1;
2290 MBERRORR( rval,
"Failed to get edges" );
2291 if( edges1.size() != 1 )
2292 MBERRORR( MB_FAILURE,
"Failed to get adjacent edges to 2 nodes" );
2293 currentBoundary = edges1[0];
2296 visitedTriangles.insert( tri );
2297 currentPoint = intx;
2298 points.push_back( intx );
2299 entities.push_back( currentBoundary );
2300 triangles.push_back( tri );
2318 vect = p2 - currentPoint;
2322 std::cout <<
"nb entities: " << entities.size() <<
" triangles:" << triangles.size()
2323 <<
" points.size(): " << points.size() <<
"\n";
2346 if( dim != 1 )
return MB_FAILURE;
2347 if( !
_smooth )
return MB_FAILURE;
2353 double u = curve->
u_from_position( point[0], point[1], point[2], closeNode, edgeIndex );
2354 if( 0 == closeNode )
2363 std::cout <<
"not found a close node, u is: " << u <<
" edge index: " << edgeIndex <<
"\n";
2374 if( dim != 1 )
return MB_FAILURE;
2386 std::vector< EntityHandle > ents;
2389 if( ents.size() < 1 )
return MB_FAILURE;
2394 int num_mesh_edges = (int)ents.size();
2397 for( index_edge = 0; index_edge < num_mesh_edges; index_edge++ )
2399 rval =
MBI->get_connectivity( ents[index_edge], conn, len );
2401 if( index_edge == 0 ) firstNode = conn[0];
2402 if( conn[0] == node )
2404 if( index_edge == 0 )
2413 else if( conn[1] == node )
2419 if( index_edge == num_mesh_edges - 1 )
2430 std::cout <<
"Split edge with " << num_mesh_edges <<
" mesh edges, at index (0 based) " << index_edge <<
"\n";
2443 MBERRORR( rval,
"Failed to create a new vertex set" );
2446 MBERRORR( rval,
"Failed to add the node to the set" );
2449 MBERRORR( rval,
"Failed to commit the node set" );
2453 std::cout <<
" create a vertex set (this should have been created before!)"
2463 MBERRORR( rval,
"can't create geo edge" );
2465 int remaining = num_mesh_edges - 1 - index_edge;
2469 MBERRORR( rval,
"can't add edges to the new edge" );
2475 MBERRORR( rval,
"can't remove edges from the old edge" );
2482 if( vertexRange.
size() == 1 )
2486 secondSet = vertexRange[0];
2490 if( vertexRange.
size() > 2 )
return MB_FAILURE;
2493 for( k = 0; k < 2; k++ )
2498 MBERRORR( rval,
"can't get vertices from vertex set" );
2499 if( verts.
size() != 1 )
MBERRORR( MB_FAILURE,
" node set not defined well" );
2500 if( firstNode == verts[0] )
2502 secondSet = vertexRange[1 - k];
2509 MBERRORR( MB_FAILURE,
" can't find the right vertex" );
2516 MBERRORR( rval,
" can't remove the second vertex from edge" );
2520 MBERRORR( rval,
" can't add new vertex to old edge" );
2523 MBERRORR( rval,
" can't add new vertex to new edge" );
2528 MBERRORR( rval,
" can't add second vertex to new edge" );
2533 MBERRORR( rval,
" can't add new edge" );
2549 MBERRORR( rval,
" can't add new edge - face parent relation" );
2552 MBERRORR( rval,
" can't get initial sense of edge in the adjacent face" );
2555 MBERRORR( rval,
" can't set sense of new edge in the adjacent face" );
2569 if( dim != 1 )
return MB_FAILURE;
2582 std::vector< EntityHandle > ents;
2585 if( ents.size() < 1 )
return MB_FAILURE;
2594 MBERRORR( rval,
"Failed to get connectivity of broken edge" );
2599 std::vector< EntityHandle > adj_edges;
2601 if( adj_edges.size() < 1 || rval !=
MB_SUCCESS )
MBERRORR( MB_FAILURE,
" Can't find small split edge" );
2607 MBERRORR( rval,
"Failed to get connectivity of first split edge" );
2609 if( conn02[0] != connActual[0] )
2613 MBERRORR( rval,
"Failed to reset connectivity of first split edge" );
2619 if( adj_edges.size() < 1 || rval !=
MB_SUCCESS )
MBERRORR( MB_FAILURE,
" Can't find second small split edge" );
2624 MBERRORR( rval,
"Failed to get connectivity of first split edge" );
2626 if( conn21[0] != connActual[0] )
2630 MBERRORR( rval,
"Failed to reset connectivity of first split edge" );
2633 int num_mesh_edges = (int)ents.size();
2637 for( index_edge = 0; index_edge < num_mesh_edges; index_edge++ )
2638 if( brokenEdge == ents[index_edge] )
break;
2639 if( index_edge >= num_mesh_edges )
MBERRORR( MB_FAILURE,
"can't find the broken edge" );
2649 std::cout <<
"Split edge with " << num_mesh_edges <<
" mesh edges, at index (0 based) " << index_edge <<
"\n";
2662 MBERRORR( rval,
"Failed to create a new vertex set" );
2665 MBERRORR( rval,
"Failed to add the node to the set" );
2668 MBERRORR( rval,
"Failed to commit the node set" );
2672 std::cout <<
" create a vertex set (this should have been created before!)"
2682 MBERRORR( rval,
"can't create geo edge" );
2684 int remaining = num_mesh_edges - 1 - index_edge;
2688 MBERRORR( rval,
"can't add second split edge to the new edge" );
2691 MBERRORR( rval,
"can't add edges to the new edge" );
2697 MBERRORR( rval,
"can't remove edges from the old edge" );
2700 MBERRORR( rval,
"can't add first split edge to the old edge" );
2707 if( vertexRange.
size() == 1 )
2711 secondSet = vertexRange[0];
2715 if( vertexRange.
size() > 2 )
return MB_FAILURE;
2719 rval =
MBI->get_connectivity( ents[0], conn, len );
2721 firstNode = conn[0];
2724 for( k = 0; k < 2; k++ )
2729 MBERRORR( rval,
"can't get vertices from vertex set" );
2730 if( verts.
size() != 1 )
MBERRORR( MB_FAILURE,
" node set not defined well" );
2731 if( firstNode == verts[0] )
2733 secondSet = vertexRange[1 - k];
2740 MBERRORR( MB_FAILURE,
" can't find the right vertex" );
2747 MBERRORR( rval,
" can't remove the second vertex from edge" );
2751 MBERRORR( rval,
" can't add new vertex to old edge" );
2754 MBERRORR( rval,
" can't add new vertex to new edge" );
2759 MBERRORR( rval,
" can't add second vertex to new edge" );
2764 MBERRORR( rval,
" can't add new edge" );
2780 MBERRORR( rval,
" can't add new edge - face parent relation" );
2783 MBERRORR( rval,
" can't get initial sense of edge in the adjacent face" );
2786 MBERRORR( rval,
" can't set sense of new edge in the adjacent face" );
2802 MBERRORR( rval,
" can't get boundary edges" );
2811 MBERRORR( rval,
" can't get mesh edges" );
2815 if( mesh_edges.
find( brokenEdge ) != mesh_edges.
end() )
2826 MBERRORR( rval,
" can't get nodes from mesh edges" );
2828 if( nodes.
find( atNode ) != nodes.
end() )
2839 MBERRORR( MB_FAILURE,
" we did not find an appropriate boundary edge" );
2849 const void*
const zero_val[] = { &zero };
2874 std::vector< EntityHandle >& chainedEdges )
2883 MBERRORR( rval,
" can't get triangles from old face" );
2885 MBERRORR( rval,
" can't get triangles from new face" );
2890 MBERRORR( rval,
" can't get children sets from face" );
2895 if( std::find( chainedEdges.begin(), chainedEdges.end(),
edge ) != chainedEdges.end() )
2901 MBERRORR( rval,
" can't get mesh edges from edge" );
2902 if( mesh_edges.
empty() )
MBERRORR( MB_FAILURE,
" no mesh edges" );
2907 MBERRORR( rval,
" can't get adjacent triangles" );
2910 if( !intx1.
empty() && !intx2.
empty() )
MBERRORR( MB_FAILURE,
" at least one should be empty" );
2923 MBERRORR( rval,
" can't remove parent child relation for edge" );
2926 MBERRORR( rval,
" can't add parent child relation for edge" );
2929 int num1, sense, offset;
2931 MBERRORR( rval,
"mesh edge not adjacent to triangle" );
2934 MBERRORR( rval,
"can't set proper sense of edge in face" );
2946 MBERRORR( rval,
"can't get tag handle" );
2986 MBERRORR( rval,
"can't duplicate model" );
3008 MBERRORR( rval,
"can't get quads from the surface set" );
3010 MBERRORR( rval,
"can't remove quads from the surface set" );
3018 MBERRORR( rval,
"can't get quad connectivity" );
3022 MBERRORR( rval,
"can't get node coordinates" );
3033 MBERRORR( rval,
"can't create triangle 1" );
3035 MBERRORR( rval,
"can't create triangle 2" );
3037 MBERRORR( rval,
"can't add triangles to the set" );
3049 MBERRORR( rval,
" can't get boundary edges" );
3056 MBERRORR( rval,
" can't get mesh edges" );
3067 MBERRORR( rval,
" can't get boundary edges" );
3075 MBERRORR( rval,
" can't get mesh edges" );
3077 MBERRORR( rval,
" can't get nodes from mesh edges" );
3080 boundary_nodes.resize( b_nodes.
size() );
3081 std::copy( b_nodes.
begin(), b_nodes.
end(), boundary_nodes.begin() );
3091 MBERRORR( rval,
"can't get adj_tris" );
3093 if( adj_tri.
size() >= 3 )
3095 std::cout <<
"WARNING: non manifold geometry. Are you sure?";
3104 MBERRORR( rval,
"can't get nodes" );
3105 int num1, sense, offset;
3107 MBERRORR( rval,
"can't get side number" );
3110 int num2 = ( num1 + 1 ) % 3;
3111 int num3 = ( num2 + 1 ) % 3;
3113 EntityHandle t1[] = { conn3[num2], conn3[num3], newVertex };
3114 EntityHandle t2[] = { conn3[num1], newVertex, conn3[num3] };
3117 MBERRORR( rval,
"can't create triangle" );
3120 MBERRORR( rval,
"can't create triangle" );
3123 std::vector< EntityHandle > edges0;
3125 MBERRORR( rval,
"can't get new edges" );
3128 MBERRORR( rval,
"can't get new edges" );
3131 std::cout <<
"2 (out of 4) triangles formed:\n";
3148 MBERRORR( rval,
"can't get nodes" );
3154 MBERRORR( rval,
"can't create triangle" );
3157 MBERRORR( rval,
"can't create triangle" );
3160 MBERRORR( rval,
"can't create triangle" );
3164 std::vector< EntityHandle > edges0;
3166 MBERRORR( rval,
"can't get new edges" );
3169 MBERRORR( rval,
"can't get new edges" );
3172 std::cout <<
"3 triangles formed:\n";
3179 std::cout <<
"original nodes in tri:\n";
3196 MBERRORR( rval,
"can't create volume" );
3198 int volumeMatId = 1;
3201 MBERRORR( rval,
"can't get material tag" );
3204 MBERRORR( rval,
"can't set material tag value on volume" );
3209 MBERRORR( rval,
"can't add first face to volume" );
3212 MBERRORR( rval,
"can't add second face to volume" );
3216 MBERRORR( rval,
"can't add volume to the gtt" );
3221 MBERRORR( rval,
"can't set bottom face sense to the volume" );
3225 MBERRORR( rval,
"can't set top face sense to the volume" );
3229 std::vector< EntityHandle > edges1;
3230 std::vector< EntityHandle > edges2;
3233 MBERRORR( rval,
"can't get children edges or first face, bottom" );
3236 MBERRORR( rval,
"can't get children edges for second face, top" );
3238 if( edges1.size() != edges2.size() )
MBERRORR( MB_FAILURE,
"wrong correspondence " );
3240 for(
unsigned int i = 0; i < edges1.size(); ++i )
3244 MBERRORR( rval,
"can't weave lateral face" );
3246 MBERRORR( rval,
"can't add lateral face to volume" );
3250 MBERRORR( rval,
"can't set lateral face sense to the volume" );
3254 MBERRORR( rval,
"can't set new neumann tags" );
3261 std::vector< EntityHandle > ents;
3264 if( ents.size() < 1 )
return MB_FAILURE;
3266 nodes.resize( ents.size() + 1 );
3269 for(
unsigned int i = 0; i < ents.size(); ++i )
3272 MBERRORR( rval,
"can't get edge connectivity" );
3276 nodes[ents.size()] = conn[1];
3288 MBERRORR( rval,
"can't create new lateral face" );
3294 std::vector< EntityHandle > adj;
3296 MBERRORR( rval,
"can't get children nodes" );
3297 bool periodic =
false;
3298 if( adj.size() == 1 )
3300 v[0] = v[1] = adj[0];
3310 MBERRORR( rval,
"can't get bottom edge sense" );
3319 MBERRORR( rval,
"can't get children nodes" );
3320 if( adj.size() == 1 )
3322 v[2] = v[3] = adj[0];
3323 if( !periodic )
MBERRORR( MB_FAILURE,
"top edge is periodic, but bottom edge is not" );
3329 if( periodic )
MBERRORR( MB_FAILURE,
"top edge is not periodic, but bottom edge is" );
3334 std::vector< EntityHandle > nodes1;
3336 MBERRORR( rval,
"can't get nodes from bott edge" );
3338 std::vector< EntityHandle > nodes2;
3340 MBERRORR( rval,
"can't get nodes from top edge" );
3342 std::vector< CartVect > coords1, coords2;
3343 coords1.resize( nodes1.size() );
3344 coords2.resize( nodes2.size() );
3346 int N1 = (int)nodes1.size();
3347 int N2 = (int)nodes2.size();
3349 rval =
_mbImpl->
get_coords( &( nodes1[0] ), nodes1.size(), (
double*)&( coords1[0] ) );
3350 MBERRORR( rval,
"can't get coords of nodes from bott edge" );
3352 rval =
_mbImpl->
get_coords( &( nodes2[0] ), nodes2.size(), (
double*)&( coords2[0] ) );
3353 MBERRORR( rval,
"can't get coords of nodes from top edge" );
3358 CartVect v1 = ( coords1[0] - coords2[0] ) * up;
3359 CartVect v2 = ( coords1[0] - coords2[N2 - 1] ) * up;
3364 for(
unsigned int k = 0; k < nodes2.size() / 2; k++ )
3367 nodes2[k] = nodes2[N2 - 1 - k];
3368 nodes2[N2 - 1 - k] = tmp;
3370 coords2[k] = coords2[N2 - 1 - k];
3371 coords2[N2 - 1 - k] = tv;
3383 EntityHandle nd[4] = { nodes1[0], nodes1[N1 - 1], nodes2[0], nodes2[N2 - 1] };
3389 MBERRORR( rval,
"can't get edges connected to vertex set 1" );
3391 for(
unsigned int j = 0; j < adj.size(); j++ )
3396 if( vertices.
find( v[2] ) != vertices.
end() )
3407 MBERRORR( rval,
"can't create edge 1" );
3410 MBERRORR( rval,
"can't add parent - child relation" );
3413 MBERRORR( rval,
"can't add parent - child relation" );
3418 MBERRORR( rval,
"can't create mesh edge" );
3421 MBERRORR( rval,
"can't add mesh edge to geo edge" );
3424 MBERRORR( rval,
"can't add edge to gtt" );
3429 MBERRORR( rval,
"can't get edges connected to vertex set 2" );
3431 for(
unsigned int i = 0; i < adj.size(); i++ )
3436 if( vertices.
find( v[3] ) != vertices.
end() )
3447 MBERRORR( rval,
"can't create edge 1" );
3450 MBERRORR( rval,
"can't add parent - child relation" );
3453 MBERRORR( rval,
"can't add parent - child relation" );
3458 MBERRORR( rval,
"can't create mesh edge" );
3461 MBERRORR( rval,
"can't add mesh edge to geo edge" );
3464 MBERRORR( rval,
"can't add edge to gtt" );
3471 MBERRORR( rval,
"can't add parent - child relation" );
3474 MBERRORR( rval,
"can't add parent - child relation" );
3477 MBERRORR( rval,
"can't add parent - child relation" );
3480 MBERRORR( rval,
"can't add parent - child relation" );
3483 MBERRORR( rval,
"can't add face to gtt" );
3487 MBERRORR( rval,
"can't set bottom edge sense to the lateral face" );
3491 MBERRORR( rval,
"can't get top edge sense" );
3494 MBERRORR( rval,
"can't set top edge sense to the lateral face" );
3497 MBERRORR( rval,
"can't set first vert edge sense" );
3500 MBERRORR( rval,
"can't set second edge sense to the lateral face" );
3503 int indexB = 0, indexT = 0;
3522 CartVect dir1 = coords1[1] - coords1[0];
3525 dir1 = up * planeNormal;
3528 bool weaveDown =
true;
3533 if( ( indexB == N1 - 1 ) && ( indexT == N2 - 1 ) )
break;
3534 if( indexB == N1 - 1 )
3538 else if( indexT == N2 - 1 )
3546 double proj1 = ( coords1[indexB + 1] - startP ) % dir1;
3547 double proj2 = ( coords2[indexT + 1] - startP ) % dir1;
3553 EntityHandle nTri[3] = { nodes1[indexB], 0, nodes2[indexT] };
3556 nTri[1] = nodes1[indexB + 1];
3557 nTri[2] = nodes2[indexT];
3562 nTri[1] = nodes2[indexT + 1];
3567 MBERRORR( rval,
"can't create triangle" );
3570 MBERRORR( rval,
"can't add triangle to face set" );
3574 dir1 = coords1[indexB] - coords1[indexB - 1];
3578 dir1 = coords2[indexT] - coords2[indexT - 1];
3580 dir1 = up * ( dir1 * up );
3604 MBERRORR( rval,
"can't get tag handle" );
3608 MBERRORR( rval,
"can't get geo sets" );
3609 int nfaces = (int)sets[2].size();
3610 int* vals =
new int[nfaces];
3611 for(
int i = 0; i < nfaces; i++ )
3616 MBERRORR( rval,
"can't set tag values for neumann sets" );
3630 MBERRORR( rval,
"can't get geo sets" );
3633 int nedges = (int)sets[1].size();
3636 for(
int i = 0; i < nedges; i++ )
3640 bool chainable =
false;
3642 MBERRORR( rval,
"can't determine chain-ability" );
3646 MBERRORR( rval,
"can't chain 2 edges" );
3668 MBERRORR( rval,
"can't get vertices" );
3674 MBERRORR( rval,
"can't get parents of vertex set" );
3678 MBERRORR( rval,
"can't get parents of edge set" );
3680 std::vector< EntityHandle > mesh_edges;
3682 MBERRORR( rval,
"can't get mesh edges from edge set" );
3683 EntityHandle lastMeshEdge = mesh_edges[mesh_edges.size() - 1];
3687 MBERRORR( rval,
"can't connectivity of last mesh edge" );
3689 if( len != 2 )
MBERRORR( MB_FAILURE,
"bad number of vertices" );
3692 MBERRORR( rval,
"Failed to get coordinates" );
3699 if(
edge == otherEdge )
continue;
3703 MBERRORR( rval,
"can't get parents of other edge set" );
3704 if( faces != faces2 )
continue;
3706 std::vector< EntityHandle > mesh_edges2;
3708 MBERRORR( rval,
"can't get mesh edges from other edge set" );
3713 MBERRORR( rval,
"can't connectivity of first mesh edge" );
3714 if( len2 != 2 )
MBERRORR( MB_FAILURE,
"bad number of vertices" );
3715 if( conn2[1] != conn22[0] )
continue;
3722 if( vec1 % vec2 < min_dot )
continue;
3724 next_edge = otherEdge;
3738 MBERRORR( rval,
"can't get vert sets" );
3740 MBERRORR( rval,
"can't get vert sets" );
3741 assert( v12 == v21 );
3742 std::vector< EntityHandle > mesh_edges;
3743 rval =
MBI->get_entities_by_type( next_edge,
MBEDGE, mesh_edges );
3744 MBERRORR( rval,
"can't get mesh edges" );
3747 MBERRORR( rval,
"can't add new mesh edges" );
3750 MBERRORR( rval,
"can't remove parent - child relation between first edge and middle vertex" );
3755 MBERRORR( rval,
"can't add second vertex to edge " );
3759 MBERRORR( rval,
"can't remove child - parent relation " );
3762 MBERRORR( rval,
"can't remove child - parent relation " );
3767 MBERRORR( rval,
"can't get parent faces " );
3773 MBERRORR( rval,
"can't remove parent-edge rel " );
3777 MBERRORR( rval,
"can't remove edge set " );
3781 MBERRORR( rval,
"can't remove edge set " );
3792 MBERRORR( rval,
"can't get child meshsets" );
3793 if( children.
size() == 1 )
3800 else if( children.
size() > 2 )
3801 MBERRORR( MB_FAILURE,
"too many vertices in one edge" );
3804 rval =
MBI->get_entities_by_type( children[0],
MBVERTEX, entities );
3805 MBERRORR( rval,
"can't get entities from vertex set" );
3806 if( entities.
size() < 1 )
MBERRORR( MB_FAILURE,
"no mesh nodes in vertex set" );
3813 std::vector< EntityHandle > ents;
3815 MBERRORR( rval,
"can't get mesh edges" );
3816 if( ents.size() < 1 )
MBERRORR( MB_FAILURE,
"no mesh edges in edge set" );
3820 rval =
MBI->get_connectivity( ents[0], conn, len );
3821 MBERRORR( rval,
"can't connectivity of first mesh edge" );
3823 if( conn[0] == node0 )