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::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
*/

View 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; }

View 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,

View 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();
}
//=============================================================================

View 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: