From: apo Date: Mon, 29 Aug 2005 06:15:12 +0000 (+0000) Subject: To introduce ID's mapping X-Git-Tag: BR-D5-38-2003_D2005-12-09~90 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e109e6af88f5481836d04a162527f8e139aa7ea2;p=modules%2Fvisu.git To introduce ID's mapping --- diff --git a/src/CONVERTOR/VISU_Convertor.hxx b/src/CONVERTOR/VISU_Convertor.hxx index e7d04964..718e18ff 100644 --- a/src/CONVERTOR/VISU_Convertor.hxx +++ b/src/CONVERTOR/VISU_Convertor.hxx @@ -137,11 +137,11 @@ namespace VISU { virtual vtkIdType - GetNodeObjId(int theVtkI) const = 0; + GetNodeObjID(int theVtkI) const = 0; virtual vtkIdType - GetElemObjId(int theVtkI) const = 0; + GetElemObjID(int theVtkI) const = 0; }; @@ -174,7 +174,7 @@ namespace VISU { virtual TGaussPointID - GetObjId(int theVtkI) const = 0; + GetObjID(int theVtkI) const = 0; }; diff --git a/src/CONVERTOR/VISU_Convertor_impl.cxx b/src/CONVERTOR/VISU_Convertor_impl.cxx index ffda7dc5..65973f9f 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.cxx +++ b/src/CONVERTOR/VISU_Convertor_impl.cxx @@ -153,10 +153,12 @@ namespace VISU void TNamedPointCoords ::Init(vtkIdType theNbPoints, - vtkIdType theDim) + vtkIdType theDim, + const TVectorID& theVectorID) { TPointCoords::Init(theNbPoints,theDim); myPointsDim.resize(theDim); + myVectorID = theVectorID; } std::string& @@ -173,8 +175,20 @@ namespace VISU return myPointsDim[theDim]; } + vtkIdType + TNamedPointCoords + ::GetObjID(vtkIdType theID) const + { + if(myVectorID.empty()) + return theID; + else + return myVectorID[theID]; + } + + //--------------------------------------------------------------- TMeshImpl::TMeshImpl(): + myNamedPointCoords(new TNamedPointCoords()), myPoints(vtkPoints::New()), myNbPoints(0) { @@ -192,14 +206,14 @@ namespace VISU vtkIdType TSubProfileImpl - ::GetNodeObjId(vtkIdType theID) const + ::GetNodeObjID(vtkIdType theID) const { return theID; } vtkIdType TSubProfileImpl - ::GetElemObjId(vtkIdType theID) const + ::GetElemObjID(vtkIdType theID) const { return theID; } @@ -225,24 +239,24 @@ namespace VISU vtkIdType TProfileImpl - ::GetNodeObjId(vtkIdType theID) const + ::GetNodeObjID(vtkIdType theID) const { vtkIdType anInputID; const TVTKAppendFilter& anAppendFilter = GetFilter(); vtkIdType aID = anAppendFilter->GetNodeObjId(theID,anInputID); const TSubProfileImpl& aSubProfileImpl = mySubProfileArr[anInputID]; - return aSubProfileImpl.GetNodeObjId(aID); + return aSubProfileImpl.GetNodeObjID(aID); } vtkIdType TProfileImpl - ::GetElemObjId(vtkIdType theID) const + ::GetElemObjID(vtkIdType theID) const { vtkIdType anInputID; const TVTKAppendFilter& anAppendFilter = GetFilter(); vtkIdType aID = anAppendFilter->GetElemObjId(theID,anInputID); const TSubProfileImpl& aSubProfileImpl = mySubProfileArr[anInputID]; - return aSubProfileImpl.GetElemObjId(aID); + return aSubProfileImpl.GetElemObjID(aID); } @@ -287,7 +301,7 @@ namespace VISU //--------------------------------------------------------------- TGaussPointID TGaussMeshImpl - ::GetObjId(int theVtkI) const + ::GetObjID(int theVtkI) const { TGaussPointID aRetVID; int aID, anIndexDS; diff --git a/src/CONVERTOR/VISU_Convertor_impl.hxx b/src/CONVERTOR/VISU_Convertor_impl.hxx index 0d95088c..64b33f0b 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.hxx +++ b/src/CONVERTOR/VISU_Convertor_impl.hxx @@ -113,32 +113,41 @@ namespace VISU const TVTKPoints& GetPoints() const { return myPoints;} }; + typedef SharedPtr PPointCoords; //--------------------------------------------------------------- + typedef TVector TVectorID; class TNamedPointCoords: public virtual TPointCoords { typedef TVector TPointsDim; TPointsDim myPointsDim; + TVectorID myVectorID; public: void Init(vtkIdType theNbPoints, - vtkIdType theDim); + vtkIdType theDim, + const TVectorID& theVectorID = TVectorID()); std::string& GetName(vtkIdType theDim); const std::string& GetName(vtkIdType theDim) const; + + virtual + vtkIdType + GetObjID(vtkIdType theID) const; }; + typedef SharedPtr PNamedPointCoords; //--------------------------------------------------------------- struct TMeshImpl: virtual TMesh, virtual TIsVTKDone { - TNamedPointCoords myNamedPointCoords; + PNamedPointCoords myNamedPointCoords; TVTKPoints myPoints; vtkIdType myNbPoints; @@ -162,11 +171,11 @@ namespace VISU virtual vtkIdType - GetNodeObjId(int theVtkI) const; + GetNodeObjID(int theVtkI) const; virtual vtkIdType - GetElemObjId(int theVtkI) const; + GetElemObjID(int theVtkI) const; ESubMeshStatus myStatus; TSubMeshID mySubMeshID; @@ -185,11 +194,13 @@ namespace VISU virtual vtkIdType - GetNodeObjId(int theVtkI) const; + GetNodeObjID(int theVtkI) const; virtual vtkIdType - GetElemObjId(int theVtkI) const; + GetElemObjID(int theVtkI) const; + + PNamedPointCoords myNamedPointCoords; TSubProfileArr mySubProfileArr; TGeom2SubProfile myGeom2SubProfile; @@ -233,7 +244,7 @@ namespace VISU virtual TGaussPointID - GetObjId(int theVtkI) const; + GetObjID(int theVtkI) const; TGaussSubMeshArr myGaussSubMeshArr; TGeom2GaussSubMesh myGeom2GaussSubMesh; diff --git a/src/CONVERTOR/VISU_MedConvertor.cxx b/src/CONVERTOR/VISU_MedConvertor.cxx index 0023e3b8..33054723 100644 --- a/src/CONVERTOR/VISU_MedConvertor.cxx +++ b/src/CONVERTOR/VISU_MedConvertor.cxx @@ -738,16 +738,19 @@ namespace //--------------------------------------------------------------- vtkIdType TMEDSubProfile - ::GetNodeObjId(vtkIdType theID) const + ::GetNodeObjID(vtkIdType theID) const { - return theID; + return myNamedPointCoords->GetObjID(theID); } vtkIdType TMEDSubProfile - ::GetElemObjId(vtkIdType theID) const + ::GetElemObjID(vtkIdType theID) const { - return theID; + if(myIsElemNum) + return myElemNum[theID]; + else + return theID; } @@ -985,7 +988,10 @@ VISU_MedConvertor TInt aDim = theMesh->myDim; TNamedPointCoords& aCoords = theMesh->myNamedPointCoords; - aCoords.Init(aNbElem,aDim); + if(EBooleen anIsNodeNum = aNodeInfo->IsElemNum()) + aCoords.Init(aNbElem,aDim,aNodeInfo->myElemNum); + else + aCoords.Init(aNbElem,aDim); for(int iDim = 0; iDim < aDim; iDim++) aCoords.GetName(iDim) = aNodeInfo->GetCoordName(iDim); @@ -1231,7 +1237,9 @@ VISU_MedConvertor //--------------------------------------------------------------- void -LoadProfile(MED::TTimeStampVal& theTimeStampVal, +LoadProfile(const MED::PWrapper& theMed, + VISU::PMEDMesh theMesh, + MED::TTimeStampVal& theTimeStampVal, VISU::TMEDValForTime& theValForTime, VISU::TMEDMeshOnEntity& theMeshOnEntity) { @@ -1268,7 +1276,29 @@ LoadProfile(MED::TTimeStampVal& theTimeStampVal, endl); } } + { + const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo; + MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(aMeshInfo); + + TEntity aVEntity = theMeshOnEntity.myEntity; + MED::EEntiteMaillage aMEntity = VTKEntityToMED(aVEntity); + + const TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile; + TGeom2SubProfile::const_iterator anIter = aGeom2SubProfile.begin(); + for(; anIter != aGeom2SubProfile.end(); anIter++){ + const PMEDSubProfile& aSubProfile = anIter->second; + MED::EGeometrieElement aMGeom = aSubProfile->myMGeom; + MED::PCellInfo aCellInfo = theMed->GetPCellInfo(aMeshInfo, + aMEntity, + aMGeom); + + aSubProfile->myIsElemNum = aCellInfo->IsElemNum(); + if(aSubProfile->myIsElemNum) + aSubProfile->myElemNum = aCellInfo->myElemNum; + aSubProfile->myNamedPointCoords = theMesh->myNamedPointCoords; + } + } aProfile->myIsDone = true; } @@ -1438,7 +1468,9 @@ LoadValForTime(const MED::PWrapper& theMed, aMKey2Profile, aKey2Gauss); - LoadProfile(aTimeStampVal, + LoadProfile(theMed, + theMesh, + aTimeStampVal, theValForTime, theMeshOnEntity); diff --git a/src/CONVERTOR/VISU_MedConvertor.hxx b/src/CONVERTOR/VISU_MedConvertor.hxx index 11421033..fd51f28f 100644 --- a/src/CONVERTOR/VISU_MedConvertor.hxx +++ b/src/CONVERTOR/VISU_MedConvertor.hxx @@ -31,16 +31,18 @@ namespace VISU struct TMEDSubProfile: virtual TSubProfileImpl { MED::EGeometrieElement myMGeom; + MED::EBooleen myIsElemNum; MED::TElemNum myElemNum; + PNamedPointCoords myNamedPointCoords; virtual vtkIdType - GetNodeObjId(vtkIdType theID) const; + GetNodeObjID(vtkIdType theID) const; virtual vtkIdType - GetElemObjId(vtkIdType theID) const; + GetElemObjID(vtkIdType theID) const; }; typedef SharedPtr PMEDSubProfile;