1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : SMDS_VolumeTool.cxx
23 // Created : Tue Jul 13 12:22:13 2004
24 // Author : Edward AGAPOV (eap)
27 #pragma warning(disable:4786)
30 #include "SMDS_VolumeTool.hxx"
32 #include "SMDS_MeshElement.hxx"
33 #include "SMDS_MeshNode.hxx"
34 #include "SMDS_PolyhedralVolumeOfNodes.hxx"
35 #include "SMDS_Mesh.hxx"
37 #include "utilities.h"
45 // ======================================================
46 // Node indices in faces depending on volume orientation
47 // making most faces normals external
48 // ======================================================
56 // N0 +---|---+ N1 TETRAHEDRON
64 static int Tetra_F [4][4] = { // FORWARD == EXTERNAL
65 { 0, 1, 2, 0 }, // All faces have external normals
69 static int Tetra_R [4][4] = { // REVERSED
70 { 0, 1, 2, 0 }, // All faces but a bottom have external normals
74 static int Tetra_RE [4][4] = { // REVERSED -> FORWARD (EXTERNAL)
75 { 0, 2, 1, 0 }, // All faces have external normals
79 static int Tetra_nbN [] = { 3, 3, 3, 3 };
84 static int Pyramid_F [5][5] = { // FORWARD == EXTERNAL
85 { 0, 1, 2, 3, 0 }, // All faces have external normals
90 static int Pyramid_R [5][5] = { // REVERSED
91 { 0, 1, 2, 3, 0 }, // All faces but a bottom have external normals
96 static int Pyramid_RE [5][5] = { // REVERSED -> FORWARD (EXTERNAL)
97 { 0, 3, 2, 1, 0 }, // All faces but a bottom have external normals
102 static int Pyramid_nbN [] = { 4, 3, 3, 3, 3 };
113 // | / \ | PENTAHEDRON
119 static int Penta_F [5][5] = { // FORWARD
120 { 0, 1, 2, 0, 0 }, // Top face has an internal normal, other - external
121 { 3, 4, 5, 3, 3 }, // 0 is bottom, 1 is top face
125 static int Penta_R [5][5] = { // REVERSED
126 { 0, 1, 2, 0, 0 }, // Bottom face has an internal normal, other - external
127 { 3, 4, 5, 3, 3 }, // 0 is bottom, 1 is top face
131 static int Penta_FE [5][5] = { // FORWARD -> EXTERNAL
137 static int Penta_RE [5][5] = { // REVERSED -> EXTERNAL
143 static int Penta_nbN [] = { 3, 3, 4, 4, 4 };
150 // N4+----------+N7 |
151 // | | | | HEXAHEDRON
154 // | N1+------|---+N2
160 static int Hexa_F [6][5] = { // FORWARD
161 { 0, 1, 2, 3, 0 }, // opposite faces are neighbouring,
162 { 4, 5, 6, 7, 4 }, // odd face(1,3,5) normal is internal, even(0,2,4) - external
163 { 1, 0, 4, 5, 1 }, // same index nodes of opposite faces are linked
167 // static int Hexa_R [6][5] = { // REVERSED
168 // { 0, 3, 2, 1, 0 }, // opposite faces are neighbouring,
169 // { 4, 7, 6, 5, 4 }, // odd face(1,3,5) normal is external, even(0,2,4) - internal
170 // { 1, 5, 4, 0, 1 }, // same index nodes of opposite faces are linked
171 // { 2, 6, 7, 3, 2 },
172 // { 0, 4, 7, 3, 0 },
173 // { 1, 5, 6, 2, 1 }};
174 static int Hexa_FE [6][5] = { // FORWARD -> EXTERNAL
175 { 0, 1, 2, 3, 0 } , // opposite faces are neighbouring,
176 { 4, 7, 6, 5, 4 }, // all face normals are external,
177 { 0, 4, 5, 1, 0 }, // links in opposite faces: 0-0, 1-3, 2-2, 3-1
181 static int Hexa_RE [6][5] = { // REVERSED -> EXTERNAL
182 { 0, 3, 2, 1, 0 }, // opposite faces are neighbouring,
183 { 4, 5, 6, 7, 4 }, // all face normals are external,
184 { 0, 1, 5, 4, 0 }, // links in opposite faces: 0-0, 1-3, 2-2, 3-1
188 static int Hexa_nbN [] = { 4, 4, 4, 4, 4, 4 };
197 // N0 +---|---+ N1 TETRAHEDRON
205 static int QuadTetra_F [4][7] = { // FORWARD == EXTERNAL
206 { 0, 4, 1, 5, 2, 6, 0 }, // All faces have external normals
207 { 0, 7, 3, 8, 1, 4, 0 },
208 { 1, 8, 3, 9, 2, 5, 1 },
209 { 0, 6, 2, 9, 3, 7, 0 }};
210 static int QuadTetra_R [4][7] = { // REVERSED
211 { 0, 4, 1, 5, 2, 6, 0 }, // All faces but a bottom have external normals
212 { 0, 4, 1, 8, 3, 7, 0 },
213 { 1, 5, 2, 9, 3, 8, 1 },
214 { 0, 7, 3, 9, 2, 6, 0 }};
215 static int QuadTetra_RE [4][7] = { // REVERSED -> FORWARD (EXTERNAL)
216 { 0, 6, 2, 5, 1, 4, 0 }, // All faces have external normals
217 { 0, 4, 1, 8, 3, 7, 0 },
218 { 1, 5, 2, 9, 3, 8, 1 },
219 { 0, 7, 3, 9, 2, 6, 0 }};
220 static int QuadTetra_nbN [] = { 6, 6, 6, 6 };
230 // | | 9 - middle point for (0,4) etc.
243 static int QuadPyram_F [5][9] = { // FORWARD == EXTERNAL
244 { 0, 5, 1, 6, 2, 7, 3, 8, 0 }, // All faces have external normals
245 { 0, 9, 4, 10,1, 5, 0, 4, 4 },
246 { 1, 10,4, 11,2, 6, 1, 4, 4 },
247 { 2, 11,4, 12,3, 7, 2, 4, 4 },
248 { 3, 12,4, 9, 0, 8, 3, 4, 4 }};
249 static int QuadPyram_R [5][9] = { // REVERSED
250 { 0, 5, 1, 6, 2, 7, 3, 8, 0 }, // All faces but a bottom have external normals
251 { 0, 5, 1, 10,4, 9, 0, 4, 4 },
252 { 1, 6, 2, 11,4, 10,1, 4, 4 },
253 { 2, 7, 3, 12,4, 11,2, 4, 4 },
254 { 3, 8, 0, 9, 4, 12,3, 4, 4 }};
255 static int QuadPyram_RE [5][9] = { // REVERSED -> FORWARD (EXTERNAL)
256 { 0, 8, 3, 7, 2, 6, 1, 5, 0 }, // All faces but a bottom have external normals
257 { 0, 5, 1, 10,4, 9, 0, 4, 4 },
258 { 1, 6, 2, 11,4, 10,1, 4, 4 },
259 { 2, 7, 3, 12,4, 11,2, 4, 4 },
260 { 3, 8, 0, 9, 4, 12,3, 4, 4 }};
261 static int QuadPyram_nbN [] = { 8, 6, 6, 6, 6 };
288 static int QuadPenta_F [5][9] = { // FORWARD
289 { 0, 6, 1, 7, 2, 8, 0, 0, 0 }, // Top face has an internal normal, other - external
290 { 3, 9, 4, 10,5, 11,3, 3, 3 }, // 0 is bottom, 1 is top face
291 { 0, 8, 2, 14,5, 11,3, 12,0 },
292 { 1, 13,4, 10,5, 14,2, 7, 1 },
293 { 0, 12,3, 9, 4, 13,1, 6, 0 }};
294 static int QuadPenta_R [5][9] = { // REVERSED
295 { 0, 6, 1, 7, 2, 8, 0, 0, 0 }, // Bottom face has an internal normal, other - external
296 { 3, 9, 4, 10,5, 11,3, 3, 3 }, // 0 is bottom, 1 is top face
297 { 0, 12,3, 11,5, 14,2, 8, 0 },
298 { 1, 7, 2, 14,5, 10,4, 13,1 },
299 { 0, 6, 1, 13,4, 9, 3, 12,0 }};
300 static int QuadPenta_FE [5][9] = { // FORWARD -> EXTERNAL
301 { 0, 6, 1, 7, 2, 8, 0, 0, 0 },
302 { 3,11, 5, 10,4, 9, 3, 3, 3 },
303 { 0, 8, 2, 14,5, 11,3, 12,0 },
304 { 1, 13,4, 10,5, 14,2, 7, 1 },
305 { 0, 12,3, 9, 4, 13,1, 6, 0 }};
306 static int QuadPenta_RE [5][9] = { // REVERSED -> EXTERNAL
307 { 0, 8, 2, 7, 1, 6, 0, 0, 0 },
308 { 3, 9, 4, 10,5, 11,3, 3, 3 },
309 { 0, 12,3, 11,5, 14,2, 8, 0 },
310 { 1, 7, 2, 14,5, 10,4, 13,1 },
311 { 0, 6, 1, 13,4, 9, 3, 12,0 }};
312 static int QuadPenta_nbN [] = { 6, 6, 8, 8, 8 };
320 // N4+-----+-----+N7 | QUADRATIC
321 // | | 15 | | HEXAHEDRON
330 // | N1+-----+-|---+N2
337 static int QuadHexa_F [6][9] = { // FORWARD
338 { 0, 8, 1, 9, 2, 10,3, 11,0 }, // opposite faces are neighbouring,
339 { 4, 12,5, 13,6, 14,7, 15,4 }, // odd face(1,3,5) normal is internal, even(0,2,4) - external
340 { 1, 8, 0, 16,4, 12,5, 17,1 }, // same index nodes of opposite faces are linked
341 { 2, 10,3, 19,7, 14,6, 18,2 },
342 { 0, 11,3, 19,7, 15,4, 16,0 },
343 { 1, 9, 2, 18,6, 13,5, 17,1 }};
344 // static int Hexa_R [6][5] = { // REVERSED
345 // { 0, 3, 2, 1, 0 }, // opposite faces are neighbouring,
346 // { 4, 7, 6, 5, 4 }, // odd face(1,3,5) normal is external, even(0,2,4) - internal
347 // { 1, 5, 4, 0, 1 }, // same index nodes of opposite faces are linked
348 // { 2, 6, 7, 3, 2 },
349 // { 0, 4, 7, 3, 0 },
350 // { 1, 5, 6, 2, 1 }};
351 static int QuadHexa_FE [6][9] = { // FORWARD -> EXTERNAL
352 { 0, 8, 1, 9, 2, 10,3, 11,0 }, // opposite faces are neighbouring,
353 { 4, 15,7, 14,6, 13,5, 12,4 }, // all face normals are external,
354 { 0, 16,4, 12,5, 17,1, 8, 0 }, // links in opposite faces: 0-0, 1-3, 2-2, 3-1
355 { 3, 10,2, 18,6, 14,7, 19,3 },
356 { 0, 11,3, 19,7, 15,4, 16,0 },
357 { 1, 17,5, 13,6, 18,2, 9, 1 }};
358 static int QuadHexa_RE [6][9] = { // REVERSED -> EXTERNAL
359 { 0, 11,3, 10,2, 9, 1, 8, 0 }, // opposite faces are neighbouring,
360 { 4, 12,5, 13,6, 14,7, 15,4 }, // all face normals are external,
361 { 0, 8, 1, 17,5, 12,4, 16,0 }, // links in opposite faces: 0-0, 1-3, 2-2, 3-1
362 { 3, 19,7, 14,6, 18,2, 10,3 },
363 { 0, 16,4, 15,7, 19,3, 11,0 },
364 { 1, 9, 2, 18,6, 13,5, 17,1 }};
365 static int QuadHexa_nbN [] = { 8, 8, 8, 8, 8, 8 };
368 // ========================================================
369 // to perform some calculations without linkage to CASCADE
370 // ========================================================
375 XYZ() { x = 0; y = 0; z = 0; }
376 XYZ( double X, double Y, double Z ) { x = X; y = Y; z = Z; }
377 XYZ( const XYZ& other ) { x = other.x; y = other.y; z = other.z; }
378 XYZ( const SMDS_MeshNode* n ) { x = n->X(); y = n->Y(); z = n->Z(); }
379 XYZ operator-( const XYZ& other );
380 XYZ Crossed( const XYZ& other );
381 double Dot( const XYZ& other );
384 XYZ XYZ::operator-( const XYZ& Right ) {
385 return XYZ(x - Right.x, y - Right.y, z - Right.z);
387 XYZ XYZ::Crossed( const XYZ& Right ) {
388 return XYZ (y * Right.z - z * Right.y,
389 z * Right.x - x * Right.z,
390 x * Right.y - y * Right.x);
392 double XYZ::Dot( const XYZ& Other ) {
393 return(x * Other.x + y * Other.y + z * Other.z);
395 double XYZ::Magnitude() {
396 return sqrt (x * x + y * y + z * z);
399 //=======================================================================
400 //function : SMDS_VolumeTool
402 //=======================================================================
404 SMDS_VolumeTool::SMDS_VolumeTool ()
407 myVolForward( true ),
409 myVolumeNbNodes( 0 ),
410 myVolumeNodes( NULL ),
411 myExternalFaces( false ),
414 myFaceNodeIndices( NULL ),
419 //=======================================================================
420 //function : SMDS_VolumeTool
422 //=======================================================================
424 SMDS_VolumeTool::SMDS_VolumeTool (const SMDS_MeshElement* theVolume)
427 myVolForward( true ),
429 myVolumeNbNodes( 0 ),
430 myVolumeNodes( NULL ),
431 myExternalFaces( false ),
434 myFaceNodeIndices( NULL ),
440 //=======================================================================
441 //function : SMDS_VolumeTool
443 //=======================================================================
445 SMDS_VolumeTool::~SMDS_VolumeTool()
447 if (myVolumeNodes != NULL) {
448 delete [] myVolumeNodes;
449 myVolumeNodes = NULL;
451 if (myFaceNodes != NULL) {
452 delete [] myFaceNodes;
457 //=======================================================================
458 //function : SetVolume
459 //purpose : Set volume to iterate on
460 //=======================================================================
462 bool SMDS_VolumeTool::Set (const SMDS_MeshElement* theVolume)
470 if (myVolumeNodes != NULL) {
471 delete [] myVolumeNodes;
472 myVolumeNodes = NULL;
475 myExternalFaces = false;
479 myFaceNodeIndices = NULL;
480 if (myFaceNodes != NULL) {
481 delete [] myFaceNodes;
485 if ( theVolume && theVolume->GetType() == SMDSAbs_Volume )
487 myVolume = theVolume;
489 myNbFaces = theVolume->NbFaces();
490 myVolumeNbNodes = theVolume->NbNodes();
494 myVolumeNodes = new const SMDS_MeshNode* [myVolumeNbNodes];
495 SMDS_ElemIteratorPtr nodeIt = myVolume->nodesIterator();
496 while ( nodeIt->more() ) {
497 myVolumeNodes[ iNode++ ] = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
500 if (myVolume->IsPoly()) {
501 myPolyedre = static_cast<const SMDS_PolyhedralVolumeOfNodes*>( myVolume );
503 MESSAGE("Warning: bad volumic element");
508 switch ( myVolumeNbNodes ) {
517 // define volume orientation
519 GetFaceNormal( 0, botNormal.x, botNormal.y, botNormal.z );
520 const SMDS_MeshNode* topNode = myVolumeNodes[ myVolumeNbNodes - 1 ];
521 const SMDS_MeshNode* botNode = myVolumeNodes[ 0 ];
522 XYZ upDir (topNode->X() - botNode->X(),
523 topNode->Y() - botNode->Y(),
524 topNode->Z() - botNode->Z() );
525 myVolForward = ( botNormal.Dot( upDir ) < 0 );
533 return ( myVolume != 0 );
536 //=======================================================================
538 //purpose : Inverse volume
539 //=======================================================================
541 #define SWAP_NODES(nodes,i1,i2) \
543 const SMDS_MeshNode* tmp = nodes[ i1 ]; \
544 nodes[ i1 ] = nodes[ i2 ]; \
547 void SMDS_VolumeTool::Inverse ()
549 if ( !myVolume ) return;
551 if (myVolume->IsPoly()) {
552 MESSAGE("Warning: attempt to inverse polyhedral volume");
556 myVolForward = !myVolForward;
559 // inverse top and bottom faces
560 switch ( myVolumeNbNodes ) {
562 SWAP_NODES( myVolumeNodes, 1, 2 );
565 SWAP_NODES( myVolumeNodes, 1, 3 );
568 SWAP_NODES( myVolumeNodes, 1, 2 );
569 SWAP_NODES( myVolumeNodes, 4, 5 );
572 SWAP_NODES( myVolumeNodes, 1, 3 );
573 SWAP_NODES( myVolumeNodes, 5, 7 );
577 SWAP_NODES( myVolumeNodes, 1, 2 );
578 SWAP_NODES( myVolumeNodes, 4, 6 );
579 SWAP_NODES( myVolumeNodes, 8, 9 );
582 SWAP_NODES( myVolumeNodes, 1, 3 );
583 SWAP_NODES( myVolumeNodes, 5, 8 );
584 SWAP_NODES( myVolumeNodes, 6, 7 );
585 SWAP_NODES( myVolumeNodes, 10, 12 );
588 SWAP_NODES( myVolumeNodes, 1, 2 );
589 SWAP_NODES( myVolumeNodes, 4, 5 );
590 SWAP_NODES( myVolumeNodes, 6, 8 );
591 SWAP_NODES( myVolumeNodes, 9, 11 );
592 SWAP_NODES( myVolumeNodes, 13, 14 );
595 SWAP_NODES( myVolumeNodes, 1, 3 );
596 SWAP_NODES( myVolumeNodes, 5, 7 );
597 SWAP_NODES( myVolumeNodes, 8, 11 );
598 SWAP_NODES( myVolumeNodes, 9, 10 );
599 SWAP_NODES( myVolumeNodes, 12, 15 );
600 SWAP_NODES( myVolumeNodes, 13, 14 );
601 SWAP_NODES( myVolumeNodes, 17, 19 );
607 //=======================================================================
608 //function : GetVolumeType
610 //=======================================================================
612 SMDS_VolumeTool::VolumeType SMDS_VolumeTool::GetVolumeType() const
618 // static const VolumeType types[] = {
619 // TETRA, // myVolumeNbNodes = 4
620 // PYRAM, // myVolumeNbNodes = 5
621 // PENTA, // myVolumeNbNodes = 6
622 // UNKNOWN, // myVolumeNbNodes = 7
623 // HEXA // myVolumeNbNodes = 8
625 // return types[ myVolumeNbNodes - 4 ];
626 switch(myVolumeNbNodes) {
627 case 4: return TETRA; break;
628 case 5: return PYRAM; break;
629 case 6: return PENTA; break;
630 case 8: return HEXA; break;
631 case 10: return QUAD_TETRA; break;
632 case 13: return QUAD_PYRAM; break;
633 case 15: return QUAD_PENTA; break;
634 case 20: return QUAD_HEXA; break;
642 //=======================================================================
643 //function : getTetraVolume
645 //=======================================================================
647 static double getTetraVolume(const SMDS_MeshNode* n1,
648 const SMDS_MeshNode* n2,
649 const SMDS_MeshNode* n3,
650 const SMDS_MeshNode* n4)
668 double Q1 = -(X1-X2)*(Y3*Z4-Y4*Z3);
669 double Q2 = (X1-X3)*(Y2*Z4-Y4*Z2);
670 double R1 = -(X1-X4)*(Y2*Z3-Y3*Z2);
671 double R2 = -(X2-X3)*(Y1*Z4-Y4*Z1);
672 double S1 = (X2-X4)*(Y1*Z3-Y3*Z1);
673 double S2 = -(X3-X4)*(Y1*Z2-Y2*Z1);
675 return (Q1+Q2+R1+R2+S1+S2)/6.0;
678 //=======================================================================
680 //purpose : Return element volume
681 //=======================================================================
683 double SMDS_VolumeTool::GetSize() const
689 if ( myVolume->IsPoly() )
694 // split a polyhedron into tetrahedrons
696 SMDS_VolumeTool* me = const_cast< SMDS_VolumeTool* > ( this );
698 me->GetBaryCenter(baryCenter.x, baryCenter.y, baryCenter.z);
699 SMDS_MeshNode bcNode ( baryCenter.x, baryCenter.y, baryCenter.z );
701 for ( int f = 0; f < NbFaces(); ++f )
703 bool externalFace = me->IsFaceExternal( f ); // it calls setFace()
704 for ( int n = 2; n < myFaceNbNodes; ++n )
706 double Vn = getTetraVolume( myFaceNodes[ 0 ],
710 /// cout <<"++++ " << Vn << " nodes " <<myFaceNodes[ 0 ]->GetID() << " " <<myFaceNodes[ n-1 ]->GetID() << " " <<myFaceNodes[ n ]->GetID() << " < " << V << endl;
711 V += externalFace ? -Vn : Vn;
717 const static int ind[] = {
718 0, 1, 3, 6, 11, 19, 32, 46, 66};
719 const static int vtab[][4] = {
736 // quadratic tetrahedron
761 // quadratic pentahedron
778 // quadratic hexahedron
803 int type = GetVolumeType();
805 int n2 = ind[type+1];
807 for (int i = n1; i < n2; i++) {
808 V -= getTetraVolume( myVolumeNodes[ vtab[i][0] ],
809 myVolumeNodes[ vtab[i][1] ],
810 myVolumeNodes[ vtab[i][2] ],
811 myVolumeNodes[ vtab[i][3] ]);
817 //=======================================================================
818 //function : GetBaryCenter
820 //=======================================================================
822 bool SMDS_VolumeTool::GetBaryCenter(double & X, double & Y, double & Z) const
828 for ( int i = 0; i < myVolumeNbNodes; i++ ) {
829 X += myVolumeNodes[ i ]->X();
830 Y += myVolumeNodes[ i ]->Y();
831 Z += myVolumeNodes[ i ]->Z();
833 X /= myVolumeNbNodes;
834 Y /= myVolumeNbNodes;
835 Z /= myVolumeNbNodes;
840 //=======================================================================
841 //function : SetExternalNormal
842 //purpose : Node order will be so that faces normals are external
843 //=======================================================================
845 void SMDS_VolumeTool::SetExternalNormal ()
847 myExternalFaces = true;
851 //=======================================================================
852 //function : NbFaceNodes
853 //purpose : Return number of nodes in the array of face nodes
854 //=======================================================================
856 int SMDS_VolumeTool::NbFaceNodes( int faceIndex )
858 if ( !setFace( faceIndex ))
860 return myFaceNbNodes;
863 //=======================================================================
864 //function : GetFaceNodes
865 //purpose : Return pointer to the array of face nodes.
866 // To comfort link iteration, the array
867 // length == NbFaceNodes( faceIndex ) + 1 and
868 // the last node == the first one.
869 //=======================================================================
871 const SMDS_MeshNode** SMDS_VolumeTool::GetFaceNodes( int faceIndex )
873 if ( !setFace( faceIndex ))
878 //=======================================================================
879 //function : GetFaceNodesIndices
880 //purpose : Return pointer to the array of face nodes indices
881 // To comfort link iteration, the array
882 // length == NbFaceNodes( faceIndex ) + 1 and
883 // the last node index == the first one.
884 //=======================================================================
886 const int* SMDS_VolumeTool::GetFaceNodesIndices( int faceIndex )
888 if (myVolume->IsPoly()) {
889 MESSAGE("Warning: attempt to obtain FaceNodesIndices of polyhedral volume");
892 if ( !setFace( faceIndex ))
894 return myFaceNodeIndices;
897 //=======================================================================
898 //function : GetFaceNodes
899 //purpose : Return a set of face nodes.
900 //=======================================================================
902 bool SMDS_VolumeTool::GetFaceNodes (int faceIndex,
903 set<const SMDS_MeshNode*>& theFaceNodes )
905 if ( !setFace( faceIndex ))
908 theFaceNodes.clear();
909 int iNode, nbNode = myFaceNbNodes;
910 for ( iNode = 0; iNode < nbNode; iNode++ )
911 theFaceNodes.insert( myFaceNodes[ iNode ]);
916 //=======================================================================
917 //function : IsFaceExternal
918 //purpose : Check normal orientation of a returned face
919 //=======================================================================
921 bool SMDS_VolumeTool::IsFaceExternal( int faceIndex )
923 if ( myExternalFaces || !myVolume )
926 if (myVolume->IsPoly()) {
927 XYZ aNormal, baryCenter, p0 (myPolyedre->GetFaceNode(faceIndex + 1, 1));
928 GetFaceNormal(faceIndex, aNormal.x, aNormal.y, aNormal.z);
929 GetBaryCenter(baryCenter.x, baryCenter.y, baryCenter.z);
930 XYZ insideVec (baryCenter - p0);
931 if (insideVec.Dot(aNormal) > 0)
936 switch ( myVolumeNbNodes ) {
941 // only the bottom of a reversed tetrahedron can be internal
942 return ( myVolForward || faceIndex != 0 );
945 // in a forward pentahedron, the top is internal, in a reversed one - bottom
946 return ( myVolForward ? faceIndex != 1 : faceIndex != 0 );
949 // in a forward hexahedron, even face normal is external, odd - internal
950 bool odd = faceIndex % 2;
951 return ( myVolForward ? !odd : odd );
958 //=======================================================================
959 //function : GetFaceNormal
960 //purpose : Return a normal to a face
961 //=======================================================================
963 bool SMDS_VolumeTool::GetFaceNormal (int faceIndex, double & X, double & Y, double & Z)
965 if ( !setFace( faceIndex ))
968 XYZ p1 ( myFaceNodes[0] );
969 XYZ p2 ( myFaceNodes[1] );
970 XYZ p3 ( myFaceNodes[2] );
971 XYZ aVec12( p2 - p1 );
972 XYZ aVec13( p3 - p1 );
973 XYZ cross = aVec12.Crossed( aVec13 );
975 //if ( myFaceNbNodes == 4 ) {
976 if ( myFaceNbNodes >3 ) {
977 XYZ p4 ( myFaceNodes[3] );
978 XYZ aVec14( p4 - p1 );
979 XYZ cross2 = aVec13.Crossed( aVec14 );
985 double size = cross.Magnitude();
986 if ( size <= DBL_MIN )
996 //=======================================================================
997 //function : GetFaceArea
998 //purpose : Return face area
999 //=======================================================================
1001 double SMDS_VolumeTool::GetFaceArea( int faceIndex )
1003 if (myVolume->IsPoly()) {
1004 MESSAGE("Warning: attempt to obtain area of a face of polyhedral volume");
1008 if ( !setFace( faceIndex ))
1011 XYZ p1 ( myFaceNodes[0] );
1012 XYZ p2 ( myFaceNodes[1] );
1013 XYZ p3 ( myFaceNodes[2] );
1014 XYZ aVec12( p2 - p1 );
1015 XYZ aVec13( p3 - p1 );
1016 double area = aVec12.Crossed( aVec13 ).Magnitude() * 0.5;
1018 if ( myFaceNbNodes == 4 ) {
1019 XYZ p4 ( myFaceNodes[3] );
1020 XYZ aVec14( p4 - p1 );
1021 area += aVec14.Crossed( aVec13 ).Magnitude() * 0.5;
1026 //=======================================================================
1027 //function : GetOppFaceIndex
1028 //purpose : Return index of the opposite face if it exists, else -1.
1029 //=======================================================================
1031 int SMDS_VolumeTool::GetOppFaceIndex( int faceIndex ) const
1034 if (myVolume->IsPoly()) {
1035 MESSAGE("Warning: attempt to obtain opposite face on polyhedral volume");
1039 if ( faceIndex >= 0 && faceIndex < NbFaces() ) {
1040 switch ( myVolumeNbNodes ) {
1042 if ( faceIndex == 0 || faceIndex == 1 )
1043 ind = 1 - faceIndex;
1046 ind = faceIndex + ( faceIndex % 2 ? -1 : 1 );
1054 //=======================================================================
1055 //function : IsLinked
1056 //purpose : return true if theNode1 is linked with theNode2
1057 //=======================================================================
1059 bool SMDS_VolumeTool::IsLinked (const SMDS_MeshNode* theNode1,
1060 const SMDS_MeshNode* theNode2) const
1065 if (myVolume->IsPoly()) {
1067 MESSAGE("Warning: bad volumic element");
1070 bool isLinked = false;
1072 for (iface = 1; iface <= myNbFaces && !isLinked; iface++) {
1073 int inode, nbFaceNodes = myPolyedre->NbFaceNodes(iface);
1075 for (inode = 1; inode <= nbFaceNodes && !isLinked; inode++) {
1076 const SMDS_MeshNode* curNode = myPolyedre->GetFaceNode(iface, inode);
1078 if (curNode == theNode1 || curNode == theNode2) {
1079 int inextnode = (inode == nbFaceNodes) ? 1 : inode + 1;
1080 const SMDS_MeshNode* nextNode = myPolyedre->GetFaceNode(iface, inextnode);
1082 if ((curNode == theNode1 && nextNode == theNode2) ||
1083 (curNode == theNode2 && nextNode == theNode1)) {
1092 // find nodes indices
1093 int i1 = -1, i2 = -1;
1094 for ( int i = 0; i < myVolumeNbNodes; i++ ) {
1095 if ( myVolumeNodes[ i ] == theNode1 )
1097 else if ( myVolumeNodes[ i ] == theNode2 )
1100 return IsLinked( i1, i2 );
1103 //=======================================================================
1104 //function : IsLinked
1105 //purpose : return true if the node with theNode1Index is linked
1106 // with the node with theNode2Index
1107 //=======================================================================
1109 bool SMDS_VolumeTool::IsLinked (const int theNode1Index,
1110 const int theNode2Index) const
1112 if ( myVolume->IsPoly() ) {
1113 return IsLinked(myVolumeNodes[theNode1Index], myVolumeNodes[theNode2Index]);
1116 int minInd = min( theNode1Index, theNode2Index );
1117 int maxInd = max( theNode1Index, theNode2Index );
1119 if ( minInd < 0 || maxInd > myVolumeNbNodes - 1 || maxInd == minInd )
1122 switch ( myVolumeNbNodes ) {
1128 switch ( maxInd - minInd ) {
1130 case 3: return true;
1135 switch ( maxInd - minInd ) {
1136 case 1: return minInd != 2;
1137 case 2: return minInd == 0 || minInd == 3;
1138 case 3: return true;
1143 switch ( maxInd - minInd ) {
1144 case 1: return minInd != 3;
1145 case 3: return minInd == 0 || minInd == 4;
1146 case 4: return true;
1153 case 0: if( maxInd==4 || maxInd==6 || maxInd==7 ) return true;
1154 case 1: if( maxInd==4 || maxInd==5 || maxInd==8 ) return true;
1155 case 2: if( maxInd==5 || maxInd==6 || maxInd==9 ) return true;
1156 case 3: if( maxInd==7 || maxInd==8 || maxInd==9 ) return true;
1164 case 0: if( maxInd==5 || maxInd==8 || maxInd==9 ) return true;
1165 case 1: if( maxInd==5 || maxInd==6 || maxInd==10 ) return true;
1166 case 2: if( maxInd==6 || maxInd==7 || maxInd==11 ) return true;
1167 case 3: if( maxInd==7 || maxInd==8 || maxInd==12 ) return true;
1168 case 4: if( maxInd==9 || maxInd==10 || maxInd==11 || maxInd==12 ) return true;
1176 case 0: if( maxInd==6 || maxInd==8 || maxInd==12 ) return true;
1177 case 1: if( maxInd==6 || maxInd==7 || maxInd==13 ) return true;
1178 case 2: if( maxInd==7 || maxInd==8 || maxInd==14 ) return true;
1179 case 3: if( maxInd==9 || maxInd==11 || maxInd==12 ) return true;
1180 case 4: if( maxInd==9 || maxInd==10 || maxInd==13 ) return true;
1181 case 5: if( maxInd==10 || maxInd==11 || maxInd==14 ) return true;
1189 case 0: if( maxInd==8 || maxInd==11 || maxInd==16 ) return true;
1190 case 1: if( maxInd==8 || maxInd==9 || maxInd==17 ) return true;
1191 case 2: if( maxInd==9 || maxInd==10 || maxInd==18 ) return true;
1192 case 3: if( maxInd==10 || maxInd==11 || maxInd==19 ) return true;
1193 case 4: if( maxInd==12 || maxInd==15 || maxInd==16 ) return true;
1194 case 5: if( maxInd==12 || maxInd==13 || maxInd==17 ) return true;
1195 case 6: if( maxInd==13 || maxInd==14 || maxInd==18 ) return true;
1196 case 7: if( maxInd==14 || maxInd==15 || maxInd==19 ) return true;
1206 //=======================================================================
1207 //function : GetNodeIndex
1208 //purpose : Return an index of theNode
1209 //=======================================================================
1211 int SMDS_VolumeTool::GetNodeIndex(const SMDS_MeshNode* theNode) const
1214 for ( int i = 0; i < myVolumeNbNodes; i++ ) {
1215 if ( myVolumeNodes[ i ] == theNode )
1222 //================================================================================
1224 * \brief Fill vector with boundary faces existing in the mesh
1225 * \param faces - vector of found nodes
1226 * \retval int - nb of found faces
1228 //================================================================================
1230 int SMDS_VolumeTool::GetAllExistingFaces(vector<const SMDS_MeshElement*> & faces)
1233 faces.reserve( NbFaces() );
1234 for ( int iF = 0; iF < NbFaces(); ++iF ) {
1235 const SMDS_MeshFace* face = 0;
1236 const SMDS_MeshNode** nodes = GetFaceNodes( iF );
1237 switch ( NbFaceNodes( iF )) {
1239 face = SMDS_Mesh::FindFace( nodes[0], nodes[1], nodes[2] ); break;
1241 face = SMDS_Mesh::FindFace( nodes[0], nodes[1], nodes[2], nodes[3] ); break;
1243 face = SMDS_Mesh::FindFace( nodes[0], nodes[1], nodes[2],
1244 nodes[3], nodes[4], nodes[5]); break;
1246 face = SMDS_Mesh::FindFace( nodes[0], nodes[1], nodes[2], nodes[3],
1247 nodes[4], nodes[5], nodes[6], nodes[7]); break;
1250 faces.push_back( face );
1252 return faces.size();
1256 //================================================================================
1258 * \brief Fill vector with boundary edges existing in the mesh
1259 * \param edges - vector of found edges
1260 * \retval int - nb of found faces
1262 //================================================================================
1264 int SMDS_VolumeTool::GetAllExistingEdges(vector<const SMDS_MeshElement*> & edges) const
1267 edges.reserve( myVolumeNbNodes * 2 );
1268 for ( int i = 0; i < myVolumeNbNodes; ++i ) {
1269 for ( int j = i + 1; j < myVolumeNbNodes; ++j ) {
1270 if ( IsLinked( i, j )) {
1271 const SMDS_MeshElement* edge =
1272 SMDS_Mesh::FindEdge( myVolumeNodes[i], myVolumeNodes[j] );
1274 edges.push_back( edge );
1278 return edges.size();
1281 //=======================================================================
1282 //function : IsFreeFace
1283 //purpose : check that only one volume is build on the face nodes
1284 //=======================================================================
1286 bool SMDS_VolumeTool::IsFreeFace( int faceIndex )
1288 const int free = true;
1290 if (!setFace( faceIndex ))
1293 const SMDS_MeshNode** nodes = GetFaceNodes( faceIndex );
1294 int nbFaceNodes = myFaceNbNodes;
1296 // evaluate nb of face nodes shared by other volume
1297 int maxNbShared = -1;
1298 typedef map< const SMDS_MeshElement*, int > TElemIntMap;
1299 TElemIntMap volNbShared;
1300 TElemIntMap::iterator vNbIt;
1301 for ( int iNode = 0; iNode < nbFaceNodes; iNode++ ) {
1302 const SMDS_MeshNode* n = nodes[ iNode ];
1303 SMDS_ElemIteratorPtr eIt = n->GetInverseElementIterator();
1304 while ( eIt->more() ) {
1305 const SMDS_MeshElement* elem = eIt->next();
1306 if ( elem != myVolume && elem->GetType() == SMDSAbs_Volume ) {
1308 vNbIt = volNbShared.find( elem );
1309 if ( vNbIt == volNbShared.end() ) {
1310 volNbShared.insert ( TElemIntMap::value_type( elem, nbShared ));
1313 nbShared = ++(*vNbIt).second;
1315 if ( nbShared > maxNbShared )
1316 maxNbShared = nbShared;
1320 if ( maxNbShared < 3 )
1321 return free; // is free
1323 // find volumes laying on the opposite side of the face
1324 // and sharing all nodes
1325 XYZ intNormal; // internal normal
1326 GetFaceNormal( faceIndex, intNormal.x, intNormal.y, intNormal.z );
1327 if ( IsFaceExternal( faceIndex ))
1328 intNormal = XYZ( -intNormal.x, -intNormal.y, -intNormal.z );
1329 XYZ p0 ( nodes[0] ), baryCenter;
1330 for ( vNbIt = volNbShared.begin(); vNbIt != volNbShared.end(); vNbIt++ ) {
1331 int nbShared = (*vNbIt).second;
1332 if ( nbShared >= 3 ) {
1333 SMDS_VolumeTool volume( (*vNbIt).first );
1334 volume.GetBaryCenter( baryCenter.x, baryCenter.y, baryCenter.z );
1335 XYZ intNormal2( baryCenter - p0 );
1336 if ( intNormal.Dot( intNormal2 ) < 0 )
1337 continue; // opposite side
1339 // remove a volume from volNbShared map
1340 volNbShared.erase( vNbIt-- );
1343 // here volNbShared contains only volumes laying on the
1344 // opposite side of the face
1345 if ( volNbShared.empty() ) {
1346 return free; // is free
1349 // check if the whole area of a face is shared
1350 bool isShared[] = { false, false, false, false }; // 4 triangle parts of a quadrangle
1351 for ( vNbIt = volNbShared.begin(); vNbIt != volNbShared.end(); vNbIt++ ) {
1352 SMDS_VolumeTool volume( (*vNbIt).first );
1353 bool prevLinkShared = false;
1354 int nbSharedLinks = 0;
1355 for ( int iNode = 0; iNode < nbFaceNodes; iNode++ ) {
1356 bool linkShared = volume.IsLinked( nodes[ iNode ], nodes[ iNode + 1] );
1359 if ( linkShared && prevLinkShared &&
1360 volume.IsLinked( nodes[ iNode - 1 ], nodes[ iNode + 1] ))
1361 isShared[ iNode ] = true;
1362 prevLinkShared = linkShared;
1364 if ( nbSharedLinks == nbFaceNodes )
1365 return !free; // is not free
1366 if ( nbFaceNodes == 4 ) {
1367 // check traingle parts 1 & 3
1368 if ( isShared[1] && isShared[3] )
1369 return !free; // is not free
1370 // check triangle parts 0 & 2;
1371 // 0 part could not be checked in the loop; check it here
1372 if ( isShared[2] && prevLinkShared &&
1373 volume.IsLinked( nodes[ 0 ], nodes[ 1 ] ) &&
1374 volume.IsLinked( nodes[ 1 ], nodes[ 3 ] ) )
1375 return !free; // is not free
1381 //=======================================================================
1382 //function : GetFaceIndex
1383 //purpose : Return index of a face formed by theFaceNodes
1384 //=======================================================================
1386 int SMDS_VolumeTool::GetFaceIndex( const set<const SMDS_MeshNode*>& theFaceNodes )
1388 for ( int iFace = 0; iFace < myNbFaces; iFace++ ) {
1389 const SMDS_MeshNode** nodes = GetFaceNodes( iFace );
1390 int nbFaceNodes = NbFaceNodes( iFace );
1391 set<const SMDS_MeshNode*> nodeSet;
1392 for ( int iNode = 0; iNode < nbFaceNodes; iNode++ )
1393 nodeSet.insert( nodes[ iNode ] );
1394 if ( theFaceNodes == nodeSet )
1400 //=======================================================================
1401 //function : GetFaceIndex
1402 //purpose : Return index of a face formed by theFaceNodes
1403 //=======================================================================
1405 /*int SMDS_VolumeTool::GetFaceIndex( const set<int>& theFaceNodesIndices )
1407 for ( int iFace = 0; iFace < myNbFaces; iFace++ ) {
1408 const int* nodes = GetFaceNodesIndices( iFace );
1409 int nbFaceNodes = NbFaceNodes( iFace );
1411 for ( int iNode = 0; iNode < nbFaceNodes; iNode++ )
1412 nodeSet.insert( nodes[ iNode ] );
1413 if ( theFaceNodesIndices == nodeSet )
1419 //=======================================================================
1420 //function : setFace
1422 //=======================================================================
1424 bool SMDS_VolumeTool::setFace( int faceIndex )
1429 if ( myCurFace == faceIndex )
1434 if ( faceIndex < 0 || faceIndex >= NbFaces() )
1437 if (myFaceNodes != NULL) {
1438 delete [] myFaceNodes;
1442 if (myVolume->IsPoly()) {
1444 MESSAGE("Warning: bad volumic element");
1448 // check orientation
1449 bool isGoodOri = true;
1450 if (myExternalFaces)
1451 isGoodOri = IsFaceExternal( faceIndex );
1455 myFaceNbNodes = myPolyedre->NbFaceNodes(faceIndex + 1);
1456 myFaceNodes = new const SMDS_MeshNode* [myFaceNbNodes + 1];
1458 for ( iNode = 0; iNode < myFaceNbNodes; iNode++ )
1459 myFaceNodes[ iNode ] = myPolyedre->GetFaceNode(faceIndex + 1, iNode + 1);
1461 for ( iNode = 0; iNode < myFaceNbNodes; iNode++ )
1462 myFaceNodes[ iNode ] = myPolyedre->GetFaceNode(faceIndex + 1, myFaceNbNodes - iNode);
1464 myFaceNodes[ myFaceNbNodes ] = myFaceNodes[ 0 ]; // last = first
1468 // choose face node indices
1469 switch ( myVolumeNbNodes ) {
1471 myFaceNbNodes = Tetra_nbN[ faceIndex ];
1472 if ( myExternalFaces )
1473 myFaceNodeIndices = myVolForward ? Tetra_F[ faceIndex ] : Tetra_RE[ faceIndex ];
1475 myFaceNodeIndices = myVolForward ? Tetra_F[ faceIndex ] : Tetra_R[ faceIndex ];
1478 myFaceNbNodes = Pyramid_nbN[ faceIndex ];
1479 if ( myExternalFaces )
1480 myFaceNodeIndices = myVolForward ? Pyramid_F[ faceIndex ] : Pyramid_RE[ faceIndex ];
1482 myFaceNodeIndices = myVolForward ? Pyramid_F[ faceIndex ] : Pyramid_R[ faceIndex ];
1485 myFaceNbNodes = Penta_nbN[ faceIndex ];
1486 if ( myExternalFaces )
1487 myFaceNodeIndices = myVolForward ? Penta_FE[ faceIndex ] : Penta_RE[ faceIndex ];
1489 myFaceNodeIndices = myVolForward ? Penta_F[ faceIndex ] : Penta_R[ faceIndex ];
1492 myFaceNbNodes = Hexa_nbN[ faceIndex ];
1493 if ( myExternalFaces )
1494 myFaceNodeIndices = myVolForward ? Hexa_FE[ faceIndex ] : Hexa_RE[ faceIndex ];
1496 myFaceNodeIndices = Hexa_F[ faceIndex ];
1499 myFaceNbNodes = QuadTetra_nbN[ faceIndex ];
1500 if ( myExternalFaces )
1501 myFaceNodeIndices = myVolForward ? QuadTetra_F[ faceIndex ] : QuadTetra_RE[ faceIndex ];
1503 myFaceNodeIndices = myVolForward ? QuadTetra_F[ faceIndex ] : QuadTetra_R[ faceIndex ];
1506 myFaceNbNodes = QuadPyram_nbN[ faceIndex ];
1507 if ( myExternalFaces )
1508 myFaceNodeIndices = myVolForward ? QuadPyram_F[ faceIndex ] : QuadPyram_RE[ faceIndex ];
1510 myFaceNodeIndices = myVolForward ? QuadPyram_F[ faceIndex ] : QuadPyram_R[ faceIndex ];
1513 myFaceNbNodes = QuadPenta_nbN[ faceIndex ];
1514 if ( myExternalFaces )
1515 myFaceNodeIndices = myVolForward ? QuadPenta_FE[ faceIndex ] : QuadPenta_RE[ faceIndex ];
1517 myFaceNodeIndices = myVolForward ? QuadPenta_F[ faceIndex ] : QuadPenta_R[ faceIndex ];
1520 myFaceNbNodes = QuadHexa_nbN[ faceIndex ];
1521 if ( myExternalFaces )
1522 myFaceNodeIndices = myVolForward ? QuadHexa_FE[ faceIndex ] : QuadHexa_RE[ faceIndex ];
1524 myFaceNodeIndices = QuadHexa_F[ faceIndex ];
1531 myFaceNodes = new const SMDS_MeshNode* [myFaceNbNodes + 1];
1532 for ( int iNode = 0; iNode < myFaceNbNodes; iNode++ )
1533 myFaceNodes[ iNode ] = myVolumeNodes[ myFaceNodeIndices[ iNode ]];
1534 myFaceNodes[ myFaceNbNodes ] = myFaceNodes[ 0 ];
1537 myCurFace = faceIndex;
1542 //=======================================================================
1543 //function : GetType
1544 //purpose : return VolumeType by nb of nodes in a volume
1545 //=======================================================================
1547 SMDS_VolumeTool::VolumeType SMDS_VolumeTool::GetType(int nbNodes)
1549 switch ( nbNodes ) {
1550 case 4: return TETRA;
1551 case 5: return PYRAM;
1552 case 6: return PENTA;
1553 case 8: return HEXA;
1554 case 10: return QUAD_TETRA;
1555 case 13: return QUAD_PYRAM;
1556 case 15: return QUAD_PENTA;
1557 case 20: return QUAD_HEXA;
1558 default:return UNKNOWN;
1562 //=======================================================================
1563 //function : NbFaces
1564 //purpose : return nb of faces by volume type
1565 //=======================================================================
1567 int SMDS_VolumeTool::NbFaces( VolumeType type )
1571 case QUAD_TETRA: return 4;
1573 case QUAD_PYRAM: return 5;
1575 case QUAD_PENTA: return 5;
1577 case QUAD_HEXA : return 6;
1582 //================================================================================
1584 * \brief Useful to know nb of corner nodes of a quadratic volume
1585 * \param type - volume type
1586 * \retval int - nb of corner nodes
1588 //================================================================================
1590 int SMDS_VolumeTool::NbCornerNodes(VolumeType type)
1594 case QUAD_TETRA: return 4;
1596 case QUAD_PYRAM: return 5;
1598 case QUAD_PENTA: return 6;
1600 case QUAD_HEXA : return 8;
1607 //=======================================================================
1608 //function : GetFaceNodesIndices
1609 //purpose : Return the array of face nodes indices
1610 // To comfort link iteration, the array
1611 // length == NbFaceNodes( faceIndex ) + 1 and
1612 // the last node index == the first one.
1613 //=======================================================================
1615 const int* SMDS_VolumeTool::GetFaceNodesIndices(VolumeType type,
1620 case TETRA: return Tetra_F[ faceIndex ];
1621 case PYRAM: return Pyramid_F[ faceIndex ];
1622 case PENTA: return external ? Penta_FE[ faceIndex ] : Penta_F[ faceIndex ];
1623 case HEXA: return external ? Hexa_FE[ faceIndex ] : Hexa_F[ faceIndex ];
1624 case QUAD_TETRA: return QuadTetra_F[ faceIndex ];
1625 case QUAD_PYRAM: return QuadPyram_F[ faceIndex ];
1626 case QUAD_PENTA: return external ? QuadPenta_FE[ faceIndex ] : QuadPenta_F[ faceIndex ];
1627 case QUAD_HEXA: return external ? QuadHexa_FE[ faceIndex ] : QuadHexa_F[ faceIndex ];
1633 //=======================================================================
1634 //function : NbFaceNodes
1635 //purpose : Return number of nodes in the array of face nodes
1636 //=======================================================================
1638 int SMDS_VolumeTool::NbFaceNodes(VolumeType type,
1642 case TETRA: return Tetra_nbN[ faceIndex ];
1643 case PYRAM: return Pyramid_nbN[ faceIndex ];
1644 case PENTA: return Penta_nbN[ faceIndex ];
1645 case HEXA: return Hexa_nbN[ faceIndex ];
1646 case QUAD_TETRA: return QuadTetra_nbN[ faceIndex ];
1647 case QUAD_PYRAM: return QuadPyram_nbN[ faceIndex ];
1648 case QUAD_PENTA: return QuadPenta_nbN[ faceIndex ];
1649 case QUAD_HEXA: return QuadHexa_nbN[ faceIndex ];
1655 //=======================================================================
1657 //purpose : return element
1658 //=======================================================================
1660 const SMDS_MeshVolume* SMDS_VolumeTool::Get() const
1662 return static_cast<const SMDS_MeshVolume*>( myVolume );
1665 //=======================================================================
1667 //purpose : return element ID
1668 //=======================================================================
1670 int SMDS_VolumeTool::ID() const
1672 return myVolume ? myVolume->GetID() : 0;