+//================================================================================
+/*!
+ * \brief Finds FACEs w/o layers for a given SOLID by an hypothesis
+ */
+//================================================================================
+
+void _ViscousBuilder::getIgnoreFaces(const TopoDS_Shape& solid,
+ const StdMeshers_ViscousLayers* hyp,
+ const TopoDS_Shape& hypShape,
+ set<TGeomID>& ignoreFaceIds)
+{
+ TopExp_Explorer exp;
+
+ vector<TGeomID> ids = hyp->GetBndShapes();
+ if ( hyp->IsToIgnoreShapes() ) // FACEs to ignore are given
+ {
+ for ( size_t ii = 0; ii < ids.size(); ++ii )
+ {
+ const TopoDS_Shape& s = getMeshDS()->IndexToShape( ids[ii] );
+ if ( !s.IsNull() && s.ShapeType() == TopAbs_FACE )
+ ignoreFaceIds.insert( ids[ii] );
+ }
+ }
+ else // FACEs with layers are given
+ {
+ exp.Init( solid, TopAbs_FACE );
+ for ( ; exp.More(); exp.Next() )
+ {
+ TGeomID faceInd = getMeshDS()->ShapeToIndex( exp.Current() );
+ if ( find( ids.begin(), ids.end(), faceInd ) == ids.end() )
+ ignoreFaceIds.insert( faceInd );
+ }
+ }
+
+ // ignore internal FACEs if inlets and outlets are specified
+ if ( hyp->IsToIgnoreShapes() )
+ {
+ TopTools_IndexedDataMapOfShapeListOfShape solidsOfFace;
+ TopExp::MapShapesAndAncestors( hypShape,
+ TopAbs_FACE, TopAbs_SOLID, solidsOfFace);
+
+ for ( exp.Init( solid, TopAbs_FACE ); exp.More(); exp.Next() )
+ {
+ const TopoDS_Face& face = TopoDS::Face( exp.Current() );
+ if ( SMESH_MesherHelper::NbAncestors( face, *_mesh, TopAbs_SOLID ) < 2 )
+ continue;
+
+ int nbSolids = solidsOfFace.FindFromKey( face ).Extent();
+ if ( nbSolids > 1 )
+ ignoreFaceIds.insert( getMeshDS()->ShapeToIndex( face ));
+ }
+ }
+}
+