From 776e25bc46048a970a8492f432a4e8ce01dada79 Mon Sep 17 00:00:00 2001 From: apo Date: Mon, 24 Jan 2005 13:37:56 +0000 Subject: [PATCH] [Bug PAL7784] REGR: wrong Export-Import Mesh in med --- src/DriverMED/DriverMED_Family.cxx | 8 ++-- src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx | 43 +++++++++++++--------- src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx | 18 ++++----- 3 files changed, 39 insertions(+), 30 deletions(-) diff --git a/src/DriverMED/DriverMED_Family.cxx b/src/DriverMED/DriverMED_Family.cxx index 778c282a5..34ff2c20b 100644 --- a/src/DriverMED/DriverMED_Family.cxx +++ b/src/DriverMED/DriverMED_Family.cxx @@ -193,10 +193,10 @@ list DriverMED_Family::MakeFamilies aFamilies.push_back(aFreeVolumesFam); } - DriverMED_FamilyPtr aNullFam (new DriverMED_Family); - aNullFam->SetId(0); - aNullFam->myType = SMDSAbs_All; - aFamilies.push_back(aNullFam); + //DriverMED_FamilyPtr aNullFam (new DriverMED_Family); + //aNullFam->SetId(0); + //aNullFam->myType = SMDSAbs_All; + //aFamilies.push_back(aNullFam); return aFamilies; } diff --git a/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx b/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx index 25e517cf4..fe5100d4f 100644 --- a/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx +++ b/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx @@ -38,6 +38,12 @@ #include +#ifdef _DEBUG_ +static int MYDEBUG = 0; +#else +static int MYDEBUG = 0; +#endif + #define _EDF_NODE_IDS_ using namespace MED; @@ -136,7 +142,7 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform() Status aResult = DRS_FAIL; try{ myFamilies.clear(); - MESSAGE("Perform - myFile : "<GetName()); + if(MYDEBUG) MESSAGE("Perform - aMeshName : "<GetName()); if(aMeshName != aMeshInfo->GetName()) continue; aResult = DRS_OK; //TInt aMeshDim = aMeshInfo->GetDim(); // Reading MED families to the temporary structure //------------------------------------------------ - TInt aNbFams = aMed->GetNbFamilies(aMeshInfo); - MESSAGE("Read " << aNbFams << " families"); + TErr anErr; + TInt aNbFams = aMed->GetNbFamilies(aMeshInfo); + if(MYDEBUG) MESSAGE("Read " << aNbFams << " families"); for (TInt iFam = 0; iFam < aNbFams; iFam++) { - PFamilyInfo aFamilyInfo = aMed->GetPFamilyInfo(aMeshInfo, iFam+1); - TInt aFamId = aFamilyInfo->GetId(); - MESSAGE("Family " << aFamId << " :"); - + PFamilyInfo aFamilyInfo = aMed->GetPFamilyInfo(aMeshInfo,iFam+1,&anErr); + if(anErr >= 0){ + TInt aFamId = aFamilyInfo->GetId(); + if(MYDEBUG) MESSAGE("Family " << aFamId << " :"); + DriverMED_FamilyPtr aFamily (new DriverMED_Family); - + TInt aNbGrp = aFamilyInfo->GetNbGroup(); - MESSAGE("belong to " << aNbGrp << " groups"); + if(MYDEBUG) MESSAGE("belong to " << aNbGrp << " groups"); for (TInt iGr = 0; iGr < aNbGrp; iGr++) { string aGroupName = aFamilyInfo->GetGroupName(iGr); - MESSAGE(aGroupName); + if(MYDEBUG) MESSAGE(aGroupName); aFamily->AddGroupName(aGroupName); } myFamilies[aFamId] = aFamily; + } } // Reading MED nodes to the corresponding SMDS structure @@ -221,7 +230,7 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform() EBooleen anIsNodeNum = aNodeInfo->IsElemNum(); TInt aNbElems = aNodeInfo->GetNbElem(); - MESSAGE("Perform - aNodeInfo->GetNbElem() = "<GetNbElem() = "< DriverMED_R_SMESHDS_Mesh::GetGroupNames() void DriverMED_R_SMESHDS_Mesh::GetGroup(SMESHDS_Group* theGroup) { string aGroupName (theGroup->GetStoreName()); - MESSAGE("Get Group " << aGroupName); + if(MYDEBUG) MESSAGE("Get Group " << aGroupName); map::iterator aFamsIter = myFamilies.begin(); for (; aFamsIter != myFamilies.end(); aFamsIter++) diff --git a/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx b/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx index cf7d9a819..74490377a 100644 --- a/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx +++ b/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx @@ -35,7 +35,6 @@ #include "SMDS_MeshNode.hxx" #include "utilities.h" -#include "MED_Factory.hxx" #include "MED_Utilities.hxx" #define _EDF_NODE_IDS_ @@ -53,7 +52,8 @@ DriverMED_W_SMESHDS_Mesh::DriverMED_W_SMESHDS_Mesh(): myDoGroupOfVolumes (false) {} -void DriverMED_W_SMESHDS_Mesh::SetFile(const std::string& theFileName, MED::EVersion theId) +void DriverMED_W_SMESHDS_Mesh::SetFile(const std::string& theFileName, + MED::EVersion theId) { myMed = CrWrapper(theFileName,theId); Driver_SMESHDS_Mesh::SetFile(theFileName); @@ -384,7 +384,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform() SMDS_MED_ENTITY = eARETE; #endif SMDS_EdgeIteratorPtr anIter = myMesh->edgesIterator(); - TInt aNbConnectivity = MED::GetNbConn(SMDS_MED_ENTITY,eSEG2,aMeshDimension); + TInt aNbConnectivity = MED::GetNbConnectivities(eSEG2); MED::TIntVector anElemNums(aNbElems); MED::TIntVector aFamilyNums(aNbElems); MED::TIntVector aConnectivity(aNbElems*aNbConnectivity); @@ -424,7 +424,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform() #ifdef _ELEMENTS_BY_DIM_ SMDS_MED_ENTITY = eFACE; #endif - TInt aNbTriaConn = MED::GetNbConn(SMDS_MED_ENTITY,eTRIA3,aMeshDimension); + TInt aNbTriaConn = MED::GetNbConnectivities(eTRIA3); MED::TIntVector anTriaElemNums; anTriaElemNums.reserve(aNbElems); MED::TIntVector aTriaFamilyNums; @@ -432,7 +432,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform() MED::TIntVector aTriaConn; aTriaConn.reserve(aNbElems*aNbTriaConn); - TInt aNbQuadConn = MED::GetNbConn(SMDS_MED_ENTITY,eQUAD4,aMeshDimension); + TInt aNbQuadConn = MED::GetNbConnectivities(eQUAD4); MED::TIntVector aQuadElemNums; aQuadElemNums.reserve(aNbElems); MED::TIntVector aQuadFamilyNums; @@ -531,7 +531,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform() #ifdef _ELEMENTS_BY_DIM_ SMDS_MED_ENTITY = eMAILLE; #endif - TInt aNbTetraConn = MED::GetNbConn(SMDS_MED_ENTITY,eTETRA4,aMeshDimension); + TInt aNbTetraConn = MED::GetNbConnectivities(eTETRA4); MED::TIntVector anTetraElemNums; anTetraElemNums.reserve(aNbElems); MED::TIntVector aTetraFamilyNums; @@ -539,7 +539,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform() MED::TIntVector aTetraConn; aTetraConn.reserve(aNbElems*aNbTetraConn); - TInt aNbPyraConn = MED::GetNbConn(SMDS_MED_ENTITY,ePYRA5,aMeshDimension); + TInt aNbPyraConn = MED::GetNbConnectivities(ePYRA5); MED::TIntVector anPyraElemNums; anPyraElemNums.reserve(aNbElems); MED::TIntVector aPyraFamilyNums; @@ -547,7 +547,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform() MED::TIntVector aPyraConn; aPyraConn.reserve(aNbElems*aNbPyraConn); - TInt aNbPentaConn = MED::GetNbConn(SMDS_MED_ENTITY,ePENTA6,aMeshDimension); + TInt aNbPentaConn = MED::GetNbConnectivities(ePENTA6); MED::TIntVector anPentaElemNums; anPentaElemNums.reserve(aNbElems); MED::TIntVector aPentaFamilyNums; @@ -555,7 +555,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform() MED::TIntVector aPentaConn; aPentaConn.reserve(aNbElems*aNbPentaConn); - TInt aNbHexaConn = MED::GetNbConn(SMDS_MED_ENTITY,eHEXA8,aMeshDimension); + TInt aNbHexaConn = MED::GetNbConnectivities(eHEXA8); MED::TIntVector aHexaElemNums; aHexaElemNums.reserve(aNbElems); MED::TIntVector aHexaFamilyNums; -- 2.39.2