]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
Geomerty & Mesh plug-ins in the ParaVis module: small corrections. ema/2.6.3_2.6.4
authorrnv <rnv@opencascade.com>
Thu, 27 Nov 2014 12:40:27 +0000 (15:40 +0300)
committerrnv <rnv@opencascade.com>
Thu, 27 Nov 2014 12:40:27 +0000 (15:40 +0300)
src/SMESH_I/SMESH_Filter_i.hxx
src/SMESH_I/SMESH_Group_i.hxx
src/SMESH_I/SMESH_MeshEditor_i.cxx
src/SMESH_I/SMESH_Mesh_i.cxx
src/SMESH_I/SMESH_subMesh_i.hxx

index 14769b0886ad6e01b43555f30e1755ffc856da19..483f7fb874debf5118d82c90595c1d4d1b449e29 100644 (file)
@@ -952,7 +952,7 @@ namespace SMESH
     virtual SMESH::array_of_ElementType* GetTypes();
     virtual SMESH::SMESH_Mesh_ptr        GetMesh();
     virtual bool                         IsMeshInfoCorrect() { return true; }
-    virtual SALOMEDS::TMPFile* GetVtkUgStream(){ return NULL; }
+    virtual SALOMEDS::TMPFile* GetVtkUgStream(){ SALOMEDS::TMPFile_var SeqFile; return SeqFile._retn(); }
     /*!
      * \brief Object notified on change of predicate
      */
index 6c6df5e32985368b133d256d4a890e71d7208f83..e8ccfff91597cac06d76d8c350633dd361996fd8 100644 (file)
@@ -98,7 +98,7 @@ class SMESH_I_EXPORT SMESH_GroupBase_i:
   /*!
    * Returns mesh unstructed grid information.
    */
-  virtual SALOMEDS::TMPFile* GetVtkUgStream(){ return NULL; }
+  virtual SALOMEDS::TMPFile* GetVtkUgStream(){ SALOMEDS::TMPFile_var SeqFile; return SeqFile._retn(); }
 
   // Internal C++ interface
   int GetLocalID() const { return myLocalID; }
index d3ef483327dbfbf736c4ee9721c3f97fccc4650e..24ecccf56be9df9ca4daee2343a90f272267addc 100644 (file)
@@ -779,7 +779,7 @@ struct SMESH_MeshEditor_i::_IDSource : public virtual POA_SMESH::SMESH_IDSource,
     }
     return types._retn();
   }
-  SALOMEDS::TMPFile* GetVtkUgStream(){ return NULL; }
+  SALOMEDS::TMPFile* GetVtkUgStream(){ SALOMEDS::TMPFile_var SeqFile; return SeqFile._retn(); }
 };
 
 SMESH::SMESH_IDSource_ptr SMESH_MeshEditor_i::MakeIDSource(const SMESH::long_array& ids,
index e8febe2310da6ee861d634872414c0bd7b209720..b9fc6e0253ffc6aa4d242c9b7595731039f68432 100644 (file)
@@ -5058,34 +5058,28 @@ void SMESH_Mesh_i::CollectMeshInfo(const SMDS_ElemIteratorPtr theItr,
 
 SALOMEDS::TMPFile* SMESH_Mesh_i::GetVtkUgStream()
 {
-       if ( SMESHDS_Mesh* aMeshDS = _impl->GetMeshDS() )
-       {
-               vtkUnstructuredGrid* aCopy;
-               SMDS_UnstructuredGrid* aGrid = aMeshDS->getGrid();
-               if(aGrid)
-               {
-                       aCopy = aGrid->NewInstance();
-                       aCopy->ShallowCopy(aGrid);
-                       vtkUnstructuredGridWriter* aWriter = vtkUnstructuredGridWriter::New();
-                       aWriter->WriteToOutputStringOn();
-                       aWriter->SetInputData(aCopy);
-                       aWriter->SetFileTypeToBinary();
-                       aWriter->Write();
-                       char* str = aWriter->GetOutputString();
-                       int size = aWriter->GetOutputStringLength();
-
-                       //Allocate octect buffer of required size
-                       CORBA::Octet* OctetBuf = SALOMEDS::TMPFile::allocbuf(size);
-                       //Copy ostrstream content to the octect buffer
-                       memcpy(OctetBuf, str, size);
-                       //Create and return TMPFile
-                       SALOMEDS::TMPFile_var SeqFile = new SALOMEDS::TMPFile(size, size, OctetBuf, 1);
-
-                       aWriter->Delete();
-                       return SeqFile._retn();
-               }
-       }
- return NULL;
+  SALOMEDS::TMPFile_var SeqFile;
+  if ( SMESHDS_Mesh* aMeshDS = _impl->GetMeshDS() ) {
+    SMDS_UnstructuredGrid* aGrid = aMeshDS->getGrid();
+    if(aGrid) {
+      vtkUnstructuredGridWriter* aWriter = vtkUnstructuredGridWriter::New();
+      aWriter->WriteToOutputStringOn();
+      aWriter->SetInputData(aGrid);
+      aWriter->SetFileTypeToBinary();
+      aWriter->Write();
+      char* str = aWriter->GetOutputString();
+      int size = aWriter->GetOutputStringLength();
+      
+      //Allocate octect buffer of required size
+      CORBA::Octet* OctetBuf = SALOMEDS::TMPFile::allocbuf(size);
+      //Copy ostrstream content to the octect buffer
+      memcpy(OctetBuf, str, size);
+      //Create and return TMPFile
+      SeqFile = new SALOMEDS::TMPFile(size, size, OctetBuf, 1);
+      aWriter->Delete();
+    }
+  }
+  return SeqFile._retn();
 }
 
 //=============================================================================
index bd8a9846e15abf27b1202025bc3f1a6960cf1fac..1fcb7035d36c80b8cb2a7a71d7c1c78f3b72bf5e 100644 (file)
@@ -113,7 +113,7 @@ public:
   /*!
    * Returns mesh unstructed grid information.
    */
-  virtual SALOMEDS::TMPFile* GetVtkUgStream(){ return NULL; }
+  virtual SALOMEDS::TMPFile* GetVtkUgStream(){ SALOMEDS::TMPFile_var SeqFile; return SeqFile._retn(); }
 
 
 protected: