- // find number of 2d elems on side faces
- int nb2d = 0;
- nb2d += GetNb2d(fFront, theMesh, aResMap);
- nb2d += GetNb2d(fRight, theMesh, aResMap);
- nb2d += GetNb2d(fBack, theMesh, aResMap);
- nb2d += GetNb2d(fLeft, theMesh, aResMap);
-
- // find number of 2d elems and nodes on bottom faces
- int nb0d=0, nb2d_3=0, nb2d_4=0;
- for(i=1; i<=BottomFaces.Length(); i++) {
- SMESH_subMesh *sm = theMesh.GetSubMesh(BottomFaces.Value(i));
- if( sm ) {
- MapShapeNbElemsItr anIt = aResMap.find(sm);
- if( anIt == aResMap.end() ) continue;
- std::vector<int> aVec = (*anIt).second;
- nb0d += aVec[SMDSEntity_Node];
- nb2d_3 += Max(aVec[SMDSEntity_Triangle], aVec[SMDSEntity_Quad_Triangle]);
- nb2d_4 += Max(aVec[SMDSEntity_Quadrangle], aVec[SMDSEntity_Quad_Quadrangle]);
- }
- }
- nb0d += nb0d_in;
-
- std::vector<int> aResVec(SMDSEntity_Last);
- for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aResVec[i] = 0;
- if(_quadraticMesh) {
- aResVec[SMDSEntity_Quad_Penta] = nb2d_3 * ( nb2d/nb1d );
- aResVec[SMDSEntity_Quad_Hexa] = nb2d_4 * ( nb2d/nb1d );
- aResVec[SMDSEntity_Node] = nb0d * ( 2*nb2d/nb1d - 1 );
- }
- else {
- aResVec[SMDSEntity_Node] = nb0d * ( nb2d/nb1d - 1 );
- aResVec[SMDSEntity_Penta] = nb2d_3 * ( nb2d/nb1d );
- aResVec[SMDSEntity_Hexa] = nb2d_4 * ( nb2d/nb1d );
- }
- SMESH_subMesh * sm = theMesh.GetSubMesh(theShape);
- aResMap.insert(std::make_pair(sm,aResVec));
+ // Fill nb of elements
+ vector<int> aResVec(SMDSEntity_Last,0);
+ int nbSeg3 = ( nbFaces + nbQuadFace ) / nbSeg2;
+ aResVec[SMDSEntity_Node] = (nbSeg1-1) * (nbSeg2-1) * (nbSeg3-1);
+ aResVec[SMDSEntity_Hexa] = nbSeg1 * nbFaces;
+ aResVec[SMDSEntity_Quad_Hexa] = nbSeg1 * nbQuadFace;
+
+ aResMap.insert( make_pair( theMesh.GetSubMesh(theShape), aResVec ));