mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-13 02:00:34 +05:00
Fix on Bug SMESH5864
- Med file writer does not respect MED specifications for elements (Ecole_Ete_a4)
This commit is contained in:
parent
2b81b5b1d8
commit
f096a91538
@ -257,16 +257,23 @@ DriverMED_R_SMESHDS_Mesh::ReadStatus DriverMED_R_SMESHDS_Mesh::ReadMySelf()
|
||||
aNbNodes = 8;
|
||||
break;
|
||||
}
|
||||
// if(anIsElemNum)
|
||||
// cout<<aCellInfo->GetElemNum(iElem)<<": ";
|
||||
// else
|
||||
// cout<<iElem<<": ";
|
||||
vector<med_int> aNodeIds(aNbNodes);
|
||||
for(int i = 0; i < aNbNodes; i++){
|
||||
aNodeIds.at(i) = aCellInfo->GetConn(iElem,i);
|
||||
//cout<<aNodeIds.at(i)<<", ";
|
||||
if(anIsNodeNum) {
|
||||
for(int i = 0; i < aNbNodes; i++){
|
||||
aNodeIds.at(i) = aNodeInfo->GetElemNum(aCellInfo->GetConn(iElem,i)-1);
|
||||
}
|
||||
}else{
|
||||
for(int i = 0; i < aNbNodes; i++){
|
||||
aNodeIds.at(i) = aCellInfo->GetConn(iElem,i);
|
||||
}
|
||||
}
|
||||
//cout<<endl;
|
||||
//if(anIsElemNum)
|
||||
// cout<<aCellInfo->GetElemNum(iElem)<<": ";
|
||||
//else
|
||||
// cout<<iElem<<": ";
|
||||
//for(int i = 0; i < aNbNodes; i++){
|
||||
// cout<<aNodeIds.at(i)<<", ";
|
||||
//}
|
||||
|
||||
bool isRenum = false;
|
||||
SMDS_MeshElement* anElement = NULL;
|
||||
|
@ -208,6 +208,9 @@ void DriverMED_W_SMESHDS_Mesh::Add()
|
||||
|
||||
// Storing SMDS nodes to the MED file for the MED mesh
|
||||
//----------------------------------------------------
|
||||
typedef map<med_int,med_int> TNodeIdMap;
|
||||
TNodeIdMap aNodeIdMap;
|
||||
|
||||
med_int aNbElems = myMesh->NbNodes();
|
||||
MED::TIntVector anElemNums(aNbElems);
|
||||
MED::TIntVector aFamilyNums(aNbElems);
|
||||
@ -218,7 +221,9 @@ void DriverMED_W_SMESHDS_Mesh::Add()
|
||||
aCoordinates[iCoord] = aNode->X();
|
||||
aCoordinates[iCoord+1] = aNode->Y();
|
||||
aCoordinates[iCoord+2] = aNode->Z();
|
||||
anElemNums[iNode] = aNode->GetID();
|
||||
TNodeIdMap::key_type aNodeId = aNode->GetID();
|
||||
anElemNums[iNode] = aNodeId;
|
||||
aNodeIdMap[aNodeId] = iNode+1;
|
||||
//cout<<aNode->GetID()<<": "<<aNode->X()<<", "<<aNode->Y()<<", "<<aNode->Z()<<endl;
|
||||
|
||||
if (anElemFamMap.find(aNode) != anElemFamMap.end())
|
||||
@ -264,13 +269,9 @@ void DriverMED_W_SMESHDS_Mesh::Add()
|
||||
SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
|
||||
for(med_int iNode = 0; iNode < aNbConnectivity && aNodesIter->more(); iNode++){
|
||||
const SMDS_MeshElement* aNode = aNodesIter->next();
|
||||
aConnectivity[iConn+iNode] = aNode->GetID();
|
||||
aConnectivity[iConn+iNode] = aNodeIdMap[aNode->GetID()];
|
||||
}
|
||||
anElemNums[iElem] = anElem->GetID();
|
||||
//cout<<anElem->GetID()<<": ";
|
||||
//for(med_int iNode = 0; iNode < aNbNodes; iNode++)
|
||||
// cout<<(*aConnectivity)[iConn+iNode]<<", ";
|
||||
//cout<<endl;
|
||||
|
||||
if (anElemFamMap.find(anElem) != anElemFamMap.end())
|
||||
aFamilyNums[iElem] = anElemFamMap[anElem];
|
||||
@ -341,19 +342,15 @@ void DriverMED_W_SMESHDS_Mesh::Add()
|
||||
// There is some differnce between SMDS and MED in cells mapping
|
||||
switch(aNbNodes){
|
||||
case 4:
|
||||
(*aConnectivity)[aSize+0] = aVector[0];
|
||||
(*aConnectivity)[aSize+1] = aVector[1];
|
||||
(*aConnectivity)[aSize+2] = aVector[3];
|
||||
(*aConnectivity)[aSize+3] = aVector[2];
|
||||
(*aConnectivity)[aSize+0] = aNodeIdMap[aVector[0]];
|
||||
(*aConnectivity)[aSize+1] = aNodeIdMap[aVector[1]];
|
||||
(*aConnectivity)[aSize+2] = aNodeIdMap[aVector[3]];
|
||||
(*aConnectivity)[aSize+3] = aNodeIdMap[aVector[2]];
|
||||
default:
|
||||
for(med_int iNode = 0; iNode < aNbNodes; iNode++)
|
||||
(*aConnectivity)[aSize+iNode] = aVector[iNode];
|
||||
(*aConnectivity)[aSize+iNode] = aNodeIdMap[aVector[iNode]];
|
||||
}
|
||||
anElemNums->push_back(anElem->GetID());
|
||||
//cout<<anElem->GetID()<<": ";
|
||||
//for(med_int iNode = 0; iNode < aNbNodes; iNode++)
|
||||
// cout<<(*aConnectivity)[aSize+iNode]<<", ";
|
||||
//cout<<endl;
|
||||
|
||||
if (anElemFamMap.find(anElem) != anElemFamMap.end())
|
||||
aFamilyNums->push_back(anElemFamMap[anElem]);
|
||||
@ -464,14 +461,14 @@ void DriverMED_W_SMESHDS_Mesh::Add()
|
||||
// There is some difference between SMDS and MED in cells mapping
|
||||
switch(aNbNodes){
|
||||
case 5:
|
||||
(*aConnectivity)[aSize+0] = aVector[0];
|
||||
(*aConnectivity)[aSize+1] = aVector[3];
|
||||
(*aConnectivity)[aSize+2] = aVector[2];
|
||||
(*aConnectivity)[aSize+3] = aVector[1];
|
||||
(*aConnectivity)[aSize+4] = aVector[4];
|
||||
(*aConnectivity)[aSize+0] = aNodeIdMap[aVector[0]];
|
||||
(*aConnectivity)[aSize+1] = aNodeIdMap[aVector[3]];
|
||||
(*aConnectivity)[aSize+2] = aNodeIdMap[aVector[2]];
|
||||
(*aConnectivity)[aSize+3] = aNodeIdMap[aVector[1]];
|
||||
(*aConnectivity)[aSize+4] = aNodeIdMap[aVector[4]];
|
||||
default:
|
||||
for(med_int iNode = 0; iNode < aNbNodes; iNode++)
|
||||
(*aConnectivity)[aSize+iNode] = aVector[iNode];
|
||||
(*aConnectivity)[aSize+iNode] = aNodeIdMap[aVector[iNode]];
|
||||
}
|
||||
anElemNums->push_back(anElem->GetID());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user