Salome HOME
ParaView / PARAVIS improvements 2014: 2.6.3/2.6.4: Geometry & Mesh plug-ins in the...
authorema <elena.mozokhina@opencascade.com>
Tue, 25 Nov 2014 12:56:20 +0000 (15:56 +0300)
committervsr <vsr@opencascade.com>
Tue, 27 Jan 2015 14:33:53 +0000 (17:33 +0300)
idl/SMESH_Mesh.idl
src/SMESH_I/SMESH_Filter_i.cxx
src/SMESH_I/SMESH_Filter_i.hxx
src/SMESH_I/SMESH_Group_i.cxx
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_Mesh_i.hxx
src/SMESH_I/SMESH_subMesh_i.cxx
src/SMESH_I/SMESH_subMesh_i.hxx

index 593272ab041154ef960366d3ce0ec1811e91858a..e143062f6237f23a19c6e2de91692c09a2564ed3 100644 (file)
@@ -313,6 +313,11 @@ module SMESH
      * happen if mesh data is not yet fully loaded from the file of study.
      */
     boolean IsMeshInfoCorrect();
      * happen if mesh data is not yet fully loaded from the file of study.
      */
     boolean IsMeshInfoCorrect();
+
+    /*!
+     * Returns mesh unstructed grid information.
+     */
+    SALOMEDS::TMPFile GetVtkUgStream();
   };
 
   interface SMESH_Group;
   };
 
   interface SMESH_Group;
index 3d7977cb6969fd9d92e157d5836622b427d78717..df4b3de60386d01f3941c3f709929232720d01ec 100644 (file)
@@ -2517,6 +2517,17 @@ SMESH::SMESH_Mesh_ptr Filter_i::GetMesh()
   return SMESH_Mesh::_duplicate( myMesh );
 }
 
   return SMESH_Mesh::_duplicate( myMesh );
 }
 
+//=======================================================================
+//function : GetVtkUgStream
+//purpose  : Return data vtk unstructured grid (not implemented)
+//=======================================================================
+
+SALOMEDS::TMPFile* Filter_i::GetVtkUgStream()
+{
+  SALOMEDS::TMPFile_var SeqFile;
+  return SeqFile._retn();
+}
+
 //================================================================================
 /*!
  * \brief Stores an object to be notified on change of predicate
 //================================================================================
 /*!
  * \brief Stores an object to be notified on change of predicate
index 92c4618df1bc21d77a11d057c435f77639c83331..19ca05f6e9f28fe9e5a4dc6160ec2de1d562a247 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 SMESH::array_of_ElementType* GetTypes();
     virtual SMESH::SMESH_Mesh_ptr        GetMesh();
     virtual bool                         IsMeshInfoCorrect() { return true; }
-
+    virtual SALOMEDS::TMPFile*           GetVtkUgStream();
     /*!
      * \brief Object notified on change of predicate
      */
     /*!
      * \brief Object notified on change of predicate
      */
index d55846adebfc7455bb74af7b3ca29083cb5a9b42..36ff20a15cf503c5447e98621f8234bb80da4208 100644 (file)
@@ -749,6 +749,17 @@ bool SMESH_GroupBase_i::IsMeshInfoCorrect()
   return myPreMeshInfo ? myPreMeshInfo->IsMeshInfoCorrect() : true;
 }
 
   return myPreMeshInfo ? myPreMeshInfo->IsMeshInfoCorrect() : true;
 }
 
+//=======================================================================
+//function : GetVtkUgStream
+//purpose  : Return data vtk unstructured grid (not implemented)
+//=======================================================================
+
+SALOMEDS::TMPFile* SMESH_GroupBase_i::GetVtkUgStream()
+{
+  SALOMEDS::TMPFile_var SeqFile;
+  return SeqFile._retn();
+}
+
 //================================================================================
 /*!
  * \brief Retrieves the predicate from the filter
 //================================================================================
 /*!
  * \brief Retrieves the predicate from the filter
index f08e51b2440772c3d89ebf24d132797766a2b968..5278ed889f580d82b749bcd20cedcb8b4c92c46a 100644 (file)
@@ -95,6 +95,10 @@ class SMESH_I_EXPORT SMESH_GroupBase_i:
    * happen if mesh data is not yet fully loaded from the file of study.
    */
   virtual bool IsMeshInfoCorrect();
    * happen if mesh data is not yet fully loaded from the file of study.
    */
   virtual bool IsMeshInfoCorrect();
+  /*!
+   * Returns mesh unstructed grid information.
+   */
+  virtual SALOMEDS::TMPFile* GetVtkUgStream();
 
   // Internal C++ interface
   int GetLocalID() const { return myLocalID; }
 
   // Internal C++ interface
   int GetLocalID() const { return myLocalID; }
index 7ed7cd8423845cad21531cd9e6ec0a2d93cd8b71..39a9d25d6b2de158a2fd6682eaf690686e85b0e6 100644 (file)
@@ -781,6 +781,11 @@ struct SMESH_MeshEditor_i::_IDSource : public virtual POA_SMESH::SMESH_IDSource,
     }
     return types._retn();
   }
     }
     return types._retn();
   }
+  SALOMEDS::TMPFile* GetVtkUgStream()
+  {
+    SALOMEDS::TMPFile_var SeqFile;
+    return SeqFile._retn();
+  }
 };
 
 SMESH::SMESH_IDSource_ptr SMESH_MeshEditor_i::MakeIDSource(const SMESH::long_array& ids,
 };
 
 SMESH::SMESH_IDSource_ptr SMESH_MeshEditor_i::MakeIDSource(const SMESH::long_array& ids,
index a5ed1ac3cc05f09eda82048861185dcef174f648..b9fc6e0253ffc6aa4d242c9b7595731039f68432 100644 (file)
@@ -79,6 +79,8 @@
 #include <iostream>
 #include <sstream>
 
 #include <iostream>
 #include <sstream>
 
+#include <vtkUnstructuredGridWriter.h>
+
 // to pass CORBA exception through SMESH_TRY
 #define SMY_OWN_CATCH catch( SALOME::SALOME_Exception& se ) { throw se; }
 
 // to pass CORBA exception through SMESH_TRY
 #define SMY_OWN_CATCH catch( SALOME::SALOME_Exception& se ) { throw se; }
 
@@ -5048,6 +5050,37 @@ void SMESH_Mesh_i::CollectMeshInfo(const SMDS_ElemIteratorPtr theItr,
   while (theItr->more())
     theInfo[ theItr->next()->GetEntityType() ]++;
 }
   while (theItr->more())
     theInfo[ theItr->next()->GetEntityType() ]++;
 }
+//=============================================================================
+/*
+ * Returns mesh unstructed grid information.
+ */
+//=============================================================================
+
+SALOMEDS::TMPFile* SMESH_Mesh_i::GetVtkUgStream()
+{
+  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();
+}
 
 //=============================================================================
 namespace /* Iterators used in SMESH_Mesh_i::GetElements(SMESH::SMESH_IDSource_var obj,
 
 //=============================================================================
 namespace /* Iterators used in SMESH_Mesh_i::GetElements(SMESH::SMESH_IDSource_var obj,
index e4c1b634a93defe52ba8eaf37db6d731178ff546..9c36bb40e37eea39660f56d8db8093d3b47e31e4 100644 (file)
@@ -650,6 +650,10 @@ public:
    * happen if mesh data is not yet fully loaded from the file of study.
    */
   bool IsMeshInfoCorrect();
    * happen if mesh data is not yet fully loaded from the file of study.
    */
   bool IsMeshInfoCorrect();
+   /*!
+    * Returns mesh unstructed grid information.
+    */
+   virtual SALOMEDS::TMPFile* GetVtkUgStream();
 
   std::map<int, SMESH_subMesh_i*> _mapSubMesh_i; //NRI
   std::map<int, ::SMESH_subMesh*> _mapSubMesh;   //NRI
 
   std::map<int, SMESH_subMesh_i*> _mapSubMesh_i; //NRI
   std::map<int, ::SMESH_subMesh*> _mapSubMesh;   //NRI
index ac64d86ad9ef83f867a07c05297571559956d147..5d81fec2475c802c5f92fb61d7e6cdd39e2514ee 100644 (file)
@@ -607,3 +607,14 @@ bool SMESH_subMesh_i::IsMeshInfoCorrect()
 {
   return _preMeshInfo ? _preMeshInfo->IsMeshInfoCorrect() : true;
 }
 {
   return _preMeshInfo ? _preMeshInfo->IsMeshInfoCorrect() : true;
 }
+
+//=======================================================================
+//function : GetVtkUgStream
+//purpose  : Return data vtk unstructured grid (not implemented)
+//=======================================================================
+
+SALOMEDS::TMPFile* SMESH_subMesh_i::GetVtkUgStream()
+{
+  SALOMEDS::TMPFile_var SeqFile;
+  return SeqFile._retn();
+}
index 69fdcd72ec323a6ad002ac4fa2c39036fd2ee45f..b02d09c2b47b152702d865a8e9a1a1c756187f2f 100644 (file)
@@ -110,7 +110,10 @@ public:
    * happen if mesh data is not yet fully loaded from the file of study.
    */
   virtual bool IsMeshInfoCorrect();
    * happen if mesh data is not yet fully loaded from the file of study.
    */
   virtual bool IsMeshInfoCorrect();
-
+  /*!
+   * Returns mesh unstructed grid information.
+   */
+  virtual SALOMEDS::TMPFile* GetVtkUgStream();
 
 protected:
 
 
 protected: