]> SALOME platform Git repositories - plugins/hybridplugin.git/commitdiff
Salome HOME
Add pyramids reading
authorChristophe Bourcier <christophe.bourcier@cea.fr>
Wed, 23 Nov 2016 16:10:19 +0000 (17:10 +0100)
committerChristophe Bourcier <christophe.bourcier@cea.fr>
Wed, 23 Nov 2016 16:10:19 +0000 (17:10 +0100)
src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.cxx
src/HYBRIDPlugin/MG_HYBRID_API.cxx
src/HYBRIDPlugin/MG_HYBRID_API.hxx

index 02b9e78c3d4c2065d70a7e6c228c1608c6c16e77..4758b872eab08c63d86063f5e14e354b0a40e112 100644 (file)
@@ -661,6 +661,7 @@ static bool readGMFFile(MG_HYBRID_API*                  MGOutput,
   tabRef[GmfTriangles]      = 3; // for enforced faces
   tabRef[GmfQuadrilaterals] = 4;
   tabRef[GmfTetrahedra]     = 4; // for new tetras
+  tabRef[GmfPyramids]       = 5; // for new pyramids
   tabRef[GmfPrisms]         = 6; // for new prisms
   tabRef[GmfHexahedra]      = 8;
 
@@ -792,6 +793,12 @@ static bool readGMFFile(MG_HYBRID_API*                  MGOutput,
 #endif
       }
     }
+    else if (token == GmfPyramids && nbElem > 0) {
+      (nbElem <= 1) ? tmpStr = " Pyramid" : tmpStr = " Pyramids";
+      for ( int iElem = 0; iElem < nbElem; iElem++ )
+        MGOutput->GmfGetLin(InpMsh, token, &id[iElem*tabRef[token]], &id[iElem*tabRef[token]+1], &id[iElem*tabRef[token]+2], &id[iElem*tabRef[token]+3],
+                  &id[iElem*tabRef[token]+4], &domainID[iElem]);
+    }
     else if (token == GmfPrisms && nbElem > 0) {
       (nbElem <= 1) ? tmpStr = " Prism" : tmpStr = " Prisms";
       for ( int iElem = 0; iElem < nbElem; iElem++ )
@@ -814,6 +821,7 @@ static bool readGMFFile(MG_HYBRID_API*                  MGOutput,
     case GmfTriangles:
     case GmfQuadrilaterals:
     case GmfTetrahedra:
+    case GmfPyramids:
     case GmfPrisms:
     case GmfHexahedra:
     {
@@ -899,6 +907,40 @@ static bool readGMFFile(MG_HYBRID_API*                  MGOutput,
                                                  noID, force3d );
           }
           break;
+        case GmfPyramids:
+          if ( hasGeom )
+          {
+            if ( solidID != HOLE_ID )
+            {
+              aCreatedElem = theHelper->AddVolume( node[3], node[2], node[1],
+                                                   node[0], node[4],
+                                                   noID, force3d );
+              theMeshDS->SetMeshElementOnShape( aCreatedElem, solidID );
+              for ( int iN = 0; iN < 5; ++iN )
+                if ( node[iN]->getshapeId() < 1 )
+                  theMeshDS->SetNodeInVolume( node[iN], solidID );
+            }
+          }
+          else
+          {
+            if ( elemSearcher ) {
+              // Issue 0020682. Avoid creating nodes and tetras at place where
+              // volumic elements already exist
+              if ( !node[1] || !node[0] || !node[2] || !node[3] || !node[4] || !node[5] )
+                continue;
+              if ( elemSearcher->FindElementsByPoint((SMESH_TNodeXYZ(node[0]) +
+                                                      SMESH_TNodeXYZ(node[1]) +
+                                                      SMESH_TNodeXYZ(node[2]) +
+                                                      SMESH_TNodeXYZ(node[3]) +
+                                                      SMESH_TNodeXYZ(node[4])) / 5.,
+                                                     SMDSAbs_Volume, foundVolumes ))
+                break;
+            }
+            aCreatedElem = theHelper->AddVolume( node[3], node[2], node[1],
+                                                   node[0], node[4],
+                                                   noID, force3d );
+          }
+          break;
         case GmfPrisms:
           if ( hasGeom )
           {
index 4f7c925043c7be8a904ef3fb5ff8e623bcbc2a53..c260a70cc2d0a13a636d3bc4a75800d47d9fccf9 100644 (file)
@@ -1054,6 +1054,25 @@ void MG_HYBRID_API::GmfGetLin(int iMesh, GmfKwdCod what,
   ::GmfGetLin(iMesh, what, node1, node2, node3, node4, node5, node6, node7, node8, domain );
 }
 
+//================================================================================
+/*!
+ * \brief Return node indices of a next pyramid
+ */
+//================================================================================
+
+void MG_HYBRID_API::GmfGetLin(int iMesh, GmfKwdCod what,
+                              int* node1, int* node2, int* node3, int* node4,
+                              int* node5, int* domain )
+{
+  if ( _useLib ) {
+#ifdef USE_MG_LIBS
+    _libData->ReadPyramidNodes( node1, node2, node3, node4, node5, domain );
+    return;
+#endif
+  }
+  ::GmfGetLin(iMesh, what, node1, node2, node3, node4, node5, domain );
+}
+
 //================================================================================
 /*!
  * \brief Return node indices of a next prism
index 461dfb5c06cf17dfd61126b5cc21567693b301b9..64cfe6a2bad730c78ba973ffbd4a0a48c8232a42 100644 (file)
@@ -66,6 +66,7 @@ public:
   void GmfGetLin(int iMesh, GmfKwdCod what, int* node1, int* node2, int* domain );
   void GmfGetLin(int iMesh, GmfKwdCod what, int* node1, int* node2, int* node3, int* domain );
   void GmfGetLin(int iMesh, GmfKwdCod what, int* node1, int* node2, int* node3, int* node4, int* domain );
+  void GmfGetLin(int iMesh, GmfKwdCod what, int* node1, int* node2, int* node3, int* node4, int* node5, int* domain ); //pyramids
   void GmfGetLin(int iMesh, GmfKwdCod what, int* node1, int* node2, int* node3, int* node4, int* node5, int* node6, int* domain );
   void GmfGetLin(int iMesh, GmfKwdCod what, int* node1, int* node2, int* node3, int* node4, int* node5, int* node6, int* node7, int* node8, int* domain );
   void GmfCloseMesh( int iMesh );