list<SMESH_subMesh*> subMeshes = tgtMesh1->GetGroupSubMeshesContaining(tgtShape);
list<SMESH_subMesh*>::iterator sm = subMeshes.begin();
int type, last = TopAbs_SHAPE;
- StdMeshers_ProjectionUtils util;
for ( ; sm != subMeshes.end(); ++sm ) {
const TopoDS_Shape & group = (*sm)->GetSubShape();
// check if group is similar to srcGroup
for ( type = srcGroup.ShapeType(); type < last; ++type)
- if ( util.Count( srcGroup, (TopAbs_ShapeEnum)type, 0) !=
- util.Count( group, (TopAbs_ShapeEnum)type, 0))
+ if ( SMESH_MesherHelper::Count( srcGroup, (TopAbs_ShapeEnum)type, 0) !=
+ SMESH_MesherHelper::Count( group, (TopAbs_ShapeEnum)type, 0))
break;
if ( type == last )
return group;
// get edges of the face
TopoDS_Edge edgeGr1, edgeGr2, verticEdge2;
list< TopoDS_Edge > edges; list< int > nbEdgesInWire;
- SMESH_Block::GetOrderedEdges( face, v1, edges, nbEdgesInWire);
+ SMESH_Block::GetOrderedEdges( face, edges, nbEdgesInWire, v1);
if ( nbEdgesInWire.front() != 4 )
return _StoreBadShape( face );
list< TopoDS_Edge >::iterator edge = edges.begin();
// Maybe groups contain only one member
TopoDS_Iterator it1( theShape1 ), it2( theShape2 );
TopAbs_ShapeEnum memberType = it1.Value().ShapeType();
- int nbMembers = Count( theShape1, memberType, true );
+ int nbMembers = SMESH_MesherHelper::Count( theShape1, memberType, true );
if ( nbMembers == 0 ) return true;
if ( nbMembers == 1 ) {
return FindSubShapeAssociation( it1.Value(), theMesh1, it2.Value(), theMesh2, theMap );
if ( groupEdges[ is2ndGroup ].Contains( f.Current() ))
if ( ++nbGroupEdges > 1 )
break;
- bool add = (nbGroupEdges > 1 || Count( face, TopAbs_EDGE, true ) == 1 );
+ bool add = (nbGroupEdges > 1 ||
+ SMESH_MesherHelper::Count( face, TopAbs_EDGE, true ) == 1 );
if ( !add ) {
add = true;
for ( TopExp_Explorer v( face, TopAbs_VERTEX ); add && v.More(); v.Next())
}
// Associate shells
//
- int nbFaces1 = Count( shell1, TopAbs_FACE, 0 );
- int nbFaces2 = Count( shell2, TopAbs_FACE, 0 );
+ int nbFaces1 = SMESH_MesherHelper:: Count( shell1, TopAbs_FACE, 0 );
+ int nbFaces2 = SMESH_MesherHelper:: Count( shell2, TopAbs_FACE, 0 );
if ( nbFaces1 != nbFaces2 )
RETURN_BAD_RESULT("Different nb of faces found for shells");
if ( nbFaces1 > 0 ) {
if ( face2.Orientation() >= TopAbs_INTERNAL ) face2.Orientation( TopAbs_FORWARD );
TopoDS_Edge edge1, edge2;
// get outer edge of theShape1
- edge1 = TopoDS::Edge( OuterShape( face1, TopAbs_EDGE ));
- // find out if any edge of face2 is a propagation edge of outer edge1
+ TopoDS_Shape wire = OuterShape( face1, TopAbs_WIRE );
+ //edge1 = TopoDS::Edge( OuterShape( face1, TopAbs_EDGE ));
map<int,TopoDS_Edge> propag_edges; // use map to find the closest propagation edge
- for ( TopExp_Explorer exp( face2, TopAbs_EDGE ); exp.More(); exp.Next() ) {
- edge2 = TopoDS::Edge( exp.Current() );
- pair<int,TopoDS_Edge> step_edge = GetPropagationEdge( theMesh1, edge2, edge1 );
- if ( !step_edge.second.IsNull() ) { // propagation found
- propag_edges.insert( step_edge );
- if ( step_edge.first == 1 ) break; // most close found
+ for ( TopoDS_Iterator edgeIt( wire ); edgeIt.More(); edgeIt.Next() )
+ {
+ edge1 = TopoDS::Edge( edgeIt.Value() );
+ // find out if any edge of face2 is a propagation edge of outer edge1
+ for ( TopExp_Explorer exp( face2, TopAbs_EDGE ); exp.More(); exp.Next() ) {
+ edge2 = TopoDS::Edge( exp.Current() );
+ pair<int,TopoDS_Edge> step_edge = GetPropagationEdge( theMesh1, edge2, edge1 );
+ if ( !step_edge.second.IsNull() ) { // propagation found
+ propag_edges.insert( step_edge );
+ if ( step_edge.first == 1 ) break; // most close found
+ }
}
+ if ( !propag_edges.empty() && propag_edges.begin()->first == 1 ) break;
}
if ( !propag_edges.empty() ) // propagation found
{
if ( vMap1.Extent() != vMap2.Extent() )
{
- if ( HERE::Count( theShape1, TopAbs_EDGE, /*ignoreSame=*/false ) !=
- HERE::Count( theShape2, TopAbs_EDGE, /*ignoreSame=*/false ))
+ if ( SMESH_MesherHelper:: Count( theShape1, TopAbs_EDGE, /*ignoreSame=*/false ) !=
+ SMESH_MesherHelper:: Count( theShape2, TopAbs_EDGE, /*ignoreSame=*/false ))
RETURN_BAD_RESULT("Different nb of vertices");
}
edges1.clear();
edges2.clear();
- if ( SMESH_Block::GetOrderedEdges( face1, VV1[0], edges1, nbEInW1, outer_wire_algo) !=
- SMESH_Block::GetOrderedEdges( face2, VV2[0], edges2, nbEInW2, outer_wire_algo) )
+ if ( SMESH_Block::GetOrderedEdges( face1, edges1, nbEInW1, VV1[0], outer_wire_algo) !=
+ SMESH_Block::GetOrderedEdges( face2, edges2, nbEInW2, VV2[0], outer_wire_algo) )
CONT_BAD_RESULT("Different number of wires in faces ");
if ( nbEInW1 != nbEInW2 && outer_wire_algo == 0 &&
{
edges1.clear();
edges2.clear();
- SMESH_Block::GetOrderedEdges( face1, VV1[0], edges1, nbEInW1, i_ok_wire_algo);
- SMESH_Block::GetOrderedEdges( face2, VV2[0], edges2, nbEInW2, i_ok_wire_algo);
+ SMESH_Block::GetOrderedEdges( face1, edges1, nbEInW1, VV1[0], i_ok_wire_algo);
+ SMESH_Block::GetOrderedEdges( face2, edges2, nbEInW2, VV2[0], i_ok_wire_algo);
}
gp_XY dUV = v0f2UV.XY() - v0f1UV.XY(); // UV shift between 2 faces
//
//================================================================================
/*!
- * \brief Count nb of sub-shapes
- * \param shape - the shape
- * \param type - the type of sub-shapes to count
- * \retval int - the calculated number
- */
-//================================================================================
-
-int StdMeshers_ProjectionUtils::Count(const TopoDS_Shape& shape,
- const TopAbs_ShapeEnum type,
- const bool ignoreSame)
-{
- if ( ignoreSame ) {
- TopTools_IndexedMapOfShape map;
- TopExp::MapShapes( shape, type, map );
- return map.Extent();
- }
- else {
- int nb = 0;
- for ( TopExp_Explorer exp( shape, type ); exp.More(); exp.Next() )
- ++nb;
- return nb;
- }
-}
-
-//================================================================================
-/*!
- * \brief Return a boundary EDGE of edgeContainer
+ * \brief Return a boundary EDGE (or all boundary EDGEs) of edgeContainer
*/
//================================================================================
// make any local coord systems of src and tgt faces
vector<gp_Pnt> srcPP, tgtPP; // 3 points on face boundaries to make axes of CS
- bool sameNbVert = ( TAssocTool::Count( tgtFace, TopAbs_VERTEX, /*ignoreSame=*/true ) ==
- TAssocTool::Count( srcFace, TopAbs_VERTEX, /*ignoreSame=*/true ));
+ int tgtNbVert = SMESH_MesherHelper::Count( tgtFace, TopAbs_VERTEX, /*ignoreSame=*/true );
+ int srcNbVert = SMESH_MesherHelper::Count( srcFace, TopAbs_VERTEX, /*ignoreSame=*/true );
SMESH_subMesh * srcSM = srcMesh->GetSubMesh( srcFace );
SMESH_subMeshIteratorPtr smIt = srcSM->getDependsOnIterator(/*includeSelf=*/false,false);
srcSM = smIt->next(); // sm of a vertex
if ( tgtShape.ShapeType() == TopAbs_VERTEX )
{
tgtP = BRep_Tool::Pnt( TopoDS::Vertex( tgtShape ));
- if ( sameNbVert || tgtPP.empty() )
+ if ( srcNbVert == tgtNbVert || tgtPP.empty() )
pOK = true;
else
pOK = (( tgtP.Distance( tgtPP[0] ) > tol*tol ) &&
{
if ( srcShape.ShapeType() == TopAbs_FACE )
{
- int nbE1 = TAssocTool::Count( tgtFace, TopAbs_EDGE, /*ignoreSame=*/true );
- int nbE2 = TAssocTool::Count( srcShape, TopAbs_EDGE, /*ignoreSame=*/true );
+ int nbE1 = SMESH_MesherHelper::Count( tgtFace, TopAbs_EDGE, /*ignoreSame=*/true );
+ int nbE2 = SMESH_MesherHelper::Count( srcShape, TopAbs_EDGE, /*ignoreSame=*/true );
if ( nbE1 != nbE2 )
return error(COMPERR_BAD_SHAPE,
SMESH_Comment("Different number of edges in source and target faces: ")
}
list< TopoDS_Edge > tgtEdges, srcEdges;
list< int > nbEdgesInWires;
- SMESH_Block::GetOrderedEdges( tgtFace, tgtV1, tgtEdges, nbEdgesInWires );
- SMESH_Block::GetOrderedEdges( srcFace, srcV1, srcEdges, nbEdgesInWires );
+ SMESH_Block::GetOrderedEdges( tgtFace, tgtEdges, nbEdgesInWires, tgtV1 );
+ SMESH_Block::GetOrderedEdges( srcFace, srcEdges, nbEdgesInWires, srcV1 );
if ( nbEdgesInWires.front() > 1 ) // possible to find out orientation
{
// Make groups of nodes to merge
- // loop on edge and vertex submeshes of a target face
+ // loop on EDGE and VERTEX sub-meshes of a target FACE
smIt = tgtSubMesh->getDependsOnIterator(/*includeSelf=*/false,/*complexShapeFirst=*/false);
while ( smIt->more() )
{
groupsOfNodes.back().push_back( nIt->next() );
}
}
- continue; // do not treate sm of degen VERTEX
+ continue; // do not treat sm of degen VERTEX
}
// Sort new and old nodes of a submesh separately
u2nodesOnSeam.size() > 0 &&
seam.ShapeType() == TopAbs_EDGE )
{
- int nbE1 = TAssocTool::Count( tgtFace, TopAbs_EDGE, /*ignoreSame=*/true );
- int nbE2 = TAssocTool::Count( srcFace, TopAbs_EDGE, /*ignoreSame=*/true );
+ int nbE1 = SMESH_MesherHelper::Count( tgtFace, TopAbs_EDGE, /*ignoreSame=*/true );
+ int nbE2 = SMESH_MesherHelper::Count( srcFace, TopAbs_EDGE, /*ignoreSame=*/true );
if ( nbE1 != nbE2 ) // 2 EDGEs are mapped to a seam EDGE
{
// find the 2 EDGEs of srcFace
TopTools_DataMapIteratorOfDataMapOfShapeShape src2tgtIt( shape2ShapeMap._map2to1 );
for ( ; src2tgtIt.More(); src2tgtIt.Next() )
if ( seam.IsSame( src2tgtIt.Value() ))
- {
- const TopoDS_Shape& tgtEdge = src2tgtIt.Key();
- if ( SMESHDS_SubMesh* tgtSM = srcMesh->GetMeshDS()->MeshElements( tgtEdge ))
- {
- SMDS_NodeIteratorPtr nIt = tgtSM->GetNodes();
- while ( nIt->more() )
- SMESH_Algo::addBadInputElement( nIt->next() );
- }
- }
+ SMESH_Algo::addBadInputElements
+ ( srcMesh->GetMeshDS()->MeshElements( src2tgtIt.Key() ));
return error( COMPERR_BAD_INPUT_MESH,
"Different number of nodes on two edges projected to a seam edge" );
}
groupsOfNodes.back().push_back( u_newNode->second );
groupsOfNodes.back().push_back( u_newOnSeam->second );
}
- }
+
+ } // loop on EDGE and VERTEX submeshes of a target FACE
// Merge