Geomerty & Mesh plug-ins in the ParaVis module: small corrections.

This commit is contained in:
rnv 2014-11-27 15:40:27 +03:00
parent ff2e6c820b
commit 66a355ac8f
5 changed files with 26 additions and 32 deletions

View File

@ -952,7 +952,7 @@ namespace SMESH
virtual SMESH::array_of_ElementType* GetTypes(); virtual SMESH::array_of_ElementType* GetTypes();
virtual SMESH::SMESH_Mesh_ptr GetMesh(); virtual SMESH::SMESH_Mesh_ptr GetMesh();
virtual bool IsMeshInfoCorrect() { return true; } 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 * \brief Object notified on change of predicate
*/ */

View File

@ -98,7 +98,7 @@ class SMESH_I_EXPORT SMESH_GroupBase_i:
/*! /*!
* Returns mesh unstructed grid information. * 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 // Internal C++ interface
int GetLocalID() const { return myLocalID; } int GetLocalID() const { return myLocalID; }

View File

@ -779,7 +779,7 @@ struct SMESH_MeshEditor_i::_IDSource : public virtual POA_SMESH::SMESH_IDSource,
} }
return types._retn(); 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, SMESH::SMESH_IDSource_ptr SMESH_MeshEditor_i::MakeIDSource(const SMESH::long_array& ids,

View File

@ -5058,34 +5058,28 @@ void SMESH_Mesh_i::CollectMeshInfo(const SMDS_ElemIteratorPtr theItr,
SALOMEDS::TMPFile* SMESH_Mesh_i::GetVtkUgStream() SALOMEDS::TMPFile* SMESH_Mesh_i::GetVtkUgStream()
{ {
if ( SMESHDS_Mesh* aMeshDS = _impl->GetMeshDS() ) SALOMEDS::TMPFile_var SeqFile;
{ if ( SMESHDS_Mesh* aMeshDS = _impl->GetMeshDS() ) {
vtkUnstructuredGrid* aCopy; SMDS_UnstructuredGrid* aGrid = aMeshDS->getGrid();
SMDS_UnstructuredGrid* aGrid = aMeshDS->getGrid(); if(aGrid) {
if(aGrid) vtkUnstructuredGridWriter* aWriter = vtkUnstructuredGridWriter::New();
{ aWriter->WriteToOutputStringOn();
aCopy = aGrid->NewInstance(); aWriter->SetInputData(aGrid);
aCopy->ShallowCopy(aGrid); aWriter->SetFileTypeToBinary();
vtkUnstructuredGridWriter* aWriter = vtkUnstructuredGridWriter::New(); aWriter->Write();
aWriter->WriteToOutputStringOn(); char* str = aWriter->GetOutputString();
aWriter->SetInputData(aCopy); int size = aWriter->GetOutputStringLength();
aWriter->SetFileTypeToBinary();
aWriter->Write(); //Allocate octect buffer of required size
char* str = aWriter->GetOutputString(); CORBA::Octet* OctetBuf = SALOMEDS::TMPFile::allocbuf(size);
int size = aWriter->GetOutputStringLength(); //Copy ostrstream content to the octect buffer
memcpy(OctetBuf, str, size);
//Allocate octect buffer of required size //Create and return TMPFile
CORBA::Octet* OctetBuf = SALOMEDS::TMPFile::allocbuf(size); SeqFile = new SALOMEDS::TMPFile(size, size, OctetBuf, 1);
//Copy ostrstream content to the octect buffer aWriter->Delete();
memcpy(OctetBuf, str, size); }
//Create and return TMPFile }
SALOMEDS::TMPFile_var SeqFile = new SALOMEDS::TMPFile(size, size, OctetBuf, 1); return SeqFile._retn();
aWriter->Delete();
return SeqFile._retn();
}
}
return NULL;
} }
//============================================================================= //=============================================================================

View File

@ -113,7 +113,7 @@ public:
/*! /*!
* Returns mesh unstructed grid information. * Returns mesh unstructed grid information.
*/ */
virtual SALOMEDS::TMPFile* GetVtkUgStream(){ return NULL; } virtual SALOMEDS::TMPFile* GetVtkUgStream(){ SALOMEDS::TMPFile_var SeqFile; return SeqFile._retn(); }
protected: protected: