From: eap Date: Thu, 16 May 2013 17:17:56 +0000 (+0000) Subject: 0022100: EDF 2413 SMESH: Take into account TRIA7 X-Git-Tag: V7_3_0a1~438 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9791c651e77e87061eb0b129d63e7e3d058796c1;p=modules%2Fsmesh.git 0022100: EDF 2413 SMESH: Take into account TRIA7 --- diff --git a/doc/salome/gui/SMESH/input/adding_quadratic_elements.doc b/doc/salome/gui/SMESH/input/adding_quadratic_elements.doc index 11b7931d8..6a9527b5d 100644 --- a/doc/salome/gui/SMESH/input/adding_quadratic_elements.doc +++ b/doc/salome/gui/SMESH/input/adding_quadratic_elements.doc @@ -8,11 +8,11 @@ Quadratic elements are defined by the same corner nodes as the corresponding linear ones, but in addition they have \a midside nodes located between the corner nodes on element sides. -If a quadratic quadrilateral element has an additional node at the -element center, it is a bi-quadratic element (or -QUAD9). If a quadratic hexahedral element has 7 additional nodes: -at the element center and at the center of each side, it is a -tri-quadratic element (or HEXA27). +If a quadratic 2D element has an additional node at the +element center, it is a bi-quadratic element (both TRIA7 and +QUAD9 elements are supported). If a quadratic hexahedral element has 7 +additional nodes: at the element center and at the center of each +side, it is a tri-quadratic element (or HEXA27). The convention of nodal connectivity of elements used in SALOME is the MED library convention. You can consult the description of nodal @@ -56,20 +56,22 @@ a new quadratic element is not created. To create any Quadratic Element specify the nodes which will form your -triangle by selecting them in the 3D viewer with pressed Shift +element by selecting them in the 3D viewer with pressed Shift button. Their numbers will appear in the dialog box as Corner Nodes (alternatively you can just input numbers in this field without -selection).The edges formed by the corner nodes will appear in the -table. To define the middle nodes for each edge double-click on the -respective field and input the number of the node. All edges and the -object formed by them will be displayed in the Object browser. When -all edges are defined you will be able to click \b Apply or Apply and Close button to +selection). The edges formed by the corner nodes will appear in the +table. To define the middle nodes for each edge, double-click on the +respective field and input the number of the node (or pick the node in +the viewer). For bi-quadratic and tri-quadratic elements, your also +need to specify central nodes. +As soon as all needed nodes are specified, a preview of a new +quadratic element will be displayed in the 3D viewer. Then +you will be able to click \b Apply or Apply and Close button to add the element to the mesh. \image html aqt.png -\b Reverse button for Quadratic Edges switches the first and the last -nodes. For all other elements it reverses the element. +\b Reverse button reverses the element. diff --git a/doc/salome/gui/SMESH/input/convert_to_from_quadratic_mesh.doc b/doc/salome/gui/SMESH/input/convert_to_from_quadratic_mesh.doc index c8f53682f..ee68098e9 100644 --- a/doc/salome/gui/SMESH/input/convert_to_from_quadratic_mesh.doc +++ b/doc/salome/gui/SMESH/input/convert_to_from_quadratic_mesh.doc @@ -34,14 +34,15 @@ The following dialog box will appear: \image html image156.gif diff --git a/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.cxx b/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.cxx index 94fdeec8a..652336eca 100644 --- a/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.cxx @@ -278,7 +278,6 @@ static int LastHexahedronIds[] = {1,2,3,0,5,6,7,4,4,5,6,7}; \brief Simple 'busy state' flag locker. \internal */ - class BusyLocker { public: @@ -295,7 +294,6 @@ private: \brief Simple editable table item. \internal */ - class IdEditItem: public QTableWidgetItem { public: @@ -325,6 +323,7 @@ QWidget* IdEditItem::createEditor() const // function : SMESHGUI_AddQuadraticElementDlg() // purpose : constructor //================================================================================= + SMESHGUI_AddQuadraticElementDlg::SMESHGUI_AddQuadraticElementDlg( SMESHGUI* theModule, const SMDSAbs_EntityType theType ) : QDialog( SMESH::GetDesktop( theModule ) ), @@ -358,6 +357,9 @@ SMESHGUI_AddQuadraticElementDlg::SMESHGUI_AddQuadraticElementDlg( SMESHGUI* theM case SMDSEntity_BiQuad_Quadrangle: anElementName = QString("BIQUADRATIC_QUADRANGLE"); break; + case SMDSEntity_BiQuad_Triangle: + anElementName = QString("BIQUADRATIC_TRIANGLE"); + break; case SMDSEntity_Quad_Tetra: anElementName = QString("QUADRATIC_TETRAHEDRON"); break; @@ -501,6 +503,7 @@ SMESHGUI_AddQuadraticElementDlg::SMESHGUI_AddQuadraticElementDlg( SMESHGUI* theM // function : ~SMESHGUI_AddQuadraticElementDlg() // purpose : Destroys the object and frees any allocated resources //================================================================================= + SMESHGUI_AddQuadraticElementDlg::~SMESHGUI_AddQuadraticElementDlg() { delete mySimulation; @@ -510,6 +513,7 @@ SMESHGUI_AddQuadraticElementDlg::~SMESHGUI_AddQuadraticElementDlg() // function : Init() // purpose : //================================================================================= + void SMESHGUI_AddQuadraticElementDlg::Init() { myRadioButton1->setChecked(true); @@ -535,6 +539,12 @@ void SMESHGUI_AddQuadraticElementDlg::Init() myNbCorners = 3; myHelpFileName = "adding_quadratic_elements_page.html#?"; //Adding_triangles break; + case SMDSEntity_BiQuad_Triangle: + aNumRows = 3; + myNbCorners = 3; + myNbCenterNodes = 1; + myHelpFileName = "adding_quadratic_elements_page.html#?"; //Adding_triangles + break; case SMDSEntity_Quad_Quadrangle: aNumRows = 4; myNbCorners = 4; @@ -651,13 +661,14 @@ void SMESHGUI_AddQuadraticElementDlg::Init() // function : ClickOnApply() // purpose : //================================================================================= -void SMESHGUI_AddQuadraticElementDlg::ClickOnApply() + +bool SMESHGUI_AddQuadraticElementDlg::ClickOnApply() { if( !isValid() ) - return; + return false; if ( mySMESHGUI->isActiveStudyLocked() || myBusy || !IsValid() ) - return; + return false; BusyLocker lock( myBusy ); @@ -671,6 +682,7 @@ void SMESHGUI_AddQuadraticElementDlg::ClickOnApply() break; case SMDSEntity_Quad_Triangle: case SMDSEntity_Quad_Quadrangle: + case SMDSEntity_BiQuad_Triangle: case SMDSEntity_BiQuad_Quadrangle: case SMDSEntity_Quad_Tetra: case SMDSEntity_Quad_Pyramid: @@ -722,7 +734,7 @@ void SMESHGUI_AddQuadraticElementDlg::ClickOnApply() int res = SUIT_MessageBox::question( this, tr( "SMESH_WRN_WARNING" ), tr( "MESH_STANDALONE_GRP_CHOSEN" ).arg( aGroupName ), tr( "SMESH_BUT_YES" ), tr( "SMESH_BUT_NO" ), 0, 1 ); - if ( res == 1 ) return; + if ( res == 1 ) return false; } aGroup = myGroups[idx-1]; } @@ -737,6 +749,7 @@ void SMESHGUI_AddQuadraticElementDlg::ClickOnApply() anElemId = aMeshEditor->AddEdge(anArrayOfIdeces.inout()); break; case SMDSEntity_Quad_Triangle: case SMDSEntity_Quad_Quadrangle: + case SMDSEntity_BiQuad_Triangle: case SMDSEntity_BiQuad_Quadrangle: anElementType = SMESH::FACE; anElemId = aMeshEditor->AddFace(anArrayOfIdeces.inout()); break; @@ -794,22 +807,26 @@ void SMESHGUI_AddQuadraticElementDlg::ClickOnApply() updateButtons(); SMESHGUI::Modified(); + + return true; } //================================================================================= // function : ClickOnOk() // purpose : //================================================================================= + void SMESHGUI_AddQuadraticElementDlg::ClickOnOk() { - ClickOnApply(); - reject(); + if ( ClickOnApply() ) + reject(); } //================================================================================= // function : reject() // purpose : //================================================================================= + void SMESHGUI_AddQuadraticElementDlg::reject() { mySelectionMgr->clearSelected(); @@ -826,6 +843,7 @@ void SMESHGUI_AddQuadraticElementDlg::reject() // function : ClickOnHelp() // purpose : //================================================================================= + void SMESHGUI_AddQuadraticElementDlg::ClickOnHelp() { LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); @@ -850,6 +868,7 @@ void SMESHGUI_AddQuadraticElementDlg::ClickOnHelp() // function : onTextChange() // purpose : //================================================================================= + void SMESHGUI_AddQuadraticElementDlg::onTextChange (const QString& theNewText) { if (myBusy) return; @@ -901,6 +920,7 @@ void SMESHGUI_AddQuadraticElementDlg::onTextChange (const QString& theNewText) // function : SelectionIntoArgument() // purpose : Called when selection has changed //================================================================================= + void SMESHGUI_AddQuadraticElementDlg::SelectionIntoArgument() { if (myBusy) return; @@ -951,6 +971,7 @@ void SMESHGUI_AddQuadraticElementDlg::SelectionIntoArgument() anElementType = SMESH::EDGE; break; case SMDSEntity_Quad_Triangle: case SMDSEntity_Quad_Quadrangle: + case SMDSEntity_BiQuad_Triangle: case SMDSEntity_BiQuad_Quadrangle: anElementType = SMESH::FACE; break; case SMDSEntity_Quad_Tetra: @@ -1008,6 +1029,7 @@ void SMESHGUI_AddQuadraticElementDlg::SelectionIntoArgument() // function : displaySimulation() // purpose : //================================================================================= + void SMESHGUI_AddQuadraticElementDlg::displaySimulation() { if ( IsValid() ) @@ -1068,6 +1090,7 @@ void SMESHGUI_AddQuadraticElementDlg::displaySimulation() // function : SetCurrentSelection() // purpose : //================================================================================= + void SMESHGUI_AddQuadraticElementDlg::SetCurrentSelection() { QPushButton* send = (QPushButton*)sender(); @@ -1091,6 +1114,7 @@ void SMESHGUI_AddQuadraticElementDlg::SetCurrentSelection() // function : DeactivateActiveDialog() // purpose : //================================================================================= + void SMESHGUI_AddQuadraticElementDlg::DeactivateActiveDialog() { if (GroupConstructors->isEnabled()) { @@ -1107,6 +1131,7 @@ void SMESHGUI_AddQuadraticElementDlg::DeactivateActiveDialog() // function : ActivateThisDialog() // purpose : //================================================================================= + void SMESHGUI_AddQuadraticElementDlg::ActivateThisDialog() { /* Emit a signal to deactivate the active dialog */ @@ -1127,6 +1152,7 @@ void SMESHGUI_AddQuadraticElementDlg::ActivateThisDialog() // function : enterEvent() // purpose : //================================================================================= + void SMESHGUI_AddQuadraticElementDlg::enterEvent (QEvent*) { if (GroupConstructors->isEnabled()) @@ -1138,6 +1164,7 @@ void SMESHGUI_AddQuadraticElementDlg::enterEvent (QEvent*) // function : onReverse() // purpose : //================================================================================= + void SMESHGUI_AddQuadraticElementDlg::onReverse (int state) { mySimulation->SetVisibility(false); @@ -1145,11 +1172,11 @@ void SMESHGUI_AddQuadraticElementDlg::onReverse (int state) updateButtons(); } - //================================================================================= // function : IsValid() // purpose : //================================================================================= + bool SMESHGUI_AddQuadraticElementDlg::IsValid() { SMDS_Mesh* aMesh = 0; @@ -1196,6 +1223,7 @@ bool SMESHGUI_AddQuadraticElementDlg::IsValid() // function : UpdateTable() // purpose : //================================================================================= + void SMESHGUI_AddQuadraticElementDlg::UpdateTable( bool theConersValidity ) { QStringList aListCorners = myCornerNodes->text().split(" ", QString::SkipEmptyParts); @@ -1217,6 +1245,7 @@ void SMESHGUI_AddQuadraticElementDlg::UpdateTable( bool theConersValidity ) aLastColIds = LastEdgeIds; break; case SMDSEntity_Quad_Triangle: + case SMDSEntity_BiQuad_Triangle: aFirstColIds = FirstTriangleIds; aLastColIds = LastTriangleIds; break; @@ -1262,11 +1291,11 @@ void SMESHGUI_AddQuadraticElementDlg::UpdateTable( bool theConersValidity ) } } - //================================================================================= // function : onTableActivate() // purpose : //================================================================================= + void SMESHGUI_AddQuadraticElementDlg::onCellDoubleClicked( int theRow, int theCol ) { myCurrentLineEdit = 0; @@ -1274,11 +1303,11 @@ void SMESHGUI_AddQuadraticElementDlg::onCellDoubleClicked( int theRow, int theCo updateButtons(); } - //================================================================================= // function : onCellTextChange() // purpose : //================================================================================= + void SMESHGUI_AddQuadraticElementDlg::onCellTextChange(int theRow, int theCol) { myCurrentLineEdit = 0; @@ -1290,6 +1319,7 @@ void SMESHGUI_AddQuadraticElementDlg::onCellTextChange(int theRow, int theCol) // function : keyPressEvent() // purpose : //================================================================================= + void SMESHGUI_AddQuadraticElementDlg::keyPressEvent( QKeyEvent* e ) { QDialog::keyPressEvent( e ); @@ -1302,6 +1332,11 @@ void SMESHGUI_AddQuadraticElementDlg::keyPressEvent( QKeyEvent* e ) } } +//======================================================================= +//function : updateButtons +//purpose : +//======================================================================= + void SMESHGUI_AddQuadraticElementDlg::updateButtons() { bool valid = IsValid(); @@ -1313,6 +1348,7 @@ void SMESHGUI_AddQuadraticElementDlg::updateButtons() // function : isValid // purpose : //================================================================================= + bool SMESHGUI_AddQuadraticElementDlg::isValid() { if( GroupGroups->isChecked() && ComboBox_GroupName->currentText().isEmpty() ) { diff --git a/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.h b/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.h index 6639f6c7c..f6ba14d1e 100644 --- a/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.h +++ b/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.h @@ -136,7 +136,7 @@ private slots: void onCellDoubleClicked( int, int ); void ClickOnOk(); - void ClickOnApply(); + bool ClickOnApply(); void ClickOnHelp(); void SetCurrentSelection(); void SelectionIntoArgument(); diff --git a/src/SMESHGUI/SMESHGUI_ConvToQuadOp.cxx b/src/SMESHGUI/SMESHGUI_ConvToQuadOp.cxx index b32a648ba..33e1aaf07 100644 --- a/src/SMESHGUI/SMESHGUI_ConvToQuadOp.cxx +++ b/src/SMESHGUI/SMESHGUI_ConvToQuadOp.cxx @@ -330,11 +330,14 @@ SMESHGUI_ConvToQuadOp::DestinationMesh( const SMESH::SMESH_IDSource_var& idSourc { SMESH::long_array_var nbElemOfType = idSource->GetMeshInfo(); - bool hasBiQuad = ( nbElemOfType[SMDSEntity_BiQuad_Quadrangle ] || + bool hasBiQuad = ( nbElemOfType[SMDSEntity_BiQuad_Triangle ] || + nbElemOfType[SMDSEntity_BiQuad_Quadrangle ] || nbElemOfType[SMDSEntity_TriQuad_Hexa ] ); - bool hasLinStruct = ( nbElemOfType[SMDSEntity_Quadrangle ] || + bool hasLinBiQuad = ( nbElemOfType[SMDSEntity_Triangle ] || + nbElemOfType[SMDSEntity_Quadrangle ] || nbElemOfType[SMDSEntity_Hexa ] ); - bool hasQuadStruct = ( nbElemOfType[SMDSEntity_Quad_Quadrangle ] || + bool hasQuadBiQuad = ( nbElemOfType[SMDSEntity_Quad_Triangle ] || + nbElemOfType[SMDSEntity_Quad_Quadrangle ] || nbElemOfType[SMDSEntity_Quad_Hexa ] ); bool hasQuad = ( nbElemOfType[SMDSEntity_Quad_Edge ] || @@ -356,9 +359,9 @@ SMESHGUI_ConvToQuadOp::DestinationMesh( const SMESH::SMESH_IDSource_var& idSourc int tgtType = 0; if ( hasBiQuad ) tgtType |= ( Quadratic | Linear ); - if ( hasLinStruct ) + if ( hasLinBiQuad ) tgtType |= ( BiQuadratic | Quadratic ); - if ( hasQuadStruct ) + if ( hasQuadBiQuad ) tgtType |= ( BiQuadratic | Linear ); if ( hasQuad ) tgtType |= Linear; diff --git a/src/SMESHGUI/SMESHGUI_MeshEditPreview.cxx b/src/SMESHGUI/SMESHGUI_MeshEditPreview.cxx index 358b2cf40..439abbb57 100644 --- a/src/SMESHGUI/SMESHGUI_MeshEditPreview.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshEditPreview.cxx @@ -111,8 +111,8 @@ SMESHGUI_MeshEditPreview::~SMESHGUI_MeshEditPreview() //================================================================================ vtkIdType getCellType( const SMDSAbs_ElementType theType, - const bool thePoly, - const int theNbNodes ) + const bool thePoly, + const int theNbNodes ) { switch( theType ) { @@ -127,6 +127,7 @@ vtkIdType getCellType( const SMDSAbs_ElementType theType, else if ( theNbNodes == 3 ) return VTK_TRIANGLE; else if ( theNbNodes == 4 ) return VTK_QUAD; else if ( theNbNodes == 6 ) return VTK_QUADRATIC_TRIANGLE; + else if ( theNbNodes == 7 ) return VTK_BIQUADRATIC_TRIANGLE; else if ( theNbNodes == 8 ) return VTK_QUADRATIC_QUAD; else if ( theNbNodes == 9 ) return VTK_BIQUADRATIC_QUAD; else return VTK_EMPTY_CELL; diff --git a/src/SMESHGUI/SMESHGUI_MeshInfo.cxx b/src/SMESHGUI/SMESHGUI_MeshInfo.cxx index e52f32026..aad40cdb2 100644 --- a/src/SMESHGUI/SMESHGUI_MeshInfo.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshInfo.cxx @@ -491,16 +491,16 @@ void SMESHGUI_MeshInfo::showInfo( SMESH::SMESH_IDSource_ptr obj ) myWidgets[i1D][iTotal] ->setProperty( "text", QString::number( nbEdges ) ); myWidgets[i1D][iLinear] ->setProperty( "text", QString::number( info[SMDSEntity_Edge] ) ); myWidgets[i1D][iQuadratic]->setProperty( "text", QString::number( info[SMDSEntity_Quad_Edge] ) ); - long nbTriangles = info[SMDSEntity_Triangle] + info[SMDSEntity_Quad_Triangle]; + long nbTriangles = info[SMDSEntity_Triangle] + info[SMDSEntity_Quad_Triangle] + info[SMDSEntity_BiQuad_Triangle]; long nbQuadrangles = info[SMDSEntity_Quadrangle] + info[SMDSEntity_Quad_Quadrangle] + info[SMDSEntity_BiQuad_Quadrangle]; long nb2DLinear = info[SMDSEntity_Triangle] + info[SMDSEntity_Quadrangle] + info[SMDSEntity_Polygon]; - long nb2DQuadratic = info[SMDSEntity_Quad_Triangle] + info[SMDSEntity_Quad_Quadrangle] + info[SMDSEntity_BiQuad_Quadrangle]; + long nb2DQuadratic = info[SMDSEntity_Quad_Triangle] + info[SMDSEntity_BiQuad_Triangle] + info[SMDSEntity_Quad_Quadrangle] + info[SMDSEntity_BiQuad_Quadrangle]; myWidgets[i2D][iTotal] ->setProperty( "text", QString::number( nb2DLinear + nb2DQuadratic ) ); myWidgets[i2D][iLinear] ->setProperty( "text", QString::number( nb2DLinear ) ); myWidgets[i2D][iQuadratic] ->setProperty( "text", QString::number( nb2DQuadratic ) ); myWidgets[i2DTriangles][iTotal] ->setProperty( "text", QString::number( nbTriangles ) ); myWidgets[i2DTriangles][iLinear] ->setProperty( "text", QString::number( info[SMDSEntity_Triangle] ) ); - myWidgets[i2DTriangles][iQuadratic] ->setProperty( "text", QString::number( info[SMDSEntity_Quad_Triangle] ) ); + myWidgets[i2DTriangles][iQuadratic] ->setProperty( "text", QString::number( info[SMDSEntity_Quad_Triangle] + info[SMDSEntity_BiQuad_Triangle]) ); myWidgets[i2DQuadrangles][iTotal] ->setProperty( "text", QString::number( nbQuadrangles ) ); myWidgets[i2DQuadrangles][iLinear] ->setProperty( "text", QString::number( info[SMDSEntity_Quadrangle] ) ); myWidgets[i2DQuadrangles][iQuadratic]->setProperty( "text", QString::number( info[SMDSEntity_Quad_Quadrangle] + info[SMDSEntity_BiQuad_Quadrangle] )); @@ -1208,7 +1208,7 @@ void SMESHGUI_SimpleElemInfo::information( const QList& ids ) SMESH::Controls::NumericalFunctorPtr afunctor; if ( !e ) return; - // element ID && type + // Element ID && Type QString stype; switch( e->GetType() ) { case SMDSAbs_0DElement: @@ -1228,11 +1228,13 @@ void SMESHGUI_SimpleElemInfo::information( const QList& ids ) myInfo->append( QString( "%1 #%2" ).arg( stype ).arg( id ) ); // separator myInfo->append( "" ); - // geometry type + + // Geometry type QString gtype; switch( e->GetEntityType() ) { case SMDSEntity_Triangle: case SMDSEntity_Quad_Triangle: + case SMDSEntity_BiQuad_Triangle: gtype = SMESHGUI_ElemInfo::tr( "TRIANGLE" ); break; case SMDSEntity_Quadrangle: case SMDSEntity_Quad_Quadrangle: @@ -1264,23 +1266,19 @@ void SMESHGUI_SimpleElemInfo::information( const QList& ids ) } if ( !gtype.isEmpty() ) myInfo->append( QString( "%1: %2" ).arg( SMESHGUI_ElemInfo::tr( "TYPE" ) ).arg( gtype ) ); - // quadratic flag and gravity center (any element except 0D) + + // Quadratic flag (any element except 0D) if ( e->GetEntityType() > SMDSEntity_0D && e->GetEntityType() < SMDSEntity_Ball ) { - // quadratic flag myInfo->append( QString( "%1? %2" ).arg( SMESHGUI_ElemInfo::tr( "QUADRATIC" ) ).arg( e->IsQuadratic() ? SMESHGUI_ElemInfo::tr( "YES" ) : SMESHGUI_ElemInfo::tr( "NO" ) ) ); - // separator - myInfo->append( "" ); - // gravity center - XYZ gc = gravityCenter( e ); - myInfo->append( QString( "%1: (%2, %3, %4)" ).arg( SMESHGUI_ElemInfo::tr( "GRAVITY_CENTER" ) ).arg( gc.x() ).arg( gc.y() ).arg( gc.z() ) ); } if ( const SMDS_BallElement* ball = dynamic_cast( e )) { - // ball diameter + // Ball diameter myInfo->append( QString( "%1: %2" ).arg( SMESHGUI_ElemInfo::tr( "BALL_DIAMETER" ) ).arg( ball->GetDiameter() )); } // separator myInfo->append( "" ); - // connectivity + + // Connectivity SMDS_ElemIteratorPtr nodeIt = e->nodesIterator(); for ( int idx = 1; nodeIt->more(); idx++ ) { const SMDS_MeshNode* node = static_cast( nodeIt->next() ); @@ -1314,27 +1312,28 @@ void SMESHGUI_SimpleElemInfo::information( const QList& ids ) } // separator myInfo->append( "" ); - //controls + + // Controls myInfo->append( QString( "%1:" ).arg( SMESHGUI_ElemInfo::tr( "CONTROLS" ) ) ); //Length - if ( e->GetType() == SMDSAbs_Edge ) { + if ( e->GetType() == SMDSAbs_Edge ) { afunctor.reset( new SMESH::Controls::Length() ); afunctor->SetMesh( actor()->GetObject()->GetMesh() ); afunctor->SetPrecision( cprecision ); myInfo->append( QString( "- %1: %2" ).arg( tr( "LENGTH_EDGES" ) ).arg( afunctor->GetValue( id ) ) ); } if( e->GetType() == SMDSAbs_Face ) { - //Area + //Area afunctor.reset( new SMESH::Controls::Area() ); afunctor->SetMesh( actor()->GetObject()->GetMesh() ); afunctor->SetPrecision( cprecision ); myInfo->append( QString( "- %1: %2" ).arg( tr( "AREA_ELEMENTS" ) ).arg( afunctor->GetValue( id ) ) ); - //Taper + //Taper afunctor.reset( new SMESH::Controls::Taper() ); afunctor->SetMesh( actor()->GetObject()->GetMesh() ); afunctor->SetPrecision( cprecision ); myInfo->append( QString( "- %1: %2" ).arg( tr( "TAPER_ELEMENTS" ) ).arg( afunctor->GetValue( id ) ) ); - //AspectRatio2D + //AspectRatio2D afunctor.reset( new SMESH::Controls::AspectRatio() ); afunctor->SetMesh( actor()->GetObject()->GetMesh() ); myInfo->append( QString( "- %1: %2" ).arg( tr( "ASPECTRATIO_ELEMENTS" ) ).arg( afunctor->GetValue( id ) ) ); @@ -1372,7 +1371,14 @@ void SMESHGUI_SimpleElemInfo::information( const QList& ids ) afunctor->SetMesh( actor()->GetObject()->GetMesh() ); myInfo->append( QString( "- %1: %2" ).arg( tr( "MAX_ELEMENT_LENGTH_3D" ) ).arg( afunctor->GetValue( id ) ) ); } - // element position + // separator + myInfo->append( "" ); + + // Gravity center + XYZ gc = gravityCenter( e ); + myInfo->append( QString( "%1: (%2, %3, %4)" ).arg( SMESHGUI_ElemInfo::tr( "GRAVITY_CENTER" ) ).arg( gc.x() ).arg( gc.y() ).arg( gc.z() ) ); + + // Element position if ( e->GetType() >= SMDSAbs_Edge && e->GetType() <= SMDSAbs_Volume ) { SMESH::SMESH_Mesh_ptr aMesh = actor()->GetObject()->GetMeshServer(); if ( !CORBA::is_nil( aMesh ) ) { @@ -1393,7 +1399,8 @@ void SMESHGUI_SimpleElemInfo::information( const QList& ids ) } } } - // groups element belongs to + + // Groups the element belongs to SMESH::SMESH_Mesh_ptr aMesh = actor()->GetObject()->GetMeshServer(); if ( !CORBA::is_nil( aMesh ) ) { SMESH::ListOfGroups_var groups = aMesh->GetGroups(); @@ -1721,18 +1728,12 @@ void SMESHGUI_TreeElemInfo::information( const QList& ids ) // element ID && type QString stype; switch( e->GetType() ) { - case SMDSAbs_0DElement: - stype = SMESHGUI_ElemInfo::tr( "0D_ELEMENT" ); break; - case SMDSAbs_Ball: - stype = SMESHGUI_ElemInfo::tr( "BALL" ); break; - case SMDSAbs_Edge: - stype = SMESHGUI_ElemInfo::tr( "EDGE" ); break; - case SMDSAbs_Face: - stype = SMESHGUI_ElemInfo::tr( "FACE" ); break; - case SMDSAbs_Volume: - stype = SMESHGUI_ElemInfo::tr( "VOLUME" ); break; - default: - break; + case SMDSAbs_0DElement: stype = SMESHGUI_ElemInfo::tr( "0D_ELEMENT" ); break; + case SMDSAbs_Ball: stype = SMESHGUI_ElemInfo::tr( "BALL" ); break; + case SMDSAbs_Edge: stype = SMESHGUI_ElemInfo::tr( "EDGE" ); break; + case SMDSAbs_Face: stype = SMESHGUI_ElemInfo::tr( "FACE" ); break; + case SMDSAbs_Volume: stype = SMESHGUI_ElemInfo::tr( "VOLUME" ); break; + default:; } if ( stype.isEmpty() ) return; QTreeWidgetItem* elemItem = createItem( 0, Bold | All ); @@ -1743,6 +1744,7 @@ void SMESHGUI_TreeElemInfo::information( const QList& ids ) switch( e->GetEntityType() ) { case SMDSEntity_Triangle: case SMDSEntity_Quad_Triangle: + case SMDSEntity_BiQuad_Triangle: gtype = SMESHGUI_ElemInfo::tr( "TRIANGLE" ); break; case SMDSEntity_Quadrangle: case SMDSEntity_Quad_Quadrangle: @@ -1777,25 +1779,12 @@ void SMESHGUI_TreeElemInfo::information( const QList& ids ) typeItem->setText( 0, SMESHGUI_ElemInfo::tr( "TYPE" ) ); typeItem->setText( 1, gtype ); } - // quadratic flag and gravity center (any element except 0D) - if ( e->GetEntityType() > SMDSEntity_0D && e->GetEntityType() < SMDSEntity_Ball ) { + // quadratic flag (for edges, faces and volumes) + if ( e->GetType() >= SMDSAbs_Edge && e->GetType() <= SMDSAbs_Volume ) { // quadratic flag QTreeWidgetItem* quadItem = createItem( elemItem, Bold ); quadItem->setText( 0, SMESHGUI_ElemInfo::tr( "QUADRATIC" ) ); quadItem->setText( 1, e->IsQuadratic() ? SMESHGUI_ElemInfo::tr( "YES" ) : SMESHGUI_ElemInfo::tr( "NO" ) ); - // gravity center - XYZ gc = gravityCenter( e ); - QTreeWidgetItem* gcItem = createItem( elemItem, Bold ); - gcItem->setText( 0, SMESHGUI_ElemInfo::tr( "GRAVITY_CENTER" ) ); - QTreeWidgetItem* xItem = createItem( gcItem ); - xItem->setText( 0, "X" ); - xItem->setText( 1, QString::number( gc.x(), precision > 0 ? 'f' : 'g', qAbs( precision ) ) ); - QTreeWidgetItem* yItem = createItem( gcItem ); - yItem->setText( 0, "Y" ); - yItem->setText( 1, QString::number( gc.y(), precision > 0 ? 'f' : 'g', qAbs( precision ) ) ); - QTreeWidgetItem* zItem = createItem( gcItem ); - zItem->setText( 0, "Z" ); - zItem->setText( 1, QString::number( gc.z(), precision > 0 ? 'f' : 'g', qAbs( precision ) ) ); } if ( const SMDS_BallElement* ball = dynamic_cast( e )) { // ball diameter @@ -1931,7 +1920,7 @@ void SMESHGUI_TreeElemInfo::information( const QList& ids ) diamItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) ); } if( e->GetType() == SMDSAbs_Volume ) { - //AspectRatio3D + //AspectRatio3D afunctor.reset( new SMESH::Controls::AspectRatio3D() ); afunctor->SetMesh( actor()->GetObject()->GetMesh() ); QTreeWidgetItem* ratlItem3 = createItem( cntrItem, Bold ); @@ -1943,16 +1932,30 @@ void SMESHGUI_TreeElemInfo::information( const QList& ids ) QTreeWidgetItem* volItem = createItem( cntrItem, Bold ); volItem->setText( 0, tr( "VOLUME_3D_ELEMENTS" ) ); volItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) ); - //ElementDiameter3D + //ElementDiameter3D afunctor.reset( new SMESH::Controls::MaxElementLength3D() ); afunctor->SetMesh( actor()->GetObject()->GetMesh() ); QTreeWidgetItem* diam3Item = createItem( cntrItem, Bold ); diam3Item->setText( 0, tr( "MAX_ELEMENT_LENGTH_3D" ) ); diam3Item->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) ); } + + // gravity center + XYZ gc = gravityCenter( e ); + QTreeWidgetItem* gcItem = createItem( elemItem, Bold ); + gcItem->setText( 0, SMESHGUI_ElemInfo::tr( "GRAVITY_CENTER" ) ); + QTreeWidgetItem* xItem = createItem( gcItem ); + xItem->setText( 0, "X" ); + xItem->setText( 1, QString::number( gc.x(), precision > 0 ? 'f' : 'g', qAbs( precision ) ) ); + QTreeWidgetItem* yItem = createItem( gcItem ); + yItem->setText( 0, "Y" ); + yItem->setText( 1, QString::number( gc.y(), precision > 0 ? 'f' : 'g', qAbs( precision ) ) ); + QTreeWidgetItem* zItem = createItem( gcItem ); + zItem->setText( 0, "Z" ); + zItem->setText( 1, QString::number( gc.z(), precision > 0 ? 'f' : 'g', qAbs( precision ) ) ); // element position + SMESH::SMESH_Mesh_ptr aMesh = actor()->GetObject()->GetMeshServer(); if ( e->GetType() >= SMDSAbs_Edge && e->GetType() <= SMDSAbs_Volume ) { - SMESH::SMESH_Mesh_ptr aMesh = actor()->GetObject()->GetMeshServer(); if ( !CORBA::is_nil( aMesh ) ) { SMESH::ElementPosition pos = aMesh->GetElementPosition( id ); int shapeID = pos.shapeID; @@ -1973,7 +1976,6 @@ void SMESHGUI_TreeElemInfo::information( const QList& ids ) } } // groups element belongs to - SMESH::SMESH_Mesh_ptr aMesh = actor()->GetObject()->GetMeshServer(); if ( !CORBA::is_nil( aMesh ) ) { SMESH::ListOfGroups_var groups = aMesh->GetGroups(); QTreeWidgetItem* groupsItem = 0; diff --git a/src/SMESHGUI/SMESHGUI_MeshInfosBox.cxx b/src/SMESHGUI/SMESHGUI_MeshInfosBox.cxx index f6fee7bb2..30db6e8ce 100644 --- a/src/SMESHGUI/SMESHGUI_MeshInfosBox.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshInfosBox.cxx @@ -403,6 +403,7 @@ void SMESHGUI_MeshInfosBox::SetMeshInfo(const SMESH::long_array& theInfo) // faces myNbFace ->setText( QString("%1").arg( theInfo[SMDSEntity_Triangle] + theInfo[SMDSEntity_Quad_Triangle] + + theInfo[SMDSEntity_BiQuad_Triangle] + theInfo[SMDSEntity_Quadrangle] + theInfo[SMDSEntity_Quad_Quadrangle] + theInfo[SMDSEntity_BiQuad_Quadrangle] + @@ -441,9 +442,11 @@ void SMESHGUI_MeshInfosBox::SetMeshInfo(const SMESH::long_array& theInfo) { // triangles myNbTrai ->setText( QString("%1").arg( theInfo[SMDSEntity_Triangle] + - theInfo[SMDSEntity_Quad_Triangle] )); + theInfo[SMDSEntity_Quad_Triangle] + + theInfo[SMDSEntity_BiQuad_Triangle] )); myNbLinTrai ->setText( QString("%1").arg( theInfo[SMDSEntity_Triangle] )); - myNbQuadTrai ->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Triangle] )); + myNbQuadTrai ->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Triangle] + + theInfo[SMDSEntity_BiQuad_Triangle] )); // quadrangles myNbQuad ->setText( QString("%1").arg( theInfo[SMDSEntity_Quadrangle] + theInfo[SMDSEntity_Quad_Quadrangle] + diff --git a/src/SMESHGUI/SMESH_images.ts b/src/SMESHGUI/SMESH_images.ts index 42874a52e..17eafcde3 100644 --- a/src/SMESHGUI/SMESH_images.ts +++ b/src/SMESHGUI/SMESH_images.ts @@ -215,6 +215,10 @@ ICON_DLG_QUADRATIC_TRIANGLE mesh_quad_triangle.png + + ICON_DLG_BIQUADRATIC_TRIANGLE + mesh_biquad_triangle.png + ICON_DLG_REM_ELEMENT mesh_rem_element.png