Salome HOME
VTK wants coordinates array with exactly 3 components.
[tools/medcoupling.git] / src / MEDLoader / SauvWriter.cxx
index 13f44b92f7c405b79184e7a70a5da5e6ef80ecdc..697847bb6ac05c182b0ec5e941e455053ee61676 100644 (file)
@@ -223,6 +223,16 @@ SauvWriter* SauvWriter::New()
   return new SauvWriter;
 }
 
+std::size_t SauvWriter::getHeapMemorySizeWithoutChildren() const
+{
+  return 0;
+}
+
+std::vector<const BigMemoryObject *> SauvWriter::getDirectChildren() const
+{
+  return std::vector<const BigMemoryObject *>();
+}
+
 //================================================================================
 /*!
  * \brief Fills own DS by MEDFileData
@@ -464,7 +474,7 @@ void SauvWriter::fillProfileSubMeshes()
           vector< vector<TypeOfField> > typesF;
           vector< vector<string> > pfls, locs;
           fields[i]->getFieldSplitedByType( iters[0].first, iters[0].second,
-                                            _fileMesh->getName(), types, typesF, pfls, locs);
+                                            _fileMesh->getName().c_str(), types, typesF, pfls, locs);
           int dimRelExt;
           for ( size_t iType = 0; iType < types.size(); ++iType )
             {
@@ -512,7 +522,7 @@ int SauvWriter::evaluateNbProfileSubMeshes() const
       vector< vector<TypeOfField> > typesF;
       vector< vector<string> > pfls, locs;
       _cellFields[i]->getFieldSplitedByType( iters[0].first, iters[0].second,
-                                             _fileMesh->getName(), types, typesF, pfls, locs);
+                                             _fileMesh->getName().c_str(), types, typesF, pfls, locs);
       nb += 2 * types.size(); // x 2 - a type can be on nodes and on cells at the same time
     }
 
@@ -568,7 +578,16 @@ void SauvWriter::makeProfileIDs( SubMesh*                          sm,
       vector<const DataArrayInt *> idsPerType( 1, profile );
       MEDCouplingAutoRefCountObjectPtr<DataArrayInt>
         resIDs = uMesh->checkTypeConsistencyAndContig( code, idsPerType );
-      ids.assign( resIDs->begin(), resIDs->end() );
+      if (( const DataArrayInt *) resIDs )
+      {
+        ids.assign( resIDs->begin(), resIDs->end() );
+      }
+      else // mesh includes only one type
+      {
+        int nbE = code[1];
+        for ( ids.resize( nbE ); nbE; --nbE )
+          ids[ nbE-1 ] = nbE-1;
+      }
     }
 }
 
@@ -1062,7 +1081,7 @@ void SauvWriter::writeNodalFields(map<string,int>& fldNamePrefixMap)
           vector< vector<TypeOfField> > typesF;
           vector< vector<string> > pfls, locs;
           vector< vector< std::pair<int,int> > > valsVec;
-          valsVec=_nodeFields[iF]->getFieldSplitedByType( it.first, it.second, _fileMesh->getName(),
+          valsVec=_nodeFields[iF]->getFieldSplitedByType( it.first, it.second, _fileMesh->getName().c_str(),
                                                           types, typesF, pfls, locs);
           // believe that there can be only one type in a nodal field,
           // so do not use a loop on types
@@ -1111,7 +1130,7 @@ void SauvWriter::writeNodalFields(map<string,int>& fldNamePrefixMap)
           vector< vector<TypeOfField> > typesF;
           vector< vector<string> > pfls, locs;
           vector< vector< std::pair<int,int> > > valsVec;
-          valsVec = _nodeFields[iF]->getFieldSplitedByType( it.first, it.second, _fileMesh->getName(),
+          valsVec = _nodeFields[iF]->getFieldSplitedByType( it.first, it.second, _fileMesh->getName().c_str(),
                                                             types, typesF, pfls, locs);
           // believe that there can be only one type in a nodal field,
           // so do not perform a loop on types
@@ -1172,7 +1191,7 @@ void SauvWriter::writeElemFields(map<string,int>& fldNamePrefixMap)
           vector< vector<TypeOfField> > typesF;
           vector< vector<string> > pfls, locs;
           vector< vector< std::pair<int,int> > > valsVec;
-          valsVec = _cellFields[iF]->getFieldSplitedByType( it.first, it.second, _fileMesh->getName(),
+          valsVec = _cellFields[iF]->getFieldSplitedByType( it.first, it.second, _fileMesh->getName().c_str(),
                                                             types, typesF, pfls, locs);
           for ( size_t i = 0; i < valsVec.size(); ++i )
             nbSub += valsVec[i].size();
@@ -1199,7 +1218,7 @@ void SauvWriter::writeElemFields(map<string,int>& fldNamePrefixMap)
           vector<INTERP_KERNEL::NormalizedCellType> types;
           vector< vector<TypeOfField> > typesF;
           vector< vector<string> > pfls, locs;
-          _cellFields[iF]->getFieldSplitedByType( it.first, it.second, _fileMesh->getName(),
+          _cellFields[iF]->getFieldSplitedByType( it.first, it.second, _fileMesh->getName().c_str(),
                                                   types, typesF, pfls, locs);
           for ( size_t iType = 0; iType < pfls.size(); ++iType )
             for ( size_t iP = 0; iP < pfls[iType].size(); ++iP )
@@ -1265,7 +1284,7 @@ void SauvWriter::writeElemTimeStamp(int iF, int iter, int order)
   vector< vector<TypeOfField> > typesF;
   vector< vector<string> > pfls, locs;
   vector< vector< std::pair<int,int> > > valsVec;
-  valsVec = _cellFields[iF]->getFieldSplitedByType( iter, order, _fileMesh->getName(),
+  valsVec = _cellFields[iF]->getFieldSplitedByType( iter, order, _fileMesh->getName().c_str(),
                                                     types, typesF, pfls, locs);
   for ( size_t iType = 0; iType < pfls.size(); ++iType )
     for ( size_t iP = 0; iP < pfls[iType].size(); ++iP )