- // Triangle defines sub-domian inside the pyramid if it's
- // normal points out of the pyram
-
- // make i2 and i3 hold indices of base nodes of the pyram while
- // keeping the nodes order in the triangle
- const int iApex = 4;
- if ( i2 == iApex )
- i2 = i3, i3 = pyram->GetNodeIndex( node1 );
- else if ( i3 == iApex )
- i3 = i2, i2 = pyram->GetNodeIndex( node1 );
-
- int i3base = (i2+1) % 4; // next index after i2 within the pyramid base
- bool isDomainInPyramid = ( i3base != i3 );
- return isDomainInPyramid ? HOLE_ID : pyram->getshapeId();
+ if ( nbNodes == 5 )
+ {
+ // Triangle defines sub-domian inside the pyramid if it's
+ // normal points out of the vol
+
+ // make i2 and i3 hold indices of base nodes of the vol while
+ // keeping the nodes order in the triangle
+ const int iApex = 4;
+ if ( i2 == iApex )
+ i2 = i3, i3 = vol->GetNodeIndex( node1 );
+ else if ( i3 == iApex )
+ i3 = i2, i2 = vol->GetNodeIndex( node1 );
+
+ int i3base = (i2+1) % 4; // next index after i2 within the pyramid base
+ bool isDomainInPyramid = ( i3base != i3 );
+ return isDomainInPyramid ? HOLE_ID : vol->getshapeId();
+ }
+ else
+ {
+ return vol->getshapeId(); // triangle is a prism top
+ }