From: apo Date: Fri, 29 Jul 2005 07:12:47 +0000 (+0000) Subject: 1. To use safe MED::TVector::operator[] instead of std::vector X-Git-Tag: BR-D5-38-2003_D2005-12-09~144 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f8e2da20f6af23b0ffb44e586d686a115467eeaa;p=modules%2Fvisu.git 1. To use safe MED::TVector::operator[] instead of std::vector 2. To use MED::ModeSwitch for TTimeStampVal and TCellInfo structures 3. To use MED::Slice interface for TCellInfo and TPolygonInfo 4. Minor bugs correction --- diff --git a/src/CONVERTOR/VISUConvertor.cxx b/src/CONVERTOR/VISUConvertor.cxx index 22aa9c72..c784c4b1 100644 --- a/src/CONVERTOR/VISUConvertor.cxx +++ b/src/CONVERTOR/VISUConvertor.cxx @@ -43,8 +43,10 @@ static int MYDEBUG = 1; static int MYDEBUG = 0; #endif +//#define _DEXCEPT_ + void parseFile(const char* theFileName) { -#ifndef _DEBUG_ +#ifndef _DEXCEPT_ try{ #endif MSG(MYDEBUG,"'"<GetPMeshInfo(iMesh); MED::PNodeInfo aNodeInfo = aMed->GetPNodeInfo(aMeshInfo); @@ -477,29 +479,20 @@ VISU_MedConvertor case MED::ePOLYGONE: { MED::PPolygoneInfo aPolygoneInfo = aMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom); TInt aNbElem = aPolygoneInfo->GetNbElem(); - MED::TElemNum aConn = aPolygoneInfo->GetConnectivite(); - MED::TElemNum aIndex = aPolygoneInfo->GetIndex(); - TInt aNbIndex = aIndex.size(); - TInt aNbConn = aConn.size(); - - aMeshOnEntity->myNbCells += aNbElem; - - for (int ii = 0; iiGetNbConn(ii); - aMeshOnEntity->myCellsSize += aNbConnii; - } - + INITMSG(MYDEBUG, "- aMGeom = "<GetCoordName(iDim); for(int iElem = 0; iElem < aNbElem; iElem++){ - TCoordSlice aCoordSlice = aCoords.GetCoordSlice(iElem); + TCoordSlice aVCoordSlice = aCoords.GetCoordSlice(iElem); + MED::TCCoordSlice aMCoordSlice = aNodeInfo->GetCoordSlice(iElem); for(int iDim = 0; iDim < aDim; iDim++) - aCoordSlice[iDim] = aNodeInfo->GetNodeCoord(iElem,iDim); + aVCoordSlice[iDim] = aMCoordSlice[iDim]; } TCell2Connect& aConnForCellType = aMeshOnEntity->myGeom2Cell2Connect[VTK_VERTEX]; @@ -894,9 +890,13 @@ VISU_MedConvertor VISU::PMEDMeshOnEntity theMeshOnEntity, const string& theFamilyName) { +#ifndef _DEXCEPT_ try{ +#endif + //Check on existing family PFamilyImpl aFamily = GetFamily(theMeshOnEntity,theFamilyName); + //Check on loading already done bool isCellsLoaded = !theMeshOnEntity->myGeom2Cell2Connect.empty(); if(isCellsLoaded) @@ -944,15 +944,13 @@ VISU_MedConvertor TCell2Connect& aCell2Connect = aGeom2Cell2Connect[aVGeom]; aCell2Connect.resize(aNbElem); - const MED::TElemNum& aIndex = aPolygoneInfo->GetIndex(); - const MED::TElemNum& aConnect = aPolygoneInfo->GetConnectivite(); - for(int iElem = 0; iElem < aNbElem; iElem++) { - TConnect& anArray = aCell2Connect[iElem]; + MED::TCConnSlice aConnSlice = aPolygoneInfo->GetConnSlice(iElem); int aNbConn = aPolygoneInfo->GetNbConn(iElem); + TConnect& anArray = aCell2Connect[iElem]; anArray.resize(aNbConn); - for(int i = 0; i < aNbConn; i++) - anArray[i] = aConnect[aIndex[iElem]-1+i]-1; + for(int iConn = 0; iConn < aNbConn; iConn++) + anArray[iConn] = aConnSlice[iConn] - 1; } } if(aFamily){ @@ -1020,16 +1018,17 @@ VISU_MedConvertor vector aConnect(aMNbNodes); for (int iElem = 0; iElem < aNbElem; iElem++) { + MED::TCConnSlice aConnSlice = aCellInfo->GetConnSlice(iElem); TConnect& anArray = aConnForCellType[iElem]; anArray.resize(aVNbNodes); if(anIsNodeNum){ - for(int i = 0; i < aMNbNodes; i++){ - aConnect[i] = aNodeIdMap[aCellInfo->GetConn(iElem,i)-1]; + for(int iConn = 0; iConn < aMNbNodes; iConn++){ + aConnect[iConn] = aNodeIdMap[aConnSlice[iConn] - 1]; } }else{ - for(int i = 0; i < aMNbNodes; i++){ - aConnect[i] = aCellInfo->GetConn(iElem,i)-1; + for(int iConn = 0; iConn < aMNbNodes; iConn++){ + aConnect[iConn] = aConnSlice[iConn] - 1; } } @@ -1073,6 +1072,8 @@ VISU_MedConvertor } } return 1; + +#ifndef _DEXCEPT_ }catch(std::exception& exc){ theMeshOnEntity->myGeom2Cell2Connect.clear(); throw; @@ -1080,6 +1081,8 @@ VISU_MedConvertor theMeshOnEntity->myGeom2Cell2Connect.clear(); EXCEPTION(runtime_error,"Unknown exception !!!"); } +#endif + return 0; } @@ -1136,7 +1139,6 @@ LoadGaussMesh(const MED::PWrapper& theMed, VISU::TMEDValForTime& theValForTime, VISU::TMEDMeshOnEntity& theMeshOnEntity) { - int MYDEBUG = true; INITMSG(MYDEBUG,"LoadGaussMesh"<