From c123f53cd87190c4b478b058a2dc13188ee5426f Mon Sep 17 00:00:00 2001 From: apo Date: Thu, 1 Sep 2005 04:23:42 +0000 Subject: [PATCH] To introduce ID's mapping --- src/CONVERTOR/VISUConvertor.cxx | 14 ++++- src/CONVERTOR/VISU_Convertor.hxx | 20 ++++--- src/CONVERTOR/VISU_Convertor_impl.cxx | 68 ++++++++++++++---------- src/CONVERTOR/VISU_Convertor_impl.hxx | 21 ++++---- src/OBJECT/VISU_Actor.cxx | 75 ++++++++++++++++----------- src/OBJECT/VISU_Actor.h | 30 ++++++++--- src/PIPELINE/VISU_PipeLine.cxx | 39 +++++++++++--- src/PIPELINE/VISU_PipeLine.hxx | 30 ++++++++--- src/PIPELINE/VISU_ScalarMapPL.cxx | 67 ++++++++++++++---------- src/PIPELINE/VISU_ScalarMapPL.hxx | 39 ++++++++++---- 10 files changed, 276 insertions(+), 127 deletions(-) diff --git a/src/CONVERTOR/VISUConvertor.cxx b/src/CONVERTOR/VISUConvertor.cxx index c42a184d..9b9499c0 100644 --- a/src/CONVERTOR/VISUConvertor.cxx +++ b/src/CONVERTOR/VISUConvertor.cxx @@ -83,11 +83,22 @@ void parseFile(const char* theFileName) VISU::TValField::const_iterator aValFieldIter = aValField.begin(); for(; aValFieldIter != aValField.end(); aValFieldIter++){ int aTimeStamp = aValFieldIter->first; + + VISU_Convertor::TOutput* aDataSet = + aCon->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp); + VISU::PProfile aProfile = aCon->GetProfile(aMeshName,anEntity,aFieldName,aTimeStamp); + int aNbCells = aDataSet->GetNumberOfCells(); + for(int anCellId = 0; anCellId < aNbCells; anCellId++){ + int anObjID = aProfile->GetElemObjID(anCellId); + int aVTKID = aProfile->GetElemVTKID(anObjID); + cout<GetTimeStampOnGaussPts(aMeshName,anEntity,aFieldName,aTimeStamp); else aCon->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp); - //goto OK; } } } @@ -124,6 +135,7 @@ void parseFile(const char* theFileName) } } + OK: MSG(MYDEBUG,"OK"); #ifndef _DEXCEPT_ }catch(std::exception& exc){ diff --git a/src/CONVERTOR/VISU_Convertor.hxx b/src/CONVERTOR/VISU_Convertor.hxx index 8097a660..9bfbc03c 100644 --- a/src/CONVERTOR/VISU_Convertor.hxx +++ b/src/CONVERTOR/VISU_Convertor.hxx @@ -138,19 +138,27 @@ namespace VISU { virtual vtkIdType - GetNodeObjID(int theVtkI) const = 0; + GetNodeObjID(vtkIdType theID) const = 0; virtual vtkIdType - GetElemObjID(int theVtkI) const = 0; + GetNodeVTKID(vtkIdType theID) const = 0; virtual - vtkCell* - GetElemCell(int theObjID) = 0; + float* + GetNodeCoord(vtkIdType theObjID) = 0; + + virtual + vtkIdType + GetElemObjID(vtkIdType theID) const = 0; + + virtual + vtkIdType + GetElemVTKID(vtkIdType theID) const = 0; virtual - float* - GetNodeCoord(int theObjID) = 0; + vtkCell* + GetElemCell(vtkIdType theObjID) = 0; }; diff --git a/src/CONVERTOR/VISU_Convertor_impl.cxx b/src/CONVERTOR/VISU_Convertor_impl.cxx index 31d7396a..04f0d3bf 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.cxx +++ b/src/CONVERTOR/VISU_Convertor_impl.cxx @@ -252,7 +252,8 @@ namespace VISU //--------------------------------------------------------------- TProfileImpl::TProfileImpl(): - myIsAll(true) + myIsAll(true), + myMeshOnEntity(NULL) {} vtkIdType @@ -262,10 +263,31 @@ namespace VISU return myNamedPointCoords->GetObjID(theID); } + vtkIdType + TProfileImpl + ::GetNodeVTKID(vtkIdType theID) const + { + return myNamedPointCoords->GetVTKID(theID); + } + + float* + TProfileImpl + ::GetNodeCoord(vtkIdType theObjID) + { + if(myMeshOnEntity) + return myMeshOnEntity->GetNodeCoord(theObjID); + + vtkIdType aVtkID = GetNodeVTKID(theObjID); + return GetFilter()->GetOutput()->GetPoint(aVtkID); + } + vtkIdType TProfileImpl ::GetElemObjID(vtkIdType theID) const { + if(myMeshOnEntity) + return myMeshOnEntity->GetElemObjID(theID); + vtkIdType anInputID; const TVTKAppendFilter& anAppendFilter = GetFilter(); vtkIdType aID = anAppendFilter->GetCellInputID(theID,anInputID); @@ -277,6 +299,9 @@ namespace VISU TProfileImpl ::GetElemVTKID(vtkIdType theID) const { + if(myMeshOnEntity) + return myMeshOnEntity->GetElemVTKID(theID); + if(myElemObj2VTKID.empty()) return theID; else{ @@ -287,29 +312,17 @@ namespace VISU return -1; } - vtkIdType - TProfileImpl - ::GetNodeVTKID(vtkIdType theID) const - { - return myNamedPointCoords->GetVTKID(theID); - } - vtkCell* TProfileImpl - ::GetElemCell(int theObjID) + ::GetElemCell(vtkIdType theObjID) { + if(myMeshOnEntity) + return myMeshOnEntity->GetElemCell(theObjID); + vtkIdType aVtkID = GetElemVTKID(theObjID); return GetFilter()->GetOutput()->GetCell(aVtkID); } - float* - TProfileImpl - ::GetNodeCoord(int theObjID) - { - vtkIdType aVtkID = GetNodeVTKID(theObjID); - return GetFilter()->GetOutput()->GetPoint(aVtkID); - } - //--------------------------------------------------------------- TGaussSubMeshImpl::TGaussSubMeshImpl(): @@ -1075,16 +1088,12 @@ namespace aCellTypesArray->SetNumberOfComponents(1); aCellTypesArray->SetNumberOfTuples(aNbCells); - VISU::TID2ID& anElemObj2VTKID = theProfile->myElemObj2VTKID; if(theSubProfile->myStatus == eAddAll){ VISU::TCell2Connect::const_iterator anIter = aCell2Connect.begin(); for(vtkIdType anId = 0, aConnId = 0; anIter != aCell2Connect.end(); anIter++){ const TConnect& anArray = aCell2Connect[anId]; PrintCells(aConnId,aConnectivity,anArray); aCellTypesArray->SetValue(anId,(unsigned char)aGeom); - - anElemObj2VTKID[theSubProfile->GetElemObjID(anId)] = anId; - aConnId += aNbNodes; anId++; } @@ -1095,9 +1104,6 @@ namespace const TConnect& anArray = aCell2Connect[aSubId]; PrintCells(aConnId,aConnectivity,anArray); aCellTypesArray->SetValue(anId,(unsigned char)aGeom); - - anElemObj2VTKID[theSubProfile->GetElemObjID(anId)] = anId; - aConnId += aNbNodes; anId++; } @@ -1154,12 +1160,17 @@ namespace if(theProfile->myIsAll){ TDataSet* aDataSet = theMeshOnEntity->GetDataSet(); anAppendFilter->AddInput(aDataSet); + theProfile->myMeshOnEntity = theMeshOnEntity.get(); }else{ const TGeom2SubProfile& aGeom2SubProfile = theProfile->myGeom2SubProfile; + + TID2ID& anElemObj2VTKID = theProfile->myElemObj2VTKID; + TSubProfileArr& aSubProfileArr = theProfile->mySubProfileArr; aSubProfileArr.resize(aGeom2SubProfile.size()); + TGeom2SubProfile::const_iterator anIter = aGeom2SubProfile.begin(); - for(vtkIdType anID = 0; anIter != aGeom2SubProfile.end(); anIter++){ + for(vtkIdType anInputID = 0, aCellID = 0; anIter != aGeom2SubProfile.end(); anIter++){ PSubProfileImpl aSubProfile = anIter->second; if(aSubProfile->myStatus == eRemoveAll) continue; @@ -1172,7 +1183,12 @@ namespace const TVTKSource& aSource = aSubProfile->GetSource(); anAppendFilter->AddInput(aSource.GetPointer()); - aSubProfileArr[anID++] = aSubProfile; + vtkIdType aNbCells = aSource->GetNumberOfCells(); + for(vtkIdType aCell = 0; aCell < aNbCells; aCell++, aCellID++){ + anElemObj2VTKID[aSubProfile->GetElemObjID(aCell)] = aCellID; + } + + aSubProfileArr[anInputID++] = aSubProfile; } } anAppendFilter->Update(); // Fix on VTK diff --git a/src/CONVERTOR/VISU_Convertor_impl.hxx b/src/CONVERTOR/VISU_Convertor_impl.hxx index 11c1fe87..f2f09b2b 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.hxx +++ b/src/CONVERTOR/VISU_Convertor_impl.hxx @@ -190,6 +190,8 @@ namespace VISU //--------------------------------------------------------------- + struct TMeshOnEntityImpl; + typedef std::map TID2ID; typedef TVector TSubProfileArr; typedef std::map TGeom2SubProfile; @@ -201,31 +203,32 @@ namespace VISU virtual vtkIdType - GetNodeObjID(int theVtkI) const; + GetNodeObjID(vtkIdType theID) const; virtual vtkIdType - GetElemObjID(int theVtkI) const; + GetNodeVTKID(vtkIdType theID) const; + + virtual + float* + GetNodeCoord(vtkIdType theObjID); virtual vtkIdType - GetElemVTKID(int theID) const; + GetElemObjID(vtkIdType theID) const; virtual vtkIdType - GetNodeVTKID(int theID) const; + GetElemVTKID(vtkIdType theID) const; virtual vtkCell* - GetElemCell(int theObjID); - - virtual - float* - GetNodeCoord(int theObjID); + GetElemCell(vtkIdType theObjID); TID2ID myElemObj2VTKID; TSubProfileArr mySubProfileArr; PNamedPointCoords myNamedPointCoords; + TMeshOnEntityImpl* myMeshOnEntity; TGeom2SubProfile myGeom2SubProfile; }; diff --git a/src/OBJECT/VISU_Actor.cxx b/src/OBJECT/VISU_Actor.cxx index 263500f0..8a80da34 100644 --- a/src/OBJECT/VISU_Actor.cxx +++ b/src/OBJECT/VISU_Actor.cxx @@ -213,41 +213,56 @@ void VISU_Actor::ShallowCopy(vtkProp *prop){ } //---------------------------------------------------------------------------- -int VISU_Actor::GetNodeObjId(int theVtkID){ - vtkIdType aID; - // - aID=myGeomFilter->GetNodeObjId(theVtkID); - if (myIsShrunk) { - aID= myShrinkFilter->GetNodeObjId(aID); - } - if (myPipeLine) { - aID=myPipeLine->GetNodeObjID(aID); - } - return aID; +vtkIdType +VISU_Actor +::GetNodeObjId(vtkIdType theID) +{ + vtkIdType anID = myGeomFilter->GetNodeObjId(theID); + + if(myIsShrunk) + anID = myShrinkFilter->GetNodeObjId(anID); + + return myPipeLine->GetNodeObjID(anID); } -//---------------------------------------------------------------------------- -int VISU_Actor::GetElemObjId(int theVtkID){ - vtkIdType aID; - // - aID=myGeomFilter->GetElemObjId(theVtkID); - if (myIsShrunk) { - aID= myShrinkFilter->GetElemObjId(aID); - } - if (myPipeLine) { - aID=myPipeLine->GetElemObjID(aID); - } - return aID; +vtkIdType +VISU_Actor +::GetNodeVTKID(vtkIdType theID) +{ + return myPipeLine->GetNodeVTKID(theID); } -//modified by NIZNHY-PKV Tue Aug 30 12:46:15 2005f -//---------------------------------------------------------------------------- -vtkCell* VISU_Actor::GetElemCell(int theObjID) + +float* +VISU_Actor +::GetNodeCoord(int theObjID) { - return myPipeLine->GetElemCell(theObjID); + return myPipeLine->GetNodeCoord(theObjID); } + + //---------------------------------------------------------------------------- -float* VISU_Actor::GetNodeCoord(int theObjID) +vtkIdType +VISU_Actor +::GetElemObjId(vtkIdType theID) { - return myPipeLine->GetNodeCoord(theObjID); + vtkIdType anID = myGeomFilter->GetElemObjId(theID); + + if(myIsShrunk) + anID = myShrinkFilter->GetElemObjId(anID); + + return myPipeLine->GetElemObjID(anID); +} + +vtkIdType +VISU_Actor +::GetElemVTKID(vtkIdType theID) +{ + return myPipeLine->GetElemVTKID(theID); +} + +vtkCell* +VISU_Actor +::GetElemCell(vtkIdType theObjID) +{ + return myPipeLine->GetElemCell(theObjID); } -//modified by NIZNHY-PKV Tue Aug 30 12:46:19 2005t diff --git a/src/OBJECT/VISU_Actor.h b/src/OBJECT/VISU_Actor.h index e750b174..22429870 100644 --- a/src/OBJECT/VISU_Actor.h +++ b/src/OBJECT/VISU_Actor.h @@ -88,12 +88,30 @@ class VTKOCC_EXPORT VISU_Actor : public SALOME_Actor { virtual void SetLineWidth(float theLineWidth); virtual float GetLineWidth(); - virtual int GetNodeObjId(int theVtkID); - virtual int GetElemObjId(int theVtkID); - //pkv f - virtual vtkCell* GetElemCell(int theObjID); - virtual float* GetNodeCoord(int theObjID); - //pkv t + virtual + vtkIdType + GetNodeObjId(vtkIdType theID); + + virtual + vtkIdType + GetNodeVTKID(vtkIdType theID); + + virtual + float* + GetNodeCoord(vtkIdType theObjID); + + virtual + vtkIdType + GetElemObjId(vtkIdType theID); + + virtual + vtkIdType + GetElemVTKID(vtkIdType theID); + + virtual + vtkCell* + GetElemCell(vtkIdType theObjID); + protected: VISU_Actor(); diff --git a/src/PIPELINE/VISU_PipeLine.cxx b/src/PIPELINE/VISU_PipeLine.cxx index 68812380..b472e1b6 100644 --- a/src/PIPELINE/VISU_PipeLine.cxx +++ b/src/PIPELINE/VISU_PipeLine.cxx @@ -313,23 +313,46 @@ bool VISU_PipeLine::IsPlanarInput() const return false; } -vtkIdType VISU_PipeLine::GetNodeObjID(vtkIdType theVtkID) +vtkIdType +VISU_PipeLine +::GetNodeObjID(vtkIdType theID) { - return myExtractGeometry->GetNodeObjId(theVtkID); + return myExtractGeometry->GetNodeObjId(theID); } -vtkIdType VISU_PipeLine::GetElemObjID(vtkIdType theVtkID) +vtkIdType +VISU_PipeLine +::GetNodeVTKID(vtkIdType theID) { - return myExtractGeometry->GetElemObjId(theVtkID); + return -1; } -//modified by NIZNHY-PKV Tue Aug 30 12:53:58 2005f -vtkCell* VISU_PipeLine::GetElemCell(int ) + +float* +VISU_PipeLine +::GetNodeCoord(int ) { return NULL; } -float* VISU_PipeLine::GetNodeCoord(int ) +vtkIdType +VISU_PipeLine +::GetElemObjID(vtkIdType theID) +{ + return myExtractGeometry->GetElemObjId(theID); +} + +vtkIdType +VISU_PipeLine +::GetElemVTKID(vtkIdType theID) +{ + return -1; +} + +vtkCell* +VISU_PipeLine +::GetElemCell(int ) { return NULL; } -//modified by NIZNHY-PKV Tue Aug 30 12:54:01 2005t + + diff --git a/src/PIPELINE/VISU_PipeLine.hxx b/src/PIPELINE/VISU_PipeLine.hxx index 396925b8..0da0e50e 100644 --- a/src/PIPELINE/VISU_PipeLine.hxx +++ b/src/PIPELINE/VISU_PipeLine.hxx @@ -105,12 +105,30 @@ public: bool IsShrinkable() { return myIsShrinkable; } - virtual vtkIdType GetNodeObjID(vtkIdType theVtkID); - virtual vtkIdType GetElemObjID(vtkIdType theVtkID); - //pkv f - virtual vtkCell* GetElemCell(int theObjID); - virtual float* GetNodeCoord(int theObjID); - //pkv t + virtual + vtkIdType + GetNodeObjID(vtkIdType theID); + + virtual + vtkIdType + GetNodeVTKID(vtkIdType theID); + + virtual + float* + GetNodeCoord(vtkIdType theObjID); + + virtual + vtkIdType + GetElemObjID(vtkIdType theID); + + virtual + vtkIdType + GetElemVTKID(vtkIdType theID); + + virtual + vtkCell* + GetElemCell(vtkIdType theObjID); + protected: VISU_PipeLine(); VISU_PipeLine(const VISU_PipeLine&); diff --git a/src/PIPELINE/VISU_ScalarMapPL.cxx b/src/PIPELINE/VISU_ScalarMapPL.cxx index 56af5b44..83a626eb 100644 --- a/src/PIPELINE/VISU_ScalarMapPL.cxx +++ b/src/PIPELINE/VISU_ScalarMapPL.cxx @@ -133,48 +133,63 @@ void VISU_ScalarMapPL::Init(){ //SetSourceRange(); } -void VISU_ScalarMapPL::SetProfile(const VISU::PProfile& theProfile) +void +VISU_ScalarMapPL +::SetProfile(const VISU::PProfile& theProfile) { myProfile=theProfile; } -const VISU::PProfile& VISU_ScalarMapPL::GetProfile()const + +const VISU::PProfile& +VISU_ScalarMapPL +::GetProfile() const { return myProfile; } -vtkIdType VISU_ScalarMapPL::GetNodeObjID(vtkIdType theVtkID) +vtkIdType +VISU_ScalarMapPL +::GetNodeObjID(vtkIdType theID) { - vtkIdType aIDx=-1; - // - if (!myProfile){ - return aIDx; - } - aIDx=VISU_PipeLine::GetNodeObjID(theVtkID); - aIDx=myProfile->GetNodeObjID(aIDx); - return aIDx; + vtkIdType anID = VISU_PipeLine::GetNodeObjID(theID); + return myProfile->GetNodeObjID(anID); } -vtkIdType VISU_ScalarMapPL::GetElemObjID(vtkIdType theVtkID) +vtkIdType +VISU_ScalarMapPL +::GetNodeVTKID(vtkIdType theID) { - vtkIdType aIDx=-1; - // - if (!myProfile){ - return aIDx; - } - aIDx=VISU_PipeLine::GetElemObjID(theVtkID); - aIDx=myProfile->GetElemObjID(aIDx); - return aIDx; + return myProfile->GetNodeVTKID(theID); } -//modified by NIZNHY-PKV Tue Aug 30 12:13:53 2005f -vtkCell* VISU_ScalarMapPL::GetElemCell(int theObjID) + +float* +VISU_ScalarMapPL +::GetNodeCoord(int theObjID) { - return GetProfile()->GetElemCell(theObjID); + return GetProfile()->GetNodeCoord(theObjID); } -float* VISU_ScalarMapPL::GetNodeCoord(int theObjID) + +vtkIdType +VISU_ScalarMapPL +::GetElemObjID(vtkIdType theID) { - return GetProfile()->GetNodeCoord(theObjID); + vtkIdType anID = VISU_PipeLine::GetElemObjID(theID); + return myProfile->GetElemObjID(anID); +} + +vtkIdType +VISU_ScalarMapPL +::GetElemVTKID(vtkIdType theID) +{ + return myProfile->GetElemVTKID(theID); +} + +vtkCell* +VISU_ScalarMapPL:: +GetElemCell(vtkIdType theObjID) +{ + return GetProfile()->GetElemCell(theObjID); } -//modified by NIZNHY-PKV Tue Aug 30 12:13:55 2005t void VISU_ScalarMapPL::Build() { diff --git a/src/PIPELINE/VISU_ScalarMapPL.hxx b/src/PIPELINE/VISU_ScalarMapPL.hxx index 7f6e379c..f7a38afc 100644 --- a/src/PIPELINE/VISU_ScalarMapPL.hxx +++ b/src/PIPELINE/VISU_ScalarMapPL.hxx @@ -78,15 +78,36 @@ public: virtual void GetSourceRange(float theRange[2]); virtual void SetSourceRange(); - virtual vtkIdType GetNodeObjID(vtkIdType theVtkID); - virtual vtkIdType GetElemObjID(vtkIdType theVtkID); - - void SetProfile(const VISU::PProfile& theProfile); - const VISU::PProfile& GetProfile()const; - //pkv f - vtkCell* GetElemCell(int theObjID); - float* GetNodeCoord(int theObjID); - //pkv t + void + SetProfile(const VISU::PProfile& theProfile); + + const VISU::PProfile& + GetProfile()const; + + virtual + vtkIdType + GetNodeObjID(vtkIdType theID); + + virtual + vtkIdType + GetNodeVTKID(vtkIdType theID); + + virtual + float* + GetNodeCoord(vtkIdType theObjID); + + virtual + vtkIdType + GetElemObjID(vtkIdType theID); + + virtual + vtkIdType + GetElemVTKID(vtkIdType theID); + + virtual + vtkCell* + GetElemCell(vtkIdType theObjID); + protected: typedef vtkDataSet THook; virtual THook* DoHook(); -- 2.39.2