+//================================================================================
+/*!
+ * \brief Set _hyperPatchList by _hyperPatchEntriesList
+ */
+//================================================================================
+
+void BLSURFPlugin_Hypothesis::
+SetHyperPatchIDsByEntry( const TopoDS_Shape& mainShape,
+ const std::map< std::string, TopoDS_Shape >& entryToShape)
+{
+ _hyperPatchList.clear();
+ if ( _hyperPatchEntriesList.empty() || mainShape.IsNull() )
+ return;
+
+ _hyperPatchList.resize( _hyperPatchEntriesList.size() );
+
+ TopTools_IndexedMapOfShape shapeMap;
+ TopExp::MapShapes( mainShape, shapeMap );
+
+ for ( size_t i = 0; i < _hyperPatchEntriesList.size(); ++i )
+ {
+ THyperPatchTags & idsList = _hyperPatchList [ i ];
+ const THyperPatchEntries & entryList = _hyperPatchEntriesList[ i ];
+ for ( const std::string & entry : entryList )
+ {
+ auto e2sIt = entryToShape.find( entry );
+ if ( e2sIt != entryToShape.end() )
+ {
+ for ( TopExp_Explorer fExp( e2sIt->second, TopAbs_FACE ); fExp.More(); fExp.Next() )
+ {
+ int id = shapeMap.FindIndex( fExp.Current() );
+ if ( id > 0 )
+ idsList.insert( id );
+ }
+ }
+ }
+ }
+ THyperPatchList hpl;
+ hpl.swap( _hyperPatchList );
+ SetHyperPatches( hpl, /*notifyMesh=*/false );
+}
+
+//=============================================================================
+/*!
+ * \brief Return a tag of a face taking into account the hyper-patches. Optionally
+ * return an index of a patch including the face
+ */
+//================================================================================
+
+int BLSURFPlugin_Hypothesis::GetHyperPatchTag( const int faceTag,
+ const BLSURFPlugin_Hypothesis* hyp,
+ int* iPatch)
+{
+ if ( hyp )
+ {
+ const THyperPatchList& hpl = hyp->_hyperPatchList;
+ for ( size_t i = 0; i < hpl.size(); ++i )
+ if ( hpl[i].count( faceTag ))
+ {
+ if ( iPatch ) *iPatch = (int) i;
+ return *( hpl[i].begin() );
+ }
+ }
+ return faceTag;
+}