From: Christophe Bourcier Date: Wed, 23 Nov 2016 16:10:19 +0000 (+0100) Subject: Add pyramids reading X-Git-Tag: V8_2_0rc1~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5d8f93270e80e865004af705df8588e1ea9f5673;p=plugins%2Fhybridplugin.git Add pyramids reading --- diff --git a/src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.cxx b/src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.cxx index 02b9e78..4758b87 100644 --- a/src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.cxx +++ b/src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.cxx @@ -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 ) { diff --git a/src/HYBRIDPlugin/MG_HYBRID_API.cxx b/src/HYBRIDPlugin/MG_HYBRID_API.cxx index 4f7c925..c260a70 100644 --- a/src/HYBRIDPlugin/MG_HYBRID_API.cxx +++ b/src/HYBRIDPlugin/MG_HYBRID_API.cxx @@ -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 diff --git a/src/HYBRIDPlugin/MG_HYBRID_API.hxx b/src/HYBRIDPlugin/MG_HYBRID_API.hxx index 461dfb5..64cfe6a 100644 --- a/src/HYBRIDPlugin/MG_HYBRID_API.hxx +++ b/src/HYBRIDPlugin/MG_HYBRID_API.hxx @@ -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 );