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 );
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." );
676 MBERRORR( rval,
"can't get nodes in vertex set." );
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 )
882 if( to_dim > this_dim )
884 int diffDim = to_dim - this_dim;
885 rval =
MBI->get_parent_meshsets( from, adjs, diffDim );
891 rval =
MBI->get_parent_meshsets( from, extra, diffDim - 1 );
898 int diffDim = this_dim - to_dim;
899 rval =
MBI->get_child_meshsets( from, adjs, diffDim );
905 rval =
MBI->get_child_meshsets( from, extra, diffDim - 1 );
930 MBI->tag_get_handle( tag_name, tag_size, mb_data_type_table2[tag_type], tag_handle_out, storage |
MB_TAG_EXCL );
934 std::string msg(
"iMesh_createTag: " );
937 msg +=
"Tag already exists with name: \"";
939 std::cout << msg <<
"\n";
943 std::cout <<
"Failed to create tag with name: " << tag_name <<
"\n";
953 int entity_handles_size,
955 void* tag_values_out )
959 return MBI->tag_get_data( tag_handle, entity_handles, entity_handles_size, tag_values_out );
963 int entity_handles_size,
965 const void* tag_values )
969 return MBI->tag_set_data( tag_handle, entity_handles, entity_handles_size, tag_values );
982 std::vector< EntityHandle > faces;
983 std::vector< int > senses;
987 for(
unsigned int i = 0; i < faces.size(); i++ )
989 if( faces[i] == mbface )
991 sense_out = senses[i];
1001 for(
int i = 0; i < entities_size; i++ )
1021 rval =
MBI->get_connectivity(
edge, conn2, num_nodes );
1022 if(
MB_SUCCESS != rval || num_nodes != 2 )
return MB_FAILURE;
1023 rval =
MBI->get_coords( conn2, 2, (
double*)&( vv[0][0] ) );
1026 vv[0] = vv[1] - vv[0];
1027 measures[i] += vv[0].
length();
1043 rval =
MBI->get_connectivity( tri, conn3, num_nodes );
1044 if(
MB_SUCCESS != rval || num_nodes != 3 )
return MB_FAILURE;
1045 rval =
MBI->get_coords( conn3, 3, (
double*)&( vv[0][0] ) );
1048 vv[1] = vv[1] - vv[0];
1049 vv[2] = vv[2] - vv[0];
1050 vv[0] = vv[1] * vv[2];
1051 measures[i] += vv[0].
length() / 2;
1107 if(
MB_SUCCESS != rval || type != 0 )
return MB_FAILURE;
1112 if(
entities.size() < 1 )
return MB_FAILURE;
1116 if(
MB_SUCCESS != rval || type != 0 )
return MB_FAILURE;
1119 if(
entities.size() < 1 )
return MB_FAILURE;
1125 std::vector< EntityHandle > ents;
1128 if( ents.size() < 1 )
return MB_FAILURE;
1133 rval =
MBI->get_connectivity( ents[0], conn, len );
1135 startNode = conn[0];
1136 rval =
MBI->get_connectivity( ents[ents.size() - 1], conn, len );
1141 if( ( startNode == endNode ) && ( v1 == startNode ) )
1145 if( ( startNode == v1 ) && ( endNode == v2 ) )
1149 if( ( startNode == v2 ) && ( endNode == v1 ) )
1195 rval =
MBI->get_parent_meshsets( entity1, adjs, type2 - type1 );
1201 rval =
MBI->get_child_meshsets( entity1, adjs, type1 - type2 );
1207 adjacent_out = adjs.
find( entity2 ) != adjs.
end();
1213 std::vector< double >& xyz,
1228 int numIniPoints = (int)xyz.size() / 3;
1229 if( ( closed && numIniPoints < 3 ) || ( !closed && numIniPoints < 2 ) )
1230 MBERRORR( MB_FAILURE,
"not enough polyline points " );
1234 MBERRORR( rval,
"Failed to get root of face." );
1236 const double dir[] = { direction[0], direction[1], direction[2] };
1237 std::vector< EntityHandle > nodes;
1243 std::vector< CartVect > b_pos;
1244 std::vector< EntityHandle > boundary_nodes;
1245 std::vector< EntityHandle > splittingNodes;
1246 Range boundary_mesh_edges;
1250 MBERRORR( rval,
"Failed to get boundary nodes." );
1251 b_pos.resize( boundary_nodes.size() );
1252 rval =
_mbImpl->
get_coords( &( boundary_nodes[0] ), boundary_nodes.size(), (
double*)( &b_pos[0][0] ) );
1253 MBERRORR( rval,
"Failed to get coordinates for boundary nodes." );
1255 MBERRORR( rval,
"Failed to get mesh boundary edges for face." );
1261 for( ; i < numIniPoints; i++ )
1264 const double point[] = { xyz[3 * i], xyz[3 * i + 1], xyz[3 * i + 2] };
1266 if( !closed && ( ( 0 == i ) || ( numIniPoints - 1 == i ) ) )
1273 if( i == numIniPoints - 1 ) i1 = i - 1;
1275 const double point1[] = { xyz[3 * i1], xyz[3 * i1 + 1], xyz[3 * i1 + 2] };
1277 CartVect normPlane = ( p2 - p1 ) * dirct;
1281 CartVect perpDir = dirct * normPlane;
1286 std::cout <<
" p1:" << p1 <<
"\n";
1287 std::cout <<
" p2:" << p2 <<
"\n";
1288 std::cout <<
" perpDir:" << perpDir <<
"\n";
1289 std::cout <<
" boundary edges size:" << boundary_mesh_edges.
size() <<
"\n";
1291 for( ; ite != boundary_mesh_edges.
end(); ++ite )
1297 MBERRORR( rval,
"Failed to get conn for boundary edge" );
1300 MBERRORR( rval,
"Failed to get coords of nodes for boundary edge" );
1310 std::cout <<
" Intersect bool:" <<
intersect <<
"\n";
1314 double proj1 = ( intx_point - p1 ) % perpDir;
1315 double proj2 = ( intx_point - p2 ) % perpDir;
1316 if( ( fabs( proj1 ) > fabs( proj2 ) )
1324 nodes.push_back( conn2[0] );
1325 splittingNodes.push_back( conn2[0] );
1327 else if( parPos == 1. )
1330 nodes.push_back( conn2[1] );
1331 splittingNodes.push_back( conn2[1] );
1339 MBERRORR( rval,
"can't create vertex" );
1340 nodes.push_back( newVertex );
1342 splittingNodes.push_back( newVertex );
1351 if( ite == boundary_mesh_edges.
end() )
1352 MBERRORR( MB_FAILURE,
"Failed to find boundary intersection edge. Bail out" );
1356 std::vector< double > distances_out;
1357 std::vector< EntityHandle > sets_out;
1358 std::vector< EntityHandle > facets_out;
1361 MBERRORR( rval,
"Failed to get ray intersections." );
1362 if( distances_out.size() < 1 )
1363 MBERRORR( MB_FAILURE,
"Failed to get one intersection point, bad direction." );
1365 if( distances_out.size() > 1 )
1367 std::cout <<
" too many intersection points. Only the first one considered\n";
1369 std::vector< EntityHandle >::iterator pFace = std::find( sets_out.begin(), sets_out.end(),
face );
1371 if( pFace == sets_out.end() )
MBERRORR( MB_FAILURE,
"Failed to intersect given face, bad direction." );
1372 unsigned int index = pFace - sets_out.begin();
1377 CartVect newPoint = P + distances_out[index] * Dir;
1380 double area_coord[3];
1383 MBERRORR( rval,
"Failed to get area coordinates" );
1387 std::cout <<
" int point:" << newPoint <<
" area coord " << area_coord[0] <<
" " << area_coord[1] <<
" "
1388 << area_coord[2] <<
"\n";
1390 <<
" boundary:" << boundary_handle <<
"\n";
1394 if( boundary_handle && ( type ==
MBVERTEX ) )
1397 nodes.push_back( boundary_handle );
1406 if( boundary_handle )
1414 nodes.push_back( newVertex );
1426 std::vector< EntityHandle > chainedEdges;
1428 for( i = 0; i < numIniPoints - 1 + closed; i++ )
1430 int nextIndex = ( i + 1 ) % numIniPoints;
1431 std::vector< EntityHandle > trianglesAlong;
1432 std::vector< CartVect > points;
1434 std::vector< EntityHandle >
entities;
1437 MBERRORR( rval,
"can't get intersection points along a line" );
1438 std::vector< EntityHandle > nodesAlongPolyline;
1440 nodesAlongPolyline.push_back(
entities[0] );
1441 int num_points = (int)points.size();
1442 for(
int j = 0; j < num_points - 1; j++ )
1453 nodesAlongPolyline.push_back( e2 );
1457 CartVect coord_vert = points[j + 1];
1460 MBERRORR( rval,
"can't create vertex" );
1461 nodesAlongPolyline.push_back( newVertex );
1478 rval =
BreakTriangle2( tri, e1, e2, nodesAlongPolyline[j], nodesAlongPolyline[j + 1] );
1479 MBERRORR( rval,
"can't break triangle 2" );
1486 std::cout <<
"nodesAlongPolyline: " << nodesAlongPolyline.size() <<
"\n";
1487 std::cout <<
"points: " << num_points <<
"\n";
1493 MBERRORR( rval,
"can't create a new edge" );
1494 chainedEdges.push_back( new_geo_edge );
1501 MBERRORR( rval,
"can't split surface" );
1504 MBERRORR( rval,
"can't chain edges" );
1514 std::vector< EntityHandle >& chainedEdges,
1515 std::vector< EntityHandle >& splittingNodes,
1526 MBERRORR( rval,
"can't get initial triangles" );
1531 bool closed = splittingNodes.size() == 0;
1535 if( splittingNodes.size() != 2 )
MBERRORR( MB_FAILURE,
"need to have exactly 2 nodes for splitting" );
1540 MBERRORR( rval,
"can't split with first node" );
1542 MBERRORR( rval,
"can't split with second node)" );
1554 MBERRORR( rval,
"can't smooth new points" );
1559 MBERRORR( rval,
"can't create a new face" );
1565 MBERRORR( rval,
"can't add first range triangles to new face" );
1567 for(
unsigned int j = 0; j < chainedEdges.size(); j++ )
1572 MBERRORR( rval,
"can't add parent child relations for new edge" );
1575 MBERRORR( rval,
"can't add parent child relations for new edge" );
1579 MBERRORR( rval,
"can't set sense for new edge" );
1582 MBERRORR( rval,
"can't set sense for new edge in original face" );
1586 MBERRORR( rval,
"can't set NEUMANN set tags" );
1590 MBERRORR( rval,
"can't remove original tris from initial face set" );
1593 MBERRORR( rval,
"can't add second range to the original set" );
1598 MBERRORR( rval,
"fail to reset the proper boundary faces" );
1611 MBERRORR( rval,
"can't delete triangles" );
1615 MBERRORR( rval,
"can't delete edges" );
1634 MBERRORR( rval,
"can't get triangles" );
1638 MBERRORR( rval,
"can't get connectivities" );
1644 for(
unsigned int j = 0; j < chainedEdges.size(); j++ )
1648 MBERRORR( rval,
"can't get mesh edges" );
1651 Range nodes_on_polyline;
1653 MBERRORR( rval,
"can't get nodes on the polyline" );
1655 Range new_intx_nodes =
subtract( nodes_on_polyline, ini_nodes );
1657 std::vector< double > ini_coords;
1658 int num_points = (int)new_intx_nodes.
size();
1659 ini_coords.resize( 3 * num_points );
1661 MBERRORR( rval,
"can't get coordinates" );
1668 smthFace->
move_to_surface( ini_coords[i3], ini_coords[i3 + 1], ini_coords[i3 + 2] );
1673 MBERRORR( rval,
"can't set smoothed coordinates for the new nodes" );
1681 std::vector< EntityHandle >& chainedEdges,
1701 for(
unsigned int j = 0; j < chainedEdges.size(); j++ )
1706 MBERRORR( rval,
"can't get new polyline edges" );
1710 <<
" mesh_edges Range size:" << mesh_edges.
size() <<
"\n";
1726 MBERRORR( rval,
"can't create temp tag for separation" );
1733 MBERRORR( rval,
"can't set delete tag value" );
1743 MBERRORR( rval,
"can't get adj_tris to mesh edge" );
1750 int num1, sense, offset;
1752 MBERRORR( rval,
"edge not adjacent" );
1772 MBERRORR( rval,
"can't get boundary edges" );
1775 Range initialBoundaryEdges;
1782 Range doNotCrossEdges =
unite( initialBoundaryEdges, mesh_edges );
1786 std::queue< EntityHandle > queue1;
1787 queue1.push( seed1 );
1788 std::vector< EntityHandle > arr1;
1789 while( !queue1.empty() )
1794 arr1.push_back( currentTriangle );
1798 MBERRORR( rval,
"can't get adjacencies" );
1802 if( doNotCrossEdges.
find( frontEdge ) == doNotCrossEdges.
end() )
1807 MBERRORR( rval,
"can't get adj_tris" );
1814 MBERRORR( rval,
"can't get tag value" );
1819 MBERRORR( rval,
"can't get tag value" );
1821 queue1.push( tri2 );
1827 std::sort( arr1.begin(), arr1.end() );
1844 MBERRORR( rval,
"can't get tris " );
1851 std::cout <<
"\n second.size() " << second.
size() <<
" first.size(): " <<
first.size() <<
"\n";
1868 MBERRORR( rval,
"can't delete tag " );
1876 MBERRORR( rval,
"can't create geo edge" );
1879 std::vector< EntityHandle > mesh_edges;
1880 for(
unsigned int i = 0; i < nodesAlongPolyline.size() - 1; i++ )
1882 EntityHandle n1 = nodesAlongPolyline[i], n2 = nodesAlongPolyline[i + 1];
1888 std::vector< EntityHandle > adjacent;
1891 bool new_edge =
true;
1892 if( adjacent.size() >= 1 )
1898 MBERRORR( rval,
"can't get connectivity" );
1899 if( conn2[0] == nn2[0] && conn2[1] == nn2[1] )
1902 mesh_edges.push_back( adjacent[0] );
1915 MBERRORR( rval,
"Failed to create a new edge" );
1916 mesh_edges.push_back( mesh_edge );
1922 mesh_edges.size() );
1923 MBERRORR( rval,
"can't add edges to new_geo_set" );
1927 Range ends_geo_edge;
1928 ends_geo_edge.
insert( nodesAlongPolyline[0] );
1929 ends_geo_edge.
insert( nodesAlongPolyline[nodesAlongPolyline.size() - 1] );
1931 for(
unsigned int k = 0; k < ends_geo_edge.
size(); k++ )
1942 MBERRORR( rval,
"Failed to create a new vertex set" );
1945 MBERRORR( rval,
"Failed to add the node to the set" );
1948 MBERRORR( rval,
"Failed to commit the node set" );
1959 MBERRORR( rval,
"Failed to add parent child relation" );
1976 std::cout <<
" nodes:" << conn3[0] <<
" " << conn3[1] <<
" " << conn3[2] <<
"\n";
1978 PP[0] = P[1] - P[0];
1979 PP[1] = P[2] - P[1];
1980 PP[2] = P[0] - P[2];
1982 std::cout <<
" pos:" << P[0] <<
" " << P[1] <<
" " << P[2] <<
"\n";
1983 std::cout <<
" x,y diffs " << PP[0][0] <<
" " << PP[0][1] <<
", " << PP[1][0] <<
" " << PP[1][1] <<
", "
1984 << PP[2][0] <<
" " << PP[2][1] <<
"\n";
1991 std::cout <<
"FBEngine::BreakTriangle not implemented yet\n";
2006 MBERRORR( rval,
"Failed to get connectivity" );
2007 assert( 3 == nnodes );
2016 for( index = 0; index < 3; index++ )
2018 if( conn3[index] == e1 )
2021 if( index == 3 )
return MB_FAILURE;
2023 EntityHandle conn[6] = { n1, conn3[( index + 1 ) % 3], n2, n1, n2, conn3[( index + 2 ) % 3] };
2026 MBERRORR( rval,
"Failed to create a new triangle" );
2030 MBERRORR( rval,
"Failed to create a new triangle" );
2037 for( index = 0; index < 3; index++ )
2039 if( conn3[index] == e2 )
2042 if( index == 3 )
return MB_FAILURE;
2044 EntityHandle conn[6] = { n2, conn3[( index + 1 ) % 3], n1, n2, n1, conn3[( index + 2 ) % 3] };
2047 MBERRORR( rval,
"Failed to create a new triangle" );
2051 MBERRORR( rval,
"Failed to create a new triangle" );
2059 int num1, num2, sense, offset;
2061 MBERRORR( rval,
"edge not adjacent" );
2064 MBERRORR( rval,
"edge not adjacent" );
2070 MBERRORR( rval,
"Failed to get connectivity of edge 1" );
2071 assert( 2 == nnodes );
2073 MBERRORR( rval,
"Failed to get connectivity of edge 2" );
2074 assert( 2 == nnodes );
2078 std::cout <<
"tri conn3:" << conn3[0] <<
" " << conn3[1] <<
" " << conn3[2] <<
"\n";
2079 std::cout <<
" edge1: conn12:" << conn12[0] <<
" " << conn12[1] <<
" side: " << num1 <<
"\n";
2080 std::cout <<
" edge2: conn22:" << conn22[0] <<
" " << conn22[1] <<
" side: " << num2 <<
"\n";
2082 int unaffectedSide = 3 - num1 - num2;
2083 int i3 = ( unaffectedSide + 2 ) % 3;
2097 int i1 = ( i3 + 1 ) % 3;
2098 int i2 = ( i3 + 2 ) % 3;
2100 EntityHandle conn[9] = { conn3[i3], v1, v2, v1, conn3[i1], conn3[i2], v2, v1, conn3[i2] };
2104 MBERRORR( rval,
"Failed to create a new triangle" );
2108 MBERRORR( rval,
"Failed to create a new triangle" );
2112 MBERRORR( rval,
"Failed to create a new triangle" );
2128 std::vector< CartVect >& points,
2129 std::vector< EntityHandle >&
entities,
2130 std::vector< EntityHandle >& triangles )
2137 MBERRORR( rval,
"failed to get 'from' coordinates" );
2139 MBERRORR( rval,
"failed to get 'from' coordinates" );
2142 double dist2 = vect.
length();
2150 std::set< EntityHandle > visitedTriangles;
2153 if( points.size() == 0 )
2155 points.push_back( p1 );
2166 vect = p2 - currentPoint;
2167 while( vect.
length() > 0. )
2173 std::vector< EntityHandle > adj_tri;
2177 for( ; j < adj_tri.size(); j++ )
2180 if( visitedTriangles.find( tri ) != visitedTriangles.end() )
2190 MBERRORR( rval,
"Failed to get connectivity" );
2193 if( conn3[0] == to || conn3[1] == to || conn3[2] == to )
2195 visitedTriangles.insert( tri );
2196 triangles.push_back( tri );
2198 points.push_back( p2 );
2209 if( nn2[0] == currentBoundary ) nn2[0] = conn3[2];
2210 if( nn2[1] == currentBoundary ) nn2[1] = conn3[2];
2215 MBERRORR( rval,
"Failed to get coordinates" );
2221 currentBoundary = nn2[0];
2225 currentBoundary = nn2[1];
2229 std::vector< EntityHandle > edges1;
2234 MBERRORR( rval,
"Failed to get edges" );
2235 if( edges1.size() != 1 )
MBERRORR( MB_FAILURE,
"Failed to get adjacent edges to 2 nodes" );
2236 currentBoundary = edges1[0];
2239 visitedTriangles.insert( tri );
2240 currentPoint = intx;
2241 points.push_back( intx );
2242 entities.push_back( currentBoundary );
2243 triangles.push_back( tri );
2256 MBERRORR( rval,
"Failed to get connectivity" );
2257 int thirdIndex = -1;
2258 for(
int tj = 0; tj < 3; tj++ )
2260 if( ( conn3[tj] != conn2[0] ) && ( conn3[tj] != conn2[1] ) )
2266 if( -1 == thirdIndex )
MBERRORR( MB_FAILURE,
" can't get third node" );
2269 MBERRORR( rval,
"Failed to get coords" );
2270 int indexFirst = ( thirdIndex + 1 ) % 3;
2271 int indexSecond = ( thirdIndex + 2 ) % 3;
2272 int index[2] = { indexFirst, indexSecond };
2273 for(
int k = 0; k < 2; k++ )
2275 nn2[0] = conn3[index[k]], nn2[1] = conn3[thirdIndex];
2277 normPlane, intx, param ) )
2281 currentBoundary = conn3[index[k]];
2285 currentBoundary = conn3[thirdIndex];
2289 std::vector< EntityHandle > edges1;
2294 MBERRORR( rval,
"Failed to get edges" );
2295 if( edges1.size() != 1 )
2296 MBERRORR( MB_FAILURE,
"Failed to get adjacent edges to 2 nodes" );
2297 currentBoundary = edges1[0];
2300 visitedTriangles.insert( tri );
2301 currentPoint = intx;
2302 points.push_back( intx );
2303 entities.push_back( currentBoundary );
2304 triangles.push_back( tri );
2322 vect = p2 - currentPoint;
2326 std::cout <<
"nb entities: " <<
entities.size() <<
" triangles:" << triangles.size()
2327 <<
" points.size(): " << points.size() <<
"\n";
2350 if(
dim != 1 )
return MB_FAILURE;
2351 if( !
_smooth )
return MB_FAILURE;
2357 double u = curve->
u_from_position( point[0], point[1], point[2], closeNode, edgeIndex );
2358 if( 0 == closeNode )
2367 std::cout <<
"not found a close node, u is: " << u <<
" edge index: " << edgeIndex <<
"\n";
2378 if(
dim != 1 )
return MB_FAILURE;
2390 std::vector< EntityHandle > ents;
2393 if( ents.size() < 1 )
return MB_FAILURE;
2398 int num_mesh_edges = (int)ents.size();
2401 for( index_edge = 0; index_edge < num_mesh_edges; index_edge++ )
2403 rval =
MBI->get_connectivity( ents[index_edge], conn, len );
2405 if( index_edge == 0 ) firstNode = conn[0];
2406 if( conn[0] == node )
2408 if( index_edge == 0 )
2417 else if( conn[1] == node )
2423 if( index_edge == num_mesh_edges - 1 )
2434 std::cout <<
"Split edge with " << num_mesh_edges <<
" mesh edges, at index (0 based) " << index_edge <<
"\n";
2447 MBERRORR( rval,
"Failed to create a new vertex set" );
2450 MBERRORR( rval,
"Failed to add the node to the set" );
2453 MBERRORR( rval,
"Failed to commit the node set" );
2457 std::cout <<
" create a vertex set (this should have been created before!)"
2467 MBERRORR( rval,
"can't create geo edge" );
2469 int remaining = num_mesh_edges - 1 - index_edge;
2473 MBERRORR( rval,
"can't add edges to the new edge" );
2479 MBERRORR( rval,
"can't remove edges from the old edge" );
2486 if( vertexRange.
size() == 1 )
2490 secondSet = vertexRange[0];
2494 if( vertexRange.
size() > 2 )
return MB_FAILURE;
2497 for( k = 0; k < 2; k++ )
2502 MBERRORR( rval,
"can't get vertices from vertex set" );
2503 if( verts.
size() != 1 )
MBERRORR( MB_FAILURE,
" node set not defined well" );
2504 if( firstNode == verts[0] )
2506 secondSet = vertexRange[1 - k];
2513 MBERRORR( MB_FAILURE,
" can't find the right vertex" );
2520 MBERRORR( rval,
" can't remove the second vertex from edge" );
2524 MBERRORR( rval,
" can't add new vertex to old edge" );
2527 MBERRORR( rval,
" can't add new vertex to new edge" );
2532 MBERRORR( rval,
" can't add second vertex to new edge" );
2537 MBERRORR( rval,
" can't add new edge" );
2553 MBERRORR( rval,
" can't add new edge - face parent relation" );
2556 MBERRORR( rval,
" can't get initial sense of edge in the adjacent face" );
2559 MBERRORR( rval,
" can't set sense of new edge in the adjacent face" );
2573 if(
dim != 1 )
return MB_FAILURE;
2586 std::vector< EntityHandle > ents;
2589 if( ents.size() < 1 )
return MB_FAILURE;
2598 MBERRORR( rval,
"Failed to get connectivity of broken edge" );
2603 std::vector< EntityHandle > adj_edges;
2605 if( adj_edges.size() < 1 || rval !=
MB_SUCCESS )
MBERRORR( MB_FAILURE,
" Can't find small split edge" );
2611 MBERRORR( rval,
"Failed to get connectivity of first split edge" );
2613 if( conn02[0] != connActual[0] )
2617 MBERRORR( rval,
"Failed to reset connectivity of first split edge" );
2623 if( adj_edges.size() < 1 || rval !=
MB_SUCCESS )
MBERRORR( MB_FAILURE,
" Can't find second small split edge" );
2628 MBERRORR( rval,
"Failed to get connectivity of first split edge" );
2630 if( conn21[0] != connActual[0] )
2634 MBERRORR( rval,
"Failed to reset connectivity of first split edge" );
2637 int num_mesh_edges = (int)ents.size();
2641 for( index_edge = 0; index_edge < num_mesh_edges; index_edge++ )
2642 if( brokenEdge == ents[index_edge] )
break;
2643 if( index_edge >= num_mesh_edges )
MBERRORR( MB_FAILURE,
"can't find the broken edge" );
2653 std::cout <<
"Split edge with " << num_mesh_edges <<
" mesh edges, at index (0 based) " << index_edge <<
"\n";
2666 MBERRORR( rval,
"Failed to create a new vertex set" );
2669 MBERRORR( rval,
"Failed to add the node to the set" );
2672 MBERRORR( rval,
"Failed to commit the node set" );
2676 std::cout <<
" create a vertex set (this should have been created before!)"
2686 MBERRORR( rval,
"can't create geo edge" );
2688 int remaining = num_mesh_edges - 1 - index_edge;
2692 MBERRORR( rval,
"can't add second split edge to the new edge" );
2695 MBERRORR( rval,
"can't add edges to the new edge" );
2701 MBERRORR( rval,
"can't remove edges from the old edge" );
2704 MBERRORR( rval,
"can't add first split edge to the old edge" );
2711 if( vertexRange.
size() == 1 )
2715 secondSet = vertexRange[0];
2719 if( vertexRange.
size() > 2 )
return MB_FAILURE;
2723 rval =
MBI->get_connectivity( ents[0], conn, len );
2725 firstNode = conn[0];
2728 for( k = 0; k < 2; k++ )
2733 MBERRORR( rval,
"can't get vertices from vertex set" );
2734 if( verts.
size() != 1 )
MBERRORR( MB_FAILURE,
" node set not defined well" );
2735 if( firstNode == verts[0] )
2737 secondSet = vertexRange[1 - k];
2744 MBERRORR( MB_FAILURE,
" can't find the right vertex" );
2751 MBERRORR( rval,
" can't remove the second vertex from edge" );
2755 MBERRORR( rval,
" can't add new vertex to old edge" );
2758 MBERRORR( rval,
" can't add new vertex to new edge" );
2763 MBERRORR( rval,
" can't add second vertex to new edge" );
2768 MBERRORR( rval,
" can't add new edge" );
2784 MBERRORR( rval,
" can't add new edge - face parent relation" );
2787 MBERRORR( rval,
" can't get initial sense of edge in the adjacent face" );
2790 MBERRORR( rval,
" can't set sense of new edge in the adjacent face" );
2806 MBERRORR( rval,
" can't get boundary edges" );
2815 MBERRORR( rval,
" can't get mesh edges" );
2819 if( mesh_edges.
find( brokenEdge ) != mesh_edges.
end() )
2830 MBERRORR( rval,
" can't get nodes from mesh edges" );
2832 if( nodes.
find( atNode ) != nodes.
end() )
2843 MBERRORR( MB_FAILURE,
" we did not find an appropriate boundary edge" );
2853 const void*
const zero_val[] = { &zero };
2878 std::vector< EntityHandle >& chainedEdges )
2887 MBERRORR( rval,
" can't get triangles from old face" );
2889 MBERRORR( rval,
" can't get triangles from new face" );
2894 MBERRORR( rval,
" can't get children sets from face" );
2899 if( std::find( chainedEdges.begin(), chainedEdges.end(),
edge ) != chainedEdges.end() )
2905 MBERRORR( rval,
" can't get mesh edges from edge" );
2906 if( mesh_edges.
empty() )
MBERRORR( MB_FAILURE,
" no mesh edges" );
2911 MBERRORR( rval,
" can't get adjacent triangles" );
2914 if( !intx1.
empty() && !intx2.
empty() )
MBERRORR( MB_FAILURE,
" at least one should be empty" );
2927 MBERRORR( rval,
" can't remove parent child relation for edge" );
2930 MBERRORR( rval,
" can't add parent child relation for edge" );
2933 int num1, sense, offset;
2935 MBERRORR( rval,
"mesh edge not adjacent to triangle" );
2938 MBERRORR( rval,
"can't set proper sense of edge in face" );
2950 MBERRORR( rval,
"can't get tag handle" );
2990 MBERRORR( rval,
"can't duplicate model" );
3012 MBERRORR( rval,
"can't get quads from the surface set" );
3014 MBERRORR( rval,
"can't remove quads from the surface set" );
3022 MBERRORR( rval,
"can't get quad connectivity" );
3026 MBERRORR( rval,
"can't get node coordinates" );
3037 MBERRORR( rval,
"can't create triangle 1" );
3039 MBERRORR( rval,
"can't create triangle 2" );
3041 MBERRORR( rval,
"can't add triangles to the set" );
3053 MBERRORR( rval,
" can't get boundary edges" );
3060 MBERRORR( rval,
" can't get mesh edges" );
3071 MBERRORR( rval,
" can't get boundary edges" );
3079 MBERRORR( rval,
" can't get mesh edges" );
3081 MBERRORR( rval,
" can't get nodes from mesh edges" );
3084 boundary_nodes.resize( b_nodes.
size() );
3085 std::copy( b_nodes.
begin(), b_nodes.
end(), boundary_nodes.begin() );
3095 MBERRORR( rval,
"can't get adj_tris" );
3097 if( adj_tri.
size() >= 3 )
3099 std::cout <<
"WARNING: non manifold geometry. Are you sure?";
3108 MBERRORR( rval,
"can't get nodes" );
3109 int num1, sense, offset;
3111 MBERRORR( rval,
"can't get side number" );
3114 int num2 = ( num1 + 1 ) % 3;
3115 int num3 = ( num2 + 1 ) % 3;
3117 EntityHandle t1[] = { conn3[num2], conn3[num3], newVertex };
3118 EntityHandle t2[] = { conn3[num1], newVertex, conn3[num3] };
3121 MBERRORR( rval,
"can't create triangle" );
3124 MBERRORR( rval,
"can't create triangle" );
3127 std::vector< EntityHandle > edges0;
3129 MBERRORR( rval,
"can't get new edges" );
3132 MBERRORR( rval,
"can't get new edges" );
3135 std::cout <<
"2 (out of 4) triangles formed:\n";
3152 MBERRORR( rval,
"can't get nodes" );
3158 MBERRORR( rval,
"can't create triangle" );
3161 MBERRORR( rval,
"can't create triangle" );
3164 MBERRORR( rval,
"can't create triangle" );
3168 std::vector< EntityHandle > edges0;
3170 MBERRORR( rval,
"can't get new edges" );
3173 MBERRORR( rval,
"can't get new edges" );
3176 std::cout <<
"3 triangles formed:\n";
3183 std::cout <<
"original nodes in tri:\n";
3200 MBERRORR( rval,
"can't create volume" );
3202 int volumeMatId = 1;
3205 MBERRORR( rval,
"can't get material tag" );
3208 MBERRORR( rval,
"can't set material tag value on volume" );
3213 MBERRORR( rval,
"can't add first face to volume" );
3216 MBERRORR( rval,
"can't add second face to volume" );
3220 MBERRORR( rval,
"can't add volume to the gtt" );
3225 MBERRORR( rval,
"can't set bottom face sense to the volume" );
3229 MBERRORR( rval,
"can't set top face sense to the volume" );
3233 std::vector< EntityHandle > edges1;
3234 std::vector< EntityHandle > edges2;
3237 MBERRORR( rval,
"can't get children edges or first face, bottom" );
3240 MBERRORR( rval,
"can't get children edges for second face, top" );
3242 if( edges1.size() != edges2.size() )
MBERRORR( MB_FAILURE,
"wrong correspondence " );
3244 for(
unsigned int i = 0; i < edges1.size(); ++i )
3248 MBERRORR( rval,
"can't weave lateral face" );
3250 MBERRORR( rval,
"can't add lateral face to volume" );
3254 MBERRORR( rval,
"can't set lateral face sense to the volume" );
3258 MBERRORR( rval,
"can't set new neumann tags" );
3265 std::vector< EntityHandle > ents;
3268 if( ents.size() < 1 )
return MB_FAILURE;
3270 nodes.resize( ents.size() + 1 );
3273 for(
unsigned int i = 0; i < ents.size(); ++i )
3276 MBERRORR( rval,
"can't get edge connectivity" );
3280 nodes[ents.size()] = conn[1];
3292 MBERRORR( rval,
"can't create new lateral face" );
3298 std::vector< EntityHandle > adj;
3300 MBERRORR( rval,
"can't get children nodes" );
3301 bool periodic =
false;
3302 if( adj.size() == 1 )
3304 v[0] = v[1] = adj[0];
3314 MBERRORR( rval,
"can't get bottom edge sense" );
3323 MBERRORR( rval,
"can't get children nodes" );
3324 if( adj.size() == 1 )
3326 v[2] = v[3] = adj[0];
3327 if( !periodic )
MBERRORR( MB_FAILURE,
"top edge is periodic, but bottom edge is not" );
3333 if( periodic )
MBERRORR( MB_FAILURE,
"top edge is not periodic, but bottom edge is" );
3338 std::vector< EntityHandle > nodes1;
3340 MBERRORR( rval,
"can't get nodes from bott edge" );
3342 std::vector< EntityHandle > nodes2;
3344 MBERRORR( rval,
"can't get nodes from top edge" );
3346 std::vector< CartVect > coords1, coords2;
3347 coords1.resize( nodes1.size() );
3348 coords2.resize( nodes2.size() );
3350 int N1 = (int)nodes1.size();
3351 int N2 = (int)nodes2.size();
3353 rval =
_mbImpl->
get_coords( &( nodes1[0] ), nodes1.size(), (
double*)&( coords1[0] ) );
3354 MBERRORR( rval,
"can't get coords of nodes from bott edge" );
3356 rval =
_mbImpl->
get_coords( &( nodes2[0] ), nodes2.size(), (
double*)&( coords2[0] ) );
3357 MBERRORR( rval,
"can't get coords of nodes from top edge" );
3362 CartVect v1 = ( coords1[0] - coords2[0] ) * up;
3363 CartVect v2 = ( coords1[0] - coords2[N2 - 1] ) * up;
3368 for(
unsigned int k = 0; k < nodes2.size() / 2; k++ )
3371 nodes2[k] = nodes2[N2 - 1 - k];
3372 nodes2[N2 - 1 - k] = tmp;
3374 coords2[k] = coords2[N2 - 1 - k];
3375 coords2[N2 - 1 - k] = tv;
3387 EntityHandle nd[4] = { nodes1[0], nodes1[N1 - 1], nodes2[0], nodes2[N2 - 1] };
3393 MBERRORR( rval,
"can't get edges connected to vertex set 1" );
3395 for(
unsigned int j = 0; j < adj.size(); j++ )
3400 if( vertices.
find( v[2] ) != vertices.
end() )
3411 MBERRORR( rval,
"can't create edge 1" );
3414 MBERRORR( rval,
"can't add parent - child relation" );
3417 MBERRORR( rval,
"can't add parent - child relation" );
3422 MBERRORR( rval,
"can't create mesh edge" );
3425 MBERRORR( rval,
"can't add mesh edge to geo edge" );
3428 MBERRORR( rval,
"can't add edge to gtt" );
3433 MBERRORR( rval,
"can't get edges connected to vertex set 2" );
3435 for(
unsigned int i = 0; i < adj.size(); i++ )
3440 if( vertices.
find( v[3] ) != vertices.
end() )
3451 MBERRORR( rval,
"can't create edge 1" );
3454 MBERRORR( rval,
"can't add parent - child relation" );
3457 MBERRORR( rval,
"can't add parent - child relation" );
3462 MBERRORR( rval,
"can't create mesh edge" );
3465 MBERRORR( rval,
"can't add mesh edge to geo edge" );
3468 MBERRORR( rval,
"can't add edge to gtt" );
3475 MBERRORR( rval,
"can't add parent - child relation" );
3478 MBERRORR( rval,
"can't add parent - child relation" );
3481 MBERRORR( rval,
"can't add parent - child relation" );
3484 MBERRORR( rval,
"can't add parent - child relation" );
3487 MBERRORR( rval,
"can't add face to gtt" );
3491 MBERRORR( rval,
"can't set bottom edge sense to the lateral face" );
3495 MBERRORR( rval,
"can't get top edge sense" );
3498 MBERRORR( rval,
"can't set top edge sense to the lateral face" );
3501 MBERRORR( rval,
"can't set first vert edge sense" );
3504 MBERRORR( rval,
"can't set second edge sense to the lateral face" );
3507 int indexB = 0, indexT = 0;
3526 CartVect dir1 = coords1[1] - coords1[0];
3529 dir1 = up * planeNormal;
3532 bool weaveDown =
true;
3537 if( ( indexB == N1 - 1 ) && ( indexT == N2 - 1 ) )
break;
3538 if( indexB == N1 - 1 )
3542 else if( indexT == N2 - 1 )
3550 double proj1 = ( coords1[indexB + 1] - startP ) % dir1;
3551 double proj2 = ( coords2[indexT + 1] - startP ) % dir1;
3557 EntityHandle nTri[3] = { nodes1[indexB], 0, nodes2[indexT] };
3560 nTri[1] = nodes1[indexB + 1];
3561 nTri[2] = nodes2[indexT];
3566 nTri[1] = nodes2[indexT + 1];
3571 MBERRORR( rval,
"can't create triangle" );
3574 MBERRORR( rval,
"can't add triangle to face set" );
3578 dir1 = coords1[indexB] - coords1[indexB - 1];
3582 dir1 = coords2[indexT] - coords2[indexT - 1];
3584 dir1 = up * ( dir1 * up );
3608 MBERRORR( rval,
"can't get tag handle" );
3612 MBERRORR( rval,
"can't get geo sets" );
3613 int nfaces = (int)sets[2].
size();
3614 int* vals =
new int[nfaces];
3615 for(
int i = 0; i < nfaces; i++ )
3620 MBERRORR( rval,
"can't set tag values for neumann sets" );
3634 MBERRORR( rval,
"can't get geo sets" );
3637 int nedges = (int)sets[1].
size();
3640 for(
int i = 0; i < nedges; i++ )
3644 bool chainable =
false;
3646 MBERRORR( rval,
"can't determine chain-ability" );
3650 MBERRORR( rval,
"can't chain 2 edges" );
3672 MBERRORR( rval,
"can't get vertices" );
3678 MBERRORR( rval,
"can't get parents of vertex set" );
3682 MBERRORR( rval,
"can't get parents of edge set" );
3684 std::vector< EntityHandle > mesh_edges;
3686 MBERRORR( rval,
"can't get mesh edges from edge set" );
3687 EntityHandle lastMeshEdge = mesh_edges[mesh_edges.size() - 1];
3691 MBERRORR( rval,
"can't connectivity of last mesh edge" );
3693 if( len != 2 )
MBERRORR( MB_FAILURE,
"bad number of vertices" );
3696 MBERRORR( rval,
"Failed to get coordinates" );
3703 if(
edge == otherEdge )
continue;
3707 MBERRORR( rval,
"can't get parents of other edge set" );
3708 if( faces != faces2 )
continue;
3710 std::vector< EntityHandle > mesh_edges2;
3712 MBERRORR( rval,
"can't get mesh edges from other edge set" );
3717 MBERRORR( rval,
"can't connectivity of first mesh edge" );
3718 if( len2 != 2 )
MBERRORR( MB_FAILURE,
"bad number of vertices" );
3719 if( conn2[1] != conn22[0] )
continue;
3726 if( vec1 % vec2 < min_dot )
continue;
3728 next_edge = otherEdge;
3742 MBERRORR( rval,
"can't get vert sets" );
3744 MBERRORR( rval,
"can't get vert sets" );
3745 assert( v12 == v21 );
3746 std::vector< EntityHandle > mesh_edges;
3747 rval =
MBI->get_entities_by_type( next_edge,
MBEDGE, mesh_edges );
3748 MBERRORR( rval,
"can't get mesh edges" );
3751 MBERRORR( rval,
"can't add new mesh edges" );
3754 MBERRORR( rval,
"can't remove parent - child relation between first edge and middle vertex" );
3759 MBERRORR( rval,
"can't add second vertex to edge " );
3763 MBERRORR( rval,
"can't remove child - parent relation " );
3766 MBERRORR( rval,
"can't remove child - parent relation " );
3771 MBERRORR( rval,
"can't get parent faces " );
3777 MBERRORR( rval,
"can't remove parent-edge rel " );
3781 MBERRORR( rval,
"can't remove edge set " );
3785 MBERRORR( rval,
"can't remove edge set " );
3796 MBERRORR( rval,
"can't get child meshsets" );
3805 MBERRORR( MB_FAILURE,
"too many vertices in one edge" );
3809 MBERRORR( rval,
"can't get entities from vertex set" );
3810 if(
entities.size() < 1 )
MBERRORR( MB_FAILURE,
"no mesh nodes in vertex set" );
3817 std::vector< EntityHandle > ents;
3819 MBERRORR( rval,
"can't get mesh edges" );
3820 if( ents.size() < 1 )
MBERRORR( MB_FAILURE,
"no mesh edges in edge set" );
3824 rval =
MBI->get_connectivity( ents[0], conn, len );
3825 MBERRORR( rval,
"can't connectivity of first mesh edge" );
3827 if( conn[0] == node0 )