1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // File : SMDS_VolumeTool.cxx
21 // Created : Tue Jul 13 12:22:13 2004
22 // Author : Edward AGAPOV (eap)
23 // Copyright : Open CASCADE
26 #pragma warning(disable:4786)
29 #include "SMDS_VolumeTool.hxx"
31 #include "SMDS_MeshElement.hxx"
32 #include "SMDS_MeshNode.hxx"
33 #include "SMDS_PolyhedralVolumeOfNodes.hxx"
34 #include "SMDS_Mesh.hxx"
36 #include "utilities.h"
44 // ======================================================
45 // Node indices in faces depending on volume orientation
46 // making most faces normals external
47 // ======================================================
55 // N0 +---|---+ N1 TETRAHEDRON
63 static int Tetra_F [4][4] = { // FORWARD == EXTERNAL
64 { 0, 1, 2, 0 }, // All faces have external normals
68 static int Tetra_R [4][4] = { // REVERSED
69 { 0, 1, 2, 0 }, // All faces but a bottom have external normals
73 static int Tetra_RE [4][4] = { // REVERSED -> FORWARD (EXTERNAL)
74 { 0, 2, 1, 0 }, // All faces have external normals
78 static int Tetra_nbN [] = { 3, 3, 3, 3 };
83 static int Pyramid_F [5][5] = { // FORWARD == EXTERNAL
84 { 0, 1, 2, 3, 0 }, // All faces have external normals
89 static int Pyramid_R [5][5] = { // REVERSED
90 { 0, 1, 2, 3, 0 }, // All faces but a bottom have external normals
95 static int Pyramid_RE [5][5] = { // REVERSED -> FORWARD (EXTERNAL)
96 { 0, 3, 2, 1, 0 }, // All faces but a bottom have external normals
101 static int Pyramid_nbN [] = { 4, 3, 3, 3, 3 };
112 // | / \ | PENTAHEDRON
118 static int Penta_F [5][5] = { // FORWARD
119 { 0, 1, 2, 0, 0 }, // Top face has an internal normal, other - external
120 { 3, 4, 5, 3, 3 }, // 0 is bottom, 1 is top face
124 static int Penta_R [5][5] = { // REVERSED
125 { 0, 1, 2, 0, 0 }, // Bottom face has an internal normal, other - external
126 { 3, 4, 5, 3, 3 }, // 0 is bottom, 1 is top face
130 static int Penta_FE [5][5] = { // FORWARD -> EXTERNAL
136 static int Penta_RE [5][5] = { // REVERSED -> EXTERNAL
142 static int Penta_nbN [] = { 3, 3, 4, 4, 4 };
149 // N4+----------+N7 |
150 // | | | | HEXAHEDRON
153 // | N1+------|---+N2
159 static int Hexa_F [6][5] = { // FORWARD
160 { 0, 1, 2, 3, 0 }, // opposite faces are neighbouring,
161 { 4, 5, 6, 7, 4 }, // odd face(1,3,5) normal is internal, even(0,2,4) - external
162 { 1, 0, 4, 5, 1 }, // same index nodes of opposite faces are linked
166 // static int Hexa_R [6][5] = { // REVERSED
167 // { 0, 3, 2, 1, 0 }, // opposite faces are neighbouring,
168 // { 4, 7, 6, 5, 4 }, // odd face(1,3,5) normal is external, even(0,2,4) - internal
169 // { 1, 5, 4, 0, 1 }, // same index nodes of opposite faces are linked
170 // { 2, 6, 7, 3, 2 },
171 // { 0, 4, 7, 3, 0 },
172 // { 1, 5, 6, 2, 1 }};
173 static int Hexa_FE [6][5] = { // FORWARD -> EXTERNAL
174 { 0, 1, 2, 3, 0 } , // opposite faces are neighbouring,
175 { 4, 7, 6, 5, 4 }, // all face normals are external,
176 { 0, 4, 5, 1, 0 }, // links in opposite faces: 0-0, 1-3, 2-2, 3-1
180 static int Hexa_RE [6][5] = { // REVERSED -> EXTERNAL
181 { 0, 3, 2, 1, 0 }, // opposite faces are neighbouring,
182 { 4, 5, 6, 7, 4 }, // all face normals are external,
183 { 0, 1, 5, 4, 0 }, // links in opposite faces: 0-0, 1-3, 2-2, 3-1
187 static int Hexa_nbN [] = { 4, 4, 4, 4, 4, 4 };
196 // N0 +---|---+ N1 TETRAHEDRON
204 static int QuadTetra_F [4][7] = { // FORWARD == EXTERNAL
205 { 0, 4, 1, 5, 2, 6, 0 }, // All faces have external normals
206 { 0, 7, 3, 8, 1, 4, 0 },
207 { 1, 8, 3, 9, 2, 5, 1 },
208 { 0, 6, 2, 9, 3, 7, 0 }};
209 static int QuadTetra_R [4][7] = { // REVERSED
210 { 0, 4, 1, 5, 2, 6, 0 }, // All faces but a bottom have external normals
211 { 0, 4, 1, 8, 3, 7, 0 },
212 { 1, 5, 2, 9, 3, 8, 1 },
213 { 0, 7, 3, 9, 2, 6, 0 }};
214 static int QuadTetra_RE [4][7] = { // REVERSED -> FORWARD (EXTERNAL)
215 { 0, 6, 2, 5, 1, 4, 0 }, // All faces have external normals
216 { 0, 4, 1, 8, 3, 7, 0 },
217 { 1, 5, 2, 9, 3, 8, 1 },
218 { 0, 7, 3, 9, 2, 6, 0 }};
219 static int QuadTetra_nbN [] = { 6, 6, 6, 6 };
229 // | | 9 - middle point for (0,4) etc.
242 static int QuadPyram_F [5][9] = { // FORWARD == EXTERNAL
243 { 0, 5, 1, 6, 2, 7, 3, 8, 0 }, // All faces have external normals
244 { 0, 9, 4, 10,1, 5, 0, 4, 4 },
245 { 1, 10,4, 11,2, 6, 1, 4, 4 },
246 { 2, 11,4, 12,3, 7, 2, 4, 4 },
247 { 3, 12,4, 9, 0, 8, 3, 4, 4 }};
248 static int QuadPyram_R [5][9] = { // REVERSED
249 { 0, 5, 1, 6, 2, 7, 3, 8, 0 }, // All faces but a bottom have external normals
250 { 0, 5, 1, 10,4, 9, 0, 4, 4 },
251 { 1, 6, 2, 11,4, 10,1, 4, 4 },
252 { 2, 7, 3, 12,4, 11,2, 4, 4 },
253 { 3, 8, 0, 9, 4, 12,3, 4, 4 }};
254 static int QuadPyram_RE [5][9] = { // REVERSED -> FORWARD (EXTERNAL)
255 { 0, 8, 3, 7, 2, 6, 1, 5, 0 }, // All faces but a bottom have external normals
256 { 0, 5, 1, 10,4, 9, 0, 4, 4 },
257 { 1, 6, 2, 11,4, 10,1, 4, 4 },
258 { 2, 7, 3, 12,4, 11,2, 4, 4 },
259 { 3, 8, 0, 9, 4, 12,3, 4, 4 }};
260 static int QuadPyram_nbN [] = { 8, 6, 6, 6, 6 };
287 static int QuadPenta_F [5][9] = { // FORWARD
288 { 0, 6, 1, 7, 2, 8, 0, 0, 0 }, // Top face has an internal normal, other - external
289 { 3, 9, 4, 10,5, 11,3, 3, 3 }, // 0 is bottom, 1 is top face
290 { 0, 8, 2, 14,5, 11,3, 12,0 },
291 { 1, 13,4, 10,5, 14,2, 7, 1 },
292 { 0, 12,3, 9, 4, 13,1, 6, 0 }};
293 static int QuadPenta_R [5][9] = { // REVERSED
294 { 0, 6, 1, 7, 2, 8, 0, 0, 0 }, // Bottom face has an internal normal, other - external
295 { 3, 9, 4, 10,5, 11,3, 3, 3 }, // 0 is bottom, 1 is top face
296 { 0, 12,3, 11,5, 14,2, 8, 0 },
297 { 1, 7, 2, 14,5, 10,4, 13,1 },
298 { 0, 6, 1, 13,4, 9, 3, 12,0 }};
299 static int QuadPenta_FE [5][9] = { // FORWARD -> EXTERNAL
300 { 0, 6, 1, 7, 2, 8, 0, 0, 0 },
301 { 3,11, 5, 10,4, 9, 3, 3, 3 },
302 { 0, 8, 2, 14,5, 11,3, 12,0 },
303 { 1, 13,4, 10,5, 14,2, 7, 1 },
304 { 0, 12,3, 9, 4, 13,1, 6, 0 }};
305 static int QuadPenta_RE [5][9] = { // REVERSED -> EXTERNAL
306 { 0, 8, 2, 7, 1, 6, 0, 0, 0 },
307 { 3, 9, 4, 10,5, 11,3, 3, 3 },
308 { 0, 12,3, 11,5, 14,2, 8, 0 },
309 { 1, 7, 2, 14,5, 10,4, 13,1 },
310 { 0, 6, 1, 13,4, 9, 3, 12,0 }};
311 static int QuadPenta_nbN [] = { 6, 6, 8, 8, 8 };
319 // N4+-----+-----+N7 | QUADRATIC
320 // | | 15 | | HEXAHEDRON
329 // | N1+-----+-|---+N2
336 static int QuadHexa_F [6][9] = { // FORWARD
337 { 0, 8, 1, 9, 2, 10,3, 11,0 }, // opposite faces are neighbouring,
338 { 4, 12,5, 13,6, 14,7, 15,4 }, // odd face(1,3,5) normal is internal, even(0,2,4) - external
339 { 1, 8, 0, 16,4, 12,5, 17,1 }, // same index nodes of opposite faces are linked
340 { 2, 10,3, 19,7, 14,6, 18,2 },
341 { 0, 11,3, 19,7, 15,4, 16,0 },
342 { 1, 9, 2, 18,6, 13,5, 17,1 }};
343 // static int Hexa_R [6][5] = { // REVERSED
344 // { 0, 3, 2, 1, 0 }, // opposite faces are neighbouring,
345 // { 4, 7, 6, 5, 4 }, // odd face(1,3,5) normal is external, even(0,2,4) - internal
346 // { 1, 5, 4, 0, 1 }, // same index nodes of opposite faces are linked
347 // { 2, 6, 7, 3, 2 },
348 // { 0, 4, 7, 3, 0 },
349 // { 1, 5, 6, 2, 1 }};
350 static int QuadHexa_FE [6][9] = { // FORWARD -> EXTERNAL
351 { 0, 8, 1, 9, 2, 10,3, 11,0 }, // opposite faces are neighbouring,
352 { 4, 15,7, 14,6, 13,5, 12,4 }, // all face normals are external,
353 { 0, 16,4, 12,5, 17,1, 8, 0 }, // links in opposite faces: 0-0, 1-3, 2-2, 3-1
354 { 3, 10,2, 18,6, 14,7, 19,3 },
355 { 0, 11,3, 19,7, 15,4, 16,0 },
356 { 1, 17,5, 13,6, 18,2, 9, 1 }};
357 static int QuadHexa_RE [6][9] = { // REVERSED -> EXTERNAL
358 { 0, 11,3, 10,2, 9, 1, 8, 0 }, // opposite faces are neighbouring,
359 { 4, 12,5, 13,6, 14,7, 15,4 }, // all face normals are external,
360 { 0, 8, 1, 17,5, 12,4, 16,0 }, // links in opposite faces: 0-0, 1-3, 2-2, 3-1
361 { 3, 19,7, 14,6, 18,2, 10,3 },
362 { 0, 16,4, 15,7, 19,3, 11,0 },
363 { 1, 9, 2, 18,6, 13,5, 17,1 }};
364 static int QuadHexa_nbN [] = { 8, 8, 8, 8, 8, 8 };
367 // ========================================================
368 // to perform some calculations without linkage to CASCADE
369 // ========================================================
374 XYZ() { x = 0; y = 0; z = 0; }
375 XYZ( double X, double Y, double Z ) { x = X; y = Y; z = Z; }
376 XYZ( const XYZ& other ) { x = other.x; y = other.y; z = other.z; }
377 XYZ( const SMDS_MeshNode* n ) { x = n->X(); y = n->Y(); z = n->Z(); }
378 XYZ operator-( const XYZ& other );
379 XYZ Crossed( const XYZ& other );
380 double Dot( const XYZ& other );
383 XYZ XYZ::operator-( const XYZ& Right ) {
384 return XYZ(x - Right.x, y - Right.y, z - Right.z);
386 XYZ XYZ::Crossed( const XYZ& Right ) {
387 return XYZ (y * Right.z - z * Right.y,
388 z * Right.x - x * Right.z,
389 x * Right.y - y * Right.x);
391 double XYZ::Dot( const XYZ& Other ) {
392 return(x * Other.x + y * Other.y + z * Other.z);
394 double XYZ::Magnitude() {
395 return sqrt (x * x + y * y + z * z);
398 //=======================================================================
399 //function : SMDS_VolumeTool
401 //=======================================================================
403 SMDS_VolumeTool::SMDS_VolumeTool ()
406 myVolForward( true ),
408 myVolumeNbNodes( 0 ),
409 myVolumeNodes( NULL ),
410 myExternalFaces( false ),
413 myFaceNodeIndices( NULL ),
418 //=======================================================================
419 //function : SMDS_VolumeTool
421 //=======================================================================
423 SMDS_VolumeTool::SMDS_VolumeTool (const SMDS_MeshElement* theVolume)
426 myVolForward( true ),
428 myVolumeNbNodes( 0 ),
429 myVolumeNodes( NULL ),
430 myExternalFaces( false ),
433 myFaceNodeIndices( NULL ),
439 //=======================================================================
440 //function : SMDS_VolumeTool
442 //=======================================================================
444 SMDS_VolumeTool::~SMDS_VolumeTool()
446 if (myVolumeNodes != NULL) {
447 delete [] myVolumeNodes;
448 myVolumeNodes = NULL;
450 if (myFaceNodes != NULL) {
451 delete [] myFaceNodes;
456 //=======================================================================
457 //function : SetVolume
458 //purpose : Set volume to iterate on
459 //=======================================================================
461 bool SMDS_VolumeTool::Set (const SMDS_MeshElement* theVolume)
469 if (myVolumeNodes != NULL) {
470 delete [] myVolumeNodes;
471 myVolumeNodes = NULL;
474 myExternalFaces = false;
478 myFaceNodeIndices = NULL;
479 if (myFaceNodes != NULL) {
480 delete [] myFaceNodes;
484 if ( theVolume && theVolume->GetType() == SMDSAbs_Volume )
486 myVolume = theVolume;
488 myNbFaces = theVolume->NbFaces();
489 myVolumeNbNodes = theVolume->NbNodes();
493 myVolumeNodes = new const SMDS_MeshNode* [myVolumeNbNodes];
494 SMDS_ElemIteratorPtr nodeIt = myVolume->nodesIterator();
495 while ( nodeIt->more() ) {
496 myVolumeNodes[ iNode++ ] = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
499 if (myVolume->IsPoly()) {
500 myPolyedre = static_cast<const SMDS_PolyhedralVolumeOfNodes*>( myVolume );
502 MESSAGE("Warning: bad volumic element");
507 switch ( myVolumeNbNodes ) {
516 // define volume orientation
518 GetFaceNormal( 0, botNormal.x, botNormal.y, botNormal.z );
519 const SMDS_MeshNode* topNode = myVolumeNodes[ myVolumeNbNodes - 1 ];
520 const SMDS_MeshNode* botNode = myVolumeNodes[ 0 ];
521 XYZ upDir (topNode->X() - botNode->X(),
522 topNode->Y() - botNode->Y(),
523 topNode->Z() - botNode->Z() );
524 myVolForward = ( botNormal.Dot( upDir ) < 0 );
532 return ( myVolume != 0 );
535 //=======================================================================
537 //purpose : Inverse volume
538 //=======================================================================
540 #define SWAP_NODES(nodes,i1,i2) \
542 const SMDS_MeshNode* tmp = nodes[ i1 ]; \
543 nodes[ i1 ] = nodes[ i2 ]; \
546 void SMDS_VolumeTool::Inverse ()
548 if ( !myVolume ) return;
550 if (myVolume->IsPoly()) {
551 MESSAGE("Warning: attempt to inverse polyhedral volume");
555 myVolForward = !myVolForward;
558 // inverse top and bottom faces
559 switch ( myVolumeNbNodes ) {
561 SWAP_NODES( myVolumeNodes, 1, 2 );
564 SWAP_NODES( myVolumeNodes, 1, 3 );
567 SWAP_NODES( myVolumeNodes, 1, 2 );
568 SWAP_NODES( myVolumeNodes, 4, 5 );
571 SWAP_NODES( myVolumeNodes, 1, 3 );
572 SWAP_NODES( myVolumeNodes, 5, 7 );
576 SWAP_NODES( myVolumeNodes, 1, 2 );
577 SWAP_NODES( myVolumeNodes, 4, 6 );
578 SWAP_NODES( myVolumeNodes, 8, 9 );
581 SWAP_NODES( myVolumeNodes, 1, 3 );
582 SWAP_NODES( myVolumeNodes, 5, 8 );
583 SWAP_NODES( myVolumeNodes, 6, 7 );
584 SWAP_NODES( myVolumeNodes, 10, 12 );
587 SWAP_NODES( myVolumeNodes, 1, 2 );
588 SWAP_NODES( myVolumeNodes, 4, 5 );
589 SWAP_NODES( myVolumeNodes, 6, 8 );
590 SWAP_NODES( myVolumeNodes, 9, 11 );
591 SWAP_NODES( myVolumeNodes, 13, 14 );
594 SWAP_NODES( myVolumeNodes, 1, 3 );
595 SWAP_NODES( myVolumeNodes, 5, 7 );
596 SWAP_NODES( myVolumeNodes, 8, 11 );
597 SWAP_NODES( myVolumeNodes, 9, 10 );
598 SWAP_NODES( myVolumeNodes, 12, 15 );
599 SWAP_NODES( myVolumeNodes, 13, 14 );
600 SWAP_NODES( myVolumeNodes, 17, 19 );
606 //=======================================================================
607 //function : GetVolumeType
609 //=======================================================================
611 SMDS_VolumeTool::VolumeType SMDS_VolumeTool::GetVolumeType() const
617 // static const VolumeType types[] = {
618 // TETRA, // myVolumeNbNodes = 4
619 // PYRAM, // myVolumeNbNodes = 5
620 // PENTA, // myVolumeNbNodes = 6
621 // UNKNOWN, // myVolumeNbNodes = 7
622 // HEXA // myVolumeNbNodes = 8
624 // return types[ myVolumeNbNodes - 4 ];
625 switch(myVolumeNbNodes) {
626 case 4: return TETRA; break;
627 case 5: return PYRAM; break;
628 case 6: return PENTA; break;
629 case 8: return HEXA; break;
630 case 10: return QUAD_TETRA; break;
631 case 13: return QUAD_PYRAM; break;
632 case 15: return QUAD_PENTA; break;
633 case 20: return QUAD_HEXA; break;
641 //=======================================================================
642 //function : getTetraVolume
644 //=======================================================================
646 static double getTetraVolume(const SMDS_MeshNode* n1,
647 const SMDS_MeshNode* n2,
648 const SMDS_MeshNode* n3,
649 const SMDS_MeshNode* n4)
667 double Q1 = -(X1-X2)*(Y3*Z4-Y4*Z3);
668 double Q2 = (X1-X3)*(Y2*Z4-Y4*Z2);
669 double R1 = -(X1-X4)*(Y2*Z3-Y3*Z2);
670 double R2 = -(X2-X3)*(Y1*Z4-Y4*Z1);
671 double S1 = (X2-X4)*(Y1*Z3-Y3*Z1);
672 double S2 = -(X3-X4)*(Y1*Z2-Y2*Z1);
674 return (Q1+Q2+R1+R2+S1+S2)/6.0;
677 //=======================================================================
679 //purpose : Return element volume
680 //=======================================================================
682 double SMDS_VolumeTool::GetSize() const
688 if ( myVolume->IsPoly() )
693 // split a polyhedron into tetrahedrons
695 SMDS_VolumeTool* me = const_cast< SMDS_VolumeTool* > ( this );
697 me->GetBaryCenter(baryCenter.x, baryCenter.y, baryCenter.z);
698 SMDS_MeshNode bcNode ( baryCenter.x, baryCenter.y, baryCenter.z );
700 for ( int f = 0; f < NbFaces(); ++f )
702 bool externalFace = me->IsFaceExternal( f ); // it calls setFace()
703 for ( int n = 2; n < myFaceNbNodes; ++n )
705 double Vn = getTetraVolume( myFaceNodes[ 0 ],
709 /// cout <<"++++ " << Vn << " nodes " <<myFaceNodes[ 0 ]->GetID() << " " <<myFaceNodes[ n-1 ]->GetID() << " " <<myFaceNodes[ n ]->GetID() << " < " << V << endl;
710 V += externalFace ? -Vn : Vn;
716 const static int ind[] = {
717 0, 1, 3, 6, 11, 19, 32, 46, 66};
718 const static int vtab[][4] = {
735 // quadratic tetrahedron
760 // quadratic pentahedron
777 // quadratic hexahedron
802 int type = GetVolumeType();
804 int n2 = ind[type+1];
806 for (int i = n1; i < n2; i++) {
807 V -= getTetraVolume( myVolumeNodes[ vtab[i][0] ],
808 myVolumeNodes[ vtab[i][1] ],
809 myVolumeNodes[ vtab[i][2] ],
810 myVolumeNodes[ vtab[i][3] ]);
816 //=======================================================================
817 //function : GetBaryCenter
819 //=======================================================================
821 bool SMDS_VolumeTool::GetBaryCenter(double & X, double & Y, double & Z) const
827 for ( int i = 0; i < myVolumeNbNodes; i++ ) {
828 X += myVolumeNodes[ i ]->X();
829 Y += myVolumeNodes[ i ]->Y();
830 Z += myVolumeNodes[ i ]->Z();
832 X /= myVolumeNbNodes;
833 Y /= myVolumeNbNodes;
834 Z /= myVolumeNbNodes;
839 //=======================================================================
840 //function : SetExternalNormal
841 //purpose : Node order will be so that faces normals are external
842 //=======================================================================
844 void SMDS_VolumeTool::SetExternalNormal ()
846 myExternalFaces = true;
850 //=======================================================================
851 //function : NbFaceNodes
852 //purpose : Return number of nodes in the array of face nodes
853 //=======================================================================
855 int SMDS_VolumeTool::NbFaceNodes( int faceIndex )
857 if ( !setFace( faceIndex ))
859 return myFaceNbNodes;
862 //=======================================================================
863 //function : GetFaceNodes
864 //purpose : Return pointer to the array of face nodes.
865 // To comfort link iteration, the array
866 // length == NbFaceNodes( faceIndex ) + 1 and
867 // the last node == the first one.
868 //=======================================================================
870 const SMDS_MeshNode** SMDS_VolumeTool::GetFaceNodes( int faceIndex )
872 if ( !setFace( faceIndex ))
877 //=======================================================================
878 //function : GetFaceNodesIndices
879 //purpose : Return pointer to the array of face nodes indices
880 // To comfort link iteration, the array
881 // length == NbFaceNodes( faceIndex ) + 1 and
882 // the last node index == the first one.
883 //=======================================================================
885 const int* SMDS_VolumeTool::GetFaceNodesIndices( int faceIndex )
887 if (myVolume->IsPoly()) {
888 MESSAGE("Warning: attempt to obtain FaceNodesIndices of polyhedral volume");
891 if ( !setFace( faceIndex ))
893 return myFaceNodeIndices;
896 //=======================================================================
897 //function : GetFaceNodes
898 //purpose : Return a set of face nodes.
899 //=======================================================================
901 bool SMDS_VolumeTool::GetFaceNodes (int faceIndex,
902 set<const SMDS_MeshNode*>& theFaceNodes )
904 if ( !setFace( faceIndex ))
907 theFaceNodes.clear();
908 int iNode, nbNode = myFaceNbNodes;
909 for ( iNode = 0; iNode < nbNode; iNode++ )
910 theFaceNodes.insert( myFaceNodes[ iNode ]);
915 //=======================================================================
916 //function : IsFaceExternal
917 //purpose : Check normal orientation of a returned face
918 //=======================================================================
920 bool SMDS_VolumeTool::IsFaceExternal( int faceIndex )
922 if ( myExternalFaces || !myVolume )
925 if (myVolume->IsPoly()) {
926 XYZ aNormal, baryCenter, p0 (myPolyedre->GetFaceNode(faceIndex + 1, 1));
927 GetFaceNormal(faceIndex, aNormal.x, aNormal.y, aNormal.z);
928 GetBaryCenter(baryCenter.x, baryCenter.y, baryCenter.z);
929 XYZ insideVec (baryCenter - p0);
930 if (insideVec.Dot(aNormal) > 0)
935 switch ( myVolumeNbNodes ) {
940 // only the bottom of a reversed tetrahedron can be internal
941 return ( myVolForward || faceIndex != 0 );
944 // in a forward pentahedron, the top is internal, in a reversed one - bottom
945 return ( myVolForward ? faceIndex != 1 : faceIndex != 0 );
948 // in a forward hexahedron, even face normal is external, odd - internal
949 bool odd = faceIndex % 2;
950 return ( myVolForward ? !odd : odd );
957 //=======================================================================
958 //function : GetFaceNormal
959 //purpose : Return a normal to a face
960 //=======================================================================
962 bool SMDS_VolumeTool::GetFaceNormal (int faceIndex, double & X, double & Y, double & Z)
964 if ( !setFace( faceIndex ))
967 XYZ p1 ( myFaceNodes[0] );
968 XYZ p2 ( myFaceNodes[1] );
969 XYZ p3 ( myFaceNodes[2] );
970 XYZ aVec12( p2 - p1 );
971 XYZ aVec13( p3 - p1 );
972 XYZ cross = aVec12.Crossed( aVec13 );
974 //if ( myFaceNbNodes == 4 ) {
975 if ( myFaceNbNodes >3 ) {
976 XYZ p4 ( myFaceNodes[3] );
977 XYZ aVec14( p4 - p1 );
978 XYZ cross2 = aVec13.Crossed( aVec14 );
984 double size = cross.Magnitude();
985 if ( size <= DBL_MIN )
995 //=======================================================================
996 //function : GetFaceArea
997 //purpose : Return face area
998 //=======================================================================
1000 double SMDS_VolumeTool::GetFaceArea( int faceIndex )
1002 if (myVolume->IsPoly()) {
1003 MESSAGE("Warning: attempt to obtain area of a face of polyhedral volume");
1007 if ( !setFace( faceIndex ))
1010 XYZ p1 ( myFaceNodes[0] );
1011 XYZ p2 ( myFaceNodes[1] );
1012 XYZ p3 ( myFaceNodes[2] );
1013 XYZ aVec12( p2 - p1 );
1014 XYZ aVec13( p3 - p1 );
1015 double area = aVec12.Crossed( aVec13 ).Magnitude() * 0.5;
1017 if ( myFaceNbNodes == 4 ) {
1018 XYZ p4 ( myFaceNodes[3] );
1019 XYZ aVec14( p4 - p1 );
1020 area += aVec14.Crossed( aVec13 ).Magnitude() * 0.5;
1025 //=======================================================================
1026 //function : GetOppFaceIndex
1027 //purpose : Return index of the opposite face if it exists, else -1.
1028 //=======================================================================
1030 int SMDS_VolumeTool::GetOppFaceIndex( int faceIndex ) const
1033 if (myVolume->IsPoly()) {
1034 MESSAGE("Warning: attempt to obtain opposite face on polyhedral volume");
1038 if ( faceIndex >= 0 && faceIndex < NbFaces() ) {
1039 switch ( myVolumeNbNodes ) {
1041 if ( faceIndex == 0 || faceIndex == 1 )
1042 ind = 1 - faceIndex;
1045 ind = faceIndex + ( faceIndex % 2 ? -1 : 1 );
1053 //=======================================================================
1054 //function : IsLinked
1055 //purpose : return true if theNode1 is linked with theNode2
1056 //=======================================================================
1058 bool SMDS_VolumeTool::IsLinked (const SMDS_MeshNode* theNode1,
1059 const SMDS_MeshNode* theNode2) const
1064 if (myVolume->IsPoly()) {
1066 MESSAGE("Warning: bad volumic element");
1069 bool isLinked = false;
1071 for (iface = 1; iface <= myNbFaces && !isLinked; iface++) {
1072 int inode, nbFaceNodes = myPolyedre->NbFaceNodes(iface);
1074 for (inode = 1; inode <= nbFaceNodes && !isLinked; inode++) {
1075 const SMDS_MeshNode* curNode = myPolyedre->GetFaceNode(iface, inode);
1077 if (curNode == theNode1 || curNode == theNode2) {
1078 int inextnode = (inode == nbFaceNodes) ? 1 : inode + 1;
1079 const SMDS_MeshNode* nextNode = myPolyedre->GetFaceNode(iface, inextnode);
1081 if ((curNode == theNode1 && nextNode == theNode2) ||
1082 (curNode == theNode2 && nextNode == theNode1)) {
1091 // find nodes indices
1092 int i1 = -1, i2 = -1;
1093 for ( int i = 0; i < myVolumeNbNodes; i++ ) {
1094 if ( myVolumeNodes[ i ] == theNode1 )
1096 else if ( myVolumeNodes[ i ] == theNode2 )
1099 return IsLinked( i1, i2 );
1102 //=======================================================================
1103 //function : IsLinked
1104 //purpose : return true if the node with theNode1Index is linked
1105 // with the node with theNode2Index
1106 //=======================================================================
1108 bool SMDS_VolumeTool::IsLinked (const int theNode1Index,
1109 const int theNode2Index) const
1111 if ( myVolume->IsPoly() ) {
1112 return IsLinked(myVolumeNodes[theNode1Index], myVolumeNodes[theNode2Index]);
1115 int minInd = min( theNode1Index, theNode2Index );
1116 int maxInd = max( theNode1Index, theNode2Index );
1118 if ( minInd < 0 || maxInd > myVolumeNbNodes - 1 || maxInd == minInd )
1121 switch ( myVolumeNbNodes ) {
1127 switch ( maxInd - minInd ) {
1129 case 3: return true;
1134 switch ( maxInd - minInd ) {
1135 case 1: return minInd != 2;
1136 case 2: return minInd == 0 || minInd == 3;
1137 case 3: return true;
1142 switch ( maxInd - minInd ) {
1143 case 1: return minInd != 3;
1144 case 3: return minInd == 0 || minInd == 4;
1145 case 4: return true;
1152 case 0: if( maxInd==4 || maxInd==6 || maxInd==7 ) return true;
1153 case 1: if( maxInd==4 || maxInd==5 || maxInd==8 ) return true;
1154 case 2: if( maxInd==5 || maxInd==6 || maxInd==9 ) return true;
1155 case 3: if( maxInd==7 || maxInd==8 || maxInd==9 ) return true;
1163 case 0: if( maxInd==5 || maxInd==8 || maxInd==9 ) return true;
1164 case 1: if( maxInd==5 || maxInd==6 || maxInd==10 ) return true;
1165 case 2: if( maxInd==6 || maxInd==7 || maxInd==11 ) return true;
1166 case 3: if( maxInd==7 || maxInd==8 || maxInd==12 ) return true;
1167 case 4: if( maxInd==9 || maxInd==10 || maxInd==11 || maxInd==12 ) return true;
1175 case 0: if( maxInd==6 || maxInd==8 || maxInd==12 ) return true;
1176 case 1: if( maxInd==6 || maxInd==7 || maxInd==13 ) return true;
1177 case 2: if( maxInd==7 || maxInd==8 || maxInd==14 ) return true;
1178 case 3: if( maxInd==9 || maxInd==11 || maxInd==12 ) return true;
1179 case 4: if( maxInd==9 || maxInd==10 || maxInd==13 ) return true;
1180 case 5: if( maxInd==10 || maxInd==11 || maxInd==14 ) return true;
1188 case 0: if( maxInd==8 || maxInd==11 || maxInd==16 ) return true;
1189 case 1: if( maxInd==8 || maxInd==9 || maxInd==17 ) return true;
1190 case 2: if( maxInd==9 || maxInd==10 || maxInd==18 ) return true;
1191 case 3: if( maxInd==10 || maxInd==11 || maxInd==19 ) return true;
1192 case 4: if( maxInd==12 || maxInd==15 || maxInd==16 ) return true;
1193 case 5: if( maxInd==12 || maxInd==13 || maxInd==17 ) return true;
1194 case 6: if( maxInd==13 || maxInd==14 || maxInd==18 ) return true;
1195 case 7: if( maxInd==14 || maxInd==15 || maxInd==19 ) return true;
1205 //=======================================================================
1206 //function : GetNodeIndex
1207 //purpose : Return an index of theNode
1208 //=======================================================================
1210 int SMDS_VolumeTool::GetNodeIndex(const SMDS_MeshNode* theNode) const
1213 for ( int i = 0; i < myVolumeNbNodes; i++ ) {
1214 if ( myVolumeNodes[ i ] == theNode )
1221 //================================================================================
1223 * \brief Fill vector with boundary faces existing in the mesh
1224 * \param faces - vector of found nodes
1225 * \retval int - nb of found faces
1227 //================================================================================
1229 int SMDS_VolumeTool::GetAllExistingFaces(vector<const SMDS_MeshElement*> & faces)
1232 faces.reserve( NbFaces() );
1233 for ( int iF = 0; iF < NbFaces(); ++iF ) {
1234 const SMDS_MeshFace* face = 0;
1235 const SMDS_MeshNode** nodes = GetFaceNodes( iF );
1236 switch ( NbFaceNodes( iF )) {
1238 face = SMDS_Mesh::FindFace( nodes[0], nodes[1], nodes[2] ); break;
1240 face = SMDS_Mesh::FindFace( nodes[0], nodes[1], nodes[2], nodes[3] ); break;
1242 face = SMDS_Mesh::FindFace( nodes[0], nodes[1], nodes[2],
1243 nodes[3], nodes[4], nodes[5]); break;
1245 face = SMDS_Mesh::FindFace( nodes[0], nodes[1], nodes[2], nodes[3],
1246 nodes[4], nodes[5], nodes[6], nodes[7]); break;
1249 faces.push_back( face );
1251 return faces.size();
1255 //================================================================================
1257 * \brief Fill vector with boundary edges existing in the mesh
1258 * \param edges - vector of found edges
1259 * \retval int - nb of found faces
1261 //================================================================================
1263 int SMDS_VolumeTool::GetAllExistingEdges(vector<const SMDS_MeshElement*> & edges) const
1266 edges.reserve( myVolumeNbNodes * 2 );
1267 for ( int i = 0; i < myVolumeNbNodes; ++i ) {
1268 for ( int j = i + 1; j < myVolumeNbNodes; ++j ) {
1269 if ( IsLinked( i, j )) {
1270 const SMDS_MeshElement* edge =
1271 SMDS_Mesh::FindEdge( myVolumeNodes[i], myVolumeNodes[j] );
1273 edges.push_back( edge );
1277 return edges.size();
1280 //=======================================================================
1281 //function : IsFreeFace
1282 //purpose : check that only one volume is build on the face nodes
1283 //=======================================================================
1285 bool SMDS_VolumeTool::IsFreeFace( int faceIndex )
1287 const int free = true;
1289 if (!setFace( faceIndex ))
1292 const SMDS_MeshNode** nodes = GetFaceNodes( faceIndex );
1293 int nbFaceNodes = myFaceNbNodes;
1295 // evaluate nb of face nodes shared by other volume
1296 int maxNbShared = -1;
1297 typedef map< const SMDS_MeshElement*, int > TElemIntMap;
1298 TElemIntMap volNbShared;
1299 TElemIntMap::iterator vNbIt;
1300 for ( int iNode = 0; iNode < nbFaceNodes; iNode++ ) {
1301 const SMDS_MeshNode* n = nodes[ iNode ];
1302 SMDS_ElemIteratorPtr eIt = n->GetInverseElementIterator();
1303 while ( eIt->more() ) {
1304 const SMDS_MeshElement* elem = eIt->next();
1305 if ( elem != myVolume && elem->GetType() == SMDSAbs_Volume ) {
1307 vNbIt = volNbShared.find( elem );
1308 if ( vNbIt == volNbShared.end() ) {
1309 volNbShared.insert ( TElemIntMap::value_type( elem, nbShared ));
1312 nbShared = ++(*vNbIt).second;
1314 if ( nbShared > maxNbShared )
1315 maxNbShared = nbShared;
1319 if ( maxNbShared < 3 )
1320 return free; // is free
1322 // find volumes laying on the opposite side of the face
1323 // and sharing all nodes
1324 XYZ intNormal; // internal normal
1325 GetFaceNormal( faceIndex, intNormal.x, intNormal.y, intNormal.z );
1326 if ( IsFaceExternal( faceIndex ))
1327 intNormal = XYZ( -intNormal.x, -intNormal.y, -intNormal.z );
1328 XYZ p0 ( nodes[0] ), baryCenter;
1329 for ( vNbIt = volNbShared.begin(); vNbIt != volNbShared.end(); vNbIt++ ) {
1330 int nbShared = (*vNbIt).second;
1331 if ( nbShared >= 3 ) {
1332 SMDS_VolumeTool volume( (*vNbIt).first );
1333 volume.GetBaryCenter( baryCenter.x, baryCenter.y, baryCenter.z );
1334 XYZ intNormal2( baryCenter - p0 );
1335 if ( intNormal.Dot( intNormal2 ) < 0 )
1336 continue; // opposite side
1338 // remove a volume from volNbShared map
1339 volNbShared.erase( vNbIt-- );
1342 // here volNbShared contains only volumes laying on the
1343 // opposite side of the face
1344 if ( volNbShared.empty() ) {
1345 return free; // is free
1348 // check if the whole area of a face is shared
1349 bool isShared[] = { false, false, false, false }; // 4 triangle parts of a quadrangle
1350 for ( vNbIt = volNbShared.begin(); vNbIt != volNbShared.end(); vNbIt++ ) {
1351 SMDS_VolumeTool volume( (*vNbIt).first );
1352 bool prevLinkShared = false;
1353 int nbSharedLinks = 0;
1354 for ( int iNode = 0; iNode < nbFaceNodes; iNode++ ) {
1355 bool linkShared = volume.IsLinked( nodes[ iNode ], nodes[ iNode + 1] );
1358 if ( linkShared && prevLinkShared &&
1359 volume.IsLinked( nodes[ iNode - 1 ], nodes[ iNode + 1] ))
1360 isShared[ iNode ] = true;
1361 prevLinkShared = linkShared;
1363 if ( nbSharedLinks == nbFaceNodes )
1364 return !free; // is not free
1365 if ( nbFaceNodes == 4 ) {
1366 // check traingle parts 1 & 3
1367 if ( isShared[1] && isShared[3] )
1368 return !free; // is not free
1369 // check triangle parts 0 & 2;
1370 // 0 part could not be checked in the loop; check it here
1371 if ( isShared[2] && prevLinkShared &&
1372 volume.IsLinked( nodes[ 0 ], nodes[ 1 ] ) &&
1373 volume.IsLinked( nodes[ 1 ], nodes[ 3 ] ) )
1374 return !free; // is not free
1380 //=======================================================================
1381 //function : GetFaceIndex
1382 //purpose : Return index of a face formed by theFaceNodes
1383 //=======================================================================
1385 int SMDS_VolumeTool::GetFaceIndex( const set<const SMDS_MeshNode*>& theFaceNodes )
1387 for ( int iFace = 0; iFace < myNbFaces; iFace++ ) {
1388 const SMDS_MeshNode** nodes = GetFaceNodes( iFace );
1389 int nbFaceNodes = NbFaceNodes( iFace );
1390 set<const SMDS_MeshNode*> nodeSet;
1391 for ( int iNode = 0; iNode < nbFaceNodes; iNode++ )
1392 nodeSet.insert( nodes[ iNode ] );
1393 if ( theFaceNodes == nodeSet )
1399 //=======================================================================
1400 //function : GetFaceIndex
1401 //purpose : Return index of a face formed by theFaceNodes
1402 //=======================================================================
1404 /*int SMDS_VolumeTool::GetFaceIndex( const set<int>& theFaceNodesIndices )
1406 for ( int iFace = 0; iFace < myNbFaces; iFace++ ) {
1407 const int* nodes = GetFaceNodesIndices( iFace );
1408 int nbFaceNodes = NbFaceNodes( iFace );
1410 for ( int iNode = 0; iNode < nbFaceNodes; iNode++ )
1411 nodeSet.insert( nodes[ iNode ] );
1412 if ( theFaceNodesIndices == nodeSet )
1418 //=======================================================================
1419 //function : setFace
1421 //=======================================================================
1423 bool SMDS_VolumeTool::setFace( int faceIndex )
1428 if ( myCurFace == faceIndex )
1433 if ( faceIndex < 0 || faceIndex >= NbFaces() )
1436 if (myFaceNodes != NULL) {
1437 delete [] myFaceNodes;
1441 if (myVolume->IsPoly()) {
1443 MESSAGE("Warning: bad volumic element");
1447 // check orientation
1448 bool isGoodOri = true;
1449 if (myExternalFaces)
1450 isGoodOri = IsFaceExternal( faceIndex );
1454 myFaceNbNodes = myPolyedre->NbFaceNodes(faceIndex + 1);
1455 myFaceNodes = new const SMDS_MeshNode* [myFaceNbNodes + 1];
1457 for ( iNode = 0; iNode < myFaceNbNodes; iNode++ )
1458 myFaceNodes[ iNode ] = myPolyedre->GetFaceNode(faceIndex + 1, iNode + 1);
1460 for ( iNode = 0; iNode < myFaceNbNodes; iNode++ )
1461 myFaceNodes[ iNode ] = myPolyedre->GetFaceNode(faceIndex + 1, myFaceNbNodes - iNode);
1463 myFaceNodes[ myFaceNbNodes ] = myFaceNodes[ 0 ]; // last = first
1467 // choose face node indices
1468 switch ( myVolumeNbNodes ) {
1470 myFaceNbNodes = Tetra_nbN[ faceIndex ];
1471 if ( myExternalFaces )
1472 myFaceNodeIndices = myVolForward ? Tetra_F[ faceIndex ] : Tetra_RE[ faceIndex ];
1474 myFaceNodeIndices = myVolForward ? Tetra_F[ faceIndex ] : Tetra_R[ faceIndex ];
1477 myFaceNbNodes = Pyramid_nbN[ faceIndex ];
1478 if ( myExternalFaces )
1479 myFaceNodeIndices = myVolForward ? Pyramid_F[ faceIndex ] : Pyramid_RE[ faceIndex ];
1481 myFaceNodeIndices = myVolForward ? Pyramid_F[ faceIndex ] : Pyramid_R[ faceIndex ];
1484 myFaceNbNodes = Penta_nbN[ faceIndex ];
1485 if ( myExternalFaces )
1486 myFaceNodeIndices = myVolForward ? Penta_FE[ faceIndex ] : Penta_RE[ faceIndex ];
1488 myFaceNodeIndices = myVolForward ? Penta_F[ faceIndex ] : Penta_R[ faceIndex ];
1491 myFaceNbNodes = Hexa_nbN[ faceIndex ];
1492 if ( myExternalFaces )
1493 myFaceNodeIndices = myVolForward ? Hexa_FE[ faceIndex ] : Hexa_RE[ faceIndex ];
1495 myFaceNodeIndices = Hexa_F[ faceIndex ];
1498 myFaceNbNodes = QuadTetra_nbN[ faceIndex ];
1499 if ( myExternalFaces )
1500 myFaceNodeIndices = myVolForward ? QuadTetra_F[ faceIndex ] : QuadTetra_RE[ faceIndex ];
1502 myFaceNodeIndices = myVolForward ? QuadTetra_F[ faceIndex ] : QuadTetra_R[ faceIndex ];
1505 myFaceNbNodes = QuadPyram_nbN[ faceIndex ];
1506 if ( myExternalFaces )
1507 myFaceNodeIndices = myVolForward ? QuadPyram_F[ faceIndex ] : QuadPyram_RE[ faceIndex ];
1509 myFaceNodeIndices = myVolForward ? QuadPyram_F[ faceIndex ] : QuadPyram_R[ faceIndex ];
1512 myFaceNbNodes = QuadPenta_nbN[ faceIndex ];
1513 if ( myExternalFaces )
1514 myFaceNodeIndices = myVolForward ? QuadPenta_FE[ faceIndex ] : QuadPenta_RE[ faceIndex ];
1516 myFaceNodeIndices = myVolForward ? QuadPenta_F[ faceIndex ] : QuadPenta_R[ faceIndex ];
1519 myFaceNbNodes = QuadHexa_nbN[ faceIndex ];
1520 if ( myExternalFaces )
1521 myFaceNodeIndices = myVolForward ? QuadHexa_FE[ faceIndex ] : QuadHexa_RE[ faceIndex ];
1523 myFaceNodeIndices = QuadHexa_F[ faceIndex ];
1530 myFaceNodes = new const SMDS_MeshNode* [myFaceNbNodes + 1];
1531 for ( int iNode = 0; iNode < myFaceNbNodes; iNode++ )
1532 myFaceNodes[ iNode ] = myVolumeNodes[ myFaceNodeIndices[ iNode ]];
1533 myFaceNodes[ myFaceNbNodes ] = myFaceNodes[ 0 ];
1536 myCurFace = faceIndex;
1541 //=======================================================================
1542 //function : GetType
1543 //purpose : return VolumeType by nb of nodes in a volume
1544 //=======================================================================
1546 SMDS_VolumeTool::VolumeType SMDS_VolumeTool::GetType(int nbNodes)
1548 switch ( nbNodes ) {
1549 case 4: return TETRA;
1550 case 5: return PYRAM;
1551 case 6: return PENTA;
1552 case 8: return HEXA;
1553 case 10: return QUAD_TETRA;
1554 case 13: return QUAD_PYRAM;
1555 case 15: return QUAD_PENTA;
1556 case 20: return QUAD_HEXA;
1557 default:return UNKNOWN;
1561 //=======================================================================
1562 //function : NbFaces
1563 //purpose : return nb of faces by volume type
1564 //=======================================================================
1566 int SMDS_VolumeTool::NbFaces( VolumeType type )
1570 case QUAD_TETRA: return 4;
1572 case QUAD_PYRAM: return 5;
1574 case QUAD_PENTA: return 5;
1576 case QUAD_HEXA : return 6;
1581 //================================================================================
1583 * \brief Useful to know nb of corner nodes of a quadratic volume
1584 * \param type - volume type
1585 * \retval int - nb of corner nodes
1587 //================================================================================
1589 int SMDS_VolumeTool::NbCornerNodes(VolumeType type)
1593 case QUAD_TETRA: return 4;
1595 case QUAD_PYRAM: return 5;
1597 case QUAD_PENTA: return 6;
1599 case QUAD_HEXA : return 8;
1606 //=======================================================================
1607 //function : GetFaceNodesIndices
1608 //purpose : Return the array of face nodes indices
1609 // To comfort link iteration, the array
1610 // length == NbFaceNodes( faceIndex ) + 1 and
1611 // the last node index == the first one.
1612 //=======================================================================
1614 const int* SMDS_VolumeTool::GetFaceNodesIndices(VolumeType type,
1619 case TETRA: return Tetra_F[ faceIndex ];
1620 case PYRAM: return Pyramid_F[ faceIndex ];
1621 case PENTA: return external ? Penta_FE[ faceIndex ] : Penta_F[ faceIndex ];
1622 case HEXA: return external ? Hexa_FE[ faceIndex ] : Hexa_F[ faceIndex ];
1623 case QUAD_TETRA: return QuadTetra_F[ faceIndex ];
1624 case QUAD_PYRAM: return QuadPyram_F[ faceIndex ];
1625 case QUAD_PENTA: return external ? QuadPenta_FE[ faceIndex ] : QuadPenta_F[ faceIndex ];
1626 case QUAD_HEXA: return external ? QuadHexa_FE[ faceIndex ] : QuadHexa_F[ faceIndex ];
1632 //=======================================================================
1633 //function : NbFaceNodes
1634 //purpose : Return number of nodes in the array of face nodes
1635 //=======================================================================
1637 int SMDS_VolumeTool::NbFaceNodes(VolumeType type,
1641 case TETRA: return Tetra_nbN[ faceIndex ];
1642 case PYRAM: return Pyramid_nbN[ faceIndex ];
1643 case PENTA: return Penta_nbN[ faceIndex ];
1644 case HEXA: return Hexa_nbN[ faceIndex ];
1645 case QUAD_TETRA: return QuadTetra_nbN[ faceIndex ];
1646 case QUAD_PYRAM: return QuadPyram_nbN[ faceIndex ];
1647 case QUAD_PENTA: return QuadPenta_nbN[ faceIndex ];
1648 case QUAD_HEXA: return QuadHexa_nbN[ faceIndex ];
1654 //=======================================================================
1656 //purpose : return element
1657 //=======================================================================
1659 const SMDS_MeshVolume* SMDS_VolumeTool::Get() const
1661 return static_cast<const SMDS_MeshVolume*>( myVolume );
1664 //=======================================================================
1666 //purpose : return element ID
1667 //=======================================================================
1669 int SMDS_VolumeTool::ID() const
1671 return myVolume ? myVolume->GetID() : 0;