From: pkv Date: Thu, 1 Sep 2005 12:22:18 +0000 (+0000) Subject: provides ID mapping for entities X-Git-Tag: BR-D5-38-2003_D2005-12-09~49 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=163cba4191ed4961703c261d616c05d8705fbd17;p=modules%2Fvisu.git provides ID mapping for entities --- diff --git a/src/CONVERTOR/VISUConvertor.cxx b/src/CONVERTOR/VISUConvertor.cxx index 9b9499c0..e17c9149 100644 --- a/src/CONVERTOR/VISUConvertor.cxx +++ b/src/CONVERTOR/VISUConvertor.cxx @@ -86,15 +86,17 @@ void parseFile(const char* theFileName) VISU_Convertor::TOutput* aDataSet = aCon->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp); - VISU::PProfile aProfile = aCon->GetProfile(aMeshName,anEntity,aFieldName,aTimeStamp); + + VISU::PIDMapper aPIDMapper = + aCon->GetTimeStampOnMeshIDMapper(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); + int anObjID = aPIDMapper->GetElemObjID(anCellId); + int aVTKID = aPIDMapper->GetElemVTKID(anObjID); cout<GetTimeStampOnGaussPts(aMeshName,anEntity,aFieldName,aTimeStamp); else @@ -104,10 +106,24 @@ void parseFile(const char* theFileName) } //Import mesh on entity + cout << "\n\n ** TEST GetMeshOnEntityIDMapper ***" << endl; aMeshOnEntityMapIter = aMeshOnEntityMap.begin(); for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){ const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first; - aCon->GetMeshOnEntity(aMeshName,anEntity); + VISU_Convertor::TOutput* aDataSet = aCon->GetMeshOnEntity(aMeshName,anEntity); + //pkv f + { + 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); + cout< PProfile; - + //pkv f + struct TIDMapper; + typedef SharedPtr PIDMapper; + // pkv t struct TMeshOnEntity; typedef SharedPtr PMeshOnEntity; @@ -132,10 +135,43 @@ 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 + struct TProfile: virtual TBaseStructure, virtual TIDMapper { + //pkv f + /* virtual vtkIdType GetNodeObjID(vtkIdType theID) const = 0; @@ -159,6 +195,8 @@ namespace VISU virtual vtkCell* GetElemCell(vtkIdType theObjID) = 0; + */ + //pkv t }; @@ -208,7 +246,8 @@ namespace VISU typedef std::map TFamilyMap; typedef std::map TFieldMap; - struct TMeshOnEntity: virtual TBaseStructure + struct TMeshOnEntity: virtual TBaseStructure, + virtual TIDMapper //pkv ft { TGaussMeshMap myGaussMeshMap; TProfileMap myProfileMap; @@ -222,7 +261,8 @@ namespace VISU //--------------------------------------------------------------- - struct TFamily: virtual TIntId + struct TFamily: virtual TIntId, + virtual TIDMapper //pkv ft { TEntity myEntity; TName myName; @@ -232,7 +272,8 @@ namespace VISU //--------------------------------------------------------------- typedef std::set TFamilySet; - struct TGroup: virtual TBaseStructure + struct TGroup: virtual TBaseStructure, + virtual TIDMapper //pkv ft { TFamilySet myFamilySet; }; @@ -360,11 +401,31 @@ public: int theStampsNum) = 0; virtual - VISU::PProfile - GetProfile(const std::string& theMeshName, - const VISU::TEntity& theEntity, - const std::string& theFieldName, - int theStampsNum) = 0; + //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* diff --git a/src/CONVERTOR/VISU_Convertor_impl.cxx b/src/CONVERTOR/VISU_Convertor_impl.cxx index ae616a38..9bfc2b43 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.cxx +++ b/src/CONVERTOR/VISU_Convertor_impl.cxx @@ -261,7 +261,7 @@ namespace VISU { return myNamedPointCoords->GetObjID(theID); } - + vtkIdType TProfileImpl ::GetNodeVTKID(vtkIdType theID) const @@ -321,7 +321,7 @@ namespace VISU vtkIdType aVtkID = GetElemVTKID(theObjID); return GetFilter()->GetOutput()->GetCell(aVtkID); } - + //--------------------------------------------------------------- TGaussSubMeshImpl::TGaussSubMeshImpl(): @@ -442,12 +442,12 @@ namespace VISU //--------------------------------------------------------------- vtkCell* TFamilyImpl - ::GetElemCell(int theObjID) + ::GetElemCell(/*int*/vtkIdType theObjID) //pkv ft { vtkIdType aVtkID = GetElemVTKID(theObjID); return GetSource()->GetCell(aVtkID); } - + //--------------------------------------------------------------- vtkIdType TFamilyImpl ::GetElemVTKID(vtkIdType theID) const @@ -461,15 +461,30 @@ namespace VISU } return -1; } - + //--------------------------------------------------------------- vtkIdType TFamilyImpl ::GetElemObjID(vtkIdType theID) const { return myMeshID[theID]; } - - + //modified by NIZNHY-PKV Thu Sep 1 14:55:37 2005f + //--------------------------------------------------------------- + vtkIdType TFamilyImpl::GetNodeObjID(vtkIdType theID) const + { + return theID; + } + //--------------------------------------------------------------- + vtkIdType TFamilyImpl::GetNodeVTKID(vtkIdType theID) const + { + return theID; + } + //--------------------------------------------------------------- + float* TFamilyImpl::GetNodeCoord(vtkIdType )//theObjID) + { + return NULL; + } + //modified by NIZNHY-PKV Thu Sep 1 14:55:51 2005t //--------------------------------------------------------------- TNbASizeCells TGroupImpl @@ -484,15 +499,15 @@ namespace VISU } return make_pair(aNbCells,aCellsSize); } - + //--------------------------------------------------------------- vtkCell* TGroupImpl - ::GetElemCell(int theObjID) + ::GetElemCell(/*int*/vtkIdType theObjID) //pkv ft { vtkIdType aVtkID = GetElemVTKID(theObjID); return GetFilter()->GetOutput()->GetCell(aVtkID); } - + //--------------------------------------------------------------- vtkIdType TGroupImpl ::GetElemVTKID(vtkIdType theID) const @@ -506,7 +521,7 @@ namespace VISU } return -1; } - + //--------------------------------------------------------------- vtkIdType TGroupImpl ::GetElemObjID(vtkIdType theID) const @@ -517,7 +532,23 @@ namespace VISU const PFamilyImpl& aFamily = myFamilyArr[anInputID]; return aFamily->GetElemObjID(anID); } - + //modified by NIZNHY-PKV Thu Sep 1 15:07:34 2005f + //--------------------------------------------------------------- + vtkIdType TGroupImpl::GetNodeObjID(vtkIdType theID) const + { + return theID; + } + //--------------------------------------------------------------- + vtkIdType TGroupImpl::GetNodeVTKID(vtkIdType theID) const + { + return theID; + } + //--------------------------------------------------------------- + float* TGroupImpl::GetNodeCoord(vtkIdType )//theObjID) + { + return NULL; + } + //modified by NIZNHY-PKV Thu Sep 1 15:07:50 2005t //--------------------------------------------------------------- void @@ -1754,12 +1785,14 @@ VISU_Convertor_impl //--------------------------------------------------------------- -VISU::PProfile -VISU_Convertor_impl -::GetProfile(const std::string& theMeshName, - const VISU::TEntity& theEntity, - const std::string& theFieldName, - int theStampsNum) +//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, @@ -1770,8 +1803,47 @@ VISU_Convertor_impl 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 f2f09b2b..22f2f999 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.hxx +++ b/src/CONVERTOR/VISU_Convertor_impl.hxx @@ -200,7 +200,7 @@ namespace VISU { TProfileImpl(); bool myIsAll; - + virtual vtkIdType GetNodeObjID(vtkIdType theID) const; @@ -224,7 +224,7 @@ namespace VISU virtual vtkCell* GetElemCell(vtkIdType theObjID); - + TID2ID myElemObj2VTKID; TSubProfileArr mySubProfileArr; PNamedPointCoords myNamedPointCoords; @@ -338,9 +338,22 @@ namespace VISU struct TFamilyImpl: virtual TFamily, virtual TSource { + // pkv f + vtkIdType + GetNodeObjID(vtkIdType theID) const ; + + virtual + vtkIdType + GetNodeVTKID(vtkIdType theID) const ; + + virtual + float* + GetNodeCoord(vtkIdType theObjID) ; + //pkv t + virtual vtkCell* - GetElemCell(int theObjID); + GetElemCell(/*int*/vtkIdType theObjID);//pkv ft virtual vtkIdType @@ -370,7 +383,7 @@ namespace VISU virtual vtkCell* - GetElemCell(int theObjID); + GetElemCell(/*int*/vtkIdType theObjID);//pkv ft virtual vtkIdType @@ -380,6 +393,20 @@ namespace VISU vtkIdType GetElemObjID(vtkIdType theID) const; + //pkv f + virtual + vtkIdType + GetNodeObjID(vtkIdType theID) const; + + virtual + vtkIdType + GetNodeVTKID(vtkIdType theID) const; + + virtual + float* + GetNodeCoord(vtkIdType theObjID); + //pkv t + TID2ID myElemObj2VTKID; TFamilyArr myFamilyArr; PNamedPointCoords myNamedPointCoords; @@ -546,11 +573,29 @@ public: const std::string& theFieldName, int theStampsNum); virtual - VISU::PProfile - GetProfile(const std::string& theMeshName, - const VISU::TEntity& theEntity, - const std::string& theFieldName, - int theStampsNum); + //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* diff --git a/src/PIPELINE/VISU_PipeLine.cxx b/src/PIPELINE/VISU_PipeLine.cxx index b472e1b6..05ae01be 100644 --- a/src/PIPELINE/VISU_PipeLine.cxx +++ b/src/PIPELINE/VISU_PipeLine.cxx @@ -354,5 +354,21 @@ VISU_PipeLine { return NULL; } - - +//modified by NIZNHY-PKV Thu Sep 1 16:16:05 2005f +//======================================================================= +//function : VISU_PipeLine::SetIdMapper +//purpose : +//======================================================================= +void VISU_PipeLine::SetIDMapper(const VISU::PIDMapper& theIDMapper) +{ + myIDMapper=theIDMapper; +} +//======================================================================= +//function : VISU_PipeLine::GetIDMapper +//purpose : +//======================================================================= +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 0da0e50e..bf43f17a 100644 --- a/src/PIPELINE/VISU_PipeLine.hxx +++ b/src/PIPELINE/VISU_PipeLine.hxx @@ -31,10 +31,11 @@ #include #include - //pkv f -class vtkCell; +#include //pkv t + +class vtkCell; template class TVTKSmartPtr: public vtkSmartPointer { @@ -129,6 +130,10 @@ public: vtkCell* GetElemCell(vtkIdType theObjID); + void SetIDMapper(const VISU::PIDMapper& theIDMapper); + + const VISU::PIDMapper& GetIDMapper()const; + protected: VISU_PipeLine(); VISU_PipeLine(const VISU_PipeLine&); @@ -143,6 +148,10 @@ protected: // Clipping planes TVTKSmartPtr myExtractGeometry; + // + //pkv f + VISU::PIDMapper myIDMapper; + //pkv t }; #endif diff --git a/src/PIPELINE/VISU_ScalarMapPL.cxx b/src/PIPELINE/VISU_ScalarMapPL.cxx index 83a626eb..86235fa8 100644 --- a/src/PIPELINE/VISU_ScalarMapPL.cxx +++ b/src/PIPELINE/VISU_ScalarMapPL.cxx @@ -132,7 +132,8 @@ VISU_ScalarMapPL::THook* VISU_ScalarMapPL::DoHook(){ void VISU_ScalarMapPL::Init(){ //SetSourceRange(); } - +//modified by NIZNHY-PKV Thu Sep 1 16:25:25 2005f +/* void VISU_ScalarMapPL ::SetProfile(const VISU::PProfile& theProfile) @@ -146,27 +147,37 @@ VISU_ScalarMapPL { return myProfile; } - +*/ +//modified by NIZNHY-PKV Thu Sep 1 16:25:30 2005t vtkIdType VISU_ScalarMapPL ::GetNodeObjID(vtkIdType theID) { vtkIdType anID = VISU_PipeLine::GetNodeObjID(theID); - return myProfile->GetNodeObjID(anID); + //modified by NIZNHY-PKV Thu Sep 1 16:26:06 2005f + //return myProfile->GetNodeObjID(anID); + return myIDMapper->GetNodeObjID(anID); + //modified by NIZNHY-PKV Thu Sep 1 16:26:09 2005t } vtkIdType VISU_ScalarMapPL ::GetNodeVTKID(vtkIdType theID) { - return myProfile->GetNodeVTKID(theID); + //modified by NIZNHY-PKV Thu Sep 1 16:26:32 2005f + //return myProfile->GetNodeVTKID(theID); + return myIDMapper->GetNodeVTKID(theID); + //modified by NIZNHY-PKV Thu Sep 1 16:26:34 2005t } float* VISU_ScalarMapPL ::GetNodeCoord(int theObjID) { - return GetProfile()->GetNodeCoord(theObjID); + //modified by NIZNHY-PKV Thu Sep 1 16:27:21 2005f + //return GetProfile()->GetNodeCoord(theObjID); + return myIDMapper->GetNodeCoord(theObjID); + //modified by NIZNHY-PKV Thu Sep 1 16:27:24 2005t } vtkIdType @@ -174,21 +185,30 @@ VISU_ScalarMapPL ::GetElemObjID(vtkIdType theID) { vtkIdType anID = VISU_PipeLine::GetElemObjID(theID); - return myProfile->GetElemObjID(anID); + //modified by NIZNHY-PKV Thu Sep 1 16:27:52 2005f + //return myProfile->GetElemObjID(anID); + return myIDMapper->GetElemObjID(anID);return myIDMapper->GetElemObjID(anID); + //modified by NIZNHY-PKV Thu Sep 1 16:27:54 2005t } vtkIdType VISU_ScalarMapPL ::GetElemVTKID(vtkIdType theID) { - return myProfile->GetElemVTKID(theID); + //modified by NIZNHY-PKV Thu Sep 1 16:28:32 2005f + // return myProfile->GetElemVTKID(theID); + return myIDMapper->GetElemVTKID(theID); + //modified by NIZNHY-PKV Thu Sep 1 16:28:35 2005t } vtkCell* VISU_ScalarMapPL:: GetElemCell(vtkIdType theObjID) { - return GetProfile()->GetElemCell(theObjID); + //modified by NIZNHY-PKV Thu Sep 1 16:28:53 2005f + // return GetProfile()->GetElemCell(theObjID); + return myIDMapper->GetElemCell(theObjID); + //modified by NIZNHY-PKV Thu Sep 1 16:28:59 2005t } diff --git a/src/PIPELINE/VISU_ScalarMapPL.hxx b/src/PIPELINE/VISU_ScalarMapPL.hxx index f7a38afc..68a33af1 100644 --- a/src/PIPELINE/VISU_ScalarMapPL.hxx +++ b/src/PIPELINE/VISU_ScalarMapPL.hxx @@ -31,12 +31,11 @@ #include "VISU_PipeLine.hxx" #include "VISU_ScalarBarActor.hxx" -#include - -class vtkDataSet; //pkv f -class vtkCell; +//#include //pkv t +class vtkDataSet; +class vtkCell; class VISU_Extractor; class VISU_FieldTransform; @@ -78,12 +77,15 @@ public: virtual void GetSourceRange(float theRange[2]); virtual void SetSourceRange(); + //pkv f + /* void SetProfile(const VISU::PProfile& theProfile); const VISU::PProfile& GetProfile()const; - + */ + //pkv t virtual vtkIdType GetNodeObjID(vtkIdType theID); @@ -115,7 +117,7 @@ protected: VISU_LookupTable *myMapperTable, *myBarTable; VISU_FieldTransform *myFieldTransform; VISU_Extractor* myExtractor; - VISU::PProfile myProfile; + //VISU::PProfile myProfile;//pkv ft }; #endif diff --git a/src/VISU_I/VISU_ScalarMap_i.cc b/src/VISU_I/VISU_ScalarMap_i.cc index 0bc6cd2a..c602b718 100644 --- a/src/VISU_I/VISU_ScalarMap_i.cc +++ b/src/VISU_I/VISU_ScalarMap_i.cc @@ -468,7 +468,9 @@ void VISU::ScalarMap_i::DoSetInput(Result_i* theResult){ 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->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->Build(); }