Salome HOME
Labels management of splitter
[tools/medcoupling.git] / src / MEDLoader / SauvWriter.cxx
index 7d6440aa2cd5b16a9e8f171d5d2344a8f88577b8..55ed3c39328d89bef07de1a6c445a96ed545d777 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2015  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2019  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -106,7 +106,7 @@ namespace
 
   //================================================================================
   /*!
-   * \brief Converts MED long names into SAUVE short ones, returnes a healed long name
+   * \brief Converts MED long names into SAUVE short ones, returns a healed long name
    */
   //================================================================================
 
@@ -450,17 +450,21 @@ void SauvWriter::fillGroupSubMeshes()
               ++k;
             }
         }
+      if ( k == 0 )
+        continue;
       // if a family exists but has no element, no submesh has been found for this family
       // => we have to resize famSubMeshes with the number of submeshes stored
       if (k != famNames.size())
-          famSubMeshes.resize(k);
+        famSubMeshes.resize(k);
       SubMesh* grpSubMesh = addSubMesh( groupName, famSubMeshes[0]->_dimRelExt );
-      if(!_cpy_grp_if_on_single_family)
-        grpSubMesh->_subs.swap( famSubMeshes );
+      if( ! _cpy_grp_if_on_single_family )
+        {
+          grpSubMesh->_subs.swap( famSubMeshes );
+        }
       else
         {
-          /* If a group sub mesh consists of only one family, the group is written as 
-           * a copy of this family. 
+          /* If a group sub mesh consists of only one family, the group is written as
+           * a copy of this family.
            * A mesh composed of only one submesh may cause an issue with some Gibi operators.*/
           if (famSubMeshes.size() == 1)
             {
@@ -555,7 +559,7 @@ int SauvWriter::evaluateNbProfileSubMeshes() const
 
 //================================================================================
 /*!
- * \brief Transorm a profile into ids of mesh elements
+ * \brief Transform a profile into ids of mesh elements
  */
 //================================================================================
 
@@ -721,7 +725,7 @@ void SauvWriter::writeSubMeshes()
 
   writeNames( nameNbMap );
 
-  TFieldCounter fcount( *_sauvFile, 10 ); // 10 intergers per line
+  TFieldCounter fcount( *_sauvFile, 10 ); // 10 integers per line
 
   for ( size_t iSub = 0; iSub < _subs.size(); ++iSub )
     {
@@ -828,7 +832,7 @@ void SauvWriter::writeCompoundSubMesh(int iSub)
              << zeroI8
              << zeroI8 << endl;
 
-  TFieldCounter fcount( *_sauvFile, 10 ); // 10 intergers per line
+  TFieldCounter fcount( *_sauvFile, 10 ); // 10 integers per line
   for ( size_t i = 0; i < subIDs.size(); ++i, fcount++ )
     *_sauvFile << setw(8) << subIDs[i];
 }
@@ -844,7 +848,7 @@ void SauvWriter::writeNodes()
   MCAuto< MEDCouplingMesh > mesh = _fileMesh->getMeshAtLevel( 1 );
   MCAuto< MEDCouplingUMesh > umesh = mesh->buildUnstructured();
 
-  // write the index connecting nodes with their coodrinates
+  // write the index connecting nodes with their coordinates
 
   const int nbNodes = umesh->getNumberOfNodes();
   *_sauvFile << " ENREGISTREMENT DE TYPE   2" << endl
@@ -1166,7 +1170,7 @@ void SauvWriter::writeNodalFields(map<string,int>& fldNamePrefixMap)
               fcount.stop();
             }
         }
-    } // loop on fiels
+    } // loop on files
 }
 
 //================================================================================