Salome HOME
PR: correct some warnings
[modules/smesh.git] / src / DriverMED / DriverMED_W_SMESHDS_Mesh.cxx
index d44e27675bb8f39d19d0416a4d17358af9043876..e203707c539483e9cd67e0253424512a9eee03cb 100644 (file)
@@ -384,13 +384,14 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
         if ( aMeshDimension == 2 && anIsZDimension ) // 2D only if mesh is in XOY plane
           aMeshDimension = 3;
         // PAL18941(a saved study with a mesh belong Z is opened and the mesh is belong X)
-        if ( aMeshDimension == 1 && !anIsXDimension ) // 1D only if mesh is along OX
+        if ( aMeshDimension == 1 && !anIsXDimension ) {// 1D only if mesh is along OX
           if ( anIsYDimension ) {
             aMeshDimension = 2;
             anIsXDimension = true;
           } else {
             aMeshDimension = 3;
           }
+        }
       }
 
       SMDS_NodeIteratorPtr aNodesIter = myMesh->nodesIterator(/*idInceasingOrder=*/true);
@@ -430,7 +431,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
     int myFacesDefaultFamilyId   = 0;
     int myVolumesDefaultFamilyId = 0;
     int nbNodes   = myMesh->NbNodes();
-    int nb0DElements = myMesh->Nb0DElements();
+    //int nb0DElements = myMesh->Nb0DElements();
     int nbEdges   = myMesh->NbEdges();
     int nbFaces   = myMesh->NbFaces();
     int nbVolumes = myMesh->NbVolumes();
@@ -622,6 +623,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
                                              nbElemInfo.NbHexas( ORDER_QUADRATIC ),
                                              SMDSAbs_Volume));
     if ( polyTypesSupported ) {
+      //MESSAGE("polyTypesSupported");
       aTElemTypeDatas.push_back( TElemTypeData(anEntity,
                                                ePOLYEDRE,
                                                nbElemInfo.NbPolyhedrons(),
@@ -738,18 +740,21 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
       // ----------------
       else if (aElemTypeData->_geomType == ePOLYEDRE )
       {
+        //MESSAGE("_geomType == ePOLYEDRE");
         if ( nbPolyhedronNodes == 0 ) {
           // Count nb of nodes
           while ( const SMDS_MeshElement* anElem = elemIterator->next() ) {
-            const SMDS_PolyhedralVolumeOfNodes* aPolyedre =
-              dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*>( anElem );
-            if ( aPolyedre ) {
+              const SMDS_VtkVolume *aPolyedre = dynamic_cast<const SMDS_VtkVolume*>(anElem);
+              if ( aPolyedre && aPolyedre->IsPoly()) {
               nbPolyhedronNodes += aPolyedre->NbNodes();
               nbPolyhedronFaces += aPolyedre->NbFaces();
               if ( ++iElem == aElemTypeData->_nbElems )
                 break;
             }
           }
+          //MESSAGE("nbPolyhedronNodes=" << nbPolyhedronNodes);
+          //MESSAGE("nbPolyhedronFaces=" << nbPolyhedronFaces);
+          //MESSAGE("_nbElems="<< aElemTypeData->_nbElems);
         }
         else {
           // Store in med file
@@ -771,19 +776,22 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
           TInt iFace = 0, iNode = 0;
           while ( const SMDS_MeshElement* anElem = elemIterator->next() )
           {
-            const SMDS_PolyhedralVolumeOfNodes* aPolyedre =
-              dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*>( anElem );
+            const SMDS_VtkVolume *aPolyedre = dynamic_cast<const SMDS_VtkVolume*>(anElem);
             if ( !aPolyedre )
               continue;
-
+            if ( !aPolyedre->IsPoly() )
+              continue;
+            //MESSAGE("index[" << iElem << "]=" << index[iElem] << " iElem=" << iElem);
             // index
             TInt aNbFaces = aPolyedre->NbFaces();
             index[ iElem+1 ] = index[ iElem ] + aNbFaces;
+            //MESSAGE("index[" << iElem+1 << "]=" << index[iElem+1] << " iElem=" << iElem);
 
             // face index
             for (TInt f = 1; f <= aNbFaces; ++f, ++iFace ) {
               int aNbFaceNodes = aPolyedre->NbFaceNodes( f );
               faces[ iFace+1 ] = faces[ iFace ] + aNbFaceNodes;
+              //MESSAGE("faces[" << iFace+1 << "]=" << faces[iFace+1] << " iFace=" << iFace);
             }
             // connectivity
             SMDS_ElemIteratorPtr nodeIt = anElem->nodesIterator();
@@ -791,8 +799,10 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
               const SMDS_MeshElement* aNode = nodeIt->next();
 #ifdef _EDF_NODE_IDS_
               conn[ iNode ] = aNodeIdMap[aNode->GetID()];
+              //MESSAGE("conn["<< iNode << "]=" << conn[iNode] << " aNode->GetID()=" << aNode->GetID());
 #else
               conn[ iNode ] = aNode->GetID();
+              //MESSAGE("conn["<< iNode << "]=" << conn[iNode]);
 #endif
               ++iNode;
             }
@@ -868,11 +878,11 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
 
   }
   catch(const std::exception& exc) {
-    INFOS("Follow exception was cought:\n\t"<<exc.what());
+    INFOS("The following exception was caught:\n\t"<<exc.what());
     throw;
   }
   catch(...) {
-    INFOS("Unknown exception was cought !!!");
+    INFOS("Unknown exception was caught !!!");
     throw;
   }