[Bug PAL7784] REGR: wrong Export-Import Mesh in med

This commit is contained in:
apo 2005-01-24 13:37:56 +00:00
parent 298f5a9bb3
commit 776e25bc46
3 changed files with 39 additions and 30 deletions

View File

@ -193,10 +193,10 @@ list<DriverMED_FamilyPtr> DriverMED_Family::MakeFamilies
aFamilies.push_back(aFreeVolumesFam); aFamilies.push_back(aFreeVolumesFam);
} }
DriverMED_FamilyPtr aNullFam (new DriverMED_Family); //DriverMED_FamilyPtr aNullFam (new DriverMED_Family);
aNullFam->SetId(0); //aNullFam->SetId(0);
aNullFam->myType = SMDSAbs_All; //aNullFam->myType = SMDSAbs_All;
aFamilies.push_back(aNullFam); //aFamilies.push_back(aNullFam);
return aFamilies; return aFamilies;
} }

View File

@ -38,6 +38,12 @@
#include <stdlib.h> #include <stdlib.h>
#ifdef _DEBUG_
static int MYDEBUG = 0;
#else
static int MYDEBUG = 0;
#endif
#define _EDF_NODE_IDS_ #define _EDF_NODE_IDS_
using namespace MED; using namespace MED;
@ -136,7 +142,7 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
Status aResult = DRS_FAIL; Status aResult = DRS_FAIL;
try{ try{
myFamilies.clear(); myFamilies.clear();
MESSAGE("Perform - myFile : "<<myFile); if(MYDEBUG) MESSAGE("Perform - myFile : "<<myFile);
PWrapper aMed = CrWrapper(myFile); PWrapper aMed = CrWrapper(myFile);
aResult = DRS_EMPTY; aResult = DRS_EMPTY;
@ -153,31 +159,34 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
} else { } else {
aMeshName = myMeshName; aMeshName = myMeshName;
} }
MESSAGE("Perform - aMeshName : "<<aMeshName<<"; "<<aMeshInfo->GetName()); if(MYDEBUG) MESSAGE("Perform - aMeshName : "<<aMeshName<<"; "<<aMeshInfo->GetName());
if(aMeshName != aMeshInfo->GetName()) continue; if(aMeshName != aMeshInfo->GetName()) continue;
aResult = DRS_OK; aResult = DRS_OK;
//TInt aMeshDim = aMeshInfo->GetDim(); //TInt aMeshDim = aMeshInfo->GetDim();
// Reading MED families to the temporary structure // Reading MED families to the temporary structure
//------------------------------------------------ //------------------------------------------------
TErr anErr;
TInt aNbFams = aMed->GetNbFamilies(aMeshInfo); TInt aNbFams = aMed->GetNbFamilies(aMeshInfo);
MESSAGE("Read " << aNbFams << " families"); if(MYDEBUG) MESSAGE("Read " << aNbFams << " families");
for (TInt iFam = 0; iFam < aNbFams; iFam++) { for (TInt iFam = 0; iFam < aNbFams; iFam++) {
PFamilyInfo aFamilyInfo = aMed->GetPFamilyInfo(aMeshInfo, iFam+1); PFamilyInfo aFamilyInfo = aMed->GetPFamilyInfo(aMeshInfo,iFam+1,&anErr);
if(anErr >= 0){
TInt aFamId = aFamilyInfo->GetId(); TInt aFamId = aFamilyInfo->GetId();
MESSAGE("Family " << aFamId << " :"); if(MYDEBUG) MESSAGE("Family " << aFamId << " :");
DriverMED_FamilyPtr aFamily (new DriverMED_Family); DriverMED_FamilyPtr aFamily (new DriverMED_Family);
TInt aNbGrp = aFamilyInfo->GetNbGroup(); TInt aNbGrp = aFamilyInfo->GetNbGroup();
MESSAGE("belong to " << aNbGrp << " groups"); if(MYDEBUG) MESSAGE("belong to " << aNbGrp << " groups");
for (TInt iGr = 0; iGr < aNbGrp; iGr++) { for (TInt iGr = 0; iGr < aNbGrp; iGr++) {
string aGroupName = aFamilyInfo->GetGroupName(iGr); string aGroupName = aFamilyInfo->GetGroupName(iGr);
MESSAGE(aGroupName); if(MYDEBUG) MESSAGE(aGroupName);
aFamily->AddGroupName(aGroupName); aFamily->AddGroupName(aGroupName);
} }
myFamilies[aFamId] = aFamily; myFamilies[aFamId] = aFamily;
} }
}
// Reading MED nodes to the corresponding SMDS structure // Reading MED nodes to the corresponding SMDS structure
//------------------------------------------------------ //------------------------------------------------------
@ -221,7 +230,7 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
EBooleen anIsNodeNum = aNodeInfo->IsElemNum(); EBooleen anIsNodeNum = aNodeInfo->IsElemNum();
TInt aNbElems = aNodeInfo->GetNbElem(); TInt aNbElems = aNodeInfo->GetNbElem();
MESSAGE("Perform - aNodeInfo->GetNbElem() = "<<aNbElems<<"; anIsNodeNum = "<<anIsNodeNum); if(MYDEBUG) MESSAGE("Perform - aNodeInfo->GetNbElem() = "<<aNbElems<<"; anIsNodeNum = "<<anIsNodeNum);
for(TInt iElem = 0; iElem < aNbElems; iElem++){ for(TInt iElem = 0; iElem < aNbElems; iElem++){
double aCoords[3] = {0.0, 0.0, 0.0}; double aCoords[3] = {0.0, 0.0, 0.0};
for(TInt iDim = 0; iDim < 3; iDim++) for(TInt iDim = 0; iDim < 3; iDim++)
@ -263,8 +272,8 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
PCellInfo aCellInfo = aMed->GetPCellInfo(aMeshInfo,anEntity,aGeom); PCellInfo aCellInfo = aMed->GetPCellInfo(aMeshInfo,anEntity,aGeom);
EBooleen anIsElemNum = takeNumbers ? aCellInfo->IsElemNum() : eFAUX; EBooleen anIsElemNum = takeNumbers ? aCellInfo->IsElemNum() : eFAUX;
TInt aNbElems = aCellInfo->GetNbElem(); TInt aNbElems = aCellInfo->GetNbElem();
MESSAGE("Perform - anEntity = "<<anEntity<<"; anIsElemNum = "<<anIsElemNum); if(MYDEBUG) MESSAGE("Perform - anEntity = "<<anEntity<<"; anIsElemNum = "<<anIsElemNum);
MESSAGE("Perform - aGeom = "<<aGeom<<"; aNbElems = "<<aNbElems); if(MYDEBUG) MESSAGE("Perform - aGeom = "<<aGeom<<"; aNbElems = "<<aNbElems);
for(int iElem = 0; iElem < aNbElems; iElem++){ for(int iElem = 0; iElem < aNbElems; iElem++){
TInt aNbNodes = -1; TInt aNbNodes = -1;
@ -487,7 +496,7 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
INFOS("Unknown exception was cought !!!"); INFOS("Unknown exception was cought !!!");
aResult = DRS_FAIL; aResult = DRS_FAIL;
} }
MESSAGE("Perform - aResult status = "<<aResult); if(MYDEBUG) MESSAGE("Perform - aResult status = "<<aResult);
return aResult; return aResult;
} }
@ -496,7 +505,7 @@ list<string> DriverMED_R_SMESHDS_Mesh::GetMeshNames(Status& theStatus)
list<string> aMeshNames; list<string> aMeshNames;
try { try {
MESSAGE("GetMeshNames - myFile : " << myFile); if(MYDEBUG) MESSAGE("GetMeshNames - myFile : " << myFile);
theStatus = DRS_OK; theStatus = DRS_OK;
PWrapper aMed = CrWrapper(myFile); PWrapper aMed = CrWrapper(myFile);
@ -549,7 +558,7 @@ list<string> DriverMED_R_SMESHDS_Mesh::GetGroupNames()
void DriverMED_R_SMESHDS_Mesh::GetGroup(SMESHDS_Group* theGroup) void DriverMED_R_SMESHDS_Mesh::GetGroup(SMESHDS_Group* theGroup)
{ {
string aGroupName (theGroup->GetStoreName()); string aGroupName (theGroup->GetStoreName());
MESSAGE("Get Group " << aGroupName); if(MYDEBUG) MESSAGE("Get Group " << aGroupName);
map<int, DriverMED_FamilyPtr>::iterator aFamsIter = myFamilies.begin(); map<int, DriverMED_FamilyPtr>::iterator aFamsIter = myFamilies.begin();
for (; aFamsIter != myFamilies.end(); aFamsIter++) for (; aFamsIter != myFamilies.end(); aFamsIter++)

View File

@ -35,7 +35,6 @@
#include "SMDS_MeshNode.hxx" #include "SMDS_MeshNode.hxx"
#include "utilities.h" #include "utilities.h"
#include "MED_Factory.hxx"
#include "MED_Utilities.hxx" #include "MED_Utilities.hxx"
#define _EDF_NODE_IDS_ #define _EDF_NODE_IDS_
@ -53,7 +52,8 @@ DriverMED_W_SMESHDS_Mesh::DriverMED_W_SMESHDS_Mesh():
myDoGroupOfVolumes (false) 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); myMed = CrWrapper(theFileName,theId);
Driver_SMESHDS_Mesh::SetFile(theFileName); Driver_SMESHDS_Mesh::SetFile(theFileName);
@ -384,7 +384,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
SMDS_MED_ENTITY = eARETE; SMDS_MED_ENTITY = eARETE;
#endif #endif
SMDS_EdgeIteratorPtr anIter = myMesh->edgesIterator(); 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 anElemNums(aNbElems);
MED::TIntVector aFamilyNums(aNbElems); MED::TIntVector aFamilyNums(aNbElems);
MED::TIntVector aConnectivity(aNbElems*aNbConnectivity); MED::TIntVector aConnectivity(aNbElems*aNbConnectivity);
@ -424,7 +424,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
#ifdef _ELEMENTS_BY_DIM_ #ifdef _ELEMENTS_BY_DIM_
SMDS_MED_ENTITY = eFACE; SMDS_MED_ENTITY = eFACE;
#endif #endif
TInt aNbTriaConn = MED::GetNbConn(SMDS_MED_ENTITY,eTRIA3,aMeshDimension); TInt aNbTriaConn = MED::GetNbConnectivities(eTRIA3);
MED::TIntVector anTriaElemNums; MED::TIntVector anTriaElemNums;
anTriaElemNums.reserve(aNbElems); anTriaElemNums.reserve(aNbElems);
MED::TIntVector aTriaFamilyNums; MED::TIntVector aTriaFamilyNums;
@ -432,7 +432,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
MED::TIntVector aTriaConn; MED::TIntVector aTriaConn;
aTriaConn.reserve(aNbElems*aNbTriaConn); aTriaConn.reserve(aNbElems*aNbTriaConn);
TInt aNbQuadConn = MED::GetNbConn(SMDS_MED_ENTITY,eQUAD4,aMeshDimension); TInt aNbQuadConn = MED::GetNbConnectivities(eQUAD4);
MED::TIntVector aQuadElemNums; MED::TIntVector aQuadElemNums;
aQuadElemNums.reserve(aNbElems); aQuadElemNums.reserve(aNbElems);
MED::TIntVector aQuadFamilyNums; MED::TIntVector aQuadFamilyNums;
@ -531,7 +531,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
#ifdef _ELEMENTS_BY_DIM_ #ifdef _ELEMENTS_BY_DIM_
SMDS_MED_ENTITY = eMAILLE; SMDS_MED_ENTITY = eMAILLE;
#endif #endif
TInt aNbTetraConn = MED::GetNbConn(SMDS_MED_ENTITY,eTETRA4,aMeshDimension); TInt aNbTetraConn = MED::GetNbConnectivities(eTETRA4);
MED::TIntVector anTetraElemNums; MED::TIntVector anTetraElemNums;
anTetraElemNums.reserve(aNbElems); anTetraElemNums.reserve(aNbElems);
MED::TIntVector aTetraFamilyNums; MED::TIntVector aTetraFamilyNums;
@ -539,7 +539,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
MED::TIntVector aTetraConn; MED::TIntVector aTetraConn;
aTetraConn.reserve(aNbElems*aNbTetraConn); aTetraConn.reserve(aNbElems*aNbTetraConn);
TInt aNbPyraConn = MED::GetNbConn(SMDS_MED_ENTITY,ePYRA5,aMeshDimension); TInt aNbPyraConn = MED::GetNbConnectivities(ePYRA5);
MED::TIntVector anPyraElemNums; MED::TIntVector anPyraElemNums;
anPyraElemNums.reserve(aNbElems); anPyraElemNums.reserve(aNbElems);
MED::TIntVector aPyraFamilyNums; MED::TIntVector aPyraFamilyNums;
@ -547,7 +547,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
MED::TIntVector aPyraConn; MED::TIntVector aPyraConn;
aPyraConn.reserve(aNbElems*aNbPyraConn); aPyraConn.reserve(aNbElems*aNbPyraConn);
TInt aNbPentaConn = MED::GetNbConn(SMDS_MED_ENTITY,ePENTA6,aMeshDimension); TInt aNbPentaConn = MED::GetNbConnectivities(ePENTA6);
MED::TIntVector anPentaElemNums; MED::TIntVector anPentaElemNums;
anPentaElemNums.reserve(aNbElems); anPentaElemNums.reserve(aNbElems);
MED::TIntVector aPentaFamilyNums; MED::TIntVector aPentaFamilyNums;
@ -555,7 +555,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
MED::TIntVector aPentaConn; MED::TIntVector aPentaConn;
aPentaConn.reserve(aNbElems*aNbPentaConn); aPentaConn.reserve(aNbElems*aNbPentaConn);
TInt aNbHexaConn = MED::GetNbConn(SMDS_MED_ENTITY,eHEXA8,aMeshDimension); TInt aNbHexaConn = MED::GetNbConnectivities(eHEXA8);
MED::TIntVector aHexaElemNums; MED::TIntVector aHexaElemNums;
aHexaElemNums.reserve(aNbElems); aHexaElemNums.reserve(aNbElems);
MED::TIntVector aHexaFamilyNums; MED::TIntVector aHexaFamilyNums;