- med_int aNbTriaConn = MED::GetNbConn(SMDS_MED_ENTITY,MED_TRIA3,aMeshDimension);
- MED::TIntVector anTriaElemNums;
- anTriaElemNums.reserve(aNbElems);
- MED::TIntVector aTriaFamilyNums;
- aTriaFamilyNums.reserve(aNbElems);
- MED::TIntVector aTriaConn;
- aTriaConn.reserve(aNbElems*aNbTriaConn);
-
- med_int aNbQuadConn = MED::GetNbConn(SMDS_MED_ENTITY,MED_QUAD4,aMeshDimension);
- MED::TIntVector aQuadElemNums;
- aQuadElemNums.reserve(aNbElems);
- MED::TIntVector aQuadFamilyNums;
- aQuadFamilyNums.reserve(aNbElems);
- MED::TIntVector aQuadConn;
- aQuadConn.reserve(aNbElems*aNbQuadConn);
-
- for(med_int iElem = 0; iElem < aNbElems && anIter->more(); iElem++){
- const SMDS_MeshFace* anElem = anIter->next();
- med_int aNbNodes = anElem->NbNodes();
- SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
- med_int aNbConnectivity;
- MED::TIntVector* anElemNums;
- MED::TIntVector* aFamilyNums;
- MED::TIntVector* aConnectivity;
- switch(aNbNodes){
- case 3:
- aNbConnectivity = aNbTriaConn;
- anElemNums = &anTriaElemNums;
- aFamilyNums = &aTriaFamilyNums;
- aConnectivity = &aTriaConn;
- break;
- case 4:
- aNbConnectivity = aNbQuadConn;
- anElemNums = &aQuadElemNums;
- aFamilyNums = &aQuadFamilyNums;
- aConnectivity = &aQuadConn;
- break;
- }
- MED::TIntVector aVector(aNbNodes);
- for(med_int iNode = 0; aNodesIter->more(); iNode++){
- const SMDS_MeshElement* aNode = aNodesIter->next();
- aVector[iNode] = aNode->GetID();
- }
-
- med_int aSize = aConnectivity->size();
- aConnectivity->resize(aSize+aNbConnectivity);
- // There is some differnce between SMDS and MED in cells mapping
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ eTETRA4,
+ nbElemInfo.NbTetras( ORDER_LINEAR ),
+ SMDSAbs_Volume));
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ eTETRA10,
+ nbElemInfo.NbTetras( ORDER_QUADRATIC ),
+ SMDSAbs_Volume));
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ ePYRA5,
+ nbElemInfo.NbPyramids( ORDER_LINEAR ),
+ SMDSAbs_Volume));
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ ePYRA13,
+ nbElemInfo.NbPyramids( ORDER_QUADRATIC ),
+ SMDSAbs_Volume));
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ ePENTA6,
+ nbElemInfo.NbPrisms( ORDER_LINEAR ),
+ SMDSAbs_Volume));
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ ePENTA15,
+ nbElemInfo.NbPrisms( ORDER_QUADRATIC ),
+ SMDSAbs_Volume));
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ eHEXA8,
+ nbElemInfo.NbHexas( ORDER_LINEAR ),
+ SMDSAbs_Volume));
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ eHEXA20,
+ nbElemInfo.NbHexas( ORDER_QUADRATIC )-
+ nbElemInfo.NbTriQuadHexas(),
+ SMDSAbs_Volume));
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ eHEXA27,
+ nbElemInfo.NbTriQuadHexas(),
+ SMDSAbs_Volume));
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ eOCTA12,
+ nbElemInfo.NbHexPrisms(),
+ SMDSAbs_Volume));
+ if ( polyTypesSupported ) {
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ ePOLYEDRE,
+ nbElemInfo.NbPolyhedrons(),
+ SMDSAbs_Volume));
+ // we need one more loop on poly elements to count nb of their nodes
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ ePOLYEDRE,
+ 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;
+ }
+
+ // iterator on elements of a current type
+ SMDS_ElemIteratorPtr elemIterator;
+ int iElem = 0;
+
+ // Treat POLYGONs
+ // ---------------
+ if ( aElemTypeData->_geomType == ePOLYGONE )
+ {
+ elemIterator = myMesh->elementGeomIterator( SMDSGeom_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 );