+//================================================================================
+/*!
+ * \brief Checks structure of a quadrangular mesh at the common VERTEX of two EDGEs.
+ * Returns true if there are two quadrangles near the VERTEX.
+ */
+//================================================================================
+
+bool _QuadFaceGrid::isContinuousMesh(TopoDS_Edge E1, TopoDS_Edge E2, SMESH_Mesh& mesh) const
+{
+ if (E1.Orientation() > TopAbs_REVERSED) // INTERNAL
+ E1.Orientation( TopAbs_FORWARD );
+ if (E2.Orientation() > TopAbs_REVERSED) // INTERNAL
+ E2.Orientation( TopAbs_FORWARD );
+
+ TopoDS_Vertex V;
+ if ( !TopExp::CommonVertex( E1, E2, V )) return false;
+
+ const SMDS_MeshNode* n = SMESH_Algo::VertexNode( V, mesh.GetMeshDS() );
+ if ( !n ) return false;
+
+ SMESHDS_SubMesh* sm = mesh.GetSubMesh( myFace )->GetSubMeshDS();
+ if ( !sm ) return false;
+
+ int nbQuads = 0;
+ SMDS_ElemIteratorPtr fIt = n->GetInverseElementIterator(SMDSAbs_Face);
+ while ( fIt->more() )
+ {
+ const SMDS_MeshElement* f = fIt->next();
+ if ( !sm->Contains( f )) continue;
+
+ if ( f->NbCornerNodes() == 4 )
+ ++nbQuads;
+ else
+ return false;
+ }
+ return nbQuads == 2;
+}
+
+//================================================================================
+/*!
+ * \brief Checks if a continuation FACE is needed at a given side according to
+ * presence of corner VERTEXes
+ */
+//================================================================================
+
+bool _QuadFaceGrid::needContinuationAtSide( int iSide,
+ const TopTools_MapOfShape& cornerVertices ) const
+{
+ if ( cornerVertices.IsEmpty() )
+ return false;
+
+ // current solution is rough. Take more care of composite sides!
+
+ // check presence of corners at iSide
+ const _FaceSide* side = mySides.GetSide( iSide );
+ if ( !side ) return false;
+ int nbCorners = side->NbCommonVertices( cornerVertices );
+ if ( nbCorners > 0 )
+ return false;
+
+ // check presence of corners at other sides
+ nbCorners = mySides.NbCommonVertices( cornerVertices );
+
+ return ( 0 < nbCorners && nbCorners <= 3 ); // if nbCorners == 2 additional check is needed!!!
+}
+