Salome HOME
Unwarningization under Win.
[tools/medcoupling.git] / src / MEDLoader / SauvMedConvertor.cxx
index 1ce5d818c9e790ca34a4e15254bbeca2dbeda652..b29934f03621d95ce5efe899d0e0b883fbd8a1f6 100644 (file)
@@ -1083,7 +1083,7 @@ std::string XDRReader::getName() const
  */
 //================================================================================
 
-void IntermediateMED::checkDataAvailability() const throw(INTERP_KERNEL::Exception)
+void IntermediateMED::checkDataAvailability() const
 {
   if ( _spaceDim == 0 )
     THROW_IK_EXCEPTION("Wrong file format"); // it is the first record in the sauve file
@@ -1160,7 +1160,7 @@ ParaMEDMEM::MEDFileUMesh* IntermediateMED::makeMEDFileMesh()
 
   coords->decrRef();
 
-  if ( !mesh->getName() || strlen( mesh->getName() ) == 0 )
+  if ( !mesh->getName().c_str() || strlen( mesh->getName().c_str() ) == 0 )
     mesh->setName( "MESH" );
 
   return mesh;
@@ -1577,9 +1577,16 @@ void IntermediateMED::orientFaces3D()
                               if ( lfIt2 != linkFacesMap.end() )
                                 {
                                   list<const Cell*> & ff = lfIt2->second;
-                                  ff.erase( find( ff.begin(), ff.end(), badFace ));
-                                  if ( ff.empty() )
-                                    linkFacesMap.erase( lfIt2 );
+                                  list<const Cell*>::iterator lfIt3 = find( ff.begin(), ff.end(), badFace );
+                                  // check if badFace has been found,
+                                  // else we can't erase it
+                                  // case of degenerated face in edge
+                                  if (lfIt3 != ff.end())
+                                    {
+                                      ff.erase( lfIt3 );
+                                      if ( ff.empty() )
+                                        linkFacesMap.erase( lfIt2 );
+                                    }
                                 }
                             }
                           badFace->_reverse = true; // reverse
@@ -2101,8 +2108,8 @@ void IntermediateMED::setFields( SauvUtilities::DoubleField* fld,
         }
       else
         {
-          fld->setValues( valPtr, iSub++ );
-          setTS( fld, values, medFields, mesh, iSub );
+          fld->setValues( valPtr, iSub );
+          setTS( fld, values, medFields, mesh, iSub++ );
         }
     }
 }
@@ -2120,7 +2127,7 @@ void IntermediateMED::setTS( SauvUtilities::DoubleField*  fld,
                              const int                    iSub)
 {
   // analyze a field support
-  const Group* support = fld->getSupport();
+  const Group* support = fld->getSupport( iSub );
   int dimRel;
   const bool onAll = isOnAll( support, dimRel );
   if ( !onAll && support->_name.empty() )
@@ -2376,7 +2383,7 @@ int DoubleField::setValues( double * valPtr, const int iSub, const int elemShift
     THROW_IK_EXCEPTION("SauvMedConvertor.cxx: support size mismatches field size");
   // compute nb values in previous subs
   int valsShift = 0;
-  for ( int iS = iSub-1, shift = elemShift; shift > 0; )
+  for ( int iS = iSub-1, shift = elemShift; shift > 0; --iS)
   {
     int nbE = _sub[iS]._support->size();
     shift -= nbE;