- for ( int iZ = 1; iZ < nbZ; ++iZ )
- helper.AddVolume( (*nnVec[0])[iZ-1], (*nnVec[1])[iZ-1],
- (*nnVec[2])[iZ-1], (*nnVec[3])[iZ-1],
- (*nnVec[0])[iZ], (*nnVec[1])[iZ],
- (*nnVec[2])[iZ], (*nnVec[3])[iZ]);
+ switch ( degenEdgeInd.size() )
+ {
+ case 0: // HEX
+ {
+ for ( int iZ = 1; iZ < nbZ; ++iZ )
+ helper.AddVolume( (*nnVec[0])[iZ-1], (*nnVec[1])[iZ-1],
+ (*nnVec[2])[iZ-1], (*nnVec[3])[iZ-1],
+ (*nnVec[0])[iZ], (*nnVec[1])[iZ],
+ (*nnVec[2])[iZ], (*nnVec[3])[iZ]);
+ break;
+ }
+ case 2: // PENTA?
+ {
+ int i2 = *degenEdgeInd.begin();
+ int i3 = *degenEdgeInd.rbegin();
+ bool ok = ( i3 - i2 == 1 );
+ if ( i2 == 0 && i3 == 3 ) { i2 = 3; i3 = 0; ok = true; }
+ int i0 = helper.WrapIndex( i3 + 1, nbNodes );
+ int i1 = helper.WrapIndex( i0 + 1, nbNodes );
+ for ( int iZ = 1; iZ < nbZ; ++iZ )
+ {
+ const SMDS_MeshElement* vol =
+ helper.AddVolume( (*nnVec[i3])[0], (*nnVec[i0])[iZ], (*nnVec[i0])[iZ-1],
+ (*nnVec[i2])[0], (*nnVec[i1])[iZ], (*nnVec[i1])[iZ-1]);
+ if ( !ok && vol )
+ degenVols.push_back( vol );
+ }
+ break;
+ }
+ case 3: // degen HEX
+ {
+ const SMDS_MeshNode* nn[8];
+ for ( int iZ = 1; iZ < nbZ; ++iZ )
+ {
+ const SMDS_MeshElement* vol =
+ helper.AddVolume( nnVec[0]->size() > 1 ? (*nnVec[0])[iZ-1] : (*nnVec[0])[0],
+ nnVec[1]->size() > 1 ? (*nnVec[1])[iZ-1] : (*nnVec[1])[0],
+ nnVec[2]->size() > 1 ? (*nnVec[2])[iZ-1] : (*nnVec[2])[0],
+ nnVec[3]->size() > 1 ? (*nnVec[3])[iZ-1] : (*nnVec[3])[0],
+ nnVec[0]->size() > 1 ? (*nnVec[0])[iZ] : (*nnVec[0])[0],
+ nnVec[1]->size() > 1 ? (*nnVec[1])[iZ] : (*nnVec[1])[0],
+ nnVec[2]->size() > 1 ? (*nnVec[2])[iZ] : (*nnVec[2])[0],
+ nnVec[3]->size() > 1 ? (*nnVec[3])[iZ] : (*nnVec[3])[0]);
+ degenVols.push_back( vol );
+ }
+ }