mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-30 19:30:35 +05:00
0021859: SMESH : Add conversion from QUAD8 to QUAD9 and from HEXA20 to HEXA27
This commit is contained in:
parent
acf3857e67
commit
91a2b8aad9
@ -27,6 +27,8 @@
|
|||||||
//
|
//
|
||||||
#include "SMESHGUI_ConvToQuadDlg.h"
|
#include "SMESHGUI_ConvToQuadDlg.h"
|
||||||
|
|
||||||
|
#include "SMESHGUI_ConvToQuadOp.h"
|
||||||
|
|
||||||
// Qt includes
|
// Qt includes
|
||||||
#include <QGroupBox>
|
#include <QGroupBox>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
@ -62,14 +64,17 @@ SMESHGUI_ConvToQuadDlg::SMESHGUI_ConvToQuadDlg()
|
|||||||
aBGLayout->setMargin(MARGIN);
|
aBGLayout->setMargin(MARGIN);
|
||||||
aBGLayout->setSpacing(SPACING);
|
aBGLayout->setSpacing(SPACING);
|
||||||
|
|
||||||
myRB1 = new QRadioButton( tr( "RADIOBTN_1" ), myBGBox );
|
myRB2Lin = new QRadioButton( tr( "RADIOBTN_1" ), myBGBox );
|
||||||
myRB2 = new QRadioButton( tr( "RADIOBTN_2" ), myBGBox );
|
myRB2Quad = new QRadioButton( tr( "RADIOBTN_2" ), myBGBox );
|
||||||
|
myRB2BiQua = new QRadioButton( tr( "RADIOBTN_3" ), myBGBox );
|
||||||
|
|
||||||
aBGLayout->addWidget(myRB1);
|
aBGLayout->addWidget(myRB2Lin);
|
||||||
aBGLayout->addWidget(myRB2);
|
aBGLayout->addWidget(myRB2Quad);
|
||||||
myBG->addButton(myRB1, 0);
|
aBGLayout->addWidget(myRB2BiQua);
|
||||||
myBG->addButton(myRB2, 1);
|
myBG->addButton(myRB2Lin, 0);
|
||||||
myRB1->setChecked( true );
|
myBG->addButton(myRB2Quad, 1);
|
||||||
|
myBG->addButton(myRB2BiQua, 2);
|
||||||
|
myRB2Lin->setChecked( true );
|
||||||
|
|
||||||
myWarning = new QLabel(QString("<b>%1</b>").arg(tr("NON_CONFORM_WARNING")), mainFrame());
|
myWarning = new QLabel(QString("<b>%1</b>").arg(tr("NON_CONFORM_WARNING")), mainFrame());
|
||||||
|
|
||||||
@ -92,6 +97,11 @@ SMESHGUI_ConvToQuadDlg::~SMESHGUI_ConvToQuadDlg()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SMESHGUI_ConvToQuadDlg::IsBiQuadratic() const
|
||||||
|
{
|
||||||
|
return myRB2BiQua->isChecked();
|
||||||
|
}
|
||||||
|
|
||||||
bool SMESHGUI_ConvToQuadDlg::IsMediumNdsOnGeom() const
|
bool SMESHGUI_ConvToQuadDlg::IsMediumNdsOnGeom() const
|
||||||
{
|
{
|
||||||
return !myMedNdsOnGeom->isChecked();
|
return !myMedNdsOnGeom->isChecked();
|
||||||
@ -133,27 +143,32 @@ bool SMESHGUI_ConvToQuadDlg::isWarningShown()
|
|||||||
void SMESHGUI_ConvToQuadDlg::SetEnabledControls( const bool theCheck )
|
void SMESHGUI_ConvToQuadDlg::SetEnabledControls( const bool theCheck )
|
||||||
{
|
{
|
||||||
//myBGBox->setEnabled( theCheck );
|
//myBGBox->setEnabled( theCheck );
|
||||||
myRB1->setEnabled( theCheck );
|
myRB2Lin->setEnabled( theCheck );
|
||||||
myRB2->setEnabled( theCheck );
|
myRB2Quad->setEnabled( theCheck );
|
||||||
|
myRB2BiQua->setEnabled( theCheck );
|
||||||
myMedNdsOnGeom->setEnabled( theCheck );
|
myMedNdsOnGeom->setEnabled( theCheck );
|
||||||
//setButtonEnabled( theCheck, QtxDialog::OK | QtxDialog::Apply );
|
//setButtonEnabled( theCheck, QtxDialog::OK | QtxDialog::Apply );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SMESHGUI_ConvToQuadDlg::SetEnabledRB( const int idx, const bool theCheck )
|
void SMESHGUI_ConvToQuadDlg::SetEnabledRB( const int idx, const bool theCheck )
|
||||||
{
|
{
|
||||||
if(idx)
|
myRB2Lin ->setEnabled( idx & SMESHGUI_ConvToQuadOp::Linear );
|
||||||
|
myRB2Quad ->setEnabled( idx & SMESHGUI_ConvToQuadOp::Quadratic );
|
||||||
|
myRB2BiQua->setEnabled( idx & SMESHGUI_ConvToQuadOp::BiQuadratic );
|
||||||
|
|
||||||
|
if ( idx & SMESHGUI_ConvToQuadOp::Linear )
|
||||||
{
|
{
|
||||||
myRB2->setEnabled( theCheck );
|
myRB2Lin->setChecked( true );
|
||||||
myRB1->setEnabled( !theCheck );
|
myRB2Quad->setChecked( false );
|
||||||
myRB1->setChecked( true );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
myRB1->setEnabled( theCheck );
|
myRB2Lin->setChecked( false );
|
||||||
myRB2->setEnabled( !theCheck );
|
myRB2Quad->setChecked( true );
|
||||||
myRB2->setChecked( true );
|
|
||||||
}
|
}
|
||||||
|
myRB2BiQua->setChecked( false );
|
||||||
|
|
||||||
|
myMedNdsOnGeom->setEnabled( theCheck );
|
||||||
|
|
||||||
emit onClicked( myBG->checkedId() );
|
emit onClicked( myBG->checkedId() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,6 +56,7 @@ public:
|
|||||||
int CurrentRB(); //returns the ID of the selected toggle button
|
int CurrentRB(); //returns the ID of the selected toggle button
|
||||||
void ShowWarning(bool);
|
void ShowWarning(bool);
|
||||||
bool isWarningShown();
|
bool isWarningShown();
|
||||||
|
bool IsBiQuadratic() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void onClicked( int );
|
void onClicked( int );
|
||||||
@ -64,8 +65,9 @@ private:
|
|||||||
QCheckBox* myMedNdsOnGeom;
|
QCheckBox* myMedNdsOnGeom;
|
||||||
QGroupBox* myBGBox;
|
QGroupBox* myBGBox;
|
||||||
QButtonGroup* myBG;
|
QButtonGroup* myBG;
|
||||||
QRadioButton* myRB1;
|
QRadioButton* myRB2Lin;
|
||||||
QRadioButton* myRB2;
|
QRadioButton* myRB2Quad;
|
||||||
|
QRadioButton* myRB2BiQua;
|
||||||
QLabel* myWarning;
|
QLabel* myWarning;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -142,19 +142,10 @@ void SMESHGUI_ConvToQuadOp::selectionDone()
|
|||||||
myDlg->setButtonEnabled( false, QtxDialog::OK | QtxDialog::Apply );
|
myDlg->setButtonEnabled( false, QtxDialog::OK | QtxDialog::Apply );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MeshType meshType = ConsistMesh( idSource );
|
SMESH::SMESH_Mesh_var mesh = idSource->GetMesh();
|
||||||
if( meshType == SMESHGUI_ConvToQuadOp::Quadratic )
|
bool hasGeom = mesh->HasShapeToMesh();
|
||||||
{
|
MeshDestinationType meshTgtType = DestinationMesh( idSource );
|
||||||
myDlg->SetEnabledRB( 0, false );
|
myDlg->SetEnabledRB( meshTgtType, hasGeom && ( meshTgtType & ( BiQuadratic | Quadratic )));
|
||||||
}
|
|
||||||
else if( meshType == SMESHGUI_ConvToQuadOp::Linear )
|
|
||||||
{
|
|
||||||
myDlg->SetEnabledRB( 1, false );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
myDlg->SetEnabledControls( true );
|
|
||||||
}
|
|
||||||
|
|
||||||
// show warning on non-conformal result mesh
|
// show warning on non-conformal result mesh
|
||||||
if ( ! idSource->_is_nil() )
|
if ( ! idSource->_is_nil() )
|
||||||
@ -166,8 +157,9 @@ void SMESHGUI_ConvToQuadOp::selectionDone()
|
|||||||
{
|
{
|
||||||
SMESH::SMESH_Mesh_var mesh = idSource->GetMesh();
|
SMESH::SMESH_Mesh_var mesh = idSource->GetMesh();
|
||||||
idSource = SMESH::SMESH_IDSource::_narrow( mesh );
|
idSource = SMESH::SMESH_IDSource::_narrow( mesh );
|
||||||
MeshType fullMeshType = ConsistMesh( idSource );
|
bool isMixOrder;
|
||||||
toShow = ( fullMeshType != Comp );
|
DestinationMesh( idSource, &isMixOrder );
|
||||||
|
toShow = !isMixOrder;
|
||||||
}
|
}
|
||||||
myDlg->ShowWarning( toShow );
|
myDlg->ShowWarning( toShow );
|
||||||
}
|
}
|
||||||
@ -241,17 +233,20 @@ bool SMESHGUI_ConvToQuadOp::onApply()
|
|||||||
SMESH::SMESH_MeshEditor_var aEditor = mesh->GetMeshEditor();
|
SMESH::SMESH_MeshEditor_var aEditor = mesh->GetMeshEditor();
|
||||||
aResult = true;
|
aResult = true;
|
||||||
SMESH::SMESH_Mesh_var sourceMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( pObj );
|
SMESH::SMESH_Mesh_var sourceMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( pObj );
|
||||||
if( !myDlg->CurrentRB() )
|
if( myDlg->CurrentRB()==1 || myDlg->CurrentRB()==2)
|
||||||
{
|
{
|
||||||
bool force3d = true;
|
bool force3d = true;
|
||||||
if( myDlg->IsEnabledCheck() )
|
if( myDlg->IsEnabledCheck() )
|
||||||
force3d = myDlg->IsMediumNdsOnGeom();
|
force3d = myDlg->IsMediumNdsOnGeom();
|
||||||
|
bool theToBiQuad = myDlg->IsBiQuadratic();
|
||||||
if ( sourceMesh->_is_nil() )
|
if ( sourceMesh->_is_nil() ) {
|
||||||
aEditor->ConvertToQuadraticObject( force3d, idSource );
|
if ( theToBiQuad ) aEditor->ConvertToBiQuadratic ( force3d, idSource );
|
||||||
else
|
else aEditor->ConvertToQuadraticObject( force3d, idSource );
|
||||||
aEditor->ConvertToQuadratic( force3d );
|
}
|
||||||
|
else {
|
||||||
|
if ( theToBiQuad ) aEditor->ConvertToBiQuadratic( force3d, sourceMesh );
|
||||||
|
else aEditor->ConvertToQuadratic ( force3d );
|
||||||
|
}
|
||||||
if ( !force3d )
|
if ( !force3d )
|
||||||
{
|
{
|
||||||
SMESH::ComputeError_var error = aEditor->GetLastError();
|
SMESH::ComputeError_var error = aEditor->GetLastError();
|
||||||
@ -259,7 +254,7 @@ bool SMESHGUI_ConvToQuadOp::onApply()
|
|||||||
{
|
{
|
||||||
if ( myBadElemsPreview ) delete myBadElemsPreview; // viewWindow may change
|
if ( myBadElemsPreview ) delete myBadElemsPreview; // viewWindow may change
|
||||||
myBadElemsPreview = new SMESHGUI_MeshEditPreview( viewWindow() );
|
myBadElemsPreview = new SMESHGUI_MeshEditPreview( viewWindow() );
|
||||||
|
|
||||||
vtkFloatingPointType aPointSize = SMESH::GetFloat("SMESH:node_size",3);
|
vtkFloatingPointType aPointSize = SMESH::GetFloat("SMESH:node_size",3);
|
||||||
vtkFloatingPointType aLineWidth = SMESH::GetFloat("SMESH:element_width",1);
|
vtkFloatingPointType aLineWidth = SMESH::GetFloat("SMESH:element_width",1);
|
||||||
vtkProperty* prop = vtkProperty::New();
|
vtkProperty* prop = vtkProperty::New();
|
||||||
@ -325,12 +320,23 @@ void SMESHGUI_ConvToQuadOp::onWarningWinFinished()
|
|||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
/*! ConsistMesh
|
/*! ConsistMesh
|
||||||
* Determines, what elements this mesh contains.
|
* Determines, what elements this mesh does not contain.
|
||||||
*/
|
*/
|
||||||
//================================================================================
|
//================================================================================
|
||||||
SMESHGUI_ConvToQuadOp::MeshType SMESHGUI_ConvToQuadOp::ConsistMesh( const SMESH::SMESH_IDSource_var& idSource) const
|
|
||||||
|
SMESHGUI_ConvToQuadOp::MeshDestinationType
|
||||||
|
SMESHGUI_ConvToQuadOp::DestinationMesh( const SMESH::SMESH_IDSource_var& idSource,
|
||||||
|
bool* isMixOrder) const
|
||||||
{
|
{
|
||||||
SMESH::long_array_var nbElemOfType = idSource->GetMeshInfo();
|
SMESH::long_array_var nbElemOfType = idSource->GetMeshInfo();
|
||||||
|
|
||||||
|
bool hasBiQuad = ( nbElemOfType[SMDSEntity_BiQuad_Quadrangle ] ||
|
||||||
|
nbElemOfType[SMDSEntity_TriQuad_Hexa ] );
|
||||||
|
bool hasLinStruct = ( nbElemOfType[SMDSEntity_Quadrangle ] ||
|
||||||
|
nbElemOfType[SMDSEntity_Hexa ] );
|
||||||
|
bool hasQuadStruct = ( nbElemOfType[SMDSEntity_Quad_Quadrangle ] ||
|
||||||
|
nbElemOfType[SMDSEntity_Quad_Hexa ] );
|
||||||
|
|
||||||
bool hasQuad = ( nbElemOfType[SMDSEntity_Quad_Edge ] ||
|
bool hasQuad = ( nbElemOfType[SMDSEntity_Quad_Edge ] ||
|
||||||
nbElemOfType[SMDSEntity_Quad_Triangle ] ||
|
nbElemOfType[SMDSEntity_Quad_Triangle ] ||
|
||||||
nbElemOfType[SMDSEntity_Quad_Quadrangle] ||
|
nbElemOfType[SMDSEntity_Quad_Quadrangle] ||
|
||||||
@ -347,9 +353,25 @@ SMESHGUI_ConvToQuadOp::MeshType SMESHGUI_ConvToQuadOp::ConsistMesh( const SMESH:
|
|||||||
nbElemOfType[SMDSEntity_Pyramid ] ||
|
nbElemOfType[SMDSEntity_Pyramid ] ||
|
||||||
nbElemOfType[SMDSEntity_Penta ] );
|
nbElemOfType[SMDSEntity_Penta ] );
|
||||||
|
|
||||||
if ( hasQuad && hasLin )
|
int tgtType = 0;
|
||||||
return Comp;
|
if ( hasBiQuad )
|
||||||
return hasQuad ? Quadratic : Linear;
|
tgtType |= ( Quadratic | Linear );
|
||||||
|
if ( hasLinStruct )
|
||||||
|
tgtType |= ( BiQuadratic | Quadratic );
|
||||||
|
if ( hasQuadStruct )
|
||||||
|
tgtType |= ( BiQuadratic | Linear );
|
||||||
|
if ( hasQuad )
|
||||||
|
tgtType |= Linear;
|
||||||
|
if ( hasLin )
|
||||||
|
tgtType |= Quadratic;
|
||||||
|
|
||||||
|
if ( tgtType == 0 )
|
||||||
|
tgtType = Quadratic;
|
||||||
|
|
||||||
|
if ( isMixOrder )
|
||||||
|
*isMixOrder = ( hasLin && ( hasQuad || hasBiQuad ));
|
||||||
|
|
||||||
|
return MeshDestinationType( tgtType );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SMESHGUI_ConvToQuadOp::ConnectRadioButtons( int id )
|
void SMESHGUI_ConvToQuadOp::ConnectRadioButtons( int id )
|
||||||
@ -364,7 +386,7 @@ void SMESHGUI_ConvToQuadOp::ConnectRadioButtons( int id )
|
|||||||
|
|
||||||
bool hasGeom = mesh->HasShapeToMesh();
|
bool hasGeom = mesh->HasShapeToMesh();
|
||||||
|
|
||||||
if( id || !hasGeom )
|
if( id==0 || !hasGeom )
|
||||||
myDlg->SetEnabledCheck( false );
|
myDlg->SetEnabledCheck( false );
|
||||||
else
|
else
|
||||||
myDlg->SetEnabledCheck( true );
|
myDlg->SetEnabledCheck( true );
|
||||||
|
@ -44,7 +44,7 @@ class SMESHGUI_EXPORT SMESHGUI_ConvToQuadOp : public SMESHGUI_SelectionOp
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum MeshType{ Comp = 0, Linear, Quadratic };
|
enum MeshDestinationType { Linear = 1, Quadratic = 2, BiQuadratic = 4 };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SMESHGUI_ConvToQuadOp();
|
SMESHGUI_ConvToQuadOp();
|
||||||
@ -56,7 +56,8 @@ protected:
|
|||||||
virtual void startOperation();
|
virtual void startOperation();
|
||||||
virtual void selectionDone();
|
virtual void selectionDone();
|
||||||
virtual SUIT_SelectionFilter* createFilter( const int ) const;
|
virtual SUIT_SelectionFilter* createFilter( const int ) const;
|
||||||
MeshType ConsistMesh( const SMESH::SMESH_IDSource_var& ) const;
|
MeshDestinationType DestinationMesh( const SMESH::SMESH_IDSource_var& ,
|
||||||
|
bool* isMixOrder = 0) const;
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
virtual bool onApply();
|
virtual bool onApply();
|
||||||
|
Loading…
Reference in New Issue
Block a user