]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
0022100: EDF 2413 SMESH: Take into account TRIA7
authoreap <eap@opencascade.com>
Thu, 16 May 2013 16:38:48 +0000 (16:38 +0000)
committereap <eap@opencascade.com>
Thu, 16 May 2013 16:38:48 +0000 (16:38 +0000)
src/DriverCGNS/DriverCGNS_Write.cxx
src/DriverGMF/DriverGMF_Write.cxx
src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx
src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx
src/DriverUNV/DriverUNV_R_SMDS_Mesh.cxx
src/DriverUNV/DriverUNV_W_SMDS_Mesh.cxx

index 44033075402e8553c464b8c4c4d53611fadee0f9..12cea95ac76564595ee1907c8c95f273f6c15569 100644 (file)
@@ -81,6 +81,8 @@ namespace
         static int ids[] = { 0, 2, 1, 5, 4, 3 };
         interlaces[SMDSEntity_Quad_Triangle] = ids;
         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 };
@@ -341,9 +343,12 @@ Driver_Mesh::Status DriverCGNS_Write::Perform()
     startID = cgID;
 
     if ( interlace ) // STANDARD elements
+    {
+      int cgnsNbNodes; // get nb nodes by element type, that can be less that elem->NbNodes()
+      cg_npe( cgType, &cgnsNbNodes );
       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 ));
         if ( elem->GetID() != 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;
       }
       while ( elem && elem->GetEntityType() == elemType );
-
+    }
     else if ( elemType == SMDSEntity_Polygon ) // POLYGONS
       do
       {
index c0542620ee6cdcc8665e9efe4a7a45722ed91977..d4f474771395ce3206d9c9deeb1bf8634901d7b6 100644 (file)
@@ -155,8 +155,8 @@ Driver_Mesh::Status DriverGMF_Write::Perform()
                               GmfExtraVerticesAtTriangles, tria )
     node2IdMap[ tria->GetNode( 3 )],
     node2IdMap[ tria->GetNode( 4 )],
-    node2IdMap[ tria->GetNode( 5 )]
-    //node2IdMap[ tria->GetNodeWrap( 6 )] // for TRIA7
+    node2IdMap[ tria->GetNode( 5 )],
+    node2IdMap[ tria->GetNodeWrap( 6 )] // for TRIA7
     END_EXTRA_VERTICES_WRITE();
 
   // quadrangles
index a7527fb976d4ed4f8891434084fa647b56eaf704..cd6243d16065e9be9b8c600aa27cd1cd2b915030 100644 (file)
@@ -431,6 +431,7 @@ DriverMED_R_SMESHDS_Mesh
               case eSEG3:    aNbNodes = 3;  break;
               case eTRIA3:   aNbNodes = 3;  break;
               case eTRIA6:   aNbNodes = 6;  break;
+              case eTRIA7:   aNbNodes = 7;  break;
               case eQUAD4:   aNbNodes = 4;  break;
               case eQUAD8:   aNbNodes = 8;  break;
               case eQUAD9:   aNbNodes = 9;  break;
@@ -552,6 +553,24 @@ DriverMED_R_SMESHDS_Mesh
                       isRenum = anIsElemNum;
                     }
                     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:
                     aNbNodes = 4;
                     if(anIsElemNum)
index ade26b2b7ab24e514ee69914ca26ab4dcc4586f6..a3d934c84077d39a47f4f6518876123e22bdd9ab 100644 (file)
@@ -532,28 +532,33 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
     anEntity = eARETE;
 #endif
     aTElemTypeDatas.push_back( TElemTypeData(anEntity,
-                                            eSEG2,
-                                            nbElemInfo.NbEdges( ORDER_LINEAR ),
-                                            SMDSAbs_Edge));
+                                             eSEG2,
+                                             nbElemInfo.NbEdges( ORDER_LINEAR ),
+                                             SMDSAbs_Edge));
     aTElemTypeDatas.push_back( TElemTypeData(anEntity,
-                                            eSEG3,
-                                            nbElemInfo.NbEdges( ORDER_QUADRATIC ),
-                                            SMDSAbs_Edge));
+                                             eSEG3,
+                                             nbElemInfo.NbEdges( ORDER_QUADRATIC ),
+                                             SMDSAbs_Edge));
 #ifdef _ELEMENTS_BY_DIM_
     anEntity = eFACE;
 #endif
     aTElemTypeDatas.push_back( TElemTypeData(anEntity,
-                                            eTRIA3,
-                                            nbElemInfo.NbTriangles( ORDER_LINEAR ),
-                                            SMDSAbs_Face));
+                                             eTRIA3,
+                                             nbElemInfo.NbTriangles( ORDER_LINEAR ),
+                                             SMDSAbs_Face));
     aTElemTypeDatas.push_back( TElemTypeData(anEntity,
-                                            eTRIA6,
-                                            nbElemInfo.NbTriangles( ORDER_QUADRATIC ),
-                                            SMDSAbs_Face));
+                                             eTRIA6,
+                                             nbElemInfo.NbTriangles( ORDER_QUADRATIC ) -
+                                             nbElemInfo.NbBiQuadTriangles(),
+                                             SMDSAbs_Face));
     aTElemTypeDatas.push_back( TElemTypeData(anEntity,
-                                            eQUAD4,
-                                            nbElemInfo.NbQuadrangles( ORDER_LINEAR ),
-                                            SMDSAbs_Face));
+                                             eTRIA7,
+                                             nbElemInfo.NbBiQuadTriangles(),
+                                             SMDSAbs_Face));
+    aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+                                             eQUAD4,
+                                             nbElemInfo.NbQuadrangles( ORDER_LINEAR ),
+                                             SMDSAbs_Face));
     aTElemTypeDatas.push_back( TElemTypeData(anEntity,
                                              eQUAD8,
                                              nbElemInfo.NbQuadrangles( ORDER_QUADRATIC ) -
@@ -578,25 +583,25 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
     anEntity = eMAILLE;
 #endif
     aTElemTypeDatas.push_back( TElemTypeData(anEntity,
-                                            eTETRA4,
-                                            nbElemInfo.NbTetras( ORDER_LINEAR ),
-                                            SMDSAbs_Volume));
+                                             eTETRA4,
+                                             nbElemInfo.NbTetras( ORDER_LINEAR ),
+                                             SMDSAbs_Volume));
     aTElemTypeDatas.push_back( TElemTypeData(anEntity,
-                                            eTETRA10,
-                                            nbElemInfo.NbTetras( ORDER_QUADRATIC ),
-                                            SMDSAbs_Volume));
+                                             eTETRA10,
+                                             nbElemInfo.NbTetras( ORDER_QUADRATIC ),
+                                             SMDSAbs_Volume));
     aTElemTypeDatas.push_back( TElemTypeData(anEntity,
-                                            ePYRA5,
-                                            nbElemInfo.NbPyramids( ORDER_LINEAR ),
-                                            SMDSAbs_Volume));
+                                             ePYRA5,
+                                             nbElemInfo.NbPyramids( ORDER_LINEAR ),
+                                             SMDSAbs_Volume));
     aTElemTypeDatas.push_back( TElemTypeData(anEntity,
-                                            ePYRA13,
-                                            nbElemInfo.NbPyramids( ORDER_QUADRATIC ),
-                                            SMDSAbs_Volume));
+                                             ePYRA13,
+                                             nbElemInfo.NbPyramids( ORDER_QUADRATIC ),
+                                             SMDSAbs_Volume));
     aTElemTypeDatas.push_back( TElemTypeData(anEntity,
-                                            ePENTA6,
-                                            nbElemInfo.NbPrisms( ORDER_LINEAR ),
-                                            SMDSAbs_Volume));
+                                             ePENTA6,
+                                             nbElemInfo.NbPrisms( ORDER_LINEAR ),
+                                             SMDSAbs_Volume));
     aTElemTypeDatas.push_back( TElemTypeData(anEntity,
                                              ePENTA15,
                                              nbElemInfo.NbPrisms( ORDER_QUADRATIC ),
index 6856037fae4ef3ecfa6024b9ff7c40fcb2e4f6ec..d1c9845956b6a9b7d717c1c8b470ca1b46f1b3cc 100644 (file)
@@ -198,23 +198,32 @@ Driver_Mesh::Status DriverUNV_R_SMDS_Mesh::Perform()
                                               aRec.node_labels[2],
                                               aRec.label);
             break;
-            
+
           case 42: //  Plane Stress Parabolic Triangle       
           case 52: //  Plane Strain Parabolic Triangle       
           case 62: //  Plate Parabolic Triangle              
           case 72: //  Membrane Parabolic Triangle           
           case 82: //  Axisymetric Solid 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]);
-            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);
+          case 92: //  Thin Shell Parabolic Triangle
+            if ( aRec.node_labels.size() == 7 )
+              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.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;
-            
+
           case 44: // Plane Stress Linear Quadrilateral     
           case 54: // Plane Strain Linear Quadrilateral     
           case 64: // Plate Linear Quadrilateral            
@@ -227,29 +236,41 @@ Driver_Mesh::Status DriverUNV_R_SMDS_Mesh::Perform()
                                               aRec.node_labels[3],
                                               aRec.label);
             break;
-            
+
           case 45: // Plane Stress Parabolic Quadrilateral      
           case 55: // Plane Strain Parabolic Quadrilateral      
           case 65: // Plate Parabolic Quadrilateral             
           case 75: // Membrane Parabolic Quadrilateral          
           case 85: // Axisymetric Solid Parabolic Quadrilateral 
           case 95: // Thin Shell Parabolic Quadrilateral        
-            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);
+            if ( aRec.node_labels.size() == 9 )
+              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.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;
           }
         }
         else if(IsVolume(aRec.fe_descriptor_id)){
           //MESSAGE("add volume " << aRec.label);
           switch(aRec.fe_descriptor_id){
-            
+
           case 111: // Solid Linear Tetrahedron - TET4
             anElement = myMesh->AddVolumeWithID(aRec.node_labels[0],
                                                 aRec.node_labels[2],
index d83601308b18a7a7f1122bdff22caf1a9c4f27e6..b981927bc59b16b9918775cd04c0956378155274 100644 (file)
@@ -106,17 +106,16 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
           TRecord aRec;
           aRec.label = anElem->GetID();
           aRec.node_labels.reserve(aNbNodes);
-          SMDS_ElemIteratorPtr aNodesIter;
-          aNodesIter = anElem->nodesIteratorToUNV();
           if( anElem->IsQuadratic() ) {
             aRec.fe_descriptor_id = 22;
           } else {
             aRec.fe_descriptor_id = 11;
           }
+          SMDS_NodeIteratorPtr aNodesIter = anElem->nodesIteratorToUNV();
           while( aNodesIter->more())
           {
-            const SMDS_MeshElement* aNode = aNodesIter->next();
-            aRec.node_labels.push_back(aNode->GetID());
+            const SMDS_MeshNode* aNode = aNodesIter->next();
+            aRec.node_labels.push_back( aNode->GetID() );
           }
           aDataSet2412.push_back(aRec);
         }
@@ -135,29 +134,18 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
           TRecord aRec;
           aRec.label = anElem->GetID();
           aRec.node_labels.reserve(aNbNodes);
-          SMDS_ElemIteratorPtr aNodesIter;
-          aNodesIter = anElem->nodesIteratorToUNV();
-          for(; aNodesIter->more();){
-            const SMDS_MeshElement* aNode = aNodesIter->next();
-            aRec.node_labels.push_back(aNode->GetID());
+          SMDS_NodeIteratorPtr aNodesIter = anElem->nodesIteratorToUNV();
+          while( aNodesIter->more() ) {
+            const SMDS_MeshNode* aNode = aNodesIter->next();
+            aRec.node_labels.push_back( aNode->GetID() );
           }
-          switch(aNbNodes){
-          case 3:
-            aRec.fe_descriptor_id = 41;
-            break;
-          case 4:
-            aRec.fe_descriptor_id = 44;
-            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;
+          switch ( aNbNodes ) {
+          case 3: aRec.fe_descriptor_id = 41; break;
+          case 4: aRec.fe_descriptor_id = 44; break;
+          case 6: aRec.fe_descriptor_id = 42; break;
+          case 7: 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:
             continue;
           }
@@ -173,11 +161,9 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
         while ( anIter->more())
         {
           const SMDS_MeshVolume* anElem = anIter->next();
-          int aNbNodes = anElem->NbNodes();
-          SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIteratorToUNV();
-          if ( anElem->IsPoly() ) {
+          if ( anElem->IsPoly() )
             continue;
-          }
+          int aNbNodes = anElem->NbNodes();
           int anId = -1;
           switch(aNbNodes) {
           case 4:  anId = 111; break;
@@ -196,6 +182,7 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
             aRec.label = anElem->GetID();
             aRec.fe_descriptor_id = anId;
             aRec.node_labels.reserve(aNbNodes);
+            SMDS_NodeIteratorPtr aNodesIter = anElem->nodesIteratorToUNV();
             while ( aNodesIter->more() && aRec.node_labels.size() < aNbNodes )
             {
               const SMDS_MeshElement* aNode = aNodesIter->next();