From: apo Date: Wed, 31 Aug 2005 11:22:46 +0000 (+0000) Subject: Minor changes X-Git-Tag: BR-D5-38-2003_D2005-12-09~60 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=506586a96de7ffc83ca2a5a3dfb361989694b11f;p=modules%2Fvisu.git Minor changes --- diff --git a/src/CONVERTOR/VISUConvertor.cxx b/src/CONVERTOR/VISUConvertor.cxx index b789f480..c42a184d 100644 --- a/src/CONVERTOR/VISUConvertor.cxx +++ b/src/CONVERTOR/VISUConvertor.cxx @@ -46,7 +46,7 @@ static int MYDEBUG = 1; static int MYDEBUG = 0; #endif -#define _DEXCEPT_ +//#define _DEXCEPT_ typedef vtkUnstructuredGrid TOutput; diff --git a/src/CONVERTOR/VISU_Convertor_impl.cxx b/src/CONVERTOR/VISU_Convertor_impl.cxx index a561d57f..4bf49421 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.cxx +++ b/src/CONVERTOR/VISU_Convertor_impl.cxx @@ -59,13 +59,13 @@ static int MYVTKDEBUG = 0; #ifdef _DEBUG_ static int MYDEBUG = 1; -static int MYDEBUGWITHFILES = 1; +static int MYDEBUGWITHFILES = 0; #else static int MYDEBUG = 0; static int MYDEBUGWITHFILES = 0; #endif -#define _DEXCEPT_ +//#define _DEXCEPT_ namespace VISU { @@ -268,7 +268,7 @@ namespace VISU { vtkIdType anInputID; const TVTKAppendFilter& anAppendFilter = GetFilter(); - vtkIdType aID = anAppendFilter->GetElemObjId(theID,anInputID); + vtkIdType aID = anAppendFilter->GetCellInputID(theID,anInputID); const TSubProfileImpl& aSubProfileImpl = mySubProfileArr[anInputID]; return aSubProfileImpl.GetElemObjID(aID); } @@ -280,7 +280,7 @@ namespace VISU if(myElemObj2VTKID.empty()) return theID; else{ - TElemObj2VTKID::const_iterator anIter = myElemObj2VTKID.find(theID); + TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID); if(anIter != myElemObj2VTKID.end()) return anIter->second; } @@ -351,30 +351,17 @@ namespace VISU TGaussPointID TGaussMeshImpl - ::GetObjID(int theVtkI) const + ::GetObjID(int theID) const { - TGaussPointID aRetVID; - int aID, anIndexDS; - vtkIdType aVID;//, aRetVID=-1; - // const TVTKAppendFilter& anAppendFilter = GetFilter(); - aID=anAppendFilter->GetElemObjId(theVtkI, anIndexDS); - // - const TGaussSubMeshImpl& aSubMeshImpl = myGaussSubMeshArr[anIndexDS]; - aVID=(vtkIdType)aID; - aRetVID=aSubMeshImpl.GetObjID(aVID); - return aRetVID; + vtkIdType anInputDataSetID; + vtkIdType anInputID = anAppendFilter->GetCellInputID(theID,anInputDataSetID); + const TGaussSubMeshImpl& aSubMeshImpl = myGaussSubMeshArr[anInputDataSetID]; + return aSubMeshImpl.GetObjID(anInputID); } //--------------------------------------------------------------- - vtkIdType - TSubMeshImpl - ::GetElemVTKID(vtkIdType theID) const - { - return theID; - } - vtkIdType TSubMeshImpl ::GetElemObjID(vtkIdType theID) const @@ -384,11 +371,26 @@ namespace VISU //--------------------------------------------------------------- + vtkCell* + TMeshOnEntityImpl + ::GetElemCell(int theObjID) + { + vtkIdType aVtkID = GetElemVTKID(theObjID); + return GetFilter()->GetOutput()->GetCell(aVtkID); + } + vtkIdType TMeshOnEntityImpl ::GetElemVTKID(vtkIdType theID) const { - return theID; + if(myElemObj2VTKID.empty()) + return theID; + else{ + TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID); + if(anIter != myElemObj2VTKID.end()) + return anIter->second; + } + return -1; } vtkIdType @@ -397,7 +399,7 @@ namespace VISU { vtkIdType anInputID; const TVTKAppendFilter& anAppendFilter = GetFilter(); - vtkIdType aID = anAppendFilter->GetElemObjId(theID,anInputID); + vtkIdType aID = anAppendFilter->GetCellInputID(theID,anInputID); const PSubMeshImpl& aSubMesh = mySubMeshArr[anInputID]; return aSubMesh->GetElemObjID(aID); } @@ -732,6 +734,7 @@ namespace //--------------------------------------------------------------- void GetCellsOnSubMesh(const TVTKSource& theSource, + const PMeshOnEntityImpl& theMeshOnEntity, const PSubMeshImpl& theSubMesh, const vtkIdType theGeom) { @@ -750,9 +753,11 @@ namespace aCellTypesArray->SetNumberOfComponents(1); aCellTypesArray->SetNumberOfTuples(aNbCells); + VISU::TID2ID& anElemObj2VTKID = theMeshOnEntity->myElemObj2VTKID; for(vtkIdType anID = 0; anID < aNbCells; anID++){ PrintCells(anID,aConnectivity,anArray[anID]); aCellTypesArray->SetValue(anID,(unsigned char)theGeom); + anElemObj2VTKID[theSubMesh->GetElemObjID(anID)] = anID; } vtkIdType *pts = 0, npts = 0; @@ -975,7 +980,7 @@ namespace aCellTypesArray->SetNumberOfComponents(1); aCellTypesArray->SetNumberOfTuples(aNbCells); - VISU::TElemObj2VTKID& anElemObj2VTKID = theProfile->myElemObj2VTKID; + 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++){ @@ -1072,10 +1077,11 @@ namespace const TVTKSource& aSource = aSubProfile->GetSource(); anAppendFilter->AddInput(aSource.GetPointer()); - aSubProfileArr[anID] = aSubProfile; + aSubProfileArr[anID] = aSubProfile; } } anAppendFilter->Update(); // Fix on VTK + theProfile->myNamedPointCoords = theMesh->myNamedPointCoords; theProfile->myIsVTKDone = true; } @@ -1379,10 +1385,12 @@ VISU_Convertor_impl PSubMeshImpl aSubMesh = anIter->second; const TVTKSource& aSource = aSubMesh->GetSource(); aSource->SetPoints(GetPoints(aMesh)); - GetCellsOnSubMesh(aSource,aSubMesh,aGeom); + GetCellsOnSubMesh(aSource,aMeshOnEntity,aSubMesh,aGeom); anAppendFilter->AddInput(aSource.GetPointer()); + aSubMeshArr[anID] = aSubMesh; } + aMeshOnEntity->myNamedPointCoords = aMesh->myNamedPointCoords; aMeshOnEntity->myIsVTKDone = true; diff --git a/src/CONVERTOR/VISU_Convertor_impl.hxx b/src/CONVERTOR/VISU_Convertor_impl.hxx index a655fdbc..feb422a0 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.hxx +++ b/src/CONVERTOR/VISU_Convertor_impl.hxx @@ -13,14 +13,11 @@ #include - - +class vtkCell; class vtkPoints; class VTKViewer_AppendFilter; class vtkUnstructuredGrid; -//pkv f -class vtkCell; -//pkv t + #include "VISU_Convertor.hxx" #include "MED_SliceArray.hxx" @@ -193,7 +190,7 @@ namespace VISU //--------------------------------------------------------------- - typedef std::map TElemObj2VTKID; + typedef std::map TID2ID; typedef TVector TSubProfileArr; typedef std::map TGeom2SubProfile; @@ -226,10 +223,10 @@ namespace VISU float* GetNodeCoord(int theObjID); - TElemObj2VTKID myElemObj2VTKID; + TID2ID myElemObj2VTKID; + TSubProfileArr mySubProfileArr; PNamedPointCoords myNamedPointCoords; - TSubProfileArr mySubProfileArr; TGeom2SubProfile myGeom2SubProfile; }; typedef SharedPtr PProfileImpl; @@ -285,15 +282,11 @@ namespace VISU struct TSubMeshImpl: virtual TSource { - TCell2Connect myCell2Connect; - - virtual - vtkIdType - GetElemVTKID(vtkIdType theID) const; - virtual vtkIdType GetElemObjID(vtkIdType theID) const; + + TCell2Connect myCell2Connect; }; typedef SharedPtr PSubMeshImpl; @@ -304,6 +297,10 @@ namespace VISU struct TMeshOnEntityImpl: virtual TMeshOnEntity, virtual TAppendFilter, virtual TSizeCounter { + virtual + vtkCell* + GetElemCell(int theObjID); + virtual vtkIdType GetElemVTKID(vtkIdType theID) const; @@ -312,7 +309,10 @@ namespace VISU vtkIdType GetElemObjID(vtkIdType theID) const; + TID2ID myElemObj2VTKID; TSubMeshArr mySubMeshArr; + PNamedPointCoords myNamedPointCoords; + TGeom2SubMesh myGeom2SubMesh; }; typedef SharedPtr PMeshOnEntityImpl; diff --git a/src/CONVERTOR/VISU_MedConvertor.cxx b/src/CONVERTOR/VISU_MedConvertor.cxx index f0c24e98..abed3883 100644 --- a/src/CONVERTOR/VISU_MedConvertor.cxx +++ b/src/CONVERTOR/VISU_MedConvertor.cxx @@ -37,7 +37,7 @@ #include #define _EDF_NODE_IDS_ -#define _DEXCEPT_ +//#define _DEXCEPT_ using namespace std; using namespace VISU; @@ -760,22 +760,6 @@ namespace else return TSubMeshImpl::GetElemObjID(theID); } - - vtkIdType - TMEDSubMesh - ::GetElemVTKID(vtkIdType theID) const - { - if(myIsElemNum){ - MED::TElemNum::const_iterator anIter = - std::find(myElemNum.begin(),myElemNum.end(),theID); - if(anIter != myElemNum.end()) - return *anIter; - else - return -1; - }else - return TSubMeshImpl::GetElemVTKID(theID); - } - } @@ -1358,7 +1342,7 @@ VISU_MedConvertor #ifndef _DEXCEPT_ }catch(std::exception& exc){ - throw;x + throw; }catch(...){ EXCEPTION(runtime_error,"Unknown exception !!!"); } @@ -1432,7 +1416,6 @@ LoadProfile(const MED::PWrapper& theMed, aSubProfile->myElemNum = anElemInfo->myElemNum; } } - aProfile->myNamedPointCoords = theMesh->myNamedPointCoords; aProfile->myIsDone = true; } diff --git a/src/CONVERTOR/VISU_MedConvertor.hxx b/src/CONVERTOR/VISU_MedConvertor.hxx index 74aabc04..de23886c 100644 --- a/src/CONVERTOR/VISU_MedConvertor.hxx +++ b/src/CONVERTOR/VISU_MedConvertor.hxx @@ -93,10 +93,6 @@ namespace VISU MED::EBooleen myIsElemNum; MED::TElemNum myElemNum; - virtual - vtkIdType - GetElemVTKID(vtkIdType theID) const; - virtual vtkIdType GetElemObjID(vtkIdType theID) const;