From 70c09c23d48b6adc214b747744b5750e72cdafc2 Mon Sep 17 00:00:00 2001 From: apo Date: Wed, 26 Jan 2005 15:15:02 +0000 Subject: [PATCH] Fix on [Bug PAL7837] PAL-POST-018 regression: it is impossible to create a presentation on Edges. --- src/MEDWrapper/Base/MED_Common.hxx | 8 +++-- src/MEDWrapper/Base/MED_Structures.cxx | 37 ++++++++++++------------ src/MEDWrapper/Base/MED_TStructures.hxx | 12 ++++---- src/MEDWrapper/V2_1/MED_V2_1_Wrapper.cxx | 1 + 4 files changed, 32 insertions(+), 26 deletions(-) diff --git a/src/MEDWrapper/Base/MED_Common.hxx b/src/MEDWrapper/Base/MED_Common.hxx index 02f992ea1..b3b5d9fa8 100644 --- a/src/MEDWrapper/Base/MED_Common.hxx +++ b/src/MEDWrapper/Base/MED_Common.hxx @@ -162,19 +162,23 @@ namespace MED{ const TEntity2GeomSet& GetEntity2GeomSet(); - template + template + TInt GetNbConn(EGeometrieElement typmai, + EEntiteMaillage typent, TInt mdim); template<> TInt GetNbConn(EGeometrieElement typmai, + EEntiteMaillage typent, TInt mdim); template<> TInt GetNbConn(EGeometrieElement typmai, + EEntiteMaillage typent, TInt mdim); - TInt GetNbConnectivities(EGeometrieElement typmai); + TInt GetNbNodes(EGeometrieElement typmai); struct TNameInfo; typedef SharedPtr PNameInfo; diff --git a/src/MEDWrapper/Base/MED_Structures.cxx b/src/MEDWrapper/Base/MED_Structures.cxx index 24185816f..b96bf7523 100644 --- a/src/MEDWrapper/Base/MED_Structures.cxx +++ b/src/MEDWrapper/Base/MED_Structures.cxx @@ -24,37 +24,38 @@ using namespace MED; namespace MED{ - TInt GetNbConnectivities(EGeometrieElement typmai) + TInt GetNbNodes(EGeometrieElement typmai) { - TInt taille = typmai%100; - return taille; + return typmai%100; } template<> TInt GetNbConn(EGeometrieElement typmai, + EEntiteMaillage typent, TInt mdim) { - TInt edim = typmai / 100; TInt nsup = 0; - if (mdim == 2 || mdim == 3) - if (edim == 1) - nsup = 1; - - if (mdim == 3) - if (edim == 2) - nsup = 1; - - TInt taille = nsup+typmai%100; - return taille; + if(typent == eMAILLE){ + TInt edim = typmai / 100; + if(mdim == 2 || mdim == 3) + if(edim == 1) + nsup = 1; + + if(mdim == 3) + if (edim == 2) + nsup = 1; + } + + return nsup + typmai%100; } template<> TInt GetNbConn(EGeometrieElement typmai, + EEntiteMaillage typent, TInt mdim) { - TInt taille = typmai%100; - return taille; + return typmai%100; } std::string GetString(TInt theId, TInt theStep, @@ -127,13 +128,13 @@ void TCellInfo::SetConn(TInt theElemId, TInt theConnId, TInt theVal){ TConstConnSlice TCellInfo::GetConnSlice(TInt theElemId) const { - return TConstConnSlice(myConn,std::slice(GetConnDim()*theElemId,GetNbConnectivities(myTGeom),1)); + return TConstConnSlice(myConn,std::slice(GetConnDim()*theElemId,GetNbNodes(myTGeom),1)); } TConnSlice TCellInfo::GetConnSlice(TInt theElemId) { - return TConnSlice(myConn,std::slice(GetConnDim()*theElemId,GetNbConnectivities(myTGeom),1)); + return TConnSlice(myConn,std::slice(GetConnDim()*theElemId,GetNbNodes(myTGeom),1)); } //--------------------------------------------------------------- diff --git a/src/MEDWrapper/Base/MED_TStructures.hxx b/src/MEDWrapper/Base/MED_TStructures.hxx index 15319fe7e..b2062b04f 100644 --- a/src/MEDWrapper/Base/MED_TStructures.hxx +++ b/src/MEDWrapper/Base/MED_TStructures.hxx @@ -540,8 +540,8 @@ namespace MED{ myTGeom = theInfo->GetGeom(); myTConn = theInfo->GetConn(); - TInt aConnDim = GetNbConnectivities(myTGeom); - myConn.resize(myNbElem*GetNbConn(myTGeom,myMeshInfo->myDim)); + TInt aConnDim = GetNbNodes(myTGeom); + myConn.resize(myNbElem*GetNbConn(myTGeom,myTEntity,myMeshInfo->myDim)); for(TInt anElemId = 0; anElemId < myNbElem; anElemId++){ for(TInt anConnId = 0; anConnId < aConnDim; anConnId++){ SetConn(anElemId,anConnId,theInfo->GetConn(anElemId,anConnId)); @@ -564,7 +564,7 @@ namespace MED{ myTEntity = theTEntity; myTGeom = theTGeom; myTConn = theTConn; - myConn.resize(theNbElem*GetNbConn(theTGeom,theMeshInfo->myDim)); + myConn.resize(theNbElem*GetNbConn(theTGeom,myTEntity,theMeshInfo->myDim)); } TTCellInfo(const PMeshInfo& theMeshInfo, @@ -584,9 +584,9 @@ namespace MED{ myTGeom = theTGeom; myTConn = theTConn; - TInt aConnDim = GetNbConnectivities(myTGeom); + TInt aConnDim = GetNbNodes(myTGeom); myNbElem = theConnectivities.size() / aConnDim; - myConn.resize(myNbElem*GetNbConn(myTGeom,myMeshInfo->myDim)); + myConn.resize(myNbElem*GetNbConn(myTGeom,myTEntity,myMeshInfo->myDim)); for(TInt anElemId = 0; anElemId < myNbElem; anElemId++){ for(TInt anConnId = 0; anConnId < aConnDim; anConnId++){ SetConn(anElemId,anConnId,theConnectivities[anElemId*aConnDim+anConnId]); @@ -596,7 +596,7 @@ namespace MED{ } virtual TInt GetConnDim() const { - return GetNbConn(myTGeom,myMeshInfo->myDim); + return GetNbConn(myTGeom,myTEntity,myMeshInfo->myDim); } }; diff --git a/src/MEDWrapper/V2_1/MED_V2_1_Wrapper.cxx b/src/MEDWrapper/V2_1/MED_V2_1_Wrapper.cxx index a406c0d4b..bb7adae42 100644 --- a/src/MEDWrapper/V2_1/MED_V2_1_Wrapper.cxx +++ b/src/MEDWrapper/V2_1/MED_V2_1_Wrapper.cxx @@ -509,6 +509,7 @@ namespace MED{ anEntity, aGeom, aConn); + if(theErr) *theErr = aRet; else if(aRet < 0) -- 2.39.2