From cfdcc32f72195b0ed578d5ba031c0a7e53d7a81b Mon Sep 17 00:00:00 2001 From: apo Date: Fri, 2 Sep 2005 05:20:27 +0000 Subject: [PATCH] To unify ID's mapping --- src/CONVERTOR/Makefile.in | 4 +- src/CONVERTOR/VISUConvertor.cxx | 44 ++++--- src/CONVERTOR/VISU_Convertor.hxx | 139 +++------------------- src/CONVERTOR/VISU_Convertor_impl.cxx | 136 +++++++--------------- src/CONVERTOR/VISU_Convertor_impl.hxx | 158 ++++++++++++++------------ src/CONVERTOR/VISU_IDMapper.hxx | 86 ++++++++++++++ src/CONVERTOR/VISU_MedConvertor.cxx | 5 +- src/OBJECT/VISU_Actor.cxx | 55 ++++++--- src/OBJECT/VISU_Actor.h | 15 ++- src/PIPELINE/VISUPipeLine.cxx | 16 ++- src/PIPELINE/VISU_PipeLine.cxx | 49 ++++---- src/PIPELINE/VISU_PipeLine.hxx | 41 ++++--- src/VISU_I/VISU_CutLines_i.cc | 11 ++ src/VISU_I/VISU_CutLines_i.hh | 4 + src/VISU_I/VISU_CutPlanes_i.cc | 12 ++ src/VISU_I/VISU_CutPlanes_i.hh | 4 + src/VISU_I/VISU_DeformedShape_i.cc | 5 +- src/VISU_I/VISU_DeformedShape_i.hh | 4 +- src/VISU_I/VISU_GaussPoints_i.cc | 4 +- src/VISU_I/VISU_GaussPoints_i.hh | 5 +- src/VISU_I/VISU_IsoSurfaces_i.cc | 11 ++ src/VISU_I/VISU_IsoSurfaces_i.hh | 4 + src/VISU_I/VISU_Mesh_i.cc | 38 +++---- src/VISU_I/VISU_Plot3D_i.cc | 11 ++ src/VISU_I/VISU_Plot3D_i.hh | 4 + src/VISU_I/VISU_Result_i.cc | 17 +-- src/VISU_I/VISU_ScalarMap_i.cc | 19 ++-- src/VISU_I/VISU_ScalarMap_i.hh | 4 +- src/VISU_I/VISU_StreamLines_i.cc | 19 +++- src/VISU_I/VISU_StreamLines_i.hh | 4 +- src/VISU_I/VISU_Vectors_i.cc | 1 + src/VISU_I/VISU_Vectors_i.hh | 4 +- 32 files changed, 499 insertions(+), 434 deletions(-) create mode 100644 src/CONVERTOR/VISU_IDMapper.hxx diff --git a/src/CONVERTOR/Makefile.in b/src/CONVERTOR/Makefile.in index 1e204619..c58487cb 100644 --- a/src/CONVERTOR/Makefile.in +++ b/src/CONVERTOR/Makefile.in @@ -32,7 +32,9 @@ VPATH=.:@srcdir@ @COMMENCE@ -EXPORT_HEADERS = VISU_Convertor.hxx \ +EXPORT_HEADERS = \ + VISU_IDMapper.hxx \ + VISU_Convertor.hxx \ VISU_Convertor_impl.hxx \ VISU_ConvertorUtils.hxx \ VISU_ExtractUnstructuredGrid.hxx diff --git a/src/CONVERTOR/VISUConvertor.cxx b/src/CONVERTOR/VISUConvertor.cxx index e17c9149..a45cbf73 100644 --- a/src/CONVERTOR/VISUConvertor.cxx +++ b/src/CONVERTOR/VISUConvertor.cxx @@ -69,6 +69,16 @@ void parseFile(const char* theFileName) const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap; VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter; + //Importing groups + const VISU::TGroupMap& aGroupMap = aMesh->myGroupMap; + VISU::TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin(); + for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){ + const string& aGroupName = aGroupMapIter->first; + aCon->GetMeshOnGroup(aMeshName,aGroupName); + } + + continue; + //Import fields aMeshOnEntityMapIter = aMeshOnEntityMap.begin(); for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){ @@ -84,23 +94,23 @@ void parseFile(const char* theFileName) for(; aValFieldIter != aValField.end(); aValFieldIter++){ int aTimeStamp = aValFieldIter->first; - VISU_Convertor::TOutput* aDataSet = + VISU::PIDMapper anIDMapper = aCon->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp); + VISU::TVTKOutput* aDataSet = anIDMapper->GetVTKOutput(); - VISU::PIDMapper aPIDMapper = - aCon->GetTimeStampOnMeshIDMapper(aMeshName,anEntity,aFieldName,aTimeStamp); int aNbCells = aDataSet->GetNumberOfCells(); for(int anCellId = 0; anCellId < aNbCells; anCellId++){ - int anObjID = aPIDMapper->GetElemObjID(anCellId); - int aVTKID = aPIDMapper->GetElemVTKID(anObjID); + int anObjID = anIDMapper->GetElemObjID(anCellId); + int aVTKID = anIDMapper->GetElemVTKID(anObjID); cout<GetTimeStampOnGaussPts(aMeshName,anEntity,aFieldName,aTimeStamp); - else + else{ aCon->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp); + } } } } @@ -110,24 +120,19 @@ void parseFile(const char* theFileName) aMeshOnEntityMapIter = aMeshOnEntityMap.begin(); for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){ const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first; - VISU_Convertor::TOutput* aDataSet = aCon->GetMeshOnEntity(aMeshName,anEntity); - //pkv f + VISU::PIDMapper anIDMapper = aCon->GetMeshOnEntity(aMeshName,anEntity); + VISU::TVTKOutput* aDataSet = anIDMapper->GetVTKOutput(); { int aNbCells, anCellId, anObjID, aVTKID; - // - VISU::PIDMapper aPIDMapper=aCon->GetMeshOnEntityIDMapper(aMeshName,anEntity); aNbCells = aDataSet->GetNumberOfCells(); for(anCellId = 0; anCellId < aNbCells; anCellId++){ - anObjID = aPIDMapper->GetElemObjID(anCellId); - aVTKID = aPIDMapper->GetElemVTKID(anObjID); + anObjID = anIDMapper->GetElemObjID(anCellId); + aVTKID = anIDMapper->GetElemVTKID(anObjID); cout<GetFamilyOnEntity(aMeshName,anEntity,aFamilyName); } } - - //Importing groups - const VISU::TGroupMap& aGroupMap = aMesh->myGroupMap; - VISU::TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin(); - for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){ - const string& aGroupName = aGroupMapIter->first; - aCon->GetMeshOnGroup(aMeshName,aGroupName); - } - } OK: MSG(MYDEBUG,"OK"); diff --git a/src/CONVERTOR/VISU_Convertor.hxx b/src/CONVERTOR/VISU_Convertor.hxx index 91002c1e..0240fb08 100644 --- a/src/CONVERTOR/VISU_Convertor.hxx +++ b/src/CONVERTOR/VISU_Convertor.hxx @@ -36,17 +36,11 @@ #include #include -#include "MED_SharedPtr.hxx" #include "MED_Vector.hxx" - -#include - -class vtkUnstructuredGrid; -class vtkCell; +#include "VISU_IDMapper.hxx" namespace VISU { - using MED::SharedPtr; using MED::TVector; //--------------------------------------------------------------- @@ -67,10 +61,7 @@ namespace VISU struct TProfile; typedef SharedPtr PProfile; - //pkv f - struct TIDMapper; - typedef SharedPtr PIDMapper; - // pkv t + struct TMeshOnEntity; typedef SharedPtr PMeshOnEntity; @@ -94,18 +85,10 @@ namespace VISU typedef TVector TNames; - //--------------------------------------------------------------- - struct TBaseStructure - { - virtual ~TBaseStructure() - {} - }; - - //--------------------------------------------------------------- struct TIntId: virtual TBaseStructure { - int myId; + vtkIdType myId; TIntId(): myId(0) {} @@ -135,69 +118,10 @@ namespace VISU struct TSubProfile: virtual TBaseStructure {}; - //pkv f - //--------------------------------------------------------------- - // TIDMapper - // - struct TIDMapper: virtual TBaseStructure - { - virtual - vtkIdType - GetNodeObjID(vtkIdType theID) const = 0; - - virtual - vtkIdType - GetNodeVTKID(vtkIdType theID) const = 0; - - virtual - float* - GetNodeCoord(vtkIdType theObjID) = 0; - - virtual - vtkIdType - GetElemObjID(vtkIdType theID) const = 0; - virtual - vtkIdType - GetElemVTKID(vtkIdType theID) const = 0; - - virtual - vtkCell* - GetElemCell(vtkIdType theObjID) = 0; - }; - //pkv t - //--------------------------------------------------------------- - struct TProfile: virtual TBaseStructure, virtual TIDMapper - { - //pkv f - /* - virtual - vtkIdType - GetNodeObjID(vtkIdType theID) const = 0; - - virtual - vtkIdType - GetNodeVTKID(vtkIdType theID) const = 0; - - virtual - float* - GetNodeCoord(vtkIdType theObjID) = 0; - - virtual - vtkIdType - GetElemObjID(vtkIdType theID) const = 0; - - virtual - vtkIdType - GetElemVTKID(vtkIdType theID) const = 0; - - virtual - vtkCell* - GetElemCell(vtkIdType theObjID) = 0; - */ - //pkv t - }; + struct TProfile: virtual TIDMapper + {}; //--------------------------------------------------------------- @@ -246,8 +170,7 @@ namespace VISU typedef std::map TFamilyMap; typedef std::map TFieldMap; - struct TMeshOnEntity: virtual TBaseStructure, - virtual TIDMapper //pkv ft + struct TMeshOnEntity: virtual TIDMapper { TGaussMeshMap myGaussMeshMap; TProfileMap myProfileMap; @@ -262,7 +185,7 @@ namespace VISU //--------------------------------------------------------------- struct TFamily: virtual TIntId, - virtual TIDMapper //pkv ft + virtual TIDMapper { TEntity myEntity; TName myName; @@ -272,8 +195,7 @@ namespace VISU //--------------------------------------------------------------- typedef std::set TFamilySet; - struct TGroup: virtual TBaseStructure, - virtual TIDMapper //pkv ft + struct TGroup: virtual TIDMapper { TFamilySet myFamilySet; }; @@ -349,7 +271,7 @@ public: int IsDone() const { return myIsDone; } - typedef vtkUnstructuredGrid TOutput; + typedef VISU::TVTKOutput TOutput; virtual VISU_Convertor* @@ -364,27 +286,27 @@ public: GetSize() = 0; virtual - TOutput* + VISU::PIDMapper GetMeshOnEntity(const std::string& theMeshName, const VISU::TEntity& theEntity) = 0; - virtual - TOutput* - GetFamilyOnEntity(const std::string& theMeshName, - const VISU::TEntity& theEntity, - const std::string& theFamilyName) = 0; virtual float GetMeshOnEntitySize(const std::string& theMeshName, const VISU::TEntity& theEntity) = 0; virtual + VISU::PIDMapper + GetFamilyOnEntity(const std::string& theMeshName, + const VISU::TEntity& theEntity, + const std::string& theFamilyName) = 0; + virtual float GetFamilyOnEntitySize(const std::string& theMeshName, const VISU::TEntity& theEntity, const std::string& theFamilyName) = 0; virtual - TOutput* + VISU::PIDMapper GetMeshOnGroup(const std::string& theMeshName, const std::string& theGroupName) = 0; @@ -394,39 +316,12 @@ public: const std::string& theGroupName) = 0; virtual - TOutput* + VISU::PIDMapper GetTimeStampOnMesh(const std::string& theMeshName, const VISU::TEntity& theEntity, const std::string& theFieldName, int theStampsNum) = 0; - virtual - //pkv f - //VISU::PProfile - VISU::PIDMapper - //pkv t - GetTimeStampOnMeshIDMapper(const std::string& theMeshName, - const VISU::TEntity& theEntity, - const std::string& theFieldName, - int theStampsNum) = 0; - //pkv f - virtual - VISU::PIDMapper - GetFamilyOnEntityIDMapper(const std::string& theMeshName, - const VISU::TEntity& theEntity, - const std::string& theFamilyName) = 0; - - virtual - VISU::PIDMapper - GetMeshOnEntityIDMapper(const std::string& theMeshName, - const VISU::TEntity& theEntity) = 0; - - virtual - VISU::PIDMapper - GetMeshOnGroupIDMapper(const std::string& theMeshName, - const std::string& theGroupName)=0; - //pkv t - virtual TOutput* GetTimeStampOnGaussPts(const std::string& theMeshName, diff --git a/src/CONVERTOR/VISU_Convertor_impl.cxx b/src/CONVERTOR/VISU_Convertor_impl.cxx index 2a689908..abd08dc0 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.cxx +++ b/src/CONVERTOR/VISU_Convertor_impl.cxx @@ -58,14 +58,13 @@ static int MYVTKDEBUG = 0; #ifdef _DEBUG_ static int MYDEBUG = 1; -static int MYDEBUGWITHFILES = 1; +static int MYDEBUGWITHFILES = 0; +//#define _DEXCEPT_ #else static int MYDEBUG = 0; static int MYDEBUGWITHFILES = 0; #endif -//#define _DEXCEPT_ - namespace VISU { //--------------------------------------------------------------- @@ -97,6 +96,13 @@ namespace VISU return mySource; } + TVTKOutput* + TSource + ::GetVTKOutput() + { + return GetSource().GetPointer(); + } + //--------------------------------------------------------------- TAppendFilter::TAppendFilter() @@ -114,9 +120,9 @@ namespace VISU return myFilter; } - TDataSet* + TVTKOutput* TAppendFilter - ::GetDataSet() const + ::GetVTKOutput() { return GetFilter()->GetOutput(); } @@ -499,7 +505,7 @@ namespace VISU { vtkIdType aNbCells = 0, aCellsSize = 0; TFamilySet::const_iterator anIter = myFamilySet.begin(); - for(; anIter == myFamilySet.end(); anIter++){ + for(; anIter != myFamilySet.end(); anIter++){ PFamilyImpl aFamily = *anIter; aNbCells += aFamily->myNbCells; aCellsSize += aFamily->myCellsSize; @@ -1201,7 +1207,7 @@ namespace anAppendFilter->SetPoints(GetPoints(theMesh)); if(theProfile->myIsAll){ - TDataSet* aDataSet = theMeshOnEntity->GetDataSet(); + TVTKOutput* aDataSet = theMeshOnEntity->GetVTKOutput(); anAppendFilter->AddInput(aDataSet); theProfile->myMeshOnEntity = theMeshOnEntity.get(); }else{ @@ -1503,7 +1509,7 @@ VISU_Convertor_impl //--------------------------------------------------------------- -VISU_Convertor::TOutput* +VISU::PIDMapper VISU_Convertor_impl ::GetMeshOnEntity(const string& theMeshName, const VISU::TEntity& theEntity) @@ -1521,11 +1527,11 @@ VISU_Convertor_impl PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindMeshOnEntity); //Main part of code - const TVTKAppendFilter& anAppendFilter = aMeshOnEntity->GetFilter(); #ifndef _DEXCEPT_ try{ #endif if(!aMeshOnEntity->myIsVTKDone){ + const TVTKAppendFilter& anAppendFilter = aMeshOnEntity->GetFilter(); if(MYVTKDEBUG) anAppendFilter->DebugOn(); LoadMeshOnEntity(aMesh,aMeshOnEntity); @@ -1562,11 +1568,11 @@ VISU_Convertor_impl aFileName += aMeshName + dtos("-%d-",int(theEntity)) + "-Conv.vtk"; VISU::WriteToFile(anAppendFilter->GetOutput(),aFileName); } - } - if(MYVTKDEBUG){ - GetMeshOnEntitySize(theMeshName,theEntity); - PrintMemorySize(anAppendFilter->GetOutput()); + if(MYVTKDEBUG){ + GetMeshOnEntitySize(theMeshName,theEntity); + PrintMemorySize(anAppendFilter->GetOutput()); + } } #ifndef _DEXCEPT_ @@ -1575,12 +1581,12 @@ VISU_Convertor_impl } #endif - return anAppendFilter->GetOutput(); + return aMeshOnEntity; } //--------------------------------------------------------------- -VISU_Convertor::TOutput* +VISU::PIDMapper VISU_Convertor_impl ::GetFamilyOnEntity(const std::string& theMeshName, const VISU::TEntity& theEntity, @@ -1601,11 +1607,11 @@ VISU_Convertor_impl PFamilyImpl aFamily = boost::get<2>(aFindFamilyOnEntity); //Main part of code - const TVTKSource& aSource = aFamily->GetSource(); #ifndef _DEXCEPT_ try{ #endif if(!aFamily->myIsVTKDone){ + const TVTKSource& aSource = aFamily->GetSource(); if(MYVTKDEBUG) aSource->DebugOn(); GetMeshOnEntity(theMeshName,theEntity); @@ -1625,11 +1631,11 @@ VISU_Convertor_impl aFileName += aMeshName + dtos("-%d-",int(theEntity)) + aFamilyName + "-Conv.vtk"; VISU::WriteToFile(aSource.GetPointer(),aFileName); } - } - if(MYVTKDEBUG){ - GetFamilyOnEntitySize(theMeshName,theEntity,theFamilyName); - PrintMemorySize(aSource.GetPointer()); + if(MYVTKDEBUG){ + GetFamilyOnEntitySize(theMeshName,theEntity,theFamilyName); + PrintMemorySize(aSource.GetPointer()); + } } #ifndef _DEXCEPT_ @@ -1638,12 +1644,12 @@ VISU_Convertor_impl } #endif - return aSource.GetPointer(); + return aFamily; } //--------------------------------------------------------------- -VISU_Convertor::TOutput* +VISU::PIDMapper VISU_Convertor_impl ::GetMeshOnGroup(const string& theMeshName, const string& theGroupName) @@ -1660,12 +1666,13 @@ VISU_Convertor_impl PGroupImpl aGroup = boost::get<1>(aFindMeshOnGroup); //Main part of code - const TVTKAppendFilter& anAppendFilter = aGroup->GetFilter(); #ifndef _DEXCEPT_ try{ #endif if(!aGroup->myIsVTKDone){ + const TVTKAppendFilter& anAppendFilter = aGroup->GetFilter(); const VISU::TFamilySet& aFamilySet = aGroup->myFamilySet; + LoadMeshOnGroup(aMesh,aFamilySet); anAppendFilter->SetPoints(GetPoints(aMesh)); @@ -1679,7 +1686,9 @@ VISU_Convertor_impl PFamilyImpl aFamily = *anIter; const std::string& aFamilyName = aFamily->myName; const VISU::TEntity& anEntity = aFamily->myEntity; - TOutput* anOutput = GetFamilyOnEntity(theMeshName,anEntity,aFamilyName); + + VISU::PIDMapper anIDMapper = GetFamilyOnEntity(theMeshName,anEntity,aFamilyName); + VISU::TVTKOutput* anOutput = anIDMapper->GetVTKOutput(); anAppendFilter->AddInput(anOutput); vtkIdType aNbCells = anOutput->GetNumberOfCells(); @@ -1706,12 +1715,12 @@ VISU_Convertor_impl } #endif - return anAppendFilter->GetOutput(); + return aGroup; } //--------------------------------------------------------------- -VISU_Convertor::TOutput* +VISU::PIDMapper VISU_Convertor_impl ::GetTimeStampOnMesh(const string& theMeshName, const VISU::TEntity& theEntity, @@ -1738,12 +1747,12 @@ VISU_Convertor_impl PFieldImpl aField = boost::get<3>(aFindTimeStamp); //Main part of code - TSource& aMeshSource = aValForTime->myMeshSource; - const TVTKSource& aSource = aMeshSource.GetSource(); + PProfileImpl aProfile = aValForTime->myProfile; + TSource& aProfileSource = aProfile->mySource; #ifndef _DEXCEPT_ try{ #endif - if(!aMeshSource.myIsVTKDone){ + if(!aProfileSource.myIsVTKDone){ LoadValForTimeOnMesh(aMesh,aMeshOnEntity,aField,aValForTime); try{ @@ -1756,16 +1765,15 @@ VISU_Convertor_impl MSG(MYDEBUG,"Unknown exception was occured!"); } - GetMeshOnEntity(aVTKMeshOnEntity->myMeshName,aVTKMeshOnEntity->myEntity); - - PProfileImpl aProfile = aValForTime->myProfile; + GetMeshOnEntity(aVTKMeshOnEntity->myMeshName,aVTKMeshOnEntity->myEntity); GetMeshOnProfile(aMesh,aVTKMeshOnEntity,aProfile); const TVTKAppendFilter& anAppendFilter = aProfile->GetFilter(); + const TVTKSource& aSource = aProfile->mySource.GetSource(); aSource->ShallowCopy(anAppendFilter->GetOutput()); GetTimeStampOnProfile(aSource,aField,aValForTime); - aMeshSource.myIsVTKDone = true; + aProfileSource.myIsVTKDone = true; if(MYDEBUGWITHFILES){ string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1(); @@ -1793,70 +1801,10 @@ VISU_Convertor_impl } #endif - return aSource.GetPointer(); + return aValForTime->myProfile; } -//--------------------------------------------------------------- -//pkv f -//VISU::PProfile -VISU::PIDMapper -//pkv t -VISU_Convertor_impl::GetTimeStampOnMeshIDMapper(const std::string& theMeshName, - const VISU::TEntity& theEntity, - const std::string& theFieldName, - int theStampsNum) -{ - GetTimeStampOnMesh(theMeshName, theEntity, theFieldName, theStampsNum); - TFindTimeStamp aFindTimeStamp = FindTimeStamp(theMeshName, - theEntity, - theFieldName, - theStampsNum); - PValForTimeImpl aValForTime = boost::get<4>(aFindTimeStamp); - PProfileImpl aProfile = aValForTime->myProfile; - return aProfile; -} -//modified by NIZNHY-PKV Thu Sep 1 15:38:49 2005f -//--------------------------------------------------------------- -VISU::PIDMapper -VISU_Convertor_impl:: -GetMeshOnGroupIDMapper(const std::string& theMeshName, - const std::string& theGroupName) -{ - TFindMeshOnGroup aFindMeshOnGroup = FindMeshOnGroup(theMeshName,theGroupName); - PMeshImpl aMesh = boost::get<0>(aFindMeshOnGroup); - PGroupImpl aGroup = boost::get<1>(aFindMeshOnGroup); - return aGroup; -} -//--------------------------------------------------------------- -VISU::PIDMapper -VISU_Convertor_impl:: -GetMeshOnEntityIDMapper(const string& theMeshName, - const VISU::TEntity& theEntity) -{ - TFindMeshOnEntity aFindMeshOnEntity = - FindMeshOnEntity(theMeshName,theEntity); - - PMeshImpl aMesh = boost::get<0>(aFindMeshOnEntity);; - PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindMeshOnEntity); - return aMeshOnEntity; -} -//--------------------------------------------------------------- -VISU::PIDMapper -VISU_Convertor_impl:: -GetFamilyOnEntityIDMapper(const std::string& theMeshName, - const VISU::TEntity& theEntity, - const std::string& theFamilyName) -{ - TFindFamilyOnEntity aFindFamilyOnEntity = - FindFamilyOnEntity(theMeshName,theEntity,theFamilyName); - - PMeshImpl aMesh = boost::get<0>(aFindFamilyOnEntity);; - PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindFamilyOnEntity); - PFamilyImpl aFamily = boost::get<2>(aFindFamilyOnEntity); - return aFamily; -} -//modified by NIZNHY-PKV Thu Sep 1 15:38:54 2005t //--------------------------------------------------------------- VISU_Convertor::TOutput* VISU_Convertor_impl diff --git a/src/CONVERTOR/VISU_Convertor_impl.hxx b/src/CONVERTOR/VISU_Convertor_impl.hxx index 237b18df..44ff2769 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.hxx +++ b/src/CONVERTOR/VISU_Convertor_impl.hxx @@ -61,11 +61,14 @@ namespace VISU const TVTKSource& GetSource() const; + + TVTKOutput* + GetVTKOutput(); }; //--------------------------------------------------------------- - struct TAppendFilter: public virtual TIsVTKDone + class TAppendFilter: public virtual TIsVTKDone { mutable TVTKAppendFilter myFilter; public: @@ -74,8 +77,9 @@ namespace VISU const TVTKAppendFilter& GetFilter() const; - TDataSet* - GetDataSet() const; + virtual + TVTKOutput* + GetVTKOutput(); }; @@ -225,11 +229,19 @@ namespace VISU vtkCell* GetElemCell(vtkIdType theObjID); + virtual + TVTKOutput* + GetVTKOutput() + { + return mySource.GetVTKOutput(); + } + TID2ID myElemObj2VTKID; TSubProfileArr mySubProfileArr; PNamedPointCoords myNamedPointCoords; TMeshOnEntityImpl* myMeshOnEntity; + TSource mySource; TGeom2SubProfile myGeom2SubProfile; }; typedef SharedPtr PProfileImpl; @@ -324,6 +336,13 @@ namespace VISU vtkIdType GetElemObjID(vtkIdType theID) const; + virtual + TVTKOutput* + GetVTKOutput() + { + return TAppendFilter::GetVTKOutput(); + } + TID2ID myElemObj2VTKID; TSubMeshArr mySubMeshArr; PNamedPointCoords myNamedPointCoords; @@ -361,6 +380,13 @@ namespace VISU vtkIdType GetElemObjID(vtkIdType theID) const; + virtual + TVTKOutput* + GetVTKOutput() + { + return TSource::GetVTKOutput(); + } + PNamedPointCoords myNamedPointCoords; TID2ID myElemObj2VTKID; TSubMeshID myMeshID; @@ -403,6 +429,13 @@ namespace VISU float* GetNodeCoord(vtkIdType theObjID); + virtual + TVTKOutput* + GetVTKOutput() + { + return TAppendFilter::GetVTKOutput(); + } + TID2ID myElemObj2VTKID; TFamilyArr myFamilyArr; PNamedPointCoords myNamedPointCoords; @@ -491,26 +524,61 @@ namespace VISU class VISU_Convertor_impl: public VISU_Convertor { public: + VISU_Convertor_impl(); + + virtual + ~VISU_Convertor_impl(); + + virtual + VISU_Convertor* + Build() + { + return this; + } + virtual float GetSize(); + virtual + VISU::PIDMapper + GetMeshOnEntity(const std::string& theMeshName, + const VISU::TEntity& theEntity); + virtual float GetMeshOnEntitySize(const std::string& theMeshName, const VISU::TEntity& theEntity); + virtual + VISU::PIDMapper + GetFamilyOnEntity(const std::string& theMeshName, + const VISU::TEntity& theEntity, + const std::string& theFamilyName); + virtual float GetFamilyOnEntitySize(const std::string& theMeshName, const VISU::TEntity& theEntity, const std::string& theFamilyName); + virtual + VISU::PIDMapper + GetMeshOnGroup(const std::string& theMeshName, + const std::string& theGroupName); + virtual float GetMeshOnGroupSize(const std::string& theMeshName, const std::string& theGroupName); + virtual + VISU::PIDMapper + GetTimeStampOnMesh(const std::string& theMeshName, + const VISU::TEntity& theEntity, + const std::string& theFieldName, + int theStampsNum); + virtual float GetTimeStampSize(const std::string& theMeshName, @@ -518,6 +586,20 @@ public: const std::string& theFieldName, int theStampsNum); + virtual + TOutput* + GetTimeStampOnGaussPts(const std::string& theMeshName, + const VISU::TEntity& theEntity, + const std::string& theFieldName, + int theStampsNum); + + virtual + VISU::PGaussMesh + GetGaussMesh(const std::string& theMeshName, + const VISU::TEntity& theEntity, + const std::string& theFieldName, + int theStampsNum); + virtual float GetFieldOnMeshSize(const std::string& theMeshName, @@ -537,76 +619,6 @@ public: const std::string& theFieldName, int theStampsNum); -public: - VISU_Convertor_impl(); - - virtual - ~VISU_Convertor_impl(); - - virtual - VISU_Convertor* Build() { return this;}; - - virtual - TOutput* - GetMeshOnEntity(const std::string& theMeshName, - const VISU::TEntity& theEntity); - - virtual - TOutput* - GetFamilyOnEntity(const std::string& theMeshName, - const VISU::TEntity& theEntity, - const std::string& theFamilyName); - - virtual - TOutput* - GetMeshOnGroup(const std::string& theMeshName, - const std::string& theGroupName); - - virtual - TOutput* - GetTimeStampOnMesh(const std::string& theMeshName, - const VISU::TEntity& theEntity, - const std::string& theFieldName, - int theStampsNum); - virtual - //pkv f - //VISU::PProfile - VISU::PIDMapper - //pkv t - GetTimeStampOnMeshIDMapper(const std::string& theMeshName, - const VISU::TEntity& theEntity, - const std::string& theFieldName, - int theStampsNum); - //pkv f - virtual - VISU::PIDMapper - GetFamilyOnEntityIDMapper(const std::string& theMeshName, - const VISU::TEntity& theEntity, - const std::string& theFamilyName); - virtual - VISU::PIDMapper - GetMeshOnEntityIDMapper(const std::string& theMeshName, - const VISU::TEntity& theEntity); - virtual - VISU::PIDMapper - GetMeshOnGroupIDMapper(const std::string& theMeshName, - const std::string& theGroupName); - //pkv t - - virtual - TOutput* - GetTimeStampOnGaussPts(const std::string& theMeshName, - const VISU::TEntity& theEntity, - const std::string& theFieldName, - int theStampsNum); - - virtual - VISU::PGaussMesh - GetGaussMesh(const std::string& theMeshName, - const VISU::TEntity& theEntity, - const std::string& theFieldName, - int theStampsNum); - protected: VISU::PMeshImpl FindMesh(const std::string& theMeshName); diff --git a/src/CONVERTOR/VISU_IDMapper.hxx b/src/CONVERTOR/VISU_IDMapper.hxx new file mode 100644 index 00000000..6bc0e1b1 --- /dev/null +++ b/src/CONVERTOR/VISU_IDMapper.hxx @@ -0,0 +1,86 @@ +// VISU CONVERTOR : +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// File : VISU_Convertor.hxx +// Author : Alexey PETROV +// Module : VISU + +#ifndef VISU_IDMapper_HeaderFile +#define VISU_IDMapper_HeaderFile + +#include "MED_SharedPtr.hxx" + +#include + +class vtkUnstructuredGrid; +class vtkCell; + +namespace VISU +{ + using MED::SharedPtr; + + //--------------------------------------------------------------- + struct TBaseStructure + { + virtual ~TBaseStructure() + {} + }; + typedef SharedPtr PBaseStructure; + + //--------------------------------------------------------------- + typedef vtkUnstructuredGrid TVTKOutput; + + struct TIDMapper: virtual TBaseStructure + { + virtual + vtkIdType + GetNodeObjID(vtkIdType theID) const = 0; + + virtual + vtkIdType + GetNodeVTKID(vtkIdType theID) const = 0; + + virtual + float* + GetNodeCoord(vtkIdType theObjID) = 0; + + virtual + vtkIdType + GetElemObjID(vtkIdType theID) const = 0; + + virtual + vtkIdType + GetElemVTKID(vtkIdType theID) const = 0; + + virtual + vtkCell* + GetElemCell(vtkIdType theObjID) = 0; + + virtual + TVTKOutput* + GetVTKOutput() = 0; + }; + typedef SharedPtr PIDMapper; + +} + +#endif diff --git a/src/CONVERTOR/VISU_MedConvertor.cxx b/src/CONVERTOR/VISU_MedConvertor.cxx index abed3883..6d53a6d3 100644 --- a/src/CONVERTOR/VISU_MedConvertor.cxx +++ b/src/CONVERTOR/VISU_MedConvertor.cxx @@ -36,9 +36,6 @@ #include -#define _EDF_NODE_IDS_ -//#define _DEXCEPT_ - using namespace std; using namespace VISU; @@ -51,6 +48,7 @@ static int MYDEBUG = 0; static int MYVALUEDEBUG = 0; static int MY_FAMILY_DEBUG = 0; static int MY_GROUP_DEBUG = 0; +//#define _DEXCEPT_ #else static int MYDEBUG = 0; static int MYVALUEDEBUG = 0; @@ -59,6 +57,7 @@ static int MY_GROUP_DEBUG = 0; #endif #define _LOAD_FAMILIES_ +#define _EDF_NODE_IDS_ namespace { diff --git a/src/OBJECT/VISU_Actor.cxx b/src/OBJECT/VISU_Actor.cxx index 338da631..2814e57c 100644 --- a/src/OBJECT/VISU_Actor.cxx +++ b/src/OBJECT/VISU_Actor.cxx @@ -64,36 +64,32 @@ static int MYDEBUG = 0; vtkStandardNewMacro(VISU_Actor); -VISU_Actor::VISU_Actor(){ +VISU_Actor::VISU_Actor(): + myIsVTKMapping(false), + myParent(this), + myPrs3d(NULL), + myPipeLine(NULL), + myMapper(vtkDataSetMapper::New()), + myIsShrunk(false), + myIsShrinkable(false), + myShrinkFilter(VTKViewer_ShrinkFilter::New()) +{ SetDebug(MYVTKDEBUG); - myParent = this; - myPipeLine = NULL; - myPrs3d = NULL; myStoreMapping = true; - myIsShrunk = false; - myIsShrinkable = false; - myShrinkFilter = VTKViewer_ShrinkFilter::New(); myShrinkFilter->SetStoreMapping(true); - SetShrinkFactor(); - - myMapper = vtkDataSetMapper::New(); - - myIO = NULL; - myName = ""; + SetShrinkFactor(); } VISU_Actor::~VISU_Actor(){ SALOME_Actor::SetProperty(NULL); - myMapper->RemoveAllInputs(); myMapper->Delete(); if(myPipeLine) myPipeLine->UnRegister(this); - myShrinkFilter->UnRegisterAllOutputs(); myShrinkFilter->Delete(); } @@ -212,11 +208,22 @@ void VISU_Actor::ShallowCopy(vtkProp *prop){ SALOME_Actor::ShallowCopy(prop); } +//---------------------------------------------------------------------------- +void +VISU_Actor +::SetVTKMapping(bool theIsVTKMapping) +{ + myIsVTKMapping = theIsVTKMapping; +} + //---------------------------------------------------------------------------- vtkDataSet* VISU_Actor ::GetInput() { + if(myIsVTKMapping) + return Superclass::GetInput(); + return myPipeLine->GetInput(); } @@ -225,6 +232,9 @@ vtkIdType VISU_Actor ::GetNodeObjId(vtkIdType theID) { + if(myIsVTKMapping) + return Superclass::GetNodeObjId(theID); + vtkIdType anID = myGeomFilter->GetNodeObjId(theID); if(myIsShrunk) @@ -237,6 +247,9 @@ vtkIdType VISU_Actor ::GetNodeVTKID(vtkIdType theID) { + if(myIsVTKMapping) + return theID; + return myPipeLine->GetNodeVTKID(theID); } @@ -244,6 +257,9 @@ float* VISU_Actor ::GetNodeCoord(int theObjID) { + if(myIsVTKMapping) + return Superclass::GetNodeCoord(theObjID); + return myPipeLine->GetNodeCoord(theObjID); } @@ -253,6 +269,9 @@ vtkIdType VISU_Actor ::GetElemObjId(vtkIdType theID) { + if(myIsVTKMapping) + return Superclass::GetElemObjId(theID); + vtkIdType anID = myGeomFilter->GetElemObjId(theID); if(myIsShrunk) @@ -265,6 +284,9 @@ vtkIdType VISU_Actor ::GetElemVTKID(vtkIdType theID) { + if(myIsVTKMapping) + return theID; + return myPipeLine->GetElemVTKID(theID); } @@ -272,5 +294,8 @@ vtkCell* VISU_Actor ::GetElemCell(vtkIdType theObjID) { + if(myIsVTKMapping) + return Superclass::GetElemCell(theObjID); + return myPipeLine->GetElemCell(theObjID); } diff --git a/src/OBJECT/VISU_Actor.h b/src/OBJECT/VISU_Actor.h index d6523570..478a6c07 100644 --- a/src/OBJECT/VISU_Actor.h +++ b/src/OBJECT/VISU_Actor.h @@ -50,7 +50,8 @@ namespace VISU { #define VTKOCC_EXPORT VTK_EXPORT #endif -class VTKOCC_EXPORT VISU_Actor : public SALOME_Actor { +class VTKOCC_EXPORT VISU_Actor : public SALOME_Actor +{ public: vtkTypeMacro(VISU_Actor,SALOME_Actor); void ShallowCopy(vtkProp *prop); @@ -88,6 +89,17 @@ class VTKOCC_EXPORT VISU_Actor : public SALOME_Actor { virtual void SetLineWidth(float theLineWidth); virtual float GetLineWidth(); + virtual + void + SetVTKMapping(bool theIsVTKMapping); + + virtual + bool + IsVTKMapping() const + { + return myIsVTKMapping; + } + virtual vtkDataSet* GetInput(); @@ -119,6 +131,7 @@ class VTKOCC_EXPORT VISU_Actor : public SALOME_Actor { protected: VISU_Actor(); + bool myIsVTKMapping; VISU_Actor* myParent; VISU::Prs3d_i* myPrs3d; VISU_PipeLine* myPipeLine; diff --git a/src/PIPELINE/VISUPipeLine.cxx b/src/PIPELINE/VISUPipeLine.cxx index cf8c455d..5424a08b 100644 --- a/src/PIPELINE/VISUPipeLine.cxx +++ b/src/PIPELINE/VISUPipeLine.cxx @@ -36,7 +36,7 @@ #include "VISU_GaussPointsPL.hxx" #include "VISU_Plot3DPL.hxx" -typedef VISU_GaussPointsPL TPresent; +typedef VISU_ScalarMapPL TPresent; #include #include @@ -75,7 +75,10 @@ int main(int argc, char** argv){ if(isOnlyMesh){ const VISU::TEntity& anEntity = VISU::CELL_ENTITY; aMeshOnEntityMapIter = aMeshOnEntityMap.find(anEntity); - vtkUnstructuredGrid* aDataSet = aConvertor->GetMeshOnEntity(aMeshName,anEntity); + + VISU::PIDMapper anIDMapper = + aConvertor->GetMeshOnEntity(aMeshName,anEntity); + VISU::TVTKOutput* aDataSet = anIDMapper->GetVTKOutput(); VISU_MeshPL* aPresent = VISU_MeshPL::New(); aPresent->SetInput(aDataSet); @@ -110,12 +113,15 @@ int main(int argc, char** argv){ VISU::TValField::const_iterator aValFieldIter = aValField.begin(); if(aValFieldIter == aValField.end()) return 0; int aTimeStamp = aValFieldIter->first; - vtkUnstructuredGrid* aDataSet; + + VISU::PIDMapper anIDMapper; + VISU::TVTKOutput* aDataSet; if(anEntity != VISU::NODE_ENTITY) aDataSet = aConvertor->GetTimeStampOnGaussPts(aMeshName,anEntity,aFieldName,aTimeStamp); else{ - continue; - aDataSet = aConvertor->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp); + //continue; + anIDMapper = aConvertor->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp); + aDataSet = anIDMapper->GetVTKOutput(); } TPresent* aPresent = TPresent::New(); diff --git a/src/PIPELINE/VISU_PipeLine.cxx b/src/PIPELINE/VISU_PipeLine.cxx index c00f14c7..e2367b04 100644 --- a/src/PIPELINE/VISU_PipeLine.cxx +++ b/src/PIPELINE/VISU_PipeLine.cxx @@ -313,6 +313,7 @@ bool VISU_PipeLine::IsPlanarInput() const return false; } +//======================================================================= vtkIdType VISU_PipeLine ::GetNodeObjID(vtkIdType theID) @@ -334,46 +335,42 @@ VISU_PipeLine { return myIDMapper->GetNodeCoord(theObjID); } -//modified by NIZNHY-PKV Thu Sep 1 18:15:13 2005f -//======================================================================= -//function : VISU_PipeLine::GetElemObjID -//purpose : + //======================================================================= -vtkIdType VISU_PipeLine::GetElemObjID(vtkIdType theID) +vtkIdType +VISU_PipeLine +::GetElemObjID(vtkIdType theID) { vtkIdType anID=myExtractGeometry->GetElemObjId(theID); return myIDMapper->GetElemObjID(anID); } -//======================================================================= -//function : VISU_PipeLine::GetElemVTKID -//purpose : -//======================================================================= -vtkIdType VISU_PipeLine::GetElemVTKID(vtkIdType theID) + +vtkIdType +VISU_PipeLine +::GetElemVTKID(vtkIdType theID) { return myIDMapper->GetElemVTKID(theID); } -//======================================================================= -//function : VISU_PipeLine::GetElemCell -//purpose : -//======================================================================= -vtkCell* VISU_PipeLine::GetElemCell(vtkIdType theObjID) + +vtkCell* +VISU_PipeLine +::GetElemCell(vtkIdType theObjID) { return myIDMapper->GetElemCell(theObjID); } + //======================================================================= -//function : VISU_PipeLine::SetIdMapper -//purpose : -//======================================================================= -void VISU_PipeLine::SetIDMapper(const VISU::PIDMapper& theIDMapper) +void +VISU_PipeLine +::SetIDMapper(const VISU::PIDMapper& theIDMapper) { - myIDMapper=theIDMapper; + myIDMapper = theIDMapper; + SetInput(myIDMapper->GetVTKOutput()); } -//======================================================================= -//function : VISU_PipeLine::GetIDMapper -//purpose : -//======================================================================= -const VISU::PIDMapper& VISU_PipeLine::GetIDMapper()const + +const VISU::PIDMapper& +VISU_PipeLine +::GetIDMapper() const { return myIDMapper; } -//modified by NIZNHY-PKV Thu Sep 1 16:16:15 2005t diff --git a/src/PIPELINE/VISU_PipeLine.hxx b/src/PIPELINE/VISU_PipeLine.hxx index bf43f17a..fd4df1bc 100644 --- a/src/PIPELINE/VISU_PipeLine.hxx +++ b/src/PIPELINE/VISU_PipeLine.hxx @@ -27,35 +27,43 @@ #ifndef VISU_PipeLine_HeaderFile #define VISU_PipeLine_HeaderFile +#include #include #include -#include -//pkv f -#include -//pkv t +#include "VISU_IDMapper.hxx" class vtkCell; + template class TVTKSmartPtr: public vtkSmartPointer { public: - TVTKSmartPtr() {} - TVTKSmartPtr(T* r, bool theIsOwner = false): vtkSmartPointer(r) { + TVTKSmartPtr() + {} + + TVTKSmartPtr(T* r, bool theIsOwner = false): vtkSmartPointer(r) + { if(r && theIsOwner) r->Delete(); } - TVTKSmartPtr& operator()(T* r, bool theIsOwner = false){ + + TVTKSmartPtr& operator()(T* r, bool theIsOwner = false) + { vtkSmartPointer::operator=(r); if(r && theIsOwner) r->Delete(); return *this; } - TVTKSmartPtr& operator=(T* r){ + + TVTKSmartPtr& operator=(T* r) + { vtkSmartPointer::operator=(r); return *this; } - operator T* () const { + + operator T* () const + { return vtkSmartPointer::GetPointer(); } }; @@ -69,7 +77,7 @@ class vtkPlane; class SALOME_ExtractGeometry; -typedef vtkUnstructuredGrid TInput; +typedef VISU::TVTKOutput TInput; class VISU_PipeLine : public vtkObject{ public: @@ -130,9 +138,11 @@ public: vtkCell* GetElemCell(vtkIdType theObjID); - void SetIDMapper(const VISU::PIDMapper& theIDMapper); + void + SetIDMapper(const VISU::PIDMapper& theIDMapper); - const VISU::PIDMapper& GetIDMapper()const; + const VISU::PIDMapper& + GetIDMapper()const; protected: VISU_PipeLine(); @@ -143,15 +153,12 @@ protected: bool myIsShrinkable; - TInput *myInput; + TInput *myInput; + VISU::PIDMapper myIDMapper; vtkDataSetMapper *myMapper; // Clipping planes TVTKSmartPtr myExtractGeometry; - // - //pkv f - VISU::PIDMapper myIDMapper; - //pkv t }; #endif diff --git a/src/VISU_I/VISU_CutLines_i.cc b/src/VISU_I/VISU_CutLines_i.cc index d542b221..02d71bc7 100644 --- a/src/VISU_I/VISU_CutLines_i.cc +++ b/src/VISU_I/VISU_CutLines_i.cc @@ -248,6 +248,17 @@ void VISU::CutLines_i::DoHook(){ ScalarMap_i::DoHook(); } +VISU_Actor* +VISU::CutLines_i +::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) +{ + if(VISU_Actor* anActor = ScalarMap_i::CreateActor(theIO)){ + anActor->SetVTKMapping(true); + return anActor; + } + return NULL; +} + void VISU::CutLines_i::BuildTableOfReal(SALOMEDS::SObject_ptr theSObject){ try{ if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal"); diff --git a/src/VISU_I/VISU_CutLines_i.hh b/src/VISU_I/VISU_CutLines_i.hh index 81ba7ffa..cbc68366 100644 --- a/src/VISU_I/VISU_CutLines_i.hh +++ b/src/VISU_I/VISU_CutLines_i.hh @@ -102,6 +102,10 @@ namespace VISU{ virtual Storable* Restore(const Storable::TRestoringMap& theMap); + virtual + VISU_Actor* + CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL); + void BuildTableOfReal(SALOMEDS::SObject_ptr theSObject); static const std::string myComment; diff --git a/src/VISU_I/VISU_CutPlanes_i.cc b/src/VISU_I/VISU_CutPlanes_i.cc index b0dca7d0..120cae90 100644 --- a/src/VISU_I/VISU_CutPlanes_i.cc +++ b/src/VISU_I/VISU_CutPlanes_i.cc @@ -185,3 +185,15 @@ void VISU::CutPlanes_i::DoHook(){ ScalarMap_i::DoHook(); } + +VISU_Actor* +VISU::CutPlanes_i +::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) +{ + if(VISU_Actor* anActor = ScalarMap_i::CreateActor(theIO)){ + anActor->SetVTKMapping(true); + return anActor; + } + return NULL; +} + diff --git a/src/VISU_I/VISU_CutPlanes_i.hh b/src/VISU_I/VISU_CutPlanes_i.hh index 28abd7d3..b6806243 100644 --- a/src/VISU_I/VISU_CutPlanes_i.hh +++ b/src/VISU_I/VISU_CutPlanes_i.hh @@ -87,6 +87,10 @@ namespace VISU{ virtual Storable* Restore(const Storable::TRestoringMap& theMap); + virtual + VISU_Actor* + CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL); + static const std::string myComment; virtual const char* GetComment() const; virtual QString GenerateName(); diff --git a/src/VISU_I/VISU_DeformedShape_i.cc b/src/VISU_I/VISU_DeformedShape_i.cc index 1198ad2d..a1d7b108 100644 --- a/src/VISU_I/VISU_DeformedShape_i.cc +++ b/src/VISU_I/VISU_DeformedShape_i.cc @@ -157,11 +157,14 @@ void VISU::DeformedShape_i::SetMapScale(double theMapScale){ } -VISU_Actor* VISU::DeformedShape_i::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) +VISU_Actor* +VISU::DeformedShape_i +::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) { VISU_Actor* anActor = VISU::ScalarMap_i::CreateActor(theIO); anActor->SetRepresentation(1); anActor->GetProperty()->SetColor(myColor.R,myColor.G,myColor.B); + anActor->SetVTKMapping(false); return anActor; } diff --git a/src/VISU_I/VISU_DeformedShape_i.hh b/src/VISU_I/VISU_DeformedShape_i.hh index a930c37d..39606011 100644 --- a/src/VISU_I/VISU_DeformedShape_i.hh +++ b/src/VISU_I/VISU_DeformedShape_i.hh @@ -85,7 +85,9 @@ namespace VISU{ virtual void SetMapScale(double theMapScale = 1.0); - virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL); + virtual + VISU_Actor* + CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL); virtual void UpdateActor(VISU_Actor* theActor) ; }; diff --git a/src/VISU_I/VISU_GaussPoints_i.cc b/src/VISU_I/VISU_GaussPoints_i.cc index f2eae4f6..e915e9d1 100644 --- a/src/VISU_I/VISU_GaussPoints_i.cc +++ b/src/VISU_I/VISU_GaussPoints_i.cc @@ -44,7 +44,7 @@ VISU::GaussPoints_i const char* theFieldName, int theIteration, int isMemoryCheck) { try{ - if(theEntity != VISU::NODE_ENTITY) + if(theEntity != VISU::NODE) return VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,isMemoryCheck); else return false; @@ -166,6 +166,8 @@ VISU::GaussPoints_i VISU_GaussPtsAct* anActor = VISU_GaussPtsAct::New(); try{ VISU::Prs3d_i::CreateActor(anActor,theIO); + anActor->SetRepresentation(VTK_POINTS); + anActor->SetVTKMapping(true); UpdateActor(anActor); }catch(...){ anActor->Delete(); diff --git a/src/VISU_I/VISU_GaussPoints_i.hh b/src/VISU_I/VISU_GaussPoints_i.hh index 8d183989..1c80fb61 100644 --- a/src/VISU_I/VISU_GaussPoints_i.hh +++ b/src/VISU_I/VISU_GaussPoints_i.hh @@ -73,10 +73,13 @@ namespace VISU virtual Storable* Restore(const Storable::TRestoringMap& theMap); - virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL); + virtual + VISU_Actor* + CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL); virtual void UpdateActor(VISU_Actor* theActor) ; }; } #endif + diff --git a/src/VISU_I/VISU_IsoSurfaces_i.cc b/src/VISU_I/VISU_IsoSurfaces_i.cc index 79b2a877..3895cc7e 100644 --- a/src/VISU_I/VISU_IsoSurfaces_i.cc +++ b/src/VISU_I/VISU_IsoSurfaces_i.cc @@ -139,6 +139,17 @@ void VISU::IsoSurfaces_i::DoHook(){ } +VISU_Actor* +VISU::IsoSurfaces_i +::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) +{ + if(VISU_Actor* anActor = ScalarMap_i::CreateActor(theIO)){ + anActor->SetVTKMapping(true); + return anActor; + } + return NULL; +} + void VISU::IsoSurfaces_i::SetMapScale(double theMapScale){ myIsoSurfacesPL->SetMapScale(theMapScale); } diff --git a/src/VISU_I/VISU_IsoSurfaces_i.hh b/src/VISU_I/VISU_IsoSurfaces_i.hh index c7371b6a..9b442b68 100644 --- a/src/VISU_I/VISU_IsoSurfaces_i.hh +++ b/src/VISU_I/VISU_IsoSurfaces_i.hh @@ -78,6 +78,10 @@ namespace VISU{ virtual Storable* Restore(const Storable::TRestoringMap& theMap); + virtual + VISU_Actor* + CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL); + virtual void SetMapScale(double theMapScale = 1.0); }; } diff --git a/src/VISU_I/VISU_Mesh_i.cc b/src/VISU_I/VISU_Mesh_i.cc index 774b3711..5bab8e3d 100644 --- a/src/VISU_I/VISU_Mesh_i.cc +++ b/src/VISU_I/VISU_Mesh_i.cc @@ -214,54 +214,42 @@ VISU::Storable* VISU::Mesh_i::Build (int theRestoring) myNodeColor.R = myNodeColor.G = 1.0; myNodeColor.B = 1.0; myLinkColor.R = myLinkColor.G = myLinkColor.B = 83/255.; } - //jfa IPAL9284:if (int(myEntity) >= 0) - if (myEntity >= 0) //jfa IPAL9284 - if (mySubMeshName == "") + + if(myEntity >= 0) + if(mySubMeshName == "") myType = VISU::TENTITY; else myType = VISU::TFAMILY; else myType = VISU::TGROUP; + if(MYDEBUG) MESSAGE("Mesh_i::Build - myType = "<GetInput()->GetMeshOnEntity(myMeshName,(VISU::TEntity)myEntity);//jfa IPAL9284 + anIDMapper = myResult->GetInput()->GetMeshOnEntity(myMeshName,(VISU::TEntity)myEntity);//jfa IPAL9284 aComment.sprintf("myComment=ENTITY;myType=%d;myMeshName=%s;myId=%d", VISU::TENTITY,myMeshName.c_str(),myEntity); - //pkv f - myMeshPL->SetIDMapper(myResult->GetInput()-> // i.e. the VISU_Convertor - GetMeshOnEntityIDMapper(myMeshName,(VISU::TEntity)myEntity)); - //pkv t break; case VISU::TFAMILY : - anOutput = myResult->GetInput()->GetFamilyOnEntity(myMeshName,(VISU::TEntity)myEntity,mySubMeshName); + anIDMapper = myResult->GetInput()->GetFamilyOnEntity(myMeshName,(VISU::TEntity)myEntity,mySubMeshName); aComment.sprintf("myComment=FAMILY;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s", VISU::TFAMILY,myMeshName.c_str(),myEntity,mySubMeshName.c_str()); - //pkv f - myMeshPL->SetIDMapper(myResult->GetInput()-> // i.e. the VISU_Convertor - GetFamilyOnEntityIDMapper(myMeshName,(VISU::TEntity)myEntity,mySubMeshName)); - //pkv t - break; case VISU::TGROUP : - anOutput = myResult->GetInput()->GetMeshOnGroup(myMeshName,mySubMeshName); + anIDMapper = myResult->GetInput()->GetMeshOnGroup(myMeshName,mySubMeshName); aComment.sprintf("myComment=GROUP;myType=%d;myMeshName=%s;myName=%s", VISU::TGROUP,myMeshName.c_str(),mySubMeshName.c_str()); - - //pkv f - myMeshPL->SetIDMapper(myResult->GetInput()-> // i.e. the VISU_Convertor - GetMeshOnGroupIDMapper(myMeshName,mySubMeshName)); - //pkv t break; } - if(anOutput == NULL) throw std::runtime_error("Mesh_i::Build - anOutput == NULL !!!"); - // - myMeshPL->SetInput(anOutput); + if(!anIDMapper) + throw std::runtime_error("Mesh_i::Build - !anIDMapper !!!"); + + myMeshPL->SetIDMapper(anIDMapper); myMeshPL->Build(); - // + if(!theRestoring) { //Setting IOR on the label myMeshPL->Init(); string aResultEntry = myResult->GetEntry(); diff --git a/src/VISU_I/VISU_Plot3D_i.cc b/src/VISU_I/VISU_Plot3D_i.cc index 6acc32d1..641afcb0 100644 --- a/src/VISU_I/VISU_Plot3D_i.cc +++ b/src/VISU_I/VISU_Plot3D_i.cc @@ -165,6 +165,17 @@ void VISU::Plot3D_i::DoHook() ScalarMap_i::DoHook(); } +VISU_Actor* +VISU::Plot3D_i +::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) +{ + if(VISU_Actor* anActor = ScalarMap_i::CreateActor(theIO)){ + anActor->SetVTKMapping(true); + return anActor; + } + return NULL; +} + void VISU::Plot3D_i::SetMapScale(double theMapScale) { myPlot3DPL->SetMapScale(theMapScale); diff --git a/src/VISU_I/VISU_Plot3D_i.hh b/src/VISU_I/VISU_Plot3D_i.hh index dd5ce199..9e214424 100644 --- a/src/VISU_I/VISU_Plot3D_i.hh +++ b/src/VISU_I/VISU_Plot3D_i.hh @@ -68,6 +68,10 @@ namespace VISU { virtual Storable* Restore (const Storable::TRestoringMap& theMap); + virtual + VISU_Actor* + CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL); + static const std::string myComment; virtual const char* GetComment() const; virtual QString GenerateName(); diff --git a/src/VISU_I/VISU_Result_i.cc b/src/VISU_I/VISU_Result_i.cc index cceb492b..b6fd953a 100644 --- a/src/VISU_I/VISU_Result_i.cc +++ b/src/VISU_I/VISU_Result_i.cc @@ -724,9 +724,12 @@ const vector< float >* Result_i::GetAxisInfo(const string& theMeshName, MESSAGE("No mesh named " << theMeshName ); return components; } - VISU_Convertor::TOutput* vtkMesh = myInput->GetMeshOnEntity (theMeshName, - CELL_ENTITY); - if ( !vtkMesh || vtkMesh->GetNumberOfCells() == 0 ) { + + VISU::PIDMapper anIDMapper = myInput->GetMeshOnEntity(theMeshName, + CELL_ENTITY); + VISU::TVTKOutput* aMesh = anIDMapper->GetVTKOutput(); + + if ( !aMesh || aMesh->GetNumberOfCells() == 0 ) { MESSAGE( "No cells in the mesh: " << theMeshName ); return components; } @@ -737,9 +740,9 @@ const vector< float >* Result_i::GetAxisInfo(const string& theMeshName, gp_Vec axDirs[ nbAxes ]; float minSize[3] = { FLT_MAX, FLT_MAX, FLT_MAX }; bool axesComputed = false; - for ( vtkIdType iCell = 0; iCell < vtkMesh->GetNumberOfCells(); ++iCell ) + for ( vtkIdType iCell = 0; iCell < aMesh->GetNumberOfCells(); ++iCell ) { - vtkCell* cell = vtkMesh->GetCell( iCell ); + vtkCell* cell = aMesh->GetCell( iCell ); int nbPnt = cell->GetNumberOfPoints(); if ( nbPnt != 8 ) continue; @@ -787,8 +790,8 @@ const vector< float >* Result_i::GetAxisInfo(const string& theMeshName, // on axis direction; define bnd box set< float > comps[ 3 ]; Bnd_Box box; - vtkPoints * points = vtkMesh->GetPoints(); - vtkIdType iP, nbP = vtkMesh->GetNumberOfPoints(); + vtkPoints * points = aMesh->GetPoints(); + vtkIdType iP, nbP = aMesh->GetNumberOfPoints(); for ( iP = 0; iP < nbP; ++iP ) { float* coo = points->GetPoint( iP ); diff --git a/src/VISU_I/VISU_ScalarMap_i.cc b/src/VISU_I/VISU_ScalarMap_i.cc index c602b718..70316dae 100644 --- a/src/VISU_I/VISU_ScalarMap_i.cc +++ b/src/VISU_I/VISU_ScalarMap_i.cc @@ -459,19 +459,18 @@ VISU::Storable* VISU::ScalarMap_i::Build(int theRestoring){ void VISU::ScalarMap_i::DoSetInput(Result_i* theResult){ if(theResult->GetInput() == NULL) throw std::runtime_error("Mesh_i::Build - theResult->GetInput() == NULL !!!"); + myField = theResult->GetInput()->GetField(myMeshName,myEntity,myFieldName); if(myField == NULL) throw std::runtime_error("There is no Field with the parameters !!!"); - VISU_Convertor::TOutput *anOutput = + + VISU::PIDMapper anIDMapper = theResult->GetInput()->GetTimeStampOnMesh(myMeshName,myEntity,myFieldName,myIteration); - if(anOutput == NULL) + + if(!anIDMapper) throw std::runtime_error("There is no TimeStamp with the parameters !!!"); - myScalarMapPL->SetInput(anOutput); - //pkv f - //myScalarMapPL->SetProfile(theResult->GetInput()->GetProfile(myMeshName,myEntity,myFieldName,myIteration)); - myScalarMapPL->SetIDMapper(theResult->GetInput()-> // i.e. the VISU_Convertor - GetTimeStampOnMeshIDMapper(myMeshName,myEntity,myFieldName,myIteration)); - //pkv t + + myScalarMapPL->SetIDMapper(anIDMapper); myScalarMapPL->Build(); } @@ -493,7 +492,9 @@ void VISU::ScalarMap_i::SetMapScale(double theMapScale){ myScalarMapPL->SetMapScale(theMapScale); } -VISU_Actor* VISU::ScalarMap_i::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) +VISU_Actor* +VISU::ScalarMap_i +::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) { VISU_ScalarMapAct* anActor = VISU_ScalarMapAct::New(); try{ diff --git a/src/VISU_I/VISU_ScalarMap_i.hh b/src/VISU_I/VISU_ScalarMap_i.hh index 3ff15020..60e666ae 100644 --- a/src/VISU_I/VISU_ScalarMap_i.hh +++ b/src/VISU_I/VISU_ScalarMap_i.hh @@ -196,7 +196,9 @@ namespace VISU{ virtual int GetIteration() { return myIteration; } - virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL); + virtual + VISU_Actor* + CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL); virtual void UpdateActor(VISU_Actor* theActor) ; }; diff --git a/src/VISU_I/VISU_StreamLines_i.cc b/src/VISU_I/VISU_StreamLines_i.cc index ecfe43c5..52175978 100644 --- a/src/VISU_I/VISU_StreamLines_i.cc +++ b/src/VISU_I/VISU_StreamLines_i.cc @@ -46,10 +46,13 @@ int VISU::StreamLines_i::IsPossible(Result_i* theResult, const char* theMeshName const char* theFieldName, int theIteration, int isMemoryCheck) { try{ - if(!VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,false)) return 0; - VISU_Convertor::TOutput *anOutput = + if(!VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,false)) + return 0; + + VISU::PIDMapper anIDMapper = theResult->GetInput()->GetTimeStampOnMesh(theMeshName,VISU::TEntity(theEntity),theFieldName,theIteration); - bool aResult = VISU_StreamLinesPL::IsPossible(anOutput); + VISU::TVTKOutput* aDataSet = anIDMapper->GetVTKOutput(); + bool aResult = VISU_StreamLinesPL::IsPossible(aDataSet); MESSAGE("StreamLines_i::IsPossible - aResult = "<SetVTKMapping(true); + return anActor; + } + return NULL; } diff --git a/src/VISU_I/VISU_StreamLines_i.hh b/src/VISU_I/VISU_StreamLines_i.hh index ab842903..a952a901 100644 --- a/src/VISU_I/VISU_StreamLines_i.hh +++ b/src/VISU_I/VISU_StreamLines_i.hh @@ -93,7 +93,9 @@ namespace VISU{ virtual void Update(); - virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL); + virtual + VISU_Actor* + CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL); virtual void UpdateActor(VISU_Actor* theActor); diff --git a/src/VISU_I/VISU_Vectors_i.cc b/src/VISU_I/VISU_Vectors_i.cc index bd086a60..1207d315 100644 --- a/src/VISU_I/VISU_Vectors_i.cc +++ b/src/VISU_I/VISU_Vectors_i.cc @@ -179,6 +179,7 @@ VISU_Actor* VISU::Vectors_i::CreateActor(const Handle(SALOME_InteractiveObject)& VISU_VectorsAct* anActor = VISU_VectorsAct::New(); try{ VISU::Prs3d_i::CreateActor(anActor,theIO); + anActor->SetVTKMapping(true); anActor->SetBarVisibility(true); anActor->GetProperty()->SetColor(myColor.R,myColor.G,myColor.B); anActor->GetProperty()->SetLineWidth(GetLineWidth()); diff --git a/src/VISU_I/VISU_Vectors_i.hh b/src/VISU_I/VISU_Vectors_i.hh index bcb4ab2f..4750308c 100644 --- a/src/VISU_I/VISU_Vectors_i.hh +++ b/src/VISU_I/VISU_Vectors_i.hh @@ -83,7 +83,9 @@ namespace VISU{ virtual const char* GetComment() const; virtual QString GenerateName(); - virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL); + virtual + VISU_Actor* + CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL); virtual void UpdateActor(VISU_Actor* theActor) ; }; -- 2.39.2