+ faces.clear();
+ for ( int iF = 0; iF < NbFaces(); ++iF ) {
+ const SMDS_MeshFace* face = 0;
+ const SMDS_MeshNode** nodes = GetFaceNodes( iF );
+ switch ( NbFaceNodes( iF )) {
+ case 3:
+ face = SMDS_Mesh::FindFace( nodes[0], nodes[1], nodes[2] ); break;
+ case 4:
+ face = SMDS_Mesh::FindFace( nodes[0], nodes[1], nodes[2], nodes[3] ); break;
+ case 6:
+ face = SMDS_Mesh::FindFace( nodes[0], nodes[1], nodes[2],
+ nodes[3], nodes[4], nodes[5]); break;
+ case 8:
+ face = SMDS_Mesh::FindFace( nodes[0], nodes[1], nodes[2], nodes[3],
+ nodes[4], nodes[5], nodes[6], nodes[7]); break;
+ }
+ if ( face )
+ faces.push_back( face );
+ }
+ return faces.size();
+}
+
+
+//================================================================================
+/*!
+ * \brief Fill vector with boundary edges existing in the mesh
+ * \param edges - vector of found edges
+ * \retval int - nb of found faces
+ */
+//================================================================================
+
+int SMDS_VolumeTool::GetAllExistingEdges(vector<const SMDS_MeshElement*> & edges) const
+{
+ edges.clear();
+ edges.reserve( myVolumeNbNodes * 2 );
+ for ( int i = 0; i < myVolumeNbNodes-1; ++i ) {
+ for ( int j = i + 1; j < myVolumeNbNodes; ++j ) {
+ if ( IsLinked( i, j )) {
+ const SMDS_MeshElement* edge =
+ SMDS_Mesh::FindEdge( myVolumeNodes[i], myVolumeNodes[j] );
+ if ( edge )
+ edges.push_back( edge );
+ }
+ }
+ }
+ return edges.size();
+}
+
+//================================================================================
+/*!
+ * \brief Return minimal square distance between connected corner nodes
+ */
+//================================================================================
+
+double SMDS_VolumeTool::MinLinearSize2() const
+{
+ double minSize = 1e+100;
+ int iQ = myVolume->IsQuadratic() ? 2 : 1;
+
+ // store current face data
+ int curFace = myCurFace, nbN = myFaceNbNodes;
+ int* ind = myFaceNodeIndices;
+ myFaceNodeIndices = NULL;
+ const SMDS_MeshNode** nodes = myFaceNodes;
+ myFaceNodes = NULL;
+
+ // it seems that compute distance twice is faster than organization of a sole computing
+ myCurFace = -1;
+ for ( int iF = 0; iF < myNbFaces; ++iF )
+ {
+ setFace( iF );
+ for ( int iN = 0; iN < myFaceNbNodes; iN += iQ )
+ {
+ XYZ n1( myFaceNodes[ iN ]);
+ XYZ n2( myFaceNodes[(iN + iQ) % myFaceNbNodes]);
+ minSize = std::min( minSize, (n1 - n2).SquareMagnitude());
+ }
+ }
+ // restore current face data
+ myCurFace = curFace;
+ myFaceNbNodes = nbN;
+ myFaceNodeIndices = ind;
+ delete [] myFaceNodes; myFaceNodes = nodes;
+
+ return minSize;
+}
+
+//================================================================================
+/*!
+ * \brief Return maximal square distance between connected corner nodes
+ */
+//================================================================================
+
+double SMDS_VolumeTool::MaxLinearSize2() const
+{
+ double maxSize = -1e+100;
+ int iQ = myVolume->IsQuadratic() ? 2 : 1;
+
+ // store current face data
+ int curFace = myCurFace, nbN = myFaceNbNodes;
+ int* ind = myFaceNodeIndices;
+ myFaceNodeIndices = NULL;
+ const SMDS_MeshNode** nodes = myFaceNodes;
+ myFaceNodes = NULL;
+
+ // it seems that compute distance twice is faster than organization of a sole computing
+ myCurFace = -1;
+ for ( int iF = 0; iF < myNbFaces; ++iF )
+ {
+ setFace( iF );
+ for ( int iN = 0; iN < myFaceNbNodes; iN += iQ )
+ {
+ XYZ n1( myFaceNodes[ iN ]);
+ XYZ n2( myFaceNodes[(iN + iQ) % myFaceNbNodes]);
+ maxSize = std::max( maxSize, (n1 - n2).SquareMagnitude());
+ }
+ }
+ // restore current face data
+ myCurFace = curFace;
+ myFaceNbNodes = nbN;
+ myFaceNodeIndices = ind;
+ delete [] myFaceNodes; myFaceNodes = nodes;
+
+ return maxSize;
+}
+
+//================================================================================
+/*!
+ * \brief fast check that only one volume is build on the face nodes
+ */
+//================================================================================
+
+bool SMDS_VolumeTool::IsFreeFace( int faceIndex, const SMDS_MeshElement** otherVol/*=0*/ ) const
+{
+ const bool isFree = true;