From d78c74ad73de05c07217fde185e6abd4d69f26be Mon Sep 17 00:00:00 2001 From: apo Date: Mon, 29 Aug 2005 05:15:43 +0000 Subject: [PATCH] To introduce ID's --- src/CONVERTOR/VISUConvertor.cxx | 2 +- src/CONVERTOR/VISU_Convertor_impl.cxx | 94 ++++++++++++++++++--------- src/CONVERTOR/VISU_Convertor_impl.hxx | 65 +++++++++--------- src/CONVERTOR/VISU_MedConvertor.cxx | 31 ++++++++- src/CONVERTOR/VISU_MedConvertor.hxx | 13 +++- src/VISU_I/VISU_CorbaMedConvertor.hxx | 2 +- src/VISU_I/VISU_GaussPoints_i.cc | 2 +- 7 files changed, 143 insertions(+), 66 deletions(-) diff --git a/src/CONVERTOR/VISUConvertor.cxx b/src/CONVERTOR/VISUConvertor.cxx index 716ab8e6..3e0d804a 100644 --- a/src/CONVERTOR/VISUConvertor.cxx +++ b/src/CONVERTOR/VISUConvertor.cxx @@ -88,7 +88,7 @@ void parseFile(const char* theFileName) //int aNbNodes, aNbCells, i; //VISU::TGaussPointID aID; // - aOut=aCon->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp); + aOut=aCon->GetTimeStampOnGaussPts(aMeshName,anEntity,aFieldName,aTimeStamp); //aNbNodes=aOut->GetNumberOfPoints(); //aNbCells=aOut->GetNumberOfCells(); diff --git a/src/CONVERTOR/VISU_Convertor_impl.cxx b/src/CONVERTOR/VISU_Convertor_impl.cxx index f8b627fd..ffda7dc5 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.cxx +++ b/src/CONVERTOR/VISU_Convertor_impl.cxx @@ -59,7 +59,7 @@ static int MYVTKDEBUG = 0; #ifdef _DEBUG_ static int MYDEBUG = 1; -static int MYDEBUGWITHFILES = 0; +static int MYDEBUGWITHFILES = 1; #else static int MYDEBUG = 0; static int MYDEBUGWITHFILES = 0; @@ -190,6 +190,21 @@ namespace VISU } + vtkIdType + TSubProfileImpl + ::GetNodeObjId(vtkIdType theID) const + { + return theID; + } + + vtkIdType + TSubProfileImpl + ::GetElemObjId(vtkIdType theID) const + { + return theID; + } + + //--------------------------------------------------------------- bool operator<(const PSubProfile& theLeft, const PSubProfile& theRight) @@ -208,6 +223,28 @@ namespace VISU myIsAll(true) {} + vtkIdType + TProfileImpl + ::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); + } + + vtkIdType + TProfileImpl + ::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); + } + //--------------------------------------------------------------- TGaussSubMeshImpl::TGaussSubMeshImpl(): @@ -248,7 +285,9 @@ namespace VISU {} //--------------------------------------------------------------- - TGaussPointID TGaussMeshImpl::GetObjId(int theVtkI) + TGaussPointID + TGaussMeshImpl + ::GetObjId(int theVtkI) const { TGaussPointID aRetVID; int aID, anIndexDS; @@ -257,7 +296,7 @@ namespace VISU const TVTKAppendFilter& anAppendFilter = GetFilter(); aID=anAppendFilter->GetElemObjId(theVtkI, anIndexDS); // - TGaussSubMeshImpl& aSubMeshImpl=myGaussSubMeshArr[anIndexDS]; + const TGaussSubMeshImpl& aSubMeshImpl = myGaussSubMeshArr[anIndexDS]; aVID=(vtkIdType)aID; aRetVID=aSubMeshImpl.GetObjID(aVID); return aRetVID; @@ -333,7 +372,7 @@ namespace VISU vtkIdType anId = theElemId; for(vtkIdType aCompId = 0; aCompId < myNbComp; aCompId++){ aValueSliceArr[aCompId] = - TCValueSlice(myValue,std::slice(anId,myNbGauss,myNbGauss)); + TCValueSlice(myValue,std::slice(anId,myNbGauss,myNbComp)); anId += 1; } return aValueSliceArr; @@ -344,10 +383,10 @@ namespace VISU ::GetCompValueSliceArr(vtkIdType theElemId) { TValueSliceArr aValueSliceArr(myNbComp); - vtkIdType anId = theElemId*myStep; + vtkIdType anId = theElemId; for(vtkIdType aCompId = 0; aCompId < myNbComp; aCompId++){ aValueSliceArr[aCompId] = - TValueSlice(myValue,std::slice(anId,myNbGauss,myNbGauss)); + TValueSlice(myValue,std::slice(anId,myNbGauss,myNbComp)); anId += 1; } return aValueSliceArr; @@ -375,13 +414,6 @@ namespace VISU int TValForTimeImpl ::GetNbGauss(vtkIdType theGeom) const - { - return myNbGauss; - } - - int - TGaussPtsValForTimeImpl - ::GetNbGauss(vtkIdType theGeom) const { if(PGaussMeshImpl aGaussMesh = myGaussMesh){ const TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh; @@ -394,7 +426,7 @@ namespace VISU } return myNbGauss; } - + //--------------------------------------------------------------- vtkIdType @@ -971,7 +1003,7 @@ namespace void GetTimeStampOnGaussMesh(const TVTKSource& theSource, const PFieldImpl& theField, - const PGaussPtsValForTimeImpl& theValForTime) + const PValForTimeImpl& theValForTime) { int aNbTuples = theSource->GetNumberOfPoints(); std::string aFieldName = GenerateFieldName(theField,theValForTime); @@ -1354,7 +1386,7 @@ VISU_Convertor_impl PMeshImpl aMesh = boost::get<0>(aFindTimeStamp); PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindTimeStamp); PMeshOnEntityImpl aVTKMeshOnEntity = boost::get<2>(aFindTimeStamp); - PGaussPtsValForTimeImpl aValForTime = boost::get<4>(aFindTimeStamp); + PValForTimeImpl aValForTime = boost::get<4>(aFindTimeStamp); PFieldImpl aField = boost::get<3>(aFindTimeStamp); //Main part of code @@ -1420,12 +1452,12 @@ VISU_Convertor_impl //--------------------------------------------------------------- VISU_Convertor::TOutput* VISU_Convertor_impl -::GetGaussPointsOnMesh(const string& theMeshName, - const VISU::TEntity& theEntity, - const string& theFieldName, - int theStampsNum) +::GetTimeStampOnGaussPts(const string& theMeshName, + const VISU::TEntity& theEntity, + const string& theFieldName, + int theStampsNum) { - INITMSG(MYDEBUG,"GetGaussPointsOnMesh"<< + INITMSG(MYDEBUG,"GetTimeStampOnGaussPts"<< "; theMeshName = '"<(aFindTimeStamp); PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindTimeStamp); PMeshOnEntityImpl aVTKMeshOnEntity = aMeshOnEntity; - PGaussPtsValForTimeImpl aValForTime = boost::get<4>(aFindTimeStamp); + PValForTimeImpl aValForTime = boost::get<4>(aFindTimeStamp); PFieldImpl aField = boost::get<3>(aFindTimeStamp); //Main part of code @@ -1456,10 +1488,8 @@ VISU_Convertor_impl GetMeshOnEntity(aVTKMeshOnEntity->myMeshName,aVTKMeshOnEntity->myEntity); PGaussMeshImpl aGaussMesh = aValForTime->myGaussMesh; - INITMSG(MYDEBUG,"aGaussMesh = "<myGeom2GaussSubMesh; BuildGaussMesh(aMesh,aVTKMeshOnEntity,aGaussMesh); - //GetGaussMesh(aMesh,aVTKMeshOnEntity,aGaussMesh); const TVTKAppendFilter& anAppendFilter = aGaussMesh->GetFilter(); aSource->ShallowCopy(anAppendFilter->GetOutput()); @@ -1497,18 +1527,20 @@ VISU_Convertor_impl } //--------------------------------------------------------------- -VISU::PGaussMesh VISU_Convertor_impl::GetGaussMesh(const string& theMeshName, - const VISU::TEntity& theEntity, - const string& theFieldName, - int theStampsNum) +VISU::PGaussMesh +VISU_Convertor_impl +::GetGaussMesh(const string& theMeshName, + const VISU::TEntity& theEntity, + const string& theFieldName, + int theStampsNum) { - GetTimeStampOnMesh(theMeshName, theEntity, theFieldName, theStampsNum); + GetTimeStampOnGaussPts(theMeshName, theEntity, theFieldName, theStampsNum); TFindTimeStamp aFindTimeStamp = FindTimeStamp(theMeshName, theEntity, theFieldName, theStampsNum); - PGaussPtsValForTimeImpl aValForTime = boost::get<4>(aFindTimeStamp); + PValForTimeImpl aValForTime = boost::get<4>(aFindTimeStamp); PGaussMeshImpl aGaussMesh=aValForTime->myGaussMesh; return aGaussMesh; @@ -1775,7 +1807,7 @@ VISU_Convertor_impl PMeshImpl aMesh = boost::get<0>(aFindField); PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindField); PMeshOnEntityImpl aVTKMeshOnEntity = boost::get<2>(aFindField); - PGaussPtsValForTimeImpl aValForTime = aValFieldIter->second; + PValForTimeImpl aValForTime = aValFieldIter->second; return TFindTimeStamp(aMesh, aMeshOnEntity, diff --git a/src/CONVERTOR/VISU_Convertor_impl.hxx b/src/CONVERTOR/VISU_Convertor_impl.hxx index df319f0f..0d95088c 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.hxx +++ b/src/CONVERTOR/VISU_Convertor_impl.hxx @@ -160,6 +160,14 @@ namespace VISU vtkIdType myGeom; std::string myName; + virtual + vtkIdType + GetNodeObjId(int theVtkI) const; + + virtual + vtkIdType + GetElemObjId(int theVtkI) const; + ESubMeshStatus myStatus; TSubMeshID mySubMeshID; }; @@ -167,12 +175,23 @@ namespace VISU //--------------------------------------------------------------- - typedef std::map TGeom2SubProfile; + typedef std::vector TSubProfileArr; + typedef std::map TGeom2SubProfile; struct TProfileImpl: virtual TProfile, virtual TAppendFilter { TProfileImpl(); bool myIsAll; + + virtual + vtkIdType + GetNodeObjId(int theVtkI) const; + + virtual + vtkIdType + GetElemObjId(int theVtkI) const; + + TSubProfileArr mySubProfileArr; TGeom2SubProfile myGeom2SubProfile; }; typedef SharedPtr PProfileImpl; @@ -211,7 +230,11 @@ namespace VISU struct TGaussMeshImpl: virtual TGaussMesh, virtual TAppendFilter { TGaussMeshImpl(); - virtual TGaussPointID GetObjId(int theVtkI); + + virtual + TGaussPointID + GetObjId(int theVtkI) const; + TGaussSubMeshArr myGaussSubMeshArr; TGeom2GaussSubMesh myGeom2GaussSubMesh; }; @@ -308,32 +331,16 @@ namespace VISU TMeshValue& GetMeshValue(vtkIdType theGeom); - int myNbGauss; - - virtual - int - GetNbGauss(vtkIdType theGeom) const; - }; - typedef SharedPtr PValForTimeImpl; - - - //--------------------------------------------------------------- - struct TMeshValForTimeImpl: virtual TMeshValForTime, virtual TValForTimeImpl - { TSource myMeshSource; - }; - - - //--------------------------------------------------------------- - struct TGaussPtsValForTimeImpl: virtual TGaussPtsValForTime, virtual TMeshValForTimeImpl - { TSource myGaussPtsSource; + int myNbGauss; + virtual int GetNbGauss(vtkIdType theGeom) const; }; - typedef SharedPtr PGaussPtsValForTimeImpl; + typedef SharedPtr PValForTimeImpl; //--------------------------------------------------------------- @@ -413,19 +420,19 @@ 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 - TOutput* - GetGaussPointsOnMesh(const std::string& theMeshName, - const VISU::TEntity& theEntity, - const std::string& theFieldName, - int theStampsNum); - protected: VISU::PMeshImpl FindMesh(const std::string& theMeshName); @@ -454,7 +461,7 @@ protected: VISU::PMeshOnEntityImpl, VISU::PMeshOnEntityImpl, VISU::PFieldImpl, - VISU::PGaussPtsValForTimeImpl> TFindTimeStamp; + VISU::PValForTimeImpl> TFindTimeStamp; TFindTimeStamp FindTimeStamp(const std::string& theMeshName, const VISU::TEntity& theEntity, diff --git a/src/CONVERTOR/VISU_MedConvertor.cxx b/src/CONVERTOR/VISU_MedConvertor.cxx index f0ec57c0..0023e3b8 100644 --- a/src/CONVERTOR/VISU_MedConvertor.cxx +++ b/src/CONVERTOR/VISU_MedConvertor.cxx @@ -49,8 +49,8 @@ using MED::EBooleen; #ifdef _DEBUG_ static int MYDEBUG = 1; static int MYVALUEDEBUG = 0; -static int MY_FAMILY_DEBUG = 0; -static int MY_GROUP_DEBUG = 0; +static int MY_FAMILY_DEBUG = 1; +static int MY_GROUP_DEBUG = 1; #else static int MYDEBUG = 0; static int MYVALUEDEBUG = 0; @@ -243,6 +243,15 @@ namespace vtkIdType aVGeom = aSubProfile->myGeom; aGeom2SubProfile[aVGeom] = aSubProfile; } + { + TSubProfileArr& aSubProfileArr = aProfile->mySubProfileArr; + aSubProfileArr.resize(aGeom2SubProfile.size()); + TGeom2SubProfile::const_iterator anIter = aGeom2SubProfile.begin(); + for(TInt anID = 0; anIter != aGeom2SubProfile.end(); anIter++, anID++){ + const PSubProfileImpl& aSubProfile = anIter->second; + aSubProfileArr[anID] = aSubProfile; + } + } aProfileMap[aProfileKey] = aProfile; theValForTime.myProfile = aProfile; } @@ -725,6 +734,24 @@ namespace } } + + //--------------------------------------------------------------- + vtkIdType + TMEDSubProfile + ::GetNodeObjId(vtkIdType theID) const + { + return theID; + } + + vtkIdType + TMEDSubProfile + ::GetElemObjId(vtkIdType theID) const + { + return theID; + } + + + //--------------------------------------------------------------- TGaussPointID TMEDGaussSubMesh ::GetObjID(vtkIdType theID) const diff --git a/src/CONVERTOR/VISU_MedConvertor.hxx b/src/CONVERTOR/VISU_MedConvertor.hxx index 6bfb8a21..11421033 100644 --- a/src/CONVERTOR/VISU_MedConvertor.hxx +++ b/src/CONVERTOR/VISU_MedConvertor.hxx @@ -31,6 +31,17 @@ namespace VISU struct TMEDSubProfile: virtual TSubProfileImpl { MED::EGeometrieElement myMGeom; + MED::EBooleen myIsElemNum; + MED::TElemNum myElemNum; + + virtual + vtkIdType + GetNodeObjId(vtkIdType theID) const; + + virtual + vtkIdType + GetElemObjId(vtkIdType theID) const; + }; typedef SharedPtr PMEDSubProfile; @@ -95,7 +106,7 @@ namespace VISU //--------------------------------------------------------------- - struct TMEDValForTime: virtual TGaussPtsValForTimeImpl + struct TMEDValForTime: virtual TValForTimeImpl {}; typedef SharedPtr PMEDValForTime; diff --git a/src/VISU_I/VISU_CorbaMedConvertor.hxx b/src/VISU_I/VISU_CorbaMedConvertor.hxx index 35ff1aca..6366a060 100644 --- a/src/VISU_I/VISU_CorbaMedConvertor.hxx +++ b/src/VISU_I/VISU_CorbaMedConvertor.hxx @@ -79,7 +79,7 @@ namespace VISU //--------------------------------------------------------------- - struct TCValForTime: virtual TGaussPtsValForTimeImpl + struct TCValForTime: virtual TValForTimeImpl { SALOME_MED::FIELD_var myField; }; diff --git a/src/VISU_I/VISU_GaussPoints_i.cc b/src/VISU_I/VISU_GaussPoints_i.cc index 71c175e5..e1207625 100644 --- a/src/VISU_I/VISU_GaussPoints_i.cc +++ b/src/VISU_I/VISU_GaussPoints_i.cc @@ -133,7 +133,7 @@ VISU::GaussPoints_i if(myField == NULL) throw std::runtime_error("There is no Field with the parameters !!!"); VISU_Convertor::TOutput *anOutput = - theResult->GetInput()->GetGaussPointsOnMesh(myMeshName,myEntity,myFieldName,myIteration); + theResult->GetInput()->GetTimeStampOnGaussPts(myMeshName,myEntity,myFieldName,myIteration); if(anOutput == NULL) throw std::runtime_error("There is no TimeStamp with the parameters !!!"); myScalarMapPL->SetInput(anOutput); -- 2.39.2