- case 3: {
- const SMDS_MeshNode* botNodes[3] = { (*columns[0])[z-1],
- (*columns[1])[z-1],
- (*columns[2])[z-1] };
- const SMDS_MeshNode* topNodes[3] = { (*columns[0])[z],
- (*columns[1])[z],
- (*columns[2])[z] };
- if ( isForward )
- vol = helper->AddVolume( botNodes[0], botNodes[1], botNodes[2],
- topNodes[0], topNodes[1], topNodes[2]);
- else
- vol = helper->AddVolume( topNodes[0], topNodes[1], topNodes[2],
- botNodes[0], botNodes[1], botNodes[2]);
- break;
- }
- case 4: {
- const SMDS_MeshNode* botNodes[4] = { (*columns[0])[z-1], (*columns[1])[z-1],
- (*columns[2])[z-1], (*columns[3])[z-1] };
- const SMDS_MeshNode* topNodes[4] = { (*columns[0])[z], (*columns[1])[z],
- (*columns[2])[z], (*columns[3])[z] };
- if ( isForward )
- vol = helper->AddVolume( botNodes[0], botNodes[1], botNodes[2], botNodes[3],
- topNodes[0], topNodes[1], topNodes[2], topNodes[3]);
- else
- vol = helper->AddVolume( topNodes[0], topNodes[1], topNodes[2], topNodes[3],
- botNodes[0], botNodes[1], botNodes[2], botNodes[3]);
- break;
- }
- default:
- // polyhedron
- vector<const SMDS_MeshNode*> nodes( 2*nbNodes + 4*nbNodes);
- vector<int> quantities( 2 + nbNodes, 4 );
- quantities[0] = quantities[1] = nbNodes;
- columns.resize( nbNodes + 1 );
- columns[ nbNodes ] = columns[ 0 ];
+ helper->SetElementsOnShape( true );
+
+ switch ( nbNodes ) {
+
+ case 3: { // ---------- pentahedra
+ const int i1 = isForward ? 1 : 2;
+ const int i2 = isForward ? 2 : 1;
+ for ( z = 1; z < nbZ; ++z )
+ helper->AddVolume( (*columns[0 ])[z-1], // bottom
+ (*columns[i1])[z-1],
+ (*columns[i2])[z-1],
+ (*columns[0 ])[z], // top
+ (*columns[i1])[z],
+ (*columns[i2])[z] );
+ break;
+ }
+ case 4: { // ---------- hexahedra
+ const int i1 = isForward ? 1 : 3;
+ const int i3 = isForward ? 3 : 1;
+ for ( z = 1; z < nbZ; ++z )
+ helper->AddVolume( (*columns[0])[z-1], (*columns[i1])[z-1], // bottom
+ (*columns[2])[z-1], (*columns[i3])[z-1],
+ (*columns[0])[z], (*columns[i1])[z], // top
+ (*columns[2])[z], (*columns[i3])[z] );
+ break;
+ }
+ case 6: { // ---------- octahedra
+ const int iBase1 = isForward ? -1 : 0;
+ const int iBase2 = isForward ? 0 :-1;
+ for ( z = 1; z < nbZ; ++z )
+ helper->AddVolume( (*columns[0])[z+iBase1], (*columns[1])[z+iBase1], // bottom or top
+ (*columns[2])[z+iBase1], (*columns[3])[z+iBase1],
+ (*columns[4])[z+iBase1], (*columns[5])[z+iBase1],
+ (*columns[0])[z+iBase2], (*columns[1])[z+iBase2], // top or bottom
+ (*columns[2])[z+iBase2], (*columns[3])[z+iBase2],
+ (*columns[4])[z+iBase2], (*columns[5])[z+iBase2] );
+ break;
+ }
+ default: // ---------- polyhedra
+ vector<int> quantities( 2 + nbNodes, 4 );
+ quantities[0] = quantities[1] = nbNodes;
+ columns.resize( nbNodes + 1 );
+ columns[ nbNodes ] = columns[ 0 ];
+ const int i1 = isForward ? 1 : 3;
+ const int i3 = isForward ? 3 : 1;
+ const int iBase1 = isForward ? -1 : 0;
+ const int iBase2 = isForward ? 0 :-1;
+ vector<const SMDS_MeshNode*> nodes( 2*nbNodes + 4*nbNodes);
+ for ( z = 1; z < nbZ; ++z )
+ {