+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ eTRIA3,
+ FromSmIdType<TInt>(nbElemInfo.NbTriangles( ORDER_LINEAR )),
+ SMDSAbs_Face));
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ eTRIA6,
+ FromSmIdType<TInt>(nbElemInfo.NbTriangles( ORDER_QUADRATIC ) -
+ nbElemInfo.NbBiQuadTriangles()),
+ SMDSAbs_Face));
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ eTRIA7,
+ FromSmIdType<TInt>(nbElemInfo.NbBiQuadTriangles()),
+ SMDSAbs_Face));
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ eQUAD4,
+ FromSmIdType<TInt>(nbElemInfo.NbQuadrangles( ORDER_LINEAR )),
+ SMDSAbs_Face));
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ eQUAD8,
+ FromSmIdType<TInt>(nbElemInfo.NbQuadrangles( ORDER_QUADRATIC ) -
+ nbElemInfo.NbBiQuadQuadrangles()),
+ SMDSAbs_Face));
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ eQUAD9,
+ FromSmIdType<TInt>(nbElemInfo.NbBiQuadQuadrangles()),
+ SMDSAbs_Face));
+ if ( polyTypesSupported ) {
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ ePOLYGONE,
+ FromSmIdType<TInt>(nbElemInfo.NbPolygons( ORDER_LINEAR )),
+ SMDSAbs_Face));
+ // we need one more loop on poly elements to count nb of their nodes
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ ePOLYGONE,
+ FromSmIdType<TInt>(nbElemInfo.NbPolygons( ORDER_LINEAR )),
+ SMDSAbs_Face));
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ ePOLYGON2,
+ FromSmIdType<TInt>(nbElemInfo.NbPolygons( ORDER_QUADRATIC )),
+ SMDSAbs_Face));
+ // we need one more loop on QUAD poly elements to count nb of their nodes
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ ePOLYGON2,
+ FromSmIdType<TInt>(nbElemInfo.NbPolygons( ORDER_QUADRATIC )),
+ SMDSAbs_Face));
+ }
+#ifdef _ELEMENTS_BY_DIM_
+ anEntity = eMAILLE;
+#endif
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ eTETRA4,
+ FromSmIdType<TInt>(nbElemInfo.NbTetras( ORDER_LINEAR )),
+ SMDSAbs_Volume));
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ eTETRA10,
+ FromSmIdType<TInt>(nbElemInfo.NbTetras( ORDER_QUADRATIC )),
+ SMDSAbs_Volume));
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ ePYRA5,
+ FromSmIdType<TInt>(nbElemInfo.NbPyramids( ORDER_LINEAR )),
+ SMDSAbs_Volume));
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ ePYRA13,
+ FromSmIdType<TInt>(nbElemInfo.NbPyramids( ORDER_QUADRATIC )),
+ SMDSAbs_Volume));
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ ePENTA6,
+ FromSmIdType<TInt>(nbElemInfo.NbPrisms( ORDER_LINEAR )),
+ SMDSAbs_Volume));
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ ePENTA15,
+ FromSmIdType<TInt>(nbElemInfo.NbQuadPrisms()),
+ SMDSAbs_Volume));
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ ePENTA18,
+ FromSmIdType<TInt>(nbElemInfo.NbBiQuadPrisms()),
+ SMDSAbs_Volume));
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ eHEXA8,
+ FromSmIdType<TInt>(nbElemInfo.NbHexas( ORDER_LINEAR )),
+ SMDSAbs_Volume));
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ eHEXA20,
+ FromSmIdType<TInt>(nbElemInfo.NbHexas( ORDER_QUADRATIC )-
+ nbElemInfo.NbTriQuadHexas()),
+ SMDSAbs_Volume));
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ eHEXA27,
+ FromSmIdType<TInt>(nbElemInfo.NbTriQuadHexas()),
+ SMDSAbs_Volume));
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ eOCTA12,
+ FromSmIdType<TInt>(nbElemInfo.NbHexPrisms()),
+ SMDSAbs_Volume));
+ if ( polyTypesSupported ) {
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ ePOLYEDRE,
+ FromSmIdType<TInt>(nbElemInfo.NbPolyhedrons()),
+ SMDSAbs_Volume));
+ // we need one more loop on poly elements to count nb of their nodes
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ ePOLYEDRE,
+ FromSmIdType<TInt>(nbElemInfo.NbPolyhedrons()),
+ SMDSAbs_Volume));
+ }
+
+ vector< bool > isElemFamMapBuilt( SMDSAbs_NbElementTypes, false );
+
+ // loop on all geom types of elements
+
+ list< TElemTypeData >::iterator aElemTypeData = aTElemTypeDatas.begin();
+ for ( ; aElemTypeData != aTElemTypeDatas.end(); ++aElemTypeData )
+ {
+ if ( aElemTypeData->_nbElems == 0 )
+ continue;
+
+ int defaultFamilyId = 0;
+ switch ( aElemTypeData->_smdsType ) {
+ case SMDSAbs_0DElement: defaultFamilyId = my0DElementsDefaultFamilyId; break;
+ case SMDSAbs_Ball: defaultFamilyId = myBallsDefaultFamilyId; break;
+ case SMDSAbs_Edge: defaultFamilyId = myEdgesDefaultFamilyId; break;
+ case SMDSAbs_Face: defaultFamilyId = myFacesDefaultFamilyId; break;
+ case SMDSAbs_Volume: defaultFamilyId = myVolumesDefaultFamilyId; break;
+ default:
+ continue;
+ }
+
+ // build map of family numbers for this type
+ if ( !isElemFamMapBuilt[ aElemTypeData->_smdsType ])
+ {
+ fillElemFamilyMap( anElemFamMap, aFamilies, aElemTypeData->_smdsType );
+ isElemFamMapBuilt[ aElemTypeData->_smdsType ] = true;
+ }
+
+ // iterator on elements of a current type
+ SMDS_ElemIteratorPtr elemIterator;
+ TInt iElem = 0;
+
+ // Treat POLYGONs
+ // ---------------
+ if ( aElemTypeData->_geomType == ePOLYGONE ||
+ aElemTypeData->_geomType == ePOLYGON2 )
+ {
+ if ( aElemTypeData->_geomType == ePOLYGONE )
+ elemIterator = myMesh->elementEntityIterator( SMDSEntity_Polygon );
+ else
+ elemIterator = myMesh->elementEntityIterator( SMDSEntity_Quad_Polygon );
+
+ if ( nbPolygonNodes == 0 ) {
+ // Count nb of nodes
+ while ( elemIterator->more() ) {
+ const SMDS_MeshElement* anElem = elemIterator->next();
+ nbPolygonNodes += anElem->NbNodes();
+ if ( ++iElem == aElemTypeData->_nbElems )
+ break;
+ }
+ }
+ else {
+ // Store in med file
+ PPolygoneInfo aPolygoneInfo = myMed->CrPolygoneInfo(aMeshInfo,
+ aElemTypeData->_entity,
+ aElemTypeData->_geomType,
+ aElemTypeData->_nbElems,
+ nbPolygonNodes,
+ theConnMode, theIsElemNum,
+ theIsElemNames);
+ TElemNum & index = *(aPolygoneInfo->myIndex.get());
+ index[0] = 1;
+
+ while ( elemIterator->more() )
+ {
+ const SMDS_MeshElement* anElem = elemIterator->next();
+ // index
+ TInt aNbNodes = anElem->NbNodes();
+ index[ iElem+1 ] = index[ iElem ] + aNbNodes;
+
+ // connectivity
+ TConnSlice aTConnSlice = aPolygoneInfo->GetConnSlice( iElem );
+ for(TInt iNode = 0; iNode < aNbNodes; iNode++) {
+ const SMDS_MeshElement* aNode = anElem->GetNode( iNode );