From: ptv Date: Tue, 25 Aug 2009 05:18:16 +0000 (+0000) Subject: 0019296: EDF 681 SMESH - Pre-evaluation of the number of elements before mesh X-Git-Tag: V5_1_3rc1~107 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=40b2818f18601091d81e0d9d749a3fd6808c31ce;p=modules%2Fsmesh.git 0019296: EDF 681 SMESH - Pre-evaluation of the number of elements before mesh Replace hard coded values of element types by new enumeration (added in advanced mesh info Improvement) --- diff --git a/src/SMESH/SMESH_Algo.hxx b/src/SMESH/SMESH_Algo.hxx index 0cdaf639b..da108fbf6 100644 --- a/src/SMESH/SMESH_Algo.hxx +++ b/src/SMESH/SMESH_Algo.hxx @@ -55,11 +55,7 @@ class SMESH_subMesh; class SMESH_MesherHelper; typedef std::map< SMESH_subMesh*, std::vector > MapShapeNbElems; -// vector must have size 17: -// 0 - node, 1 - edge lin, 2 - edge quad, 3 - triangle lin, 4 - triangle quad -// 5 - quadrangle lin, 6 - quadrangle quad, 7 - polygon, 8 - tetra lin, -// 9 - tetra quad, 10 - pyramid lin, 11 - pyramid quad, 12 - penta lin, -// 13 - penta quad, 14 - hexa lin, 15 - hexa quad, 16 -polyhedra +// vector must have size corresponding to EntityType_Last from SMDSAbs: typedef std::map< SMESH_subMesh*, std::vector >::iterator MapShapeNbElemsItr; class SMESH_EXPORT SMESH_Algo:public SMESH_Hypothesis diff --git a/src/SMESH/SMESH_subMesh.cxx b/src/SMESH/SMESH_subMesh.cxx index efd05b9c1..ad59f98c9 100644 --- a/src/SMESH/SMESH_subMesh.cxx +++ b/src/SMESH/SMESH_subMesh.cxx @@ -35,6 +35,7 @@ #include "SMESH_subMeshEventListener.hxx" #include "SMESH_Comment.hxx" #include "SMDS_SetIterator.hxx" +#include "SMDSAbs_ElementType.hxx" #include "utilities.h" #include "OpUtil.hxx" @@ -1591,9 +1592,10 @@ bool SMESH_subMesh::Evaluate(MapShapeNbElems& aResMap) bool ret = true; if (_subShape.ShapeType() == TopAbs_VERTEX) { - std::vector aVec(17); - aVec[0] = 1; - for(int i=1; i<17; i++) aVec[i] = 0; + std::vector aVec(SMDSEntity_Last); + for(int i= SMDSEntity_Node; i < SMDSEntity_Last; i++) + aVec[i] = 0; + aVec[SMDSEntity_Node] = 1; aResMap.insert(std::make_pair(this,aVec)); return ret; } diff --git a/src/SMESHGUI/Makefile.am b/src/SMESHGUI/Makefile.am index 0c8b88869..94559f098 100644 --- a/src/SMESHGUI/Makefile.am +++ b/src/SMESHGUI/Makefile.am @@ -90,6 +90,7 @@ salomeinclude_HEADERS = \ SMESHGUI_MakeNodeAtPointDlg.h \ SMESHGUI_MeshEditPreview.h \ SMESHGUI_IdValidator.h \ + SMESHGUI_MeshInfosBox.h \ SMESH_SMESHGUI.hxx # Libraries targets @@ -157,7 +158,8 @@ dist_libSMESH_la_SOURCES = \ SMESHGUI_MakeNodeAtPointDlg.cxx \ SMESHGUI_MeshEditPreview.cxx \ SMESHGUI_GroupOnShapeDlg.cxx \ - SMESHGUI_FileInfoDlg.cxx + SMESHGUI_FileInfoDlg.cxx \ + SMESHGUI_MeshInfosBox.cxx MOC_FILES = \ SMESHGUI_moc.cxx \ @@ -209,7 +211,8 @@ MOC_FILES = \ SMESHGUI_ComputeDlg_moc.cxx \ SMESHGUI_MakeNodeAtPointDlg_moc.cxx \ SMESHGUI_GroupOnShapeDlg_moc.cxx \ - SMESHGUI_FileInfoDlg_moc.cxx + SMESHGUI_FileInfoDlg_moc.cxx \ + SMESHGUI_MeshInfosBox_moc.cxx nodist_libSMESH_la_SOURCES= \ $(MOC_FILES) diff --git a/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx b/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx index 142edf8d3..fc143d84d 100644 --- a/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx @@ -29,6 +29,7 @@ #include "SMESHGUI_GEOMGenUtils.h" #include "SMESHGUI_MeshUtils.h" #include "SMESHGUI_VTKUtils.h" +#include "SMESHGUI_MeshInfosBox.h" #include "SMESHGUI_HypothesesUtils.h" #include "SMESHGUI_MeshEditPreview.h" #include "SMESH_ActorUtils.h" @@ -452,337 +453,6 @@ namespace SMESH } // namespace SMESH -// ========================================================================================= -/*! - * \brief Box showing mesh info - */ -// ========================================================================================= - -SMESHGUI_MeshInfosBox::SMESHGUI_MeshInfosBox(const bool full, QWidget* theParent) - : QGroupBox( tr("SMESH_MESHINFO_TITLE"), theParent ), myFull( full ) -{ - QGridLayout* l = new QGridLayout(this); - l->setMargin( MARGIN ); - l->setSpacing( SPACING ); - - QFont italic = font(); italic.setItalic(true); - QFont bold = font(); bold.setBold(true); - - QLabel* lab; - int row = 0; - - // title - lab = new QLabel( this ); - lab->setMinimumWidth(100); lab->setFont( italic ); - l->addWidget( lab, row, 0 ); - // -- - lab = new QLabel(tr("SMESH_MESHINFO_ORDER0"), this ); - lab->setMinimumWidth(100); lab->setFont( italic ); - l->addWidget( lab, row, 1 ); - // -- - lab = new QLabel(tr("SMESH_MESHINFO_ORDER1"), this ); - lab->setMinimumWidth(100); lab->setFont( italic ); - l->addWidget( lab, row, 2 ); - // -- - lab = new QLabel(tr("SMESH_MESHINFO_ORDER2"), this ); - lab->setMinimumWidth(100); lab->setFont( italic ); - l->addWidget( lab, row, 3 ); - - if ( myFull ) - { - // nodes - row = l->rowCount(); // retrieve current row count - // -- - lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NODES")), this ); - lab->setFont( bold ); - l->addWidget( lab, row, 0 ); - // -- - myNbNode = new QLabel( this ); - l->addWidget( myNbNode, row, 1 ); - - addSeparator(this); // add separator - - // edges - row = l->rowCount(); // retrieve current row count - // -- - lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_EDGES")), this ); - lab->setFont( bold ); - l->addWidget( lab, row, 0 ); - // -- - myNbEdge = new QLabel( this ); - l->addWidget( myNbEdge, row, 1 ); - // -- - myNbLinEdge = new QLabel( this ); - l->addWidget( myNbLinEdge, row, 2 ); - // -- - myNbQuadEdge = new QLabel( this ); - l->addWidget( myNbQuadEdge, row, 3 ); - - addSeparator(this); // add separator - - // faces - row = l->rowCount(); // retrieve current row count - // -- - lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_FACES")), this); - lab->setFont( bold ); - l->addWidget( lab, row, 0 ); - // -- - myNbFace = new QLabel( this ); - l->addWidget( myNbFace, row, 1 ); - // -- - myNbLinFace = new QLabel( this ); - l->addWidget( myNbLinFace, row, 2 ); - // -- - myNbQuadFace = new QLabel( this ); - l->addWidget( myNbQuadFace, row, 3 ); - // -- - row++; // increment row count - // ... triangles - lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TRIANGLES")), this ); - l->addWidget( lab, row, 0 ); - // -- - myNbTrai = new QLabel( this ); - l->addWidget( myNbTrai, row, 1 ); - // -- - myNbLinTrai = new QLabel( this ); - l->addWidget( myNbLinTrai, row, 2 ); - // -- - myNbQuadTrai = new QLabel( this ); - l->addWidget( myNbQuadTrai, row, 3 ); - // -- - row++; // increment row count - // ... quadrangles - lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_QUADRANGLES")), this ); - l->addWidget( lab, row, 0 ); - // -- - myNbQuad = new QLabel( this ); - l->addWidget( myNbQuad, row, 1 ); - // -- - myNbLinQuad = new QLabel( this ); - l->addWidget( myNbLinQuad, row, 2 ); - // -- - myNbQuadQuad = new QLabel( this ); - l->addWidget( myNbQuadQuad, row, 3 ); - // -- - row++; // increment row count - // ... poligones - lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_POLYGONES")), this ); - l->addWidget( lab, row, 0 ); - myNbPolyg = new QLabel( this ); - l->addWidget( myNbPolyg, row, 1 ); - - addSeparator(this); // add separator - - // volumes - row = l->rowCount(); // retrieve current row count - // -- - lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_VOLUMES")), this); - lab->setFont( bold ); - l->addWidget( lab, row, 0 ); - // -- - myNbVolum = new QLabel( this ); - l->addWidget( myNbVolum, row, 1 ); - // -- - myNbLinVolum = new QLabel( this ); - l->addWidget( myNbLinVolum, row, 2 ); - // -- - myNbQuadVolum = new QLabel( this ); - l->addWidget( myNbQuadVolum, row, 3 ); - // -- - row++; // increment row count - // ... tetras - lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TETRAS")), this ); - l->addWidget( lab, row, 0 ); - // -- - myNbTetra = new QLabel( this ); - l->addWidget( myNbTetra, row, 1 ); - // -- - myNbLinTetra = new QLabel( this ); - l->addWidget( myNbLinTetra, row, 2 ); - // -- - myNbQuadTetra = new QLabel( this ); - l->addWidget( myNbQuadTetra, row, 3 ); - // -- - row++; // increment row count - // ... hexas - lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_HEXAS")), this ); - l->addWidget( lab, row, 0 ); - // -- - myNbHexa = new QLabel( this ); - l->addWidget( myNbHexa, row, 1 ); - // -- - myNbLinHexa = new QLabel( this ); - l->addWidget( myNbLinHexa, row, 2 ); - // -- - myNbQuadHexa = new QLabel( this ); - l->addWidget( myNbQuadHexa, row, 3 ); - // -- - row++; // increment row count - // ... pyras - lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_PYRAS")), this ); - l->addWidget( lab, row, 0 ); - // -- - myNbPyra = new QLabel( this ); - l->addWidget( myNbPyra, row, 1 ); - // -- - myNbLinPyra = new QLabel( this ); - l->addWidget( myNbLinPyra, row, 2 ); - // -- - myNbQuadPyra = new QLabel( this ); - l->addWidget( myNbQuadPyra, row, 3 ); - // -- - row++; // increment row count - // ... prisms - lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_PRISMS")), this ); - l->addWidget( lab, row, 0 ); - // -- - myNbPrism = new QLabel( this ); - l->addWidget( myNbPrism, row, 1 ); - // -- - myNbLinPrism = new QLabel( this ); - l->addWidget( myNbLinPrism, row, 2 ); - // -- - myNbQuadPrism = new QLabel( this ); - l->addWidget( myNbQuadPrism, row, 3 ); - // -- - row++; // increment row count - // ... polyedres - lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_POLYEDRES")), this ); - l->addWidget( lab, row, 0 ); - // -- - myNbPolyh = new QLabel( this ); - l->addWidget( myNbPolyh, row, 1 ); - } - else - { - // nodes - row = l->rowCount(); // retrieve current row count - // -- - lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NODES")), this ); - l->addWidget( lab, row, 0 ); - // -- - myNbNode = new QLabel( this ); - l->addWidget( myNbNode, row, 1 ); - - // edges - row = l->rowCount(); // retrieve current row count - // -- - lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_EDGES")), this ); - l->addWidget( lab, row, 0 ); - // -- - myNbEdge = new QLabel( this ); - l->addWidget( myNbEdge, row, 1 ); - // -- - myNbLinEdge = new QLabel( this ); - l->addWidget( myNbLinEdge, row, 2 ); - // -- - myNbQuadEdge = new QLabel( this ); - l->addWidget( myNbQuadEdge, row, 3 ); - - // faces - row = l->rowCount(); // retrieve current row count - // -- - lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_FACES")), this); - l->addWidget( lab, row, 0 ); - // -- - myNbFace = new QLabel( this ); - l->addWidget( myNbFace, row, 1 ); - // -- - myNbLinFace = new QLabel( this ); - l->addWidget( myNbLinFace, row, 2 ); - // -- - myNbQuadFace = new QLabel( this ); - l->addWidget( myNbQuadFace, row, 3 ); - - // volumes - row = l->rowCount(); // retrieve current row count - // -- - lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_VOLUMES")), this); - l->addWidget( lab, row, 0 ); - // -- - myNbVolum = new QLabel( this ); - l->addWidget( myNbVolum, row, 1 ); - // -- - myNbLinVolum = new QLabel( this ); - l->addWidget( myNbLinVolum, row, 2 ); - // -- - myNbQuadVolum = new QLabel( this ); - l->addWidget( myNbQuadVolum, row, 3 ); - } -} - -// ========================================================================================= -/*! - * \brief Set mesh info - */ -// ========================================================================================= - -void SMESHGUI_MeshInfosBox::SetInfoByMesh(SMESH::SMESH_Mesh_var mesh) -{ - const SMESH::ElementOrder lin = SMESH::ORDER_LINEAR; - int nbTot, nbLin; - - // nodes - myNbNode ->setText( QString("%1").arg( mesh->NbNodes() )); - - // edges - nbTot = mesh->NbEdges(), nbLin = mesh->NbEdgesOfOrder(lin); - myNbEdge ->setText( QString("%1").arg( nbTot )); - myNbLinEdge ->setText( QString("%1").arg( nbLin )); - myNbQuadEdge ->setText( QString("%1").arg( nbTot - nbLin )); - - // faces - nbTot = mesh->NbFaces(), nbLin = mesh->NbFacesOfOrder(lin); - myNbFace ->setText( QString("%1").arg( nbTot )); - myNbLinFace ->setText( QString("%1").arg( nbLin )); - myNbQuadFace ->setText( QString("%1").arg( nbTot - nbLin )); - - // volumes - nbTot = mesh->NbVolumes(), nbLin = mesh->NbVolumesOfOrder(lin); - myNbVolum ->setText( QString("%1").arg( nbTot )); - myNbLinVolum ->setText( QString("%1").arg( nbLin )); - myNbQuadVolum->setText( QString("%1").arg( nbTot - nbLin )); - - if ( myFull ) - { - // triangles - nbTot = mesh->NbTriangles(), nbLin = mesh->NbTrianglesOfOrder(lin); - myNbTrai ->setText( QString("%1").arg( nbTot )); - myNbLinTrai ->setText( QString("%1").arg( nbLin )); - myNbQuadTrai ->setText( QString("%1").arg( nbTot - nbLin )); - // quadrangles - nbTot = mesh->NbQuadrangles(), nbLin = mesh->NbQuadranglesOfOrder(lin); - myNbQuad ->setText( QString("%1").arg( nbTot )); - myNbLinQuad ->setText( QString("%1").arg( nbLin )); - myNbQuadQuad ->setText( QString("%1").arg( nbTot - nbLin )); - // poligones - myNbPolyg ->setText( QString("%1").arg( mesh->NbPolygons() )); - - // tetras - nbTot = mesh->NbTetras(), nbLin = mesh->NbTetrasOfOrder(lin); - myNbTetra ->setText( QString("%1").arg( nbTot )); - myNbLinTetra ->setText( QString("%1").arg( nbLin )); - myNbQuadTetra->setText( QString("%1").arg( nbTot - nbLin )); - // hexas - nbTot = mesh->NbHexas(), nbLin = mesh->NbHexasOfOrder(lin); - myNbHexa ->setText( QString("%1").arg( nbTot )); - myNbLinHexa ->setText( QString("%1").arg( nbLin )); - myNbQuadHexa ->setText( QString("%1").arg( nbTot - nbLin )); - // pyras - nbTot = mesh->NbPyramids(), nbLin = mesh->NbPyramidsOfOrder(lin); - myNbPyra ->setText( QString("%1").arg( nbTot )); - myNbLinPyra ->setText( QString("%1").arg( nbLin )); - myNbQuadPyra ->setText( QString("%1").arg( nbTot - nbLin )); - // prisms - nbTot = mesh->NbPrisms(), nbLin = mesh->NbPrismsOfOrder(lin); - myNbPrism ->setText( QString("%1").arg( nbTot )); - myNbLinPrism ->setText( QString("%1").arg( nbLin )); - myNbQuadPrism->setText( QString("%1").arg( nbTot - nbLin )); - // polyedres - myNbPolyh ->setText( QString("%1").arg( mesh->NbPolyhedrons() )); - } -} - // ========================================================================================= /*! * \brief Dialog to compute a mesh and show computation errors @@ -1134,7 +804,8 @@ void SMESHGUI_BaseComputeOp::showComputeResult( const bool theMemoryLack, } else if ( theNoCompError && theNoHypoError ) { - aCompDlg->myFullInfo->SetInfoByMesh( myMesh ); + SMESH::long_array_var aRes = myMesh->GetMeshInfo(); + aCompDlg->myFullInfo->SetMeshInfo( aRes ); aCompDlg->myFullInfo->show(); aCompDlg->myBriefInfo->hide(); aCompDlg->myHypErrorGroup->hide(); @@ -1143,7 +814,8 @@ void SMESHGUI_BaseComputeOp::showComputeResult( const bool theMemoryLack, else { QTableWidget* tbl = aCompDlg->myTable; - aCompDlg->myBriefInfo->SetInfoByMesh( myMesh ); + SMESH::long_array_var aRes = myMesh->GetMeshInfo(); + aCompDlg->myFullInfo->SetMeshInfo( aRes ); aCompDlg->myBriefInfo->show(); aCompDlg->myFullInfo->hide(); @@ -2004,7 +1676,7 @@ void SMESHGUI_BaseComputeOp::evaluateMesh() QString aHypErrors; bool evaluateFailed = true, memoryLack = false; - std::vector aResVec(18); + SMESH::long_array_var aRes; _PTR(SObject) aMeshSObj = SMESH::FindSObject(myMesh); bool hasShape = myMesh->HasShapeToMesh(); @@ -2022,10 +1694,7 @@ void SMESHGUI_BaseComputeOp::evaluateMesh() #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 OCC_CATCH_SIGNALS; #endif - SMESH::long_array_var aVec = gen->Evaluate(myMesh, myMainShape); - for(int i=0; i<17; i++) { - aResVec[i] = aVec[i]; - } + aRes = gen->Evaluate(myMesh, myMainShape); } catch(const SALOME::SALOME_Exception & S_ex){ memoryLack = true; @@ -2078,13 +1747,12 @@ void SMESHGUI_BaseComputeOp::evaluateMesh() // SHOW RESULTS if ( isShowResultDlg ) - //showComputeResult( memoryLack, noCompError,aCompErrors, noHypoError, aHypErrors ); - showEvaluateResult( aResVec, memoryLack, noCompError, aCompErrors, + showEvaluateResult( aRes, memoryLack, noCompError, aCompErrors, noHypoError, aHypErrors); } -void SMESHGUI_BaseComputeOp::showEvaluateResult(std::vector theVec, +void SMESHGUI_BaseComputeOp::showEvaluateResult(const SMESH::long_array& theRes, const bool theMemoryLack, const bool theNoCompError, SMESH::compute_error_array_var& theCompErrors, @@ -2105,8 +1773,7 @@ void SMESHGUI_BaseComputeOp::showEvaluateResult(std::vector theVec, } else if ( theNoCompError && theNoHypoError ) { - //aCompDlg->myFullInfo->SetInfoByMesh( myMesh ); - aCompDlg->myFullInfo->SetInfoByEval( theVec ); + aCompDlg->myFullInfo->SetMeshInfo( theRes ); aCompDlg->myFullInfo->show(); aCompDlg->myBriefInfo->hide(); aCompDlg->myHypErrorGroup->hide(); @@ -2115,8 +1782,7 @@ void SMESHGUI_BaseComputeOp::showEvaluateResult(std::vector theVec, else { QTableWidget* tbl = aCompDlg->myTable; - //aCompDlg->myBriefInfo->SetInfoByMesh( myMesh ); - aCompDlg->myBriefInfo->SetInfoByEval( theVec ); + aCompDlg->myBriefInfo->SetMeshInfo( theRes ); aCompDlg->myBriefInfo->show(); aCompDlg->myFullInfo->hide(); @@ -2194,77 +1860,6 @@ void SMESHGUI_BaseComputeOp::showEvaluateResult(std::vector theVec, } -// ========================================================================================= -/*! - * \brief Set mesh info - */ -// ========================================================================================= - -void SMESHGUI_MeshInfosBox::SetInfoByEval(std::vector theVec) -{ - // nodes - myNbNode ->setText( QString("%1").arg( theVec[0] )); - - // edges - int nbTot = theVec[1] + theVec[2]; - myNbEdge ->setText( QString("%1").arg( nbTot )); - myNbLinEdge ->setText( QString("%1").arg( theVec[1] )); - myNbQuadEdge ->setText( QString("%1").arg( theVec[2] )); - - // faces - nbTot = 0; - int i = 3; - for(; i<=7; i++) nbTot += theVec[i]; - myNbFace ->setText( QString("%1").arg( nbTot )); - myNbLinFace ->setText( QString("%1").arg( theVec[3] + theVec[5] )); - myNbQuadFace ->setText( QString("%1").arg( theVec[4] + theVec[6] )); - - // volumes - nbTot = 0; - for(i=8; i<=16; i++) nbTot += theVec[i]; - int nbLin = 0, nbQua = 0;; - for(i=0; i<=3; i++) { - nbLin += theVec[8+2*i]; - nbQua += theVec[9+2*i]; - } - myNbVolum ->setText( QString("%1").arg( nbTot )); - myNbLinVolum ->setText( QString("%1").arg( nbLin )); - myNbQuadVolum->setText( QString("%1").arg( nbQua )); - - if ( myFull ) - { - // triangles - myNbTrai ->setText( QString("%1").arg( theVec[3] + theVec[4] )); - myNbLinTrai ->setText( QString("%1").arg( theVec[3] )); - myNbQuadTrai ->setText( QString("%1").arg( theVec[4] )); - // quadrangles - myNbQuad ->setText( QString("%1").arg( theVec[5] + theVec[6] )); - myNbLinQuad ->setText( QString("%1").arg( theVec[5] )); - myNbQuadQuad ->setText( QString("%1").arg( theVec[6] )); - // poligones - myNbPolyg ->setText( QString("%1").arg( theVec[7] )); - - // tetras - myNbTetra ->setText( QString("%1").arg( theVec[8] + theVec[9] )); - myNbLinTetra ->setText( QString("%1").arg( theVec[8] )); - myNbQuadTetra->setText( QString("%1").arg( theVec[9] )); - // hexas - myNbHexa ->setText( QString("%1").arg( theVec[14] + theVec[15] )); - myNbLinHexa ->setText( QString("%1").arg( theVec[14] )); - myNbQuadHexa ->setText( QString("%1").arg( theVec[15] )); - // pyras - myNbPyra ->setText( QString("%1").arg( theVec[10] + theVec[11] )); - myNbLinPyra ->setText( QString("%1").arg( theVec[10] )); - myNbQuadPyra ->setText( QString("%1").arg( theVec[11] )); - // prisms - myNbPrism ->setText( QString("%1").arg( theVec[12] + theVec[13] )); - myNbLinPrism ->setText( QString("%1").arg( theVec[12] )); - myNbQuadPrism->setText( QString("%1").arg( theVec[13] )); - // polyedres - myNbPolyh ->setText( QString("%1").arg( theVec[16] )); - } -} - //================================================================================ /*! * \brief Gets dialog of evaluate operation diff --git a/src/SMESHGUI/SMESHGUI_ComputeDlg.h b/src/SMESHGUI/SMESHGUI_ComputeDlg.h index d88731203..85102f3b1 100644 --- a/src/SMESHGUI/SMESHGUI_ComputeDlg.h +++ b/src/SMESHGUI/SMESHGUI_ComputeDlg.h @@ -50,8 +50,8 @@ class QTableWidget; class QLabel; class QtxComboBox; class SMESHGUI_ComputeDlg; +class SMESHGUI_MeshInfosBox; class SMESHGUI_PrecomputeDlg; -//class SMESHGUI_EvaluateDlg; class SMESHGUI_MeshEditPreview; class SMESH::compute_error_array; @@ -83,10 +83,9 @@ protected: SMESH::compute_error_array_var&, const bool, const QString& ); - //SMESHGUI_EvaluateDlg* evaluateDlg() const; SMESHGUI_ComputeDlg* evaluateDlg() const; void evaluateMesh(); - void showEvaluateResult(std::vector theVec, + void showEvaluateResult(const SMESH::long_array& theRes, const bool, const bool, SMESH::compute_error_array_var&, @@ -105,7 +104,6 @@ private: private: QPointer myCompDlg; - //QPointer myEvalDlg; protected: SMESH::SMESH_Mesh_var myMesh; @@ -193,55 +191,6 @@ protected: protected slots: }; -/*! - * \brief Box showing mesh info - */ - -class SMESHGUI_EXPORT SMESHGUI_MeshInfosBox : public QGroupBox -{ - Q_OBJECT - -public: - SMESHGUI_MeshInfosBox( const bool, QWidget* ); - - void SetInfoByMesh( SMESH::SMESH_Mesh_var ); - - void SetInfoByEval( std::vector theVec ); - -private: - bool myFull; - QLabel* myNbNode; - QLabel* myNbEdge; - QLabel* myNbLinEdge; - QLabel* myNbQuadEdge; - QLabel* myNbTrai; - QLabel* myNbLinTrai; - QLabel* myNbQuadTrai; - QLabel* myNbQuad; - QLabel* myNbLinQuad; - QLabel* myNbQuadQuad; - QLabel* myNbFace; - QLabel* myNbLinFace; - QLabel* myNbQuadFace; - QLabel* myNbPolyg; - QLabel* myNbHexa; - QLabel* myNbLinHexa; - QLabel* myNbQuadHexa; - QLabel* myNbTetra; - QLabel* myNbLinTetra; - QLabel* myNbQuadTetra; - QLabel* myNbPyra; - QLabel* myNbLinPyra; - QLabel* myNbQuadPyra; - QLabel* myNbPrism; - QLabel* myNbLinPrism; - QLabel* myNbQuadPrism; - QLabel* myNbVolum; - QLabel* myNbLinVolum; - QLabel* myNbQuadVolum; - QLabel* myNbPolyh; -}; - /*! * \brief Dialog to compute a mesh and show computation errors */ @@ -297,37 +246,4 @@ private: QtxComboBox* myPreviewMode; }; - -/*! - * \brief Dialog to evaluate a mesh and show result - */ -/* -class SMESHGUI_EXPORT SMESHGUI_EvaluateDlg : public SMESHGUI_Dialog -{ - Q_OBJECT - -public: - SMESHGUI_EvaluateDlg( QWidget* ); - virtual ~SMESHGUI_EvaluateDlg(); - -protected: - QFrame* createMainFrame( QWidget* ); - - QLabel* myMeshName; - QGroupBox* myMemoryLackGroup; - QGroupBox* myCompErrorGroup; - QGroupBox* myHypErrorGroup; - QLabel* myHypErrorLabel; - QTableWidget* myTable; - QPushButton* myShowBtn; - QPushButton* myPublishBtn; - QPushButton* myBadMeshBtn; - - SMESHGUI_MeshInfosBox* myBriefInfo; - SMESHGUI_MeshInfosBox* myFullInfo; - - friend class SMESHGUI_BaseComputeOp; -}; -*/ - #endif // SMESHGUI_COMPUTEDLG_H diff --git a/src/SMESHGUI/SMESHGUI_MeshInfosBox.cxx b/src/SMESHGUI/SMESHGUI_MeshInfosBox.cxx new file mode 100644 index 000000000..ffa85053d --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_MeshInfosBox.cxx @@ -0,0 +1,417 @@ +// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_MeshInfosBox.cxx +// Author : Edward AGAPOV, Open CASCADE S.A.S. +// SMESH includes +// +#include "SMESHGUI_MeshInfosBox.h" + +#include "SMDSAbs_ElementType.hxx" + +// Qt includes +#include +#include +#include + +#define SPACING 6 +#define MARGIN 11 + +#define COLONIZE(str) (QString(str).contains(":") > 0 ? QString(str) : QString(str) + " :" ) + +static void addSeparator( QWidget* parent ) +{ + QGridLayout* l = qobject_cast( parent->layout() ); + int row = l->rowCount(); + int cols = l->columnCount(); + for ( int i = 0; i < cols; i++ ) { + QFrame* hline = new QFrame( parent ); + hline->setFrameStyle( QFrame::HLine | QFrame::Sunken ); + l->addWidget( hline, row, i ); + } +} + +enum TCol { + COL_ALGO = 0, COL_SHAPE, COL_ERROR, COL_SHAPEID, COL_PUBLISHED, COL_BAD_MESH, NB_COLUMNS +}; + +// ========================================================================================= +/*! + * \brief Box showing mesh info + */ +// ========================================================================================= + +SMESHGUI_MeshInfosBox::SMESHGUI_MeshInfosBox(const bool full, QWidget* theParent) + : QGroupBox( tr("SMESH_MESHINFO_TITLE"), theParent ), myFull( full ) +{ + QGridLayout* l = new QGridLayout(this); + l->setMargin( MARGIN ); + l->setSpacing( SPACING ); + + QFont italic = font(); italic.setItalic(true); + QFont bold = font(); bold.setBold(true); + + QLabel* lab; + int row = 0; + + // title + lab = new QLabel( this ); + lab->setMinimumWidth(100); lab->setFont( italic ); + l->addWidget( lab, row, 0 ); + // -- + lab = new QLabel(tr("SMESH_MESHINFO_ORDER0"), this ); + lab->setMinimumWidth(100); lab->setFont( italic ); + l->addWidget( lab, row, 1 ); + // -- + lab = new QLabel(tr("SMESH_MESHINFO_ORDER1"), this ); + lab->setMinimumWidth(100); lab->setFont( italic ); + l->addWidget( lab, row, 2 ); + // -- + lab = new QLabel(tr("SMESH_MESHINFO_ORDER2"), this ); + lab->setMinimumWidth(100); lab->setFont( italic ); + l->addWidget( lab, row, 3 ); + + if ( myFull ) + { + // nodes + row = l->rowCount(); // retrieve current row count + // -- + lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NODES")), this ); + lab->setFont( bold ); + l->addWidget( lab, row, 0 ); + // -- + myNbNode = new QLabel( this ); + l->addWidget( myNbNode, row, 1 ); + + addSeparator(this); // add separator + + // 0D elements + row = l->rowCount(); // retrieve current row count + // -- + lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_0DELEMS")), this ); + lab->setFont( bold ); + l->addWidget( lab, row, 0 ); + // -- + my0DElem = new QLabel( this ); + l->addWidget( my0DElem, row, 1 ); + + addSeparator(this); // add separator + + // edges + row = l->rowCount(); // retrieve current row count + // -- + lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_EDGES")), this ); + lab->setFont( bold ); + l->addWidget( lab, row, 0 ); + // -- + myNbEdge = new QLabel( this ); + l->addWidget( myNbEdge, row, 1 ); + // -- + myNbLinEdge = new QLabel( this ); + l->addWidget( myNbLinEdge, row, 2 ); + // -- + myNbQuadEdge = new QLabel( this ); + l->addWidget( myNbQuadEdge, row, 3 ); + + addSeparator(this); // add separator + + // faces + row = l->rowCount(); // retrieve current row count + // -- + lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_FACES")), this); + lab->setFont( bold ); + l->addWidget( lab, row, 0 ); + // -- + myNbFace = new QLabel( this ); + l->addWidget( myNbFace, row, 1 ); + // -- + myNbLinFace = new QLabel( this ); + l->addWidget( myNbLinFace, row, 2 ); + // -- + myNbQuadFace = new QLabel( this ); + l->addWidget( myNbQuadFace, row, 3 ); + // -- + row++; // increment row count + // ... triangles + lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TRIANGLES")), this ); + l->addWidget( lab, row, 0 ); + // -- + myNbTrai = new QLabel( this ); + l->addWidget( myNbTrai, row, 1 ); + // -- + myNbLinTrai = new QLabel( this ); + l->addWidget( myNbLinTrai, row, 2 ); + // -- + myNbQuadTrai = new QLabel( this ); + l->addWidget( myNbQuadTrai, row, 3 ); + // -- + row++; // increment row count + // ... quadrangles + lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_QUADRANGLES")), this ); + l->addWidget( lab, row, 0 ); + // -- + myNbQuad = new QLabel( this ); + l->addWidget( myNbQuad, row, 1 ); + // -- + myNbLinQuad = new QLabel( this ); + l->addWidget( myNbLinQuad, row, 2 ); + // -- + myNbQuadQuad = new QLabel( this ); + l->addWidget( myNbQuadQuad, row, 3 ); + // -- + row++; // increment row count + // ... poligones + lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_POLYGONES")), this ); + l->addWidget( lab, row, 0 ); + myNbPolyg = new QLabel( this ); + l->addWidget( myNbPolyg, row, 1 ); + + addSeparator(this); // add separator + + // volumes + row = l->rowCount(); // retrieve current row count + // -- + lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_VOLUMES")), this); + lab->setFont( bold ); + l->addWidget( lab, row, 0 ); + // -- + myNbVolum = new QLabel( this ); + l->addWidget( myNbVolum, row, 1 ); + // -- + myNbLinVolum = new QLabel( this ); + l->addWidget( myNbLinVolum, row, 2 ); + // -- + myNbQuadVolum = new QLabel( this ); + l->addWidget( myNbQuadVolum, row, 3 ); + // -- + row++; // increment row count + // ... tetras + lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TETRAS")), this ); + l->addWidget( lab, row, 0 ); + // -- + myNbTetra = new QLabel( this ); + l->addWidget( myNbTetra, row, 1 ); + // -- + myNbLinTetra = new QLabel( this ); + l->addWidget( myNbLinTetra, row, 2 ); + // -- + myNbQuadTetra = new QLabel( this ); + l->addWidget( myNbQuadTetra, row, 3 ); + // -- + row++; // increment row count + // ... hexas + lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_HEXAS")), this ); + l->addWidget( lab, row, 0 ); + // -- + myNbHexa = new QLabel( this ); + l->addWidget( myNbHexa, row, 1 ); + // -- + myNbLinHexa = new QLabel( this ); + l->addWidget( myNbLinHexa, row, 2 ); + // -- + myNbQuadHexa = new QLabel( this ); + l->addWidget( myNbQuadHexa, row, 3 ); + // -- + row++; // increment row count + // ... pyras + lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_PYRAS")), this ); + l->addWidget( lab, row, 0 ); + // -- + myNbPyra = new QLabel( this ); + l->addWidget( myNbPyra, row, 1 ); + // -- + myNbLinPyra = new QLabel( this ); + l->addWidget( myNbLinPyra, row, 2 ); + // -- + myNbQuadPyra = new QLabel( this ); + l->addWidget( myNbQuadPyra, row, 3 ); + // -- + row++; // increment row count + // ... prisms + lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_PRISMS")), this ); + l->addWidget( lab, row, 0 ); + // -- + myNbPrism = new QLabel( this ); + l->addWidget( myNbPrism, row, 1 ); + // -- + myNbLinPrism = new QLabel( this ); + l->addWidget( myNbLinPrism, row, 2 ); + // -- + myNbQuadPrism = new QLabel( this ); + l->addWidget( myNbQuadPrism, row, 3 ); + // -- + row++; // increment row count + // ... polyedres + lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_POLYEDRES")), this ); + l->addWidget( lab, row, 0 ); + // -- + myNbPolyh = new QLabel( this ); + l->addWidget( myNbPolyh, row, 1 ); + } + else + { + // nodes + row = l->rowCount(); // retrieve current row count + // -- + lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NODES")), this ); + l->addWidget( lab, row, 0 ); + // -- + myNbNode = new QLabel( this ); + l->addWidget( myNbNode, row, 1 ); + + // edges + row = l->rowCount(); // retrieve current row count + // -- + lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_EDGES")), this ); + l->addWidget( lab, row, 0 ); + // -- + myNbEdge = new QLabel( this ); + l->addWidget( myNbEdge, row, 1 ); + // -- + myNbLinEdge = new QLabel( this ); + l->addWidget( myNbLinEdge, row, 2 ); + // -- + myNbQuadEdge = new QLabel( this ); + l->addWidget( myNbQuadEdge, row, 3 ); + + // faces + row = l->rowCount(); // retrieve current row count + // -- + lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_FACES")), this); + l->addWidget( lab, row, 0 ); + // -- + myNbFace = new QLabel( this ); + l->addWidget( myNbFace, row, 1 ); + // -- + myNbLinFace = new QLabel( this ); + l->addWidget( myNbLinFace, row, 2 ); + // -- + myNbQuadFace = new QLabel( this ); + l->addWidget( myNbQuadFace, row, 3 ); + + // volumes + row = l->rowCount(); // retrieve current row count + // -- + lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_VOLUMES")), this); + l->addWidget( lab, row, 0 ); + // -- + myNbVolum = new QLabel( this ); + l->addWidget( myNbVolum, row, 1 ); + // -- + myNbLinVolum = new QLabel( this ); + l->addWidget( myNbLinVolum, row, 2 ); + // -- + myNbQuadVolum = new QLabel( this ); + l->addWidget( myNbQuadVolum, row, 3 ); + } +} + +// ========================================================================================= +/*! + * \brief Set mesh info + */ +// ========================================================================================= + +void SMESHGUI_MeshInfosBox::SetMeshInfo(const SMESH::long_array& theInfo) +{ + // nodes + myNbNode ->setText( QString("%1").arg( theInfo[SMDSEntity_Node] )); + + //0D elements + my0DElem ->setText( QString("%1").arg( theInfo[SMDSEntity_0D] )); + + // edges + myNbEdge ->setText( QString("%1").arg( theInfo[SMDSEntity_Edge] + + theInfo[SMDSEntity_Quad_Edge] )); + myNbLinEdge ->setText( QString("%1").arg( theInfo[SMDSEntity_Edge] )); + myNbQuadEdge ->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Edge] )); + + // faces + myNbFace ->setText( QString("%1").arg( theInfo[SMDSEntity_Triangle] + + theInfo[SMDSEntity_Quad_Triangle] + + theInfo[SMDSEntity_Quadrangle] + + theInfo[SMDSEntity_Quad_Quadrangle] + + theInfo[SMDSEntity_Polygon] )); + myNbLinFace ->setText( QString("%1").arg( theInfo[SMDSEntity_Triangle] + + theInfo[SMDSEntity_Quadrangle] + + theInfo[SMDSEntity_Polygon] )); + myNbQuadFace ->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Triangle] + + theInfo[SMDSEntity_Quad_Quadrangle] )); + + // volumes + myNbVolum ->setText( QString("%1").arg( theInfo[SMDSEntity_Tetra] + + theInfo[SMDSEntity_Quad_Tetra] + + theInfo[SMDSEntity_Pyramid] + + theInfo[SMDSEntity_Quad_Pyramid] + + theInfo[SMDSEntity_Hexa] + + theInfo[SMDSEntity_Quad_Hexa] + + theInfo[SMDSEntity_Penta] + + theInfo[SMDSEntity_Quad_Penta] + + theInfo[SMDSEntity_Polyhedra] )); + myNbLinVolum ->setText( QString("%1").arg( theInfo[SMDSEntity_Tetra] + + theInfo[SMDSEntity_Pyramid] + + theInfo[SMDSEntity_Hexa] + + theInfo[SMDSEntity_Penta] + + theInfo[SMDSEntity_Polyhedra] )); + myNbQuadVolum->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Tetra] + + theInfo[SMDSEntity_Quad_Pyramid] + + theInfo[SMDSEntity_Quad_Hexa] + + theInfo[SMDSEntity_Quad_Penta] )); + + if ( myFull ) + { + // triangles + myNbTrai ->setText( QString("%1").arg( theInfo[SMDSEntity_Triangle] + + theInfo[SMDSEntity_Quad_Triangle] )); + myNbLinTrai ->setText( QString("%1").arg( theInfo[SMDSEntity_Triangle] )); + myNbQuadTrai ->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Triangle] )); + // quadrangles + myNbQuad ->setText( QString("%1").arg( theInfo[SMDSEntity_Quadrangle] + + theInfo[SMDSEntity_Quad_Quadrangle] )); + myNbLinQuad ->setText( QString("%1").arg( theInfo[SMDSEntity_Quadrangle] )); + myNbQuadQuad ->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Quadrangle] )); + // poligones + myNbPolyg ->setText( QString("%1").arg( theInfo[SMDSEntity_Polygon] )); + + // tetras + myNbTetra ->setText( QString("%1").arg( theInfo[SMDSEntity_Tetra] + + theInfo[SMDSEntity_Quad_Tetra] )); + myNbLinTetra ->setText( QString("%1").arg( theInfo[SMDSEntity_Tetra] )); + myNbQuadTetra->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Tetra] )); + // hexas + myNbHexa ->setText( QString("%1").arg( theInfo[SMDSEntity_Hexa] + + theInfo[SMDSEntity_Quad_Hexa] )); + myNbLinHexa ->setText( QString("%1").arg( theInfo[SMDSEntity_Hexa] )); + myNbQuadHexa ->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Hexa] )); + // pyras + myNbPyra ->setText( QString("%1").arg( theInfo[SMDSEntity_Pyramid] + + theInfo[SMDSEntity_Quad_Pyramid] )); + myNbLinPyra ->setText( QString("%1").arg( theInfo[SMDSEntity_Pyramid] )); + myNbQuadPyra ->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Pyramid] )); + // prisms + myNbPrism ->setText( QString("%1").arg( theInfo[SMDSEntity_Penta] + + theInfo[SMDSEntity_Quad_Penta] )); + myNbLinPrism ->setText( QString("%1").arg( theInfo[SMDSEntity_Penta] )); + myNbQuadPrism->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Penta] )); + // polyedres + myNbPolyh ->setText( QString("%1").arg( theInfo[SMDSEntity_Polyhedra] )); + } +} diff --git a/src/SMESHGUI/SMESHGUI_MeshInfosBox.h b/src/SMESHGUI/SMESHGUI_MeshInfosBox.h new file mode 100644 index 000000000..394bd7893 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_MeshInfosBox.h @@ -0,0 +1,88 @@ +// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_MeshInfosBox.h +// Author : Edward AGAPOV, Open CASCADE S.A.S. +// +#ifndef SMESHGUI_MeshInfosBox_H +#define SMESHGUI_MeshInfosBox_H + +// SMESH includes +#include "SMESH_SMESHGUI.hxx" + +// Qt includes +#include + +// IDL includes +#include +#include CORBA_SERVER_HEADER(SMESH_Mesh) + +class QLabel; + +/*! + * \brief Box showing mesh info + */ + +class SMESHGUI_EXPORT SMESHGUI_MeshInfosBox : public QGroupBox +{ + Q_OBJECT + +public: + SMESHGUI_MeshInfosBox( const bool, QWidget* ); + + void SetMeshInfo( const SMESH::long_array& theInfo ); + +private: + bool myFull; + QLabel* myNbNode; + QLabel* my0DElem; + QLabel* myNbEdge; + QLabel* myNbLinEdge; + QLabel* myNbQuadEdge; + QLabel* myNbTrai; + QLabel* myNbLinTrai; + QLabel* myNbQuadTrai; + QLabel* myNbQuad; + QLabel* myNbLinQuad; + QLabel* myNbQuadQuad; + QLabel* myNbFace; + QLabel* myNbLinFace; + QLabel* myNbQuadFace; + QLabel* myNbPolyg; + QLabel* myNbHexa; + QLabel* myNbLinHexa; + QLabel* myNbQuadHexa; + QLabel* myNbTetra; + QLabel* myNbLinTetra; + QLabel* myNbQuadTetra; + QLabel* myNbPyra; + QLabel* myNbLinPyra; + QLabel* myNbQuadPyra; + QLabel* myNbPrism; + QLabel* myNbLinPrism; + QLabel* myNbQuadPrism; + QLabel* myNbVolum; + QLabel* myNbLinVolum; + QLabel* myNbQuadVolum; + QLabel* myNbPolyh; +}; + +#endif // SMESHGUI_MeshInfosBox_H diff --git a/src/SMESHGUI/SMESHGUI_MeshInfosDlg.cxx b/src/SMESHGUI/SMESHGUI_MeshInfosDlg.cxx index 044c55001..0bc4b633a 100644 --- a/src/SMESHGUI/SMESHGUI_MeshInfosDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshInfosDlg.cxx @@ -28,6 +28,7 @@ #include "SMESHGUI.h" #include "SMESHGUI_Utils.h" +#include "SMESHGUI_MeshInfosBox.h" // SALOME GUI includes #include @@ -124,293 +125,13 @@ SMESHGUI_MeshInfosDlg::SMESHGUI_MeshInfosDlg(SMESHGUI* theModule): QFrame* line1 = new QFrame(myMeshWidget); line1->setFrameStyle(QFrame::HLine | QFrame::Sunken); - // --> nodes - QLabel* myMeshNbNodesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NODES")), myMeshWidget); - myMeshNbNodes = new QLabel(myMeshWidget); - myMeshNbNodes->setMinimumWidth(100); - QFrame* line12 = new QFrame(myMeshWidget); - line12->setFrameStyle(QFrame::HLine | QFrame::Sunken); - - // --> 0D elements - QLabel* myMeshNb0DElemsLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_0DELEMS")), myMeshWidget); - myMeshNb0DElems = new QLabel(myMeshWidget); - myMeshNb0DElems->setMinimumWidth(100); - - // --> header with orders - QLabel* myMeshOrder0Lab = new QLabel(tr("SMESH_MESHINFO_ORDER0"), myMeshWidget); - QLabel* myMeshOrder1Lab = new QLabel(tr("SMESH_MESHINFO_ORDER1"), myMeshWidget); - QLabel* myMeshOrder2Lab = new QLabel(tr("SMESH_MESHINFO_ORDER2"), myMeshWidget); - QFont fnti = myMeshOrder0Lab->font(); fnti.setItalic(true); - myMeshOrder0Lab->setFont(fnti); - myMeshOrder1Lab->setFont(fnti); - myMeshOrder2Lab->setFont(fnti); - - // --> edges - QLabel* myMeshNbEdgesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_EDGES")), myMeshWidget); - myMeshNbEdges = new QLabel(myMeshWidget); - myMeshNbEdges->setMinimumWidth(100); - myMeshNbEdges1 = new QLabel(myMeshWidget); - myMeshNbEdges1->setMinimumWidth(100); - myMeshNbEdges2 = new QLabel(myMeshWidget); - myMeshNbEdges2->setMinimumWidth(100); - - // --> faces - myMeshFacesGroup = new QGroupBox(tr("SMESH_MESHINFO_FACES"), myMeshWidget); - QGridLayout* myMeshFacesGroupLayout = new QGridLayout(myMeshFacesGroup); - myMeshFacesGroupLayout->setSpacing(SPACING); myMeshFacesGroupLayout->setMargin(MARGIN); - - // --> faces --> total - QLabel* myMeshNbFacesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TOTAL")), myMeshFacesGroup); - myMeshNbFacesLab->setFont(fnt); - myMeshNbFaces = new QLabel(myMeshFacesGroup); - myMeshNbFaces->setMinimumWidth(100); - myMeshNbFaces->setFont(fnt); - myMeshNbFaces1 = new QLabel(myMeshFacesGroup); - myMeshNbFaces1->setMinimumWidth(100); - myMeshNbFaces1->setFont(fnt); - myMeshNbFaces2 = new QLabel(myMeshFacesGroup); - myMeshNbFaces2->setMinimumWidth(100); - myMeshNbFaces2->setFont(fnt); - - // --> faces --> triangles - QLabel* myMeshNbTrianglesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TRIANGLES")), myMeshFacesGroup); - myMeshNbTriangles = new QLabel(myMeshFacesGroup); - myMeshNbTriangles->setMinimumWidth(100); - myMeshNbTriangles1 = new QLabel(myMeshFacesGroup); - myMeshNbTriangles1->setMinimumWidth(100); - myMeshNbTriangles2 = new QLabel(myMeshFacesGroup); - myMeshNbTriangles2->setMinimumWidth(100); - - // --> faces --> quadrangles - QLabel* myMeshNbQuadranglesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_QUADRANGLES")), myMeshFacesGroup); - myMeshNbQuadrangles = new QLabel(myMeshFacesGroup); - myMeshNbQuadrangles->setMinimumWidth(100); - myMeshNbQuadrangles1 = new QLabel(myMeshFacesGroup); - myMeshNbQuadrangles1->setMinimumWidth(100); - myMeshNbQuadrangles2 = new QLabel(myMeshFacesGroup); - myMeshNbQuadrangles2->setMinimumWidth(100); - - // --> faces --> polygons - QLabel* myMeshNbPolygonesLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_POLYGONES" ) ), myMeshFacesGroup ); - myMeshNbPolygones = new QLabel( myMeshFacesGroup ); - myMeshNbPolygones->setMinimumWidth( 100 ); - - myMeshFacesGroupLayout->addWidget(myMeshNbFacesLab, 0, 0); - myMeshFacesGroupLayout->addWidget(myMeshNbFaces, 0, 1); - myMeshFacesGroupLayout->addWidget(myMeshNbFaces1, 0, 2); - myMeshFacesGroupLayout->addWidget(myMeshNbFaces2, 0, 3); - myMeshFacesGroupLayout->addWidget(myMeshNbTrianglesLab, 1, 0); - myMeshFacesGroupLayout->addWidget(myMeshNbTriangles, 1, 1); - myMeshFacesGroupLayout->addWidget(myMeshNbTriangles1, 1, 2); - myMeshFacesGroupLayout->addWidget(myMeshNbTriangles2, 1, 3); - myMeshFacesGroupLayout->addWidget(myMeshNbQuadranglesLab, 2, 0); - myMeshFacesGroupLayout->addWidget(myMeshNbQuadrangles, 2, 1); - myMeshFacesGroupLayout->addWidget(myMeshNbQuadrangles1, 2, 2); - myMeshFacesGroupLayout->addWidget(myMeshNbQuadrangles2, 2, 3); - myMeshFacesGroupLayout->addWidget(myMeshNbPolygonesLab, 3, 0); - myMeshFacesGroupLayout->addWidget(myMeshNbPolygones, 3, 1); - - // --> volumes - myMeshVolumesGroup = new QGroupBox(tr("SMESH_MESHINFO_VOLUMES"), myMeshWidget); - QGridLayout* myMeshVolumesGroupLayout = new QGridLayout(myMeshVolumesGroup); - myMeshVolumesGroupLayout->setSpacing(SPACING); myMeshVolumesGroupLayout->setMargin(MARGIN); - - // --> volumes --> total - QLabel* myMeshNbVolumesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TOTAL")), myMeshVolumesGroup); - myMeshNbVolumesLab->setFont(fnt); - myMeshNbVolumes = new QLabel(myMeshVolumesGroup); - myMeshNbVolumes->setMinimumWidth(100); - myMeshNbVolumes->setFont(fnt); - myMeshNbVolumes1 = new QLabel(myMeshVolumesGroup); - myMeshNbVolumes1->setMinimumWidth(100); - myMeshNbVolumes1->setFont(fnt); - myMeshNbVolumes2 = new QLabel(myMeshVolumesGroup); - myMeshNbVolumes2->setMinimumWidth(100); - myMeshNbVolumes2->setFont(fnt); - - // --> volumes --> tetrahedrons - QLabel* myMeshNbTetraLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TETRAS")), myMeshVolumesGroup); - myMeshNbTetra = new QLabel(myMeshVolumesGroup); - myMeshNbTetra->setMinimumWidth(100); - myMeshNbTetra1 = new QLabel(myMeshVolumesGroup); - myMeshNbTetra1->setMinimumWidth(100); - myMeshNbTetra2 = new QLabel(myMeshVolumesGroup); - myMeshNbTetra2->setMinimumWidth(100); - - // --> volumes --> hexahedrons - QLabel* myMeshNbHexaLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_HEXAS")), myMeshVolumesGroup); - myMeshNbHexa = new QLabel(myMeshVolumesGroup); - myMeshNbHexa->setMinimumWidth(100); - myMeshNbHexa1 = new QLabel(myMeshVolumesGroup); - myMeshNbHexa1->setMinimumWidth(100); - myMeshNbHexa2 = new QLabel(myMeshVolumesGroup); - myMeshNbHexa2->setMinimumWidth(100); - - // --> volumes --> prisms - QLabel* myMeshNbPrismLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_PRISMS")), myMeshVolumesGroup); - myMeshNbPrism = new QLabel(myMeshVolumesGroup); - myMeshNbPrism->setMinimumWidth(100); - myMeshNbPrism1 = new QLabel(myMeshVolumesGroup); - myMeshNbPrism1->setMinimumWidth(100); - myMeshNbPrism2 = new QLabel(myMeshVolumesGroup); - myMeshNbPrism2->setMinimumWidth(100); - - // --> volumes --> pyramids - QLabel* myMeshNbPyraLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_PYRAS")), myMeshVolumesGroup); - myMeshNbPyra = new QLabel(myMeshVolumesGroup); - myMeshNbPyra->setMinimumWidth(100); - myMeshNbPyra1 = new QLabel(myMeshVolumesGroup); - myMeshNbPyra1->setMinimumWidth(100); - myMeshNbPyra2 = new QLabel(myMeshVolumesGroup); - myMeshNbPyra2->setMinimumWidth(100); - - // --> volumes --> polyherones - QLabel* myMeshNbPolyhedronesLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_POLYEDRES" ) ), myMeshVolumesGroup ); - myMeshNbPolyhedrones = new QLabel( myMeshVolumesGroup ); - myMeshNbPolyhedrones->setMinimumWidth( 100 ); - - myMeshVolumesGroupLayout->addWidget(myMeshNbVolumesLab, 0, 0); - myMeshVolumesGroupLayout->addWidget(myMeshNbVolumes, 0, 1); - myMeshVolumesGroupLayout->addWidget(myMeshNbVolumes1, 0, 2); - myMeshVolumesGroupLayout->addWidget(myMeshNbVolumes2, 0, 3); - myMeshVolumesGroupLayout->addWidget(myMeshNbTetraLab, 1, 0); - myMeshVolumesGroupLayout->addWidget(myMeshNbTetra, 1, 1); - myMeshVolumesGroupLayout->addWidget(myMeshNbTetra1, 1, 2); - myMeshVolumesGroupLayout->addWidget(myMeshNbTetra2, 1, 3); - myMeshVolumesGroupLayout->addWidget(myMeshNbHexaLab, 2, 0); - myMeshVolumesGroupLayout->addWidget(myMeshNbHexa, 2, 1); - myMeshVolumesGroupLayout->addWidget(myMeshNbHexa1, 2, 2); - myMeshVolumesGroupLayout->addWidget(myMeshNbHexa2, 2, 3); - myMeshVolumesGroupLayout->addWidget(myMeshNbPrismLab, 3, 0); - myMeshVolumesGroupLayout->addWidget(myMeshNbPrism, 3, 1); - myMeshVolumesGroupLayout->addWidget(myMeshNbPrism1, 3, 2); - myMeshVolumesGroupLayout->addWidget(myMeshNbPrism2, 3, 3); - myMeshVolumesGroupLayout->addWidget(myMeshNbPyraLab, 4, 0); - myMeshVolumesGroupLayout->addWidget(myMeshNbPyra, 4, 1); - myMeshVolumesGroupLayout->addWidget(myMeshNbPyra1, 4, 2); - myMeshVolumesGroupLayout->addWidget(myMeshNbPyra2, 4, 3); - myMeshVolumesGroupLayout->addWidget(myMeshNbPolyhedronesLab, 5, 0); - myMeshVolumesGroupLayout->addWidget(myMeshNbPolyhedrones, 5, 1); + myMeshInfoBox = new SMESHGUI_MeshInfosBox(true, myMeshWidget); aMeshLayout->addWidget(myMeshNameLab, 0, 0); aMeshLayout->addWidget(myMeshName, 0, 1); aMeshLayout->addWidget(line1, 1, 0, 1, 2); - aMeshLayout->addWidget(myMeshNbNodesLab, 2, 0); - aMeshLayout->addWidget(myMeshNbNodes, 2, 1); - aMeshLayout->addWidget(line12, 3, 0, 1, 2); - aMeshLayout->addWidget(myMeshNb0DElemsLab, 4, 0); - aMeshLayout->addWidget(myMeshNb0DElems, 4, 1); - aMeshLayout->addWidget(myMeshOrder0Lab, 5, 1); - aMeshLayout->addWidget(myMeshOrder1Lab, 5, 2); - aMeshLayout->addWidget(myMeshOrder2Lab, 5, 3); - aMeshLayout->addWidget(myMeshNbEdgesLab, 6, 0); - aMeshLayout->addWidget(myMeshNbEdges, 6, 1); - aMeshLayout->addWidget(myMeshNbEdges1, 6, 2); - aMeshLayout->addWidget(myMeshNbEdges2, 6, 3); - aMeshLayout->addWidget(myMeshFacesGroup, 7, 0, 1, 4); - aMeshLayout->addWidget(myMeshVolumesGroup, 8, 0, 1, 4); - aMeshLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), 9, 0); - - // submesh - mySubMeshWidget = new QWidget(myWGStack); - QGridLayout* aSubMeshLayout = new QGridLayout(mySubMeshWidget); - aSubMeshLayout->setSpacing(SPACING); aSubMeshLayout->setMargin(0); - myWGStack->addWidget(mySubMeshWidget); - - // --> name - QLabel* mySubMeshNameLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NAME")), mySubMeshWidget); - mySubMeshName = new QLabel(mySubMeshWidget); - mySubMeshName->setMinimumWidth(100); - QFrame* line2 = new QFrame(mySubMeshWidget); - line2->setFrameStyle(QFrame::HLine | QFrame::Sunken); - - // --> nodes - QLabel* mySubMeshNbNodesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NODES")), mySubMeshWidget); - mySubMeshNbNodes = new QLabel(mySubMeshWidget); - mySubMeshNbNodes->setMinimumWidth(100); - - // --> elements - mySubMeshElementsGroup = new QGroupBox(tr("SMESH_MESHINFO_ELEMENTS"), mySubMeshWidget); - QGridLayout* mySubMeshElementsGroupLayout = new QGridLayout(mySubMeshElementsGroup); - mySubMeshElementsGroupLayout->setSpacing(SPACING); mySubMeshElementsGroupLayout->setMargin(MARGIN); - - // --> elements --> total - QLabel* mySubMeshNbElementsLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TOTAL")), mySubMeshElementsGroup); - mySubMeshNbElementsLab->setFont(fnt); - mySubMeshNbElements = new QLabel(mySubMeshElementsGroup); - mySubMeshNbElements->setMinimumWidth(100); - mySubMeshNbElements->setFont(fnt); - - // --> 0D elements - QLabel* mySubMeshNb0DElemsLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_0DELEMS")), mySubMeshElementsGroup); - mySubMeshNb0DElems = new QLabel(mySubMeshElementsGroup); - mySubMeshNb0DElems->setMinimumWidth(100); - - // --> elements --> edges - QLabel* mySubMeshNbEdgesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_EDGES")), mySubMeshElementsGroup); - mySubMeshNbEdges = new QLabel(mySubMeshElementsGroup); - mySubMeshNbEdges->setMinimumWidth(100); - - // --> elements --> faces - QLabel* mySubMeshNbFacesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_FACES")), mySubMeshElementsGroup); - mySubMeshNbFaces = new QLabel(mySubMeshElementsGroup); - mySubMeshNbFaces->setMinimumWidth(100); - - // --> elements --> volumes - QLabel* mySubMeshNbVolumesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_VOLUMES")), mySubMeshElementsGroup); - mySubMeshNbVolumes = new QLabel(mySubMeshElementsGroup); - mySubMeshNbVolumes->setMinimumWidth(100); - - mySubMeshElementsGroupLayout->addWidget(mySubMeshNbElementsLab, 0, 0); - mySubMeshElementsGroupLayout->addWidget(mySubMeshNbElements, 0, 1); - mySubMeshElementsGroupLayout->addWidget(mySubMeshNb0DElemsLab, 1, 0); - mySubMeshElementsGroupLayout->addWidget(mySubMeshNb0DElems, 1, 1); - mySubMeshElementsGroupLayout->addWidget(mySubMeshNbEdgesLab, 2, 0); - mySubMeshElementsGroupLayout->addWidget(mySubMeshNbEdges, 2, 1); - mySubMeshElementsGroupLayout->addWidget(mySubMeshNbFacesLab, 3, 0); - mySubMeshElementsGroupLayout->addWidget(mySubMeshNbFaces, 3, 1); - mySubMeshElementsGroupLayout->addWidget(mySubMeshNbVolumesLab, 4, 0); - mySubMeshElementsGroupLayout->addWidget(mySubMeshNbVolumes, 4, 1); - - aSubMeshLayout->addWidget(mySubMeshNameLab, 0, 0); - aSubMeshLayout->addWidget(mySubMeshName, 0, 1); - aSubMeshLayout->addWidget(line2, 1, 0, 1, 2); - aSubMeshLayout->addWidget(mySubMeshNbNodesLab, 2, 0); - aSubMeshLayout->addWidget(mySubMeshNbNodes, 2, 1); - aSubMeshLayout->addWidget(mySubMeshElementsGroup, 3, 0, 1, 2); - aSubMeshLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), 4, 0); - - // group - myGroupWidget = new QWidget(myWGStack); - QGridLayout* myGroupWidgetLayout = new QGridLayout(myGroupWidget); - myGroupWidgetLayout->setSpacing(SPACING); myGroupWidgetLayout->setMargin(0); - myWGStack->addWidget(myGroupWidget); - - // --> name - QLabel* myGroupNameLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NAME")), myGroupWidget); - myGroupName = new QLabel(myGroupWidget); - myGroupName->setMinimumWidth(100); - QFrame* line3 = new QFrame(myGroupWidget); - line3->setFrameStyle(QFrame::HLine | QFrame::Sunken); - - // --> type - QLabel* myGroupTypeLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TYPE")), myGroupWidget); - myGroupType = new QLabel(myGroupWidget); - myGroupType->setMinimumWidth(100); - - // --> number of entities - QLabel* myGroupNbLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_ENTITIES")), myGroupWidget); - myGroupNb = new QLabel(myGroupWidget); - myGroupNb->setMinimumWidth(100); - - myGroupWidgetLayout->addWidget(myGroupNameLab, 0, 0); - myGroupWidgetLayout->addWidget(myGroupName, 0, 1); - myGroupWidgetLayout->addWidget(line3, 1, 0, 1, 2); - myGroupWidgetLayout->addWidget(myGroupTypeLab, 2, 0); - myGroupWidgetLayout->addWidget(myGroupType, 2, 1); - myGroupWidgetLayout->addWidget(myGroupNbLab, 3, 0); - myGroupWidgetLayout->addWidget(myGroupNb, 3, 1); - myGroupWidgetLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), 4, 0); + aMeshLayout->addWidget(myMeshInfoBox, 2, 0, 1, 2); + aMeshLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), 3, 0); // buttons myButtonsGroup = new QGroupBox(this); @@ -484,71 +205,8 @@ void SMESHGUI_MeshInfosDlg::DumpMeshInfos() myMeshName->setText(aSO->GetName().c_str()); SMESH::long_array_var aMeshInfo = anIDSource->GetMeshInfo(); + myMeshInfoBox->SetMeshInfo( aMeshInfo ); - myMeshNbNodes->setNum((int)aMeshInfo[SMESH::Entity_Node]); - myMeshNb0DElems->setNum((int)aMeshInfo[SMESH::Entity_0D]); - myMeshNbEdges->setNum((int)aMeshInfo[SMESH::Entity_Edge] + (int)aMeshInfo[SMESH::Entity_Quad_Edge]); - myMeshNbEdges1->setNum((int)aMeshInfo[SMESH::Entity_Edge]); - myMeshNbEdges2->setNum((int)aMeshInfo[SMESH::Entity_Quad_Edge]); - myMeshNbFaces->setNum((int)aMeshInfo[SMESH::Entity_Triangle] + - (int)aMeshInfo[SMESH::Entity_Quad_Triangle] + - (int)aMeshInfo[SMESH::Entity_Quadrangle] + - (int)aMeshInfo[SMESH::Entity_Quad_Quadrangle] + - (int)aMeshInfo[SMESH::Entity_Polygon] + - (int)aMeshInfo[SMESH::Entity_Quad_Polygon]); - myMeshNbFaces1->setNum((int)aMeshInfo[SMESH::Entity_Triangle] + - (int)aMeshInfo[SMESH::Entity_Quadrangle] + - (int)aMeshInfo[SMESH::Entity_Polygon]); - myMeshNbFaces2->setNum((int)aMeshInfo[SMESH::Entity_Quad_Triangle] + - (int)aMeshInfo[SMESH::Entity_Quad_Quadrangle] + - (int)aMeshInfo[SMESH::Entity_Quad_Polygon]); - - myMeshNbTriangles->setNum((int)aMeshInfo[SMESH::Entity_Triangle] + - (int)aMeshInfo[SMESH::Entity_Quad_Triangle]); - myMeshNbTriangles1->setNum((int)aMeshInfo[SMESH::Entity_Triangle]); - myMeshNbTriangles2->setNum((int)aMeshInfo[SMESH::Entity_Quad_Triangle]); - myMeshNbQuadrangles->setNum((int)aMeshInfo[SMESH::Entity_Quadrangle] + - (int)aMeshInfo[SMESH::Entity_Quad_Quadrangle]); - myMeshNbQuadrangles1->setNum((int)(int)aMeshInfo[SMESH::Entity_Quadrangle]); - myMeshNbQuadrangles2->setNum((int)aMeshInfo[SMESH::Entity_Quad_Quadrangle]); - myMeshNbPolygones->setNum((int)aMeshInfo[SMESH::Entity_Polygon]); - myMeshNbVolumes->setNum((int)aMeshInfo[SMESH::Entity_Tetra] + - (int)aMeshInfo[SMESH::Entity_Quad_Tetra] + - (int)aMeshInfo[SMESH::Entity_Pyramid] + - (int)aMeshInfo[SMESH::Entity_Quad_Pyramid] + - (int)aMeshInfo[SMESH::Entity_Hexa] + - (int)aMeshInfo[SMESH::Entity_Quad_Hexa] + - (int)aMeshInfo[SMESH::Entity_Penta] + - (int)aMeshInfo[SMESH::Entity_Quad_Penta] + - (int)aMeshInfo[SMESH::Entity_Polyhedra] + - (int)aMeshInfo[SMESH::Entity_Quad_Polyhedra]); - myMeshNbVolumes1->setNum((int)aMeshInfo[SMESH::Entity_Tetra] + - (int)aMeshInfo[SMESH::Entity_Pyramid] + - (int)aMeshInfo[SMESH::Entity_Hexa] + - (int)aMeshInfo[SMESH::Entity_Penta] + - (int)aMeshInfo[SMESH::Entity_Polyhedra]); - myMeshNbVolumes2->setNum((int)aMeshInfo[SMESH::Entity_Quad_Tetra] + - (int)aMeshInfo[SMESH::Entity_Quad_Pyramid] + - (int)aMeshInfo[SMESH::Entity_Quad_Hexa] + - (int)aMeshInfo[SMESH::Entity_Quad_Penta] + - (int)aMeshInfo[SMESH::Entity_Quad_Polyhedra]); - myMeshNbTetra->setNum((int)aMeshInfo[SMESH::Entity_Tetra] + - (int)aMeshInfo[SMESH::Entity_Quad_Tetra]); - myMeshNbTetra1->setNum((int)aMeshInfo[SMESH::Entity_Tetra]); - myMeshNbTetra2->setNum((int)aMeshInfo[SMESH::Entity_Quad_Tetra]); - myMeshNbHexa->setNum((int)aMeshInfo[SMESH::Entity_Hexa] + - (int)aMeshInfo[SMESH::Entity_Quad_Hexa]); - myMeshNbHexa1->setNum((int)aMeshInfo[SMESH::Entity_Hexa]); - myMeshNbHexa2->setNum((int)aMeshInfo[SMESH::Entity_Quad_Hexa]); - myMeshNbPrism->setNum((int)aMeshInfo[SMESH::Entity_Penta] + - (int)aMeshInfo[SMESH::Entity_Quad_Penta]); - myMeshNbPrism1->setNum((int)aMeshInfo[SMESH::Entity_Penta]); - myMeshNbPrism2->setNum((int)aMeshInfo[SMESH::Entity_Quad_Penta]); - myMeshNbPyra->setNum((int)aMeshInfo[SMESH::Entity_Pyramid] + - (int)aMeshInfo[SMESH::Entity_Quad_Pyramid]); - myMeshNbPyra1->setNum((int)aMeshInfo[SMESH::Entity_Pyramid]); - myMeshNbPyra2->setNum((int)aMeshInfo[SMESH::Entity_Quad_Pyramid]); - myMeshNbPolyhedrones->setNum((int)aMeshInfo[SMESH::Entity_Polyhedra]); return; } } diff --git a/src/SMESHGUI/SMESHGUI_MeshInfosDlg.h b/src/SMESHGUI/SMESHGUI_MeshInfosDlg.h index c05a2c39a..64e49822c 100644 --- a/src/SMESHGUI/SMESHGUI_MeshInfosDlg.h +++ b/src/SMESHGUI/SMESHGUI_MeshInfosDlg.h @@ -39,6 +39,7 @@ class QStackedWidget; class LightApp_SelectionMgr; class SMESHGUI; +class SMESHGUI_MeshInfosBox; class SMESHGUI_EXPORT SMESHGUI_MeshInfosDlg : public QDialog { @@ -74,54 +75,7 @@ private: QWidget* myMeshWidget; QLabel* myMeshName; - QLabel* myMeshNbNodes; - QLabel* myMeshNb0DElems; - QLabel* myMeshNbEdges; - QLabel* myMeshNbEdges1; - QLabel* myMeshNbEdges2; - QGroupBox* myMeshFacesGroup; - QLabel* myMeshNbFaces; - QLabel* myMeshNbFaces1; - QLabel* myMeshNbFaces2; - QLabel* myMeshNbTriangles; - QLabel* myMeshNbTriangles1; - QLabel* myMeshNbTriangles2; - QLabel* myMeshNbQuadrangles; - QLabel* myMeshNbQuadrangles1; - QLabel* myMeshNbQuadrangles2; - QLabel* myMeshNbPolygones; - QGroupBox* myMeshVolumesGroup; - QLabel* myMeshNbVolumes; - QLabel* myMeshNbVolumes1; - QLabel* myMeshNbVolumes2; - QLabel* myMeshNbTetra; - QLabel* myMeshNbTetra1; - QLabel* myMeshNbTetra2; - QLabel* myMeshNbHexa; - QLabel* myMeshNbHexa1; - QLabel* myMeshNbHexa2; - QLabel* myMeshNbPyra; - QLabel* myMeshNbPyra1; - QLabel* myMeshNbPyra2; - QLabel* myMeshNbPrism; - QLabel* myMeshNbPrism1; - QLabel* myMeshNbPrism2; - QLabel* myMeshNbPolyhedrones; - - QWidget* mySubMeshWidget; - QLabel* mySubMeshName; - QLabel* mySubMeshNbNodes; - QGroupBox* mySubMeshElementsGroup; - QLabel* mySubMeshNbElements; - QLabel* mySubMeshNb0DElems; - QLabel* mySubMeshNbEdges; - QLabel* mySubMeshNbFaces; - QLabel* mySubMeshNbVolumes; - - QWidget* myGroupWidget; - QLabel* myGroupName; - QLabel* myGroupType; - QLabel* myGroupNb; + SMESHGUI_MeshInfosBox* myMeshInfoBox; QGroupBox* myButtonsGroup; QPushButton* myOkBtn; diff --git a/src/SMESH_I/SMESH_Gen_i.cxx b/src/SMESH_I/SMESH_Gen_i.cxx index 8bc0dc42d..d1c66c4e0 100644 --- a/src/SMESH_I/SMESH_Gen_i.cxx +++ b/src/SMESH_I/SMESH_Gen_i.cxx @@ -1616,7 +1616,6 @@ SMESH::MeshPreviewStruct* SMESH_Gen_i::Precompute( SMESH::SMESH_Mesh_ptr theMesh */ //============================================================================= -//CORBA::Boolean SMESH::long_array* SMESH_Gen_i::Evaluate(SMESH::SMESH_Mesh_ptr theMesh, GEOM::GEOM_Object_ptr theShapeObject) // SMESH::long_array& theNbElems) @@ -1634,6 +1633,10 @@ SMESH::long_array* SMESH_Gen_i::Evaluate(SMESH::SMESH_Mesh_ptr theMesh, SALOME::BAD_PARAM ); SMESH::long_array_var nbels = new SMESH::long_array; + nbels->length(SMESH::Entity_Last); + int i = SMESH::Entity_Node; + for (; i < SMESH::Entity_Last; i++) + nbels[i] = 0; // Update Python script TPythonDump() << "theNbElems = " << this << ".Evaluate( " @@ -1657,27 +1660,15 @@ SMESH::long_array* SMESH_Gen_i::Evaluate(SMESH::SMESH_Mesh_ptr theMesh, MapShapeNbElems aResMap; /*CORBA::Boolean ret =*/ myGen.Evaluate( myLocMesh, myLocShape, aResMap); MapShapeNbElemsItr anIt = aResMap.begin(); - vector aResVec(17); - int i = 0; - for(; i<17; i++) aResVec[i] = 0; for(; anIt!=aResMap.end(); anIt++) { - // 0 - node, 1 - edge lin, 2 - edge quad, - // 3 - triangle lin, 4 - triangle quad - // 5 - quadrangle lin, 6 - quadrangle quad - // 7 - polygon, 8 - tetra lin, 9 - tetra quad - // 10 - pyramid lin, 11 - pyramid quad, - // 12 - penta lin, 13 - penta quad, 14 - hexa lin, - // 15 - hexa quad, 16 -polyhedra - vector aVec = (*anIt).second; - for(i=0; i<17; i++) { - aResVec[i] += aVec[i]; + const vector& aVec = (*anIt).second; + for(i = SMESH::Entity_Node; i < SMESH::Entity_Last; i++) { + nbels[i] += aVec[i]; } } - nbels->length(17); - for(i=0; i<17; i++) { - nbels[i] = aResVec[i]; - } +#ifdef _DEBUG_ cout< aVec = (*anIt).second; - nb2d += Max(aVec[5],aVec[6]); + nb2d += Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]); } } return nb2d; @@ -639,7 +639,7 @@ bool StdMeshers_CompositeHexa_3D::Evaluate(SMESH_Mesh& theMesh, MapShapeNbElemsItr anIt = aResMap.find(sm); if( anIt == aResMap.end() ) continue; std::vector aVec = (*anIt).second; - nb0 = aVec[0]; + nb0 = aVec[SMDSEntity_Node]; } int j = 1; for(; j<=BndEdges.Length(); j++) { @@ -670,7 +670,7 @@ bool StdMeshers_CompositeHexa_3D::Evaluate(SMESH_Mesh& theMesh, MapShapeNbElemsItr anIt = aResMap.find(sm); if( anIt == aResMap.end() ) continue; std::vector aVec = (*anIt).second; - nb1d += Max(aVec[1],aVec[2]); + nb1d += Max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]); } } @@ -689,24 +689,24 @@ bool StdMeshers_CompositeHexa_3D::Evaluate(SMESH_Mesh& theMesh, MapShapeNbElemsItr anIt = aResMap.find(sm); if( anIt == aResMap.end() ) continue; std::vector aVec = (*anIt).second; - nb0d += aVec[0]; - nb2d_3 += Max(aVec[3],aVec[4]); - nb2d_4 += Max(aVec[5],aVec[6]); + nb0d += aVec[SMDSEntity_Node]; + nb2d_3 += Max(aVec[SMDSEntity_Triangle], aVec[SMDSEntity_Quad_Triangle]); + nb2d_4 += Max(aVec[SMDSEntity_Quadrangle], aVec[SMDSEntity_Quad_Quadrangle]); } } nb0d += nb0d_in; - std::vector aResVec(17); - for(int i=0; i<17; i++) aResVec[i] = 0; + std::vector aResVec(SMDSEntity_Last); + for(int i=SMDSEntity_Node; iGetAlgo(aMesh, aFace); if( !algo ) { - std::vector aResVec(17); - for(int i=0; i<17; i++) aResVec[i] = 0; + std::vector aResVec(SMDSEntity_Last); + for(int i=SMDSEntity_Node; iGetComputeError(); @@ -787,7 +787,7 @@ bool StdMeshers_Hexa_3D::Evaluate(SMESH_Mesh & aMesh, MapShapeNbElemsItr anIt = aResMap.find(meshFaces[i]); if( anIt == aResMap.end() ) continue; std::vector aVec = (*anIt).second; - int nbtri = Max(aVec[3],aVec[4]); + int nbtri = Max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]); if( nbtri == 0 ) isAllQuad = true; } @@ -808,9 +808,9 @@ bool StdMeshers_Hexa_3D::Evaluate(SMESH_Mesh & aMesh, MapShapeNbElemsItr anIt = aResMap.find(sm); if( anIt == aResMap.end() ) continue; std::vector aVec = (*anIt).second; - nb1d += Max(aVec[1],aVec[2]); + nb1d += Max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]); if(IsFirst) { - IsQuadratic = (aVec[2] > aVec[1]); + IsQuadratic = (aVec[SMDSEntity_Quad_Edge] > aVec[SMDSEntity_Edge]); IsFirst = false; } } @@ -837,24 +837,24 @@ bool StdMeshers_Hexa_3D::Evaluate(SMESH_Mesh & aMesh, MapShapeNbElemsItr anIt = aResMap.find( meshFaces[i-1] ); if( anIt == aResMap.end() ) continue; std::vector aVec = (*anIt).second; - nb2d += Max(aVec[5],aVec[6]); + nb2d += Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]); } MapShapeNbElemsItr anIt = aResMap.find( meshFaces[0] ); std::vector aVec = (*anIt).second; - int nb2d_face0 = Max(aVec[5],aVec[6]); - int nb0d_face0 = aVec[0]; + int nb2d_face0 = Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]); + int nb0d_face0 = aVec[SMDSEntity_Node]; - std::vector aResVec(17); - for(int i=0; i<17; i++) aResVec[i] = 0; + std::vector aResVec(SMDSEntity_Last); + for(int i=SMDSEntity_Node; i aVec = (*anIt).second; - int nbe = Max(aVec[1],aVec[2]); + int nbe = Max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]); NbSeg += nbe; if(IsFirst) { - IsQuadratic = ( aVec[2] > aVec[1] ); + IsQuadratic = ( aVec[SMDSEntity_Quad_Edge] > aVec[SMDSEntity_Edge] ); IsFirst = false; } double a,b; @@ -343,15 +343,15 @@ bool StdMeshers_MEFISTO_2D::Evaluate(SMESH_Mesh & aMesh, int nbFaces = (int) ( anArea/(tmpLength*tmpLength*sqrt(3.)/4) ); int nbNodes = (int) ( nbFaces*3 - (NbSeg-1)*2 ) / 6; - std::vector aVec(17); - for(int i=0; i<17; i++) aVec[i] = 0; + std::vector aVec(SMDSEntity_Last); + for(int i=SMDSEntity_Node; i aVec = (*anIt).second; - int nbtri = Max(aVec[3],aVec[4]); - int nbqua = Max(aVec[5],aVec[6]); + int nbtri = Max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]); + int nbqua = Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]); if( nbtri>0 && nbqua==0 ) { NumBase = i; } @@ -1924,7 +1924,7 @@ bool StdMeshers_Penta_3D::Evaluate(SMESH_Mesh& aMesh, MapShapeNbElemsItr anIt = aResMap.find(sm); if( anIt == aResMap.end() ) continue; std::vector aVec = (*anIt).second; - nb1d += Max(aVec[1],aVec[2]); + nb1d += Max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]); } } // find face opposite to base face @@ -1950,30 +1950,30 @@ bool StdMeshers_Penta_3D::Evaluate(SMESH_Mesh& aMesh, MapShapeNbElemsItr anIt = aResMap.find( meshFaces[i-1] ); if( anIt == aResMap.end() ) continue; std::vector aVec = (*anIt).second; - nb2d += Max(aVec[5],aVec[6]); + nb2d += Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]); } MapShapeNbElemsItr anIt = aResMap.find( meshFaces[NumBase-1] ); std::vector aVec = (*anIt).second; - int nb2d_face0 = Max(aVec[5],aVec[6]); - int nb0d_face0 = aVec[0]; + int nb2d_face0 = Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]); + int nb0d_face0 = aVec[SMDSEntity_Node]; anIt = aResMap.find( meshFaces[OppNum-1] ); - for(i=0; i<17; i++) + for(i=SMDSEntity_Node; i aResVec(17); - for(int i=0; i<17; i++) aResVec[i] = 0; + std::vector aResVec(SMDSEntity_Last); + for(int i=SMDSEntity_Node; i aVec = (*anIt).second; - int nbtri = Max(aVec[3],aVec[4]); - int nbqua = Max(aVec[5],aVec[6]); + int nbtri = Max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]); + int nbqua = Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]); if( nbtri==0 && nbqua>0 ) { NbQFs++; } @@ -405,8 +405,8 @@ bool StdMeshers_Prism_3D::Evaluate(SMESH_Mesh& theMesh, } if(NbQFs<4) { - std::vector aResVec(17); - for(int i=0; i<17; i++) aResVec[i] = 0; + std::vector aResVec(SMDSEntity_Last); + for(int i=SMDSEntity_Node; iGetComputeError(); @@ -426,7 +426,7 @@ bool StdMeshers_Prism_3D::Evaluate(SMESH_Mesh& theMesh, MapShapeNbElemsItr anIt = aResMap.find(sm); if( anIt == aResMap.end() ) continue; std::vector aVec = (*anIt).second; - nb1d += Max(aVec[1],aVec[2]); + nb1d += Max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]); } } // find face opposite to base face @@ -452,28 +452,29 @@ bool StdMeshers_Prism_3D::Evaluate(SMESH_Mesh& theMesh, MapShapeNbElemsItr anIt = aResMap.find( meshFaces[i-1] ); if( anIt == aResMap.end() ) continue; std::vector aVec = (*anIt).second; - nb2d += Max(aVec[5],aVec[6]); + nb2d += Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]); } MapShapeNbElemsItr anIt = aResMap.find( meshFaces[NumBase-1] ); std::vector aVec = (*anIt).second; - bool IsQuadratic = (aVec[4]>aVec[3]) || (aVec[6]>aVec[5]); - int nb2d_face0_3 = Max(aVec[3],aVec[4]); - int nb2d_face0_4 = Max(aVec[5],aVec[6]); - int nb0d_face0 = aVec[0]; + bool IsQuadratic = (aVec[SMDSEntity_Quad_Triangle]>aVec[SMDSEntity_Triangle]) || + (aVec[SMDSEntity_Quad_Quadrangle]>aVec[SMDSEntity_Quadrangle]); + int nb2d_face0_3 = Max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]); + int nb2d_face0_4 = Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]); + int nb0d_face0 = aVec[SMDSEntity_Node]; int nb1d_face0_int = ( nb2d_face0_3*3 + nb2d_face0_4*4 - nb1d ) / 2; - std::vector aResVec(17); - for(int i=0; i<17; i++) aResVec[i] = 0; + std::vector aResVec(SMDSEntity_Last); + for(int i=SMDSEntity_Node; i aVec(17); - for(int i=0; i<17; i++) aVec[i] = 0; + std::vector aVec(SMDSEntity_Last); + for(int i=SMDSEntity_Node; iGetSubMeshDS()->GetElements(); if ( elemIt->more() ) quadratic = elemIt->next()->IsQuadratic(); if(quadratic) - aVec[2] = (nbNodes-1)/2; + aVec[SMDSEntity_Quad_Edge] = (nbNodes-1)/2; else - aVec[1] = nbNodes - 1; + aVec[SMDSEntity_Edge] = nbNodes - 1; SMESH_subMesh * sm = theMesh.GetSubMesh(theShape); aResMap.insert(std::make_pair(sm,aVec)); diff --git a/src/StdMeshers/StdMeshers_Projection_2D.cxx b/src/StdMeshers/StdMeshers_Projection_2D.cxx index f1326ad5e..a433e2dc3 100644 --- a/src/StdMeshers/StdMeshers_Projection_2D.cxx +++ b/src/StdMeshers/StdMeshers_Projection_2D.cxx @@ -785,29 +785,29 @@ bool StdMeshers_Projection_2D::Evaluate(SMESH_Mesh& theMesh, return error(COMPERR_BAD_INPUT_MESH,"Source mesh not computed"); - std::vector aVec(17); - for(int i=0; i<17; i++) aVec[i] = 0; + std::vector aVec(SMDSEntity_Last); + for(int i=SMDSEntity_Node; iGetSubMeshDS()->NbNodes(); + aVec[SMDSEntity_Node] = srcSubMesh->GetSubMeshDS()->NbNodes(); //bool quadratic = false; SMDS_ElemIteratorPtr elemIt = srcSubMesh->GetSubMeshDS()->GetElements(); while ( elemIt->more() ) { const SMDS_MeshElement* E = elemIt->next(); if( E->NbNodes()==3 ) { - aVec[3]++; + aVec[SMDSEntity_Triangle]++; } else if( E->NbNodes()==4 ) { - aVec[5]++; + aVec[SMDSEntity_Quadrangle]++; } else if( E->NbNodes()==6 && E->IsQuadratic() ) { - aVec[4]++; + aVec[SMDSEntity_Quad_Triangle]++; } else if( E->NbNodes()==8 && E->IsQuadratic() ) { - aVec[6]++; + aVec[SMDSEntity_Quad_Quadrangle]++; } else { - aVec[7]++; + aVec[SMDSEntity_Polygon]++; } } diff --git a/src/StdMeshers/StdMeshers_Projection_3D.cxx b/src/StdMeshers/StdMeshers_Projection_3D.cxx index 628102410..21bdecdb6 100644 --- a/src/StdMeshers/StdMeshers_Projection_3D.cxx +++ b/src/StdMeshers/StdMeshers_Projection_3D.cxx @@ -473,41 +473,41 @@ bool StdMeshers_Projection_3D::Evaluate(SMESH_Mesh& aMesh, return error(COMPERR_BAD_INPUT_MESH,"Source mesh not computed"); - std::vector aVec(17); - for(int i=0; i<17; i++) aVec[i] = 0; + std::vector aVec(SMDSEntity_Last); + for(int i=SMDSEntity_Node; iGetSubMeshDS()->NbNodes(); + aVec[SMDSEntity_Node] = srcSubMesh->GetSubMeshDS()->NbNodes(); //bool quadratic = false; SMDS_ElemIteratorPtr elemIt = srcSubMesh->GetSubMeshDS()->GetElements(); while ( elemIt->more() ) { const SMDS_MeshElement* E = elemIt->next(); if( E->NbNodes()==4 ) { - aVec[8]++; + aVec[SMDSEntity_Tetra]++; } else if( E->NbNodes()==5 ) { - aVec[10]++; + aVec[SMDSEntity_Pyramid]++; } else if( E->NbNodes()==6 ) { - aVec[12]++; + aVec[SMDSEntity_Penta]++; } else if( E->NbNodes()==8 ) { - aVec[14]++; + aVec[SMDSEntity_Hexa]++; } else if( E->NbNodes()==10 && E->IsQuadratic() ) { - aVec[9]++; + aVec[SMDSEntity_Quad_Tetra]++; } else if( E->NbNodes()==13 && E->IsQuadratic() ) { - aVec[11]++; + aVec[SMDSEntity_Quad_Pyramid]++; } else if( E->NbNodes()==15 && E->IsQuadratic() ) { - aVec[13]++; + aVec[SMDSEntity_Quad_Penta]++; } else if( E->NbNodes()==20 && E->IsQuadratic() ) { - aVec[15]++; + aVec[SMDSEntity_Quad_Hexa]++; } else { - aVec[16]++; + aVec[SMDSEntity_Polyhedra]++; } } diff --git a/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx b/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx index bd55a02c4..8ae77c241 100644 --- a/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx +++ b/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx @@ -646,8 +646,8 @@ bool StdMeshers_Quadrangle_2D::Evaluate(SMESH_Mesh& aMesh, std::vector aNbNodes(4); bool IsQuadratic = false; if( !CheckNbEdgesForEvaluate( aMesh, aShape, aResMap, aNbNodes, IsQuadratic ) ) { - std::vector aResVec(17); - for(int i=0; i<17; i++) aResVec[i] = 0; + std::vector aResVec(SMDSEntity_Last); + for(int i=SMDSEntity_Node; iGetComputeError(); @@ -695,26 +695,26 @@ bool StdMeshers_Quadrangle_2D::Evaluate(SMESH_Mesh& aMesh, //int nbFaces4 = (nbhoriz-1-kdh)*(nbvertic-1-kdv); int nbFaces4 = (nbhoriz-1)*(nbvertic-1); - std::vector aVec(17); - for(int i=0; i<17; i++) aVec[i] = 0; + std::vector aVec(SMDSEntity_Last); + for(int i=SMDSEntity_Node; i aVec = (*anIt).second; - IsQuadratic = (aVec[2] > aVec[1]); + IsQuadratic = (aVec[SMDSEntity_Quad_Edge] > aVec[SMDSEntity_Edge]); if ( nbEdgesInWire.front() == 3 ) { // exactly 3 edges if(myTriaVertexID>0) { SMESHDS_Mesh* meshDS = aMesh.GetMeshDS(); @@ -950,25 +950,25 @@ bool StdMeshers_Quadrangle_2D::CheckNbEdgesForEvaluate(SMESH_Mesh& aMesh, if(anIt==aResMap.end()) return false; std::vector aVec = (*anIt).second; if(IsQuadratic) - aNbNodes[0] = (aVec[0]-1)/2 + 2; + aNbNodes[0] = (aVec[SMDSEntity_Node]-1)/2 + 2; else - aNbNodes[0] = aVec[0] + 2; + aNbNodes[0] = aVec[SMDSEntity_Node] + 2; sm = aMesh.GetSubMesh(E2); anIt = aResMap.find(sm); if(anIt==aResMap.end()) return false; aVec = (*anIt).second; if(IsQuadratic) - aNbNodes[1] = (aVec[0]-1)/2 + 2; + aNbNodes[1] = (aVec[SMDSEntity_Node]-1)/2 + 2; else - aNbNodes[1] = aVec[0] + 2; + aNbNodes[1] = aVec[SMDSEntity_Node] + 2; sm = aMesh.GetSubMesh(E3); anIt = aResMap.find(sm); if(anIt==aResMap.end()) return false; aVec = (*anIt).second; if(IsQuadratic) - aNbNodes[2] = (aVec[0]-1)/2 + 2; + aNbNodes[2] = (aVec[SMDSEntity_Node]-1)/2 + 2; else - aNbNodes[2] = aVec[0] + 2; + aNbNodes[2] = aVec[SMDSEntity_Node] + 2; aNbNodes[3] = aNbNodes[1]; aNbNodes.resize(5); nbSides = 4; @@ -984,9 +984,9 @@ bool StdMeshers_Quadrangle_2D::CheckNbEdgesForEvaluate(SMESH_Mesh& aMesh, } std::vector aVec = (*anIt).second; if(IsQuadratic) - aNbNodes[nbSides] = (aVec[0]-1)/2 + 2; + aNbNodes[nbSides] = (aVec[SMDSEntity_Node]-1)/2 + 2; else - aNbNodes[nbSides] = aVec[0] + 2; + aNbNodes[nbSides] = aVec[SMDSEntity_Node] + 2; nbSides++; } } @@ -1019,9 +1019,9 @@ bool StdMeshers_Quadrangle_2D::CheckNbEdgesForEvaluate(SMESH_Mesh& aMesh, } std::vector aVec = (*anIt).second; if(IsQuadratic) - aNbNodes[nbSides] += (aVec[0]-1)/2 + 1; + aNbNodes[nbSides] += (aVec[SMDSEntity_Node]-1)/2 + 1; else - aNbNodes[nbSides] += aVec[0] + 1; + aNbNodes[nbSides] += aVec[SMDSEntity_Node] + 1; } ++nbSides; } @@ -1060,9 +1060,9 @@ bool StdMeshers_Quadrangle_2D::CheckNbEdgesForEvaluate(SMESH_Mesh& aMesh, } std::vector aVec = (*anIt).second; if(IsQuadratic) - aNbNodes[nbSides] += (aVec[0]-1)/2 + 1; + aNbNodes[nbSides] += (aVec[SMDSEntity_Node]-1)/2 + 1; else - aNbNodes[nbSides] += aVec[0] + 1; + aNbNodes[nbSides] += aVec[SMDSEntity_Node] + 1; } ++nbSides; } @@ -2032,22 +2032,22 @@ bool StdMeshers_Quadrangle_2D::EvaluateQuadPref(SMESH_Mesh & aMesh, nbFaces += (drl+addv)*(nb-1) + (nt-1); } // end new version implementation - std::vector aVec(17); - for(int i=0; i<17; i++) aVec[i] = 0; + std::vector aVec(SMDSEntity_Last); + for(int i=SMDSEntity_Node; i aResVec(17); - for(int i=0; i<17; i++) aResVec[i] = 0; + std::vector aResVec(SMDSEntity_Last); + for(int i=SMDSEntity_Node; iGetComputeError(); @@ -422,8 +422,8 @@ bool StdMeshers_RadialPrism_3D::Evaluate(SMESH_Mesh& aMesh, if ( !TAssocTool::FindSubShapeAssociation( outerShell, &aMesh, innerShell, &aMesh, shape2ShapeMap) ) { - std::vector aResVec(17); - for(int i=0; i<17; i++) aResVec[i] = 0; + std::vector aResVec(SMDSEntity_Last); + for(int i=SMDSEntity_Node; iGetComputeError(); @@ -439,9 +439,9 @@ bool StdMeshers_RadialPrism_3D::Evaluate(SMESH_Mesh& aMesh, SMESH_subMesh *aSubMesh = aMesh.GetSubMesh(exp.Current()); MapShapeNbElemsItr anIt = aResMap.find(aSubMesh); std::vector aVec = (*anIt).second; - nb0d_Out += aVec[0]; - nb2d_3_Out += Max(aVec[3],aVec[4]); - nb2d_4_Out += Max(aVec[5],aVec[6]); + nb0d_Out += aVec[SMDSEntity_Node]; + nb2d_3_Out += Max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]); + nb2d_4_Out += Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]); } int nb1d_Out = 0; TopTools_MapOfShape tmpMap; @@ -452,8 +452,8 @@ bool StdMeshers_RadialPrism_3D::Evaluate(SMESH_Mesh& aMesh, SMESH_subMesh *aSubMesh = aMesh.GetSubMesh(exp.Current()); MapShapeNbElemsItr anIt = aResMap.find(aSubMesh); std::vector aVec = (*anIt).second; - nb0d_Out += aVec[0]; - nb1d_Out += Max(aVec[1],aVec[2]); + nb0d_Out += aVec[SMDSEntity_Node]; + nb1d_Out += Max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]); } tmpMap.Clear(); for (TopExp_Explorer exp(outerShell, TopAbs_VERTEX); exp.More(); exp.Next()) { @@ -471,9 +471,9 @@ bool StdMeshers_RadialPrism_3D::Evaluate(SMESH_Mesh& aMesh, SMESH_subMesh *aSubMesh = aMesh.GetSubMesh(exp.Current()); MapShapeNbElemsItr anIt = aResMap.find(aSubMesh); std::vector aVec = (*anIt).second; - nb0d_In += aVec[0]; - nb2d_3_In += Max(aVec[3],aVec[4]); - nb2d_4_In += Max(aVec[5],aVec[6]); + nb0d_In += aVec[SMDSEntity_Node]; + nb2d_3_In += Max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]); + nb2d_4_In += Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]); } int nb1d_In = 0; tmpMap.Clear(); @@ -486,10 +486,10 @@ bool StdMeshers_RadialPrism_3D::Evaluate(SMESH_Mesh& aMesh, SMESH_subMesh *aSubMesh = aMesh.GetSubMesh(exp.Current()); MapShapeNbElemsItr anIt = aResMap.find(aSubMesh); std::vector aVec = (*anIt).second; - nb0d_In += aVec[0]; - nb1d_In += Max(aVec[1],aVec[2]); + nb0d_In += aVec[SMDSEntity_Node]; + nb1d_In += Max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]); if(IsFirst) { - IsQuadratic = (aVec[2] > aVec[1]); + IsQuadratic = (aVec[SMDSEntity_Quad_Edge] > aVec[SMDSEntity_Edge]); IsFirst = false; } } @@ -504,8 +504,8 @@ bool StdMeshers_RadialPrism_3D::Evaluate(SMESH_Mesh& aMesh, bool IsOK = (nb0d_Out==nb0d_In) && (nb1d_Out==nb1d_In) && (nb2d_3_Out==nb2d_3_In) && (nb2d_4_Out==nb2d_4_In); if(!IsOK) { - std::vector aResVec(17); - for(int i=0; i<17; i++) aResVec[i] = 0; + std::vector aResVec(SMDSEntity_Last); + for(int i=SMDSEntity_Node; iGetComputeError(); @@ -519,8 +519,8 @@ bool StdMeshers_RadialPrism_3D::Evaluate(SMESH_Mesh& aMesh, } if ( myDistributionHypo ) { if ( !myDistributionHypo->GetLayerDistribution() ) { - std::vector aResVec(17); - for(int i=0; i<17; i++) aResVec[i] = 0; + std::vector aResVec(SMDSEntity_Last); + for(int i=SMDSEntity_Node; iGetComputeError(); @@ -538,18 +538,18 @@ bool StdMeshers_RadialPrism_3D::Evaluate(SMESH_Mesh& aMesh, nbLayers = myLayerPositions.size() + 1; } - std::vector aResVec(17); - for(int i=0; i<17; i++) aResVec[i] = 0; + std::vector aResVec(SMDSEntity_Last); + for(int i=SMDSEntity_Node; i aVec(17); - for(int i=0; i<17; i++) aVec[i] = 0; + std::vector aVec(SMDSEntity_Last); + for(int i=SMDSEntity_Node; i params; @@ -993,12 +993,12 @@ bool StdMeshers_Regular_1D::Evaluate(SMESH_Mesh & theMesh, redistributeNearVertices( theMesh, C3d, length, params, VFirst, VLast ); if(_quadraticMesh) { - aVec[0] = 2*params.size() + 1; - aVec[2] = params.size() + 1; + aVec[SMDSEntity_Node] = 2*params.size() + 1; + aVec[SMDSEntity_Quad_Edge] = params.size() + 1; } else { - aVec[0] = params.size(); - aVec[1] = params.size() + 1; + aVec[SMDSEntity_Node] = params.size(); + aVec[SMDSEntity_Edge] = params.size() + 1; } } @@ -1006,12 +1006,12 @@ bool StdMeshers_Regular_1D::Evaluate(SMESH_Mesh & theMesh, //MESSAGE("************* Degenerated edge! *****************"); // Edge is a degenerated Edge : We put n = 5 points on the edge. if(_quadraticMesh) { - aVec[0] = 11; - aVec[2] = 6; + aVec[SMDSEntity_Node] = 11; + aVec[SMDSEntity_Quad_Edge] = 6; } else { - aVec[0] = 5; - aVec[1] = 6; + aVec[SMDSEntity_Node] = 5; + aVec[SMDSEntity_Edge] = 6; } }