+//================================================================================
+/*!
+ * \brief Destructor deletes temporary faces
+ */
+//================================================================================
+
+DriverSTL_W_SMDS_Mesh::~DriverSTL_W_SMDS_Mesh()
+{
+ for ( unsigned i = 0; i < myVolumeTrias.size(); ++i )
+ delete myVolumeTrias[i];
+}
+
+//================================================================================
+/*!
+ * \brief Finds free facets of volumes for which faces are missing in the mesh
+ */
+//================================================================================
+
+void DriverSTL_W_SMDS_Mesh::findVolumeTriangles()
+{
+ SMDS_VolumeTool myTool;
+ SMDS_VolumeIteratorPtr vIt = myMesh->volumesIterator();
+ while ( vIt->more() )
+ {
+ myTool.Set( vIt->next() );
+ for ( int iF = 0; iF < myTool.NbFaces(); ++iF )
+ if ( myTool.IsFreeFace( iF ))
+ {
+ const SMDS_MeshNode** n = myTool.GetFaceNodes(iF);
+ int nbN = myTool.NbFaceNodes(iF);
+ std::vector< const SMDS_MeshNode*> nodes( n, n+nbN );
+ if ( !myMesh->FindElement( nodes, SMDSAbs_Face, /*Nomedium=*/false))
+ {
+ int nbTria = nbN - 2;
+ for ( int iT = 0; iT < nbTria; ++iT )
+ {
+ myVolumeTrias.push_back( new SMDS_FaceOfNodes( n[0], n[1+iT], n[2+iT] ));
+ }
+ }
+ }
+ }
+}
+
+//================================================================================
+/*!
+ * \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( myVolumeTrias.begin(),
+ myVolumeTrias.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 ));
+}