+//=======================================================================
+//function : isMeshBoundToShape
+//purpose : return true if all 2d elements are bound to shape
+// if aFaceSubmesh != NULL, then check faces bound to it
+// else check all faces in aMeshDS
+//=======================================================================
+
+static bool isMeshBoundToShape(SMESHDS_Mesh * aMeshDS,
+ SMESHDS_SubMesh * aFaceSubmesh,
+ const bool isMainShape)
+{
+ if ( isMainShape ) {
+ // check that all faces are bound to aFaceSubmesh
+ if ( aMeshDS->NbFaces() != aFaceSubmesh->NbElements() )
+ return false;
+ }
+
+ // check face nodes binding
+ if ( aFaceSubmesh ) {
+ SMDS_ElemIteratorPtr fIt = aFaceSubmesh->GetElements();
+ return areNodesBound( fIt );
+ }
+ SMDS_FaceIteratorPtr fIt = aMeshDS->facesIterator();
+ return areNodesBound( fIt );
+}
+