+//================================================================================
+/*!
+ * \brief Destructor deletes temporary faces
+ */
+//================================================================================
+
+DriverSTL_W_SMDS_Mesh::~DriverSTL_W_SMDS_Mesh()
+{
+ for ( unsigned i = 0; i < myVolumeFacets.size(); ++i )
+ delete myVolumeFacets[i];
+}
+
+//================================================================================
+/*!
+ * \brief Finds free facets of volumes for which faces are missing in the mesh
+ */
+//================================================================================
+
+void DriverSTL_W_SMDS_Mesh::findVolumeTriangles()
+{
+ myNbVolumeTrias = 0;
+
+ SMDS_VolumeTool theVolume;
+ SMDS_VolumeIteratorPtr vIt = myMesh->volumesIterator();
+ std::vector< const SMDS_MeshNode*> nodes;
+ while ( vIt->more() )
+ {
+ theVolume.Set( vIt->next(), /*ignoreCentralNodes=*/false );
+ for ( int iF = 0; iF < theVolume.NbFaces(); ++iF )
+ if ( theVolume.IsFreeFace( iF ))
+ {
+ const SMDS_MeshNode** n = theVolume.GetFaceNodes(iF);
+ int nbN = theVolume.NbFaceNodes(iF);
+ nodes.assign( n, n+nbN );
+ if ( !myMesh->FindElement( nodes, SMDSAbs_Face, /*noMedium=*/false))
+ {
+ if (( nbN == 9 || nbN == 7 ) &&
+ ( !theVolume.IsPoly() )) // facet is bi-quaratic
+ {
+ int nbTria = nbN - 1;
+ for ( int iT = 0; iT < nbTria; ++iT )
+ myVolumeFacets.push_back( new SMDS_FaceOfNodes( n[8], n[0+iT], n[1+iT] ));
+ myNbVolumeTrias += nbTria;
+ }
+ else
+ {
+ myVolumeFacets.push_back( new SMDS_PolygonalFaceOfNodes( nodes ));
+ myNbVolumeTrias += nbN - 2;
+ }
+ }
+ }
+ }
+}
+
+//================================================================================
+/*!
+ * \brief Return iterator on both faces in the mesh and on temporary faces
+ */
+//================================================================================
+
+SMDS_ElemIteratorPtr DriverSTL_W_SMDS_Mesh::getFaces() const
+{
+ SMDS_ElemIteratorPtr facesIter = myMesh->elementsIterator(SMDSAbs_Face);
+ SMDS_ElemIteratorPtr tmpTriaIter( new SMDS_ElementVectorIterator( myVolumeFacets.begin(),
+ myVolumeFacets.end()));
+ typedef std::vector< SMDS_ElemIteratorPtr > TElemIterVector;
+ TElemIterVector iters(2);
+ iters[0] = facesIter;
+ iters[1] = tmpTriaIter;
+
+ typedef SMDS_IteratorOnIterators<const SMDS_MeshElement *, TElemIterVector> TItersIter;
+ return SMDS_ElemIteratorPtr( new TItersIter( iters ));
+}
+