0022100: EDF 2413 SMESH: Take into account TRIA7

This commit is contained in:
eap 2013-05-16 16:38:48 +00:00
parent 101919845f
commit 6d0acadd44
6 changed files with 123 additions and 86 deletions

View File

@ -81,6 +81,8 @@ namespace
static int ids[] = { 0, 2, 1, 5, 4, 3 }; static int ids[] = { 0, 2, 1, 5, 4, 3 };
interlaces[SMDSEntity_Quad_Triangle] = ids; interlaces[SMDSEntity_Quad_Triangle] = ids;
cgTypes [SMDSEntity_Quad_Triangle] = CGNS_ENUMV( TRI_6 ); cgTypes [SMDSEntity_Quad_Triangle] = CGNS_ENUMV( TRI_6 );
interlaces[SMDSEntity_BiQuad_Triangle] = ids;
cgTypes [SMDSEntity_BiQuad_Triangle] = CGNS_ENUMV( TRI_6 );
} }
{ {
static int ids[] = { 0, 3, 2, 1 }; static int ids[] = { 0, 3, 2, 1 };
@ -341,9 +343,12 @@ Driver_Mesh::Status DriverCGNS_Write::Perform()
startID = cgID; startID = cgID;
if ( interlace ) // STANDARD elements if ( interlace ) // STANDARD elements
{
int cgnsNbNodes; // get nb nodes by element type, that can be less that elem->NbNodes()
cg_npe( cgType, &cgnsNbNodes );
do do
{ {
for ( int i = 0, nb = elem->NbNodes(); i < nb; ++i ) for ( int i = 0; i < cgnsNbNodes; ++i )
elemData.push_back( cgnsID( elem->GetNode( interlace[i] ), n2cgID )); elemData.push_back( cgnsID( elem->GetNode( interlace[i] ), n2cgID ));
if ( elem->GetID() != cgID ) if ( elem->GetID() != cgID )
elem2cgID.insert( elem2cgID.end(), make_pair( elem, cgID )); elem2cgID.insert( elem2cgID.end(), make_pair( elem, cgID ));
@ -351,7 +356,7 @@ Driver_Mesh::Status DriverCGNS_Write::Perform()
elem = elemIt->more() ? elemIt->next() : 0; elem = elemIt->more() ? elemIt->next() : 0;
} }
while ( elem && elem->GetEntityType() == elemType ); while ( elem && elem->GetEntityType() == elemType );
}
else if ( elemType == SMDSEntity_Polygon ) // POLYGONS else if ( elemType == SMDSEntity_Polygon ) // POLYGONS
do do
{ {

View File

@ -155,8 +155,8 @@ Driver_Mesh::Status DriverGMF_Write::Perform()
GmfExtraVerticesAtTriangles, tria ) GmfExtraVerticesAtTriangles, tria )
node2IdMap[ tria->GetNode( 3 )], node2IdMap[ tria->GetNode( 3 )],
node2IdMap[ tria->GetNode( 4 )], node2IdMap[ tria->GetNode( 4 )],
node2IdMap[ tria->GetNode( 5 )] node2IdMap[ tria->GetNode( 5 )],
//node2IdMap[ tria->GetNodeWrap( 6 )] // for TRIA7 node2IdMap[ tria->GetNodeWrap( 6 )] // for TRIA7
END_EXTRA_VERTICES_WRITE(); END_EXTRA_VERTICES_WRITE();
// quadrangles // quadrangles

View File

@ -431,6 +431,7 @@ DriverMED_R_SMESHDS_Mesh
case eSEG3: aNbNodes = 3; break; case eSEG3: aNbNodes = 3; break;
case eTRIA3: aNbNodes = 3; break; case eTRIA3: aNbNodes = 3; break;
case eTRIA6: aNbNodes = 6; break; case eTRIA6: aNbNodes = 6; break;
case eTRIA7: aNbNodes = 7; break;
case eQUAD4: aNbNodes = 4; break; case eQUAD4: aNbNodes = 4; break;
case eQUAD8: aNbNodes = 8; break; case eQUAD8: aNbNodes = 8; break;
case eQUAD9: aNbNodes = 9; break; case eQUAD9: aNbNodes = 9; break;
@ -552,6 +553,24 @@ DriverMED_R_SMESHDS_Mesh
isRenum = anIsElemNum; isRenum = anIsElemNum;
} }
break; break;
case eTRIA7:
aNbNodes = 7;
if(anIsElemNum)
anElement = myMesh->AddFaceWithID(aNodeIds[0], aNodeIds[1],
aNodeIds[2], aNodeIds[3],
aNodeIds[4], aNodeIds[5], aNodeIds[6],
aCellInfo->GetElemNum(iElem));
if (!anElement) {
anElement = myMesh->AddFace(FindNode(myMesh,aNodeIds[0]),
FindNode(myMesh,aNodeIds[1]),
FindNode(myMesh,aNodeIds[2]),
FindNode(myMesh,aNodeIds[3]),
FindNode(myMesh,aNodeIds[4]),
FindNode(myMesh,aNodeIds[5]),
FindNode(myMesh,aNodeIds[6]));
isRenum = anIsElemNum;
}
break;
case eQUAD4: case eQUAD4:
aNbNodes = 4; aNbNodes = 4;
if(anIsElemNum) if(anIsElemNum)

View File

@ -532,28 +532,33 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
anEntity = eARETE; anEntity = eARETE;
#endif #endif
aTElemTypeDatas.push_back( TElemTypeData(anEntity, aTElemTypeDatas.push_back( TElemTypeData(anEntity,
eSEG2, eSEG2,
nbElemInfo.NbEdges( ORDER_LINEAR ), nbElemInfo.NbEdges( ORDER_LINEAR ),
SMDSAbs_Edge)); SMDSAbs_Edge));
aTElemTypeDatas.push_back( TElemTypeData(anEntity, aTElemTypeDatas.push_back( TElemTypeData(anEntity,
eSEG3, eSEG3,
nbElemInfo.NbEdges( ORDER_QUADRATIC ), nbElemInfo.NbEdges( ORDER_QUADRATIC ),
SMDSAbs_Edge)); SMDSAbs_Edge));
#ifdef _ELEMENTS_BY_DIM_ #ifdef _ELEMENTS_BY_DIM_
anEntity = eFACE; anEntity = eFACE;
#endif #endif
aTElemTypeDatas.push_back( TElemTypeData(anEntity, aTElemTypeDatas.push_back( TElemTypeData(anEntity,
eTRIA3, eTRIA3,
nbElemInfo.NbTriangles( ORDER_LINEAR ), nbElemInfo.NbTriangles( ORDER_LINEAR ),
SMDSAbs_Face)); SMDSAbs_Face));
aTElemTypeDatas.push_back( TElemTypeData(anEntity, aTElemTypeDatas.push_back( TElemTypeData(anEntity,
eTRIA6, eTRIA6,
nbElemInfo.NbTriangles( ORDER_QUADRATIC ), nbElemInfo.NbTriangles( ORDER_QUADRATIC ) -
SMDSAbs_Face)); nbElemInfo.NbBiQuadTriangles(),
SMDSAbs_Face));
aTElemTypeDatas.push_back( TElemTypeData(anEntity, aTElemTypeDatas.push_back( TElemTypeData(anEntity,
eQUAD4, eTRIA7,
nbElemInfo.NbQuadrangles( ORDER_LINEAR ), nbElemInfo.NbBiQuadTriangles(),
SMDSAbs_Face)); SMDSAbs_Face));
aTElemTypeDatas.push_back( TElemTypeData(anEntity,
eQUAD4,
nbElemInfo.NbQuadrangles( ORDER_LINEAR ),
SMDSAbs_Face));
aTElemTypeDatas.push_back( TElemTypeData(anEntity, aTElemTypeDatas.push_back( TElemTypeData(anEntity,
eQUAD8, eQUAD8,
nbElemInfo.NbQuadrangles( ORDER_QUADRATIC ) - nbElemInfo.NbQuadrangles( ORDER_QUADRATIC ) -
@ -578,25 +583,25 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
anEntity = eMAILLE; anEntity = eMAILLE;
#endif #endif
aTElemTypeDatas.push_back( TElemTypeData(anEntity, aTElemTypeDatas.push_back( TElemTypeData(anEntity,
eTETRA4, eTETRA4,
nbElemInfo.NbTetras( ORDER_LINEAR ), nbElemInfo.NbTetras( ORDER_LINEAR ),
SMDSAbs_Volume)); SMDSAbs_Volume));
aTElemTypeDatas.push_back( TElemTypeData(anEntity, aTElemTypeDatas.push_back( TElemTypeData(anEntity,
eTETRA10, eTETRA10,
nbElemInfo.NbTetras( ORDER_QUADRATIC ), nbElemInfo.NbTetras( ORDER_QUADRATIC ),
SMDSAbs_Volume)); SMDSAbs_Volume));
aTElemTypeDatas.push_back( TElemTypeData(anEntity, aTElemTypeDatas.push_back( TElemTypeData(anEntity,
ePYRA5, ePYRA5,
nbElemInfo.NbPyramids( ORDER_LINEAR ), nbElemInfo.NbPyramids( ORDER_LINEAR ),
SMDSAbs_Volume)); SMDSAbs_Volume));
aTElemTypeDatas.push_back( TElemTypeData(anEntity, aTElemTypeDatas.push_back( TElemTypeData(anEntity,
ePYRA13, ePYRA13,
nbElemInfo.NbPyramids( ORDER_QUADRATIC ), nbElemInfo.NbPyramids( ORDER_QUADRATIC ),
SMDSAbs_Volume)); SMDSAbs_Volume));
aTElemTypeDatas.push_back( TElemTypeData(anEntity, aTElemTypeDatas.push_back( TElemTypeData(anEntity,
ePENTA6, ePENTA6,
nbElemInfo.NbPrisms( ORDER_LINEAR ), nbElemInfo.NbPrisms( ORDER_LINEAR ),
SMDSAbs_Volume)); SMDSAbs_Volume));
aTElemTypeDatas.push_back( TElemTypeData(anEntity, aTElemTypeDatas.push_back( TElemTypeData(anEntity,
ePENTA15, ePENTA15,
nbElemInfo.NbPrisms( ORDER_QUADRATIC ), nbElemInfo.NbPrisms( ORDER_QUADRATIC ),

View File

@ -198,23 +198,32 @@ Driver_Mesh::Status DriverUNV_R_SMDS_Mesh::Perform()
aRec.node_labels[2], aRec.node_labels[2],
aRec.label); aRec.label);
break; break;
case 42: // Plane Stress Parabolic Triangle case 42: // Plane Stress Parabolic Triangle
case 52: // Plane Strain Parabolic Triangle case 52: // Plane Strain Parabolic Triangle
case 62: // Plate Parabolic Triangle case 62: // Plate Parabolic Triangle
case 72: // Membrane Parabolic Triangle case 72: // Membrane Parabolic Triangle
case 82: // Axisymetric Solid Parabolic Triangle case 82: // Axisymetric Solid Parabolic Triangle
case 92: // Thin Shell Parabolic Triangle case 92: // Thin Shell Parabolic Triangle
//MESSAGE("add face " << aRec.label << " " << aRec.node_labels[0] << " " << aRec.node_labels[1] << " " << aRec.node_labels[2] << " " << aRec.node_labels[3] << " " << aRec.node_labels[4] << " " << aRec.node_labels[5]); if ( aRec.node_labels.size() == 7 )
anElement = myMesh->AddFaceWithID(aRec.node_labels[0], anElement = myMesh->AddFaceWithID(aRec.node_labels[0],
aRec.node_labels[2], aRec.node_labels[2],
aRec.node_labels[4], aRec.node_labels[4],
aRec.node_labels[1], aRec.node_labels[1],
aRec.node_labels[3], aRec.node_labels[3],
aRec.node_labels[5], aRec.node_labels[5],
aRec.label); aRec.node_labels[6],
aRec.label);
else
anElement = myMesh->AddFaceWithID(aRec.node_labels[0],
aRec.node_labels[2],
aRec.node_labels[4],
aRec.node_labels[1],
aRec.node_labels[3],
aRec.node_labels[5],
aRec.label);
break; break;
case 44: // Plane Stress Linear Quadrilateral case 44: // Plane Stress Linear Quadrilateral
case 54: // Plane Strain Linear Quadrilateral case 54: // Plane Strain Linear Quadrilateral
case 64: // Plate Linear Quadrilateral case 64: // Plate Linear Quadrilateral
@ -227,29 +236,41 @@ Driver_Mesh::Status DriverUNV_R_SMDS_Mesh::Perform()
aRec.node_labels[3], aRec.node_labels[3],
aRec.label); aRec.label);
break; break;
case 45: // Plane Stress Parabolic Quadrilateral case 45: // Plane Stress Parabolic Quadrilateral
case 55: // Plane Strain Parabolic Quadrilateral case 55: // Plane Strain Parabolic Quadrilateral
case 65: // Plate Parabolic Quadrilateral case 65: // Plate Parabolic Quadrilateral
case 75: // Membrane Parabolic Quadrilateral case 75: // Membrane Parabolic Quadrilateral
case 85: // Axisymetric Solid Parabolic Quadrilateral case 85: // Axisymetric Solid Parabolic Quadrilateral
case 95: // Thin Shell Parabolic Quadrilateral case 95: // Thin Shell Parabolic Quadrilateral
anElement = myMesh->AddFaceWithID(aRec.node_labels[0], if ( aRec.node_labels.size() == 9 )
aRec.node_labels[2], anElement = myMesh->AddFaceWithID(aRec.node_labels[0],
aRec.node_labels[4], aRec.node_labels[2],
aRec.node_labels[6], aRec.node_labels[4],
aRec.node_labels[1], aRec.node_labels[6],
aRec.node_labels[3], aRec.node_labels[1],
aRec.node_labels[5], aRec.node_labels[3],
aRec.node_labels[7], aRec.node_labels[5],
aRec.label); aRec.node_labels[7],
aRec.node_labels[8],
aRec.label);
else
anElement = myMesh->AddFaceWithID(aRec.node_labels[0],
aRec.node_labels[2],
aRec.node_labels[4],
aRec.node_labels[6],
aRec.node_labels[1],
aRec.node_labels[3],
aRec.node_labels[5],
aRec.node_labels[7],
aRec.label);
break; break;
} }
} }
else if(IsVolume(aRec.fe_descriptor_id)){ else if(IsVolume(aRec.fe_descriptor_id)){
//MESSAGE("add volume " << aRec.label); //MESSAGE("add volume " << aRec.label);
switch(aRec.fe_descriptor_id){ switch(aRec.fe_descriptor_id){
case 111: // Solid Linear Tetrahedron - TET4 case 111: // Solid Linear Tetrahedron - TET4
anElement = myMesh->AddVolumeWithID(aRec.node_labels[0], anElement = myMesh->AddVolumeWithID(aRec.node_labels[0],
aRec.node_labels[2], aRec.node_labels[2],

View File

@ -106,17 +106,16 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
TRecord aRec; TRecord aRec;
aRec.label = anElem->GetID(); aRec.label = anElem->GetID();
aRec.node_labels.reserve(aNbNodes); aRec.node_labels.reserve(aNbNodes);
SMDS_ElemIteratorPtr aNodesIter;
aNodesIter = anElem->nodesIteratorToUNV();
if( anElem->IsQuadratic() ) { if( anElem->IsQuadratic() ) {
aRec.fe_descriptor_id = 22; aRec.fe_descriptor_id = 22;
} else { } else {
aRec.fe_descriptor_id = 11; aRec.fe_descriptor_id = 11;
} }
SMDS_NodeIteratorPtr aNodesIter = anElem->nodesIteratorToUNV();
while( aNodesIter->more()) while( aNodesIter->more())
{ {
const SMDS_MeshElement* aNode = aNodesIter->next(); const SMDS_MeshNode* aNode = aNodesIter->next();
aRec.node_labels.push_back(aNode->GetID()); aRec.node_labels.push_back( aNode->GetID() );
} }
aDataSet2412.push_back(aRec); aDataSet2412.push_back(aRec);
} }
@ -135,29 +134,18 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
TRecord aRec; TRecord aRec;
aRec.label = anElem->GetID(); aRec.label = anElem->GetID();
aRec.node_labels.reserve(aNbNodes); aRec.node_labels.reserve(aNbNodes);
SMDS_ElemIteratorPtr aNodesIter; SMDS_NodeIteratorPtr aNodesIter = anElem->nodesIteratorToUNV();
aNodesIter = anElem->nodesIteratorToUNV(); while( aNodesIter->more() ) {
for(; aNodesIter->more();){ const SMDS_MeshNode* aNode = aNodesIter->next();
const SMDS_MeshElement* aNode = aNodesIter->next(); aRec.node_labels.push_back( aNode->GetID() );
aRec.node_labels.push_back(aNode->GetID());
} }
switch(aNbNodes){ switch ( aNbNodes ) {
case 3: case 3: aRec.fe_descriptor_id = 41; break;
aRec.fe_descriptor_id = 41; case 4: aRec.fe_descriptor_id = 44; break;
break; case 6: aRec.fe_descriptor_id = 42; break;
case 4: case 7: aRec.fe_descriptor_id = 42; break;
aRec.fe_descriptor_id = 44; case 8: aRec.fe_descriptor_id = 45; break;
break; case 9: aRec.fe_descriptor_id = 45; aRec.node_labels.resize( 8 ); break;
case 6:
aRec.fe_descriptor_id = 42;
break;
case 8:
aRec.fe_descriptor_id = 45;
break;
case 9:
aRec.fe_descriptor_id = 45;
aRec.node_labels.resize( 8 );
break;
default: default:
continue; continue;
} }
@ -173,11 +161,9 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
while ( anIter->more()) while ( anIter->more())
{ {
const SMDS_MeshVolume* anElem = anIter->next(); const SMDS_MeshVolume* anElem = anIter->next();
int aNbNodes = anElem->NbNodes(); if ( anElem->IsPoly() )
SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIteratorToUNV();
if ( anElem->IsPoly() ) {
continue; continue;
} int aNbNodes = anElem->NbNodes();
int anId = -1; int anId = -1;
switch(aNbNodes) { switch(aNbNodes) {
case 4: anId = 111; break; case 4: anId = 111; break;
@ -196,6 +182,7 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
aRec.label = anElem->GetID(); aRec.label = anElem->GetID();
aRec.fe_descriptor_id = anId; aRec.fe_descriptor_id = anId;
aRec.node_labels.reserve(aNbNodes); aRec.node_labels.reserve(aNbNodes);
SMDS_NodeIteratorPtr aNodesIter = anElem->nodesIteratorToUNV();
while ( aNodesIter->more() && aRec.node_labels.size() < aNbNodes ) while ( aNodesIter->more() && aRec.node_labels.size() < aNbNodes )
{ {
const SMDS_MeshElement* aNode = aNodesIter->next(); const SMDS_MeshElement* aNode = aNodesIter->next();