From: eap Date: Thu, 30 May 2013 14:17:56 +0000 (+0000) Subject: 0022104: EDF 2550 SMESH: 2D viscous layer, allow specifying edges with viscous layer X-Git-Tag: V7_3_0a1~374 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=62c442d05faf338dd2a7c14a6c175a588735bbe4;p=modules%2Fsmesh.git 0022104: EDF 2550 SMESH: 2D viscous layer, allow specifying edges with viscous layer --- diff --git a/doc/salome/gui/SMESH/images/viscous_layers_hyp.png b/doc/salome/gui/SMESH/images/viscous_layers_hyp.png index 843ff5d09..9c9930317 100644 Binary files a/doc/salome/gui/SMESH/images/viscous_layers_hyp.png and b/doc/salome/gui/SMESH/images/viscous_layers_hyp.png differ diff --git a/doc/salome/gui/SMESH/input/additional_hypo.doc b/doc/salome/gui/SMESH/input/additional_hypo.doc index 98353ed25..a4699a032 100644 --- a/doc/salome/gui/SMESH/input/additional_hypo.doc +++ b/doc/salome/gui/SMESH/input/additional_hypo.doc @@ -53,8 +53,8 @@ segments on all four sides of the face must be even (divisible by 2).

Viscous Layers and Viscous Layers 2D

Viscous Layers and Viscous Layers 2D additional -hypotheses can be used together with some 3D algorithms, for example, -Hexahedron(i,j,k) or 2D algorithms, for example, Triangle +hypotheses can be used together with either some 3D algorithms, for example +Hexahedron(i,j,k), or 2D algorithms, for example Triangle (MEFISTO), correspondingly. These hypotheses allow creation of layers of highly stretched elements, prisms in 3D and quadrilaterals in 2D, near mesh boundary, which is beneficial for high quality viscous @@ -67,13 +67,20 @@ computations.
  • Total thickness - gives the total thickness of element layers.
  • Number of layers - defines the number of element layers.
  • Stretch factor - defines the growth factor of element height -from the mesh boundary inwards.
  • -
  • Faces (Edges) without layers - defines geometrical faces - (or edges in 2D) on which element layers should not be - constructed. By default the element layers are not constructed on - geometrical faces shared by solids (and edges shared by faces in 2D). + from the mesh boundary inwards.
  • +
  • Specified Edges are - defines how the shapes specified by + the next parameter are used. +
  • Faces without layers and Edges with/without layers - + in the 3D case it defines geometrical faces on which element layers + should not be constructed; in the 2D case it defines geometrical edges + on which element layers either should be or should not be + constructed, depending on the value of the previous parameter + (Specified Edges are). Whatever shapes are specified by this + parameter, the element layers are not constructed on geometrical + faces shared by several solids in 3D case and edges shared by + several faces in 2D case. \note A mesh shown in the 3D Viewer can prevent selection of faces - and edges, in this case just hide the mesh. To avoid a long wait when a + and edges, just hide the mesh to avoid this. To avoid a long wait when a geometry with many faces (or edges) is displayed, the number of faces (edges) shown at a time is limited by the value of "Sub-shapes preview chunk size" preference (in Preferences/Mesh/General tab). diff --git a/src/StdMeshersGUI/Makefile.am b/src/StdMeshersGUI/Makefile.am index 8fc16589c..da78f1cd9 100644 --- a/src/StdMeshersGUI/Makefile.am +++ b/src/StdMeshersGUI/Makefile.am @@ -35,7 +35,8 @@ salomeinclude_HEADERS = \ StdMeshersGUI_LayerDistributionParamWdg.h \ StdMeshersGUI_FixedPointsParamWdg.h \ StdMeshersGUI_SubShapeSelectorWdg.h \ - StdMeshersGUI_CartesianParamCreator.h + StdMeshersGUI_CartesianParamCreator.h \ + StdMeshersGUI_RadioButtonsGrpWdg.h # Libraries targets lib_LTLIBRARIES = libStdMeshersGUI.la @@ -51,7 +52,8 @@ dist_libStdMeshersGUI_la_SOURCES = \ StdMeshersGUI_LayerDistributionParamWdg.cxx \ StdMeshersGUI_FixedPointsParamWdg.cxx \ StdMeshersGUI_SubShapeSelectorWdg.cxx \ - StdMeshersGUI_CartesianParamCreator.cxx + StdMeshersGUI_CartesianParamCreator.cxx \ + StdMeshersGUI_RadioButtonsGrpWdg.cxx MOC_FILES = \ StdMeshersGUI_StdHypothesisCreator_moc.cxx \ @@ -63,7 +65,8 @@ MOC_FILES = \ StdMeshersGUI_LayerDistributionParamWdg_moc.cxx \ StdMeshersGUI_FixedPointsParamWdg_moc.cxx \ StdMeshersGUI_SubShapeSelectorWdg_moc.cxx \ - StdMeshersGUI_CartesianParamCreator_moc.cxx + StdMeshersGUI_CartesianParamCreator_moc.cxx \ + StdMeshersGUI_RadioButtonsGrpWdg_moc.cxx nodist_libStdMeshersGUI_la_SOURCES= \ $(MOC_FILES) diff --git a/src/StdMeshersGUI/StdMeshersGUI_RadioButtonsGrpWdg.cxx b/src/StdMeshersGUI/StdMeshersGUI_RadioButtonsGrpWdg.cxx new file mode 100644 index 000000000..cca80aa17 --- /dev/null +++ b/src/StdMeshersGUI/StdMeshersGUI_RadioButtonsGrpWdg.cxx @@ -0,0 +1,82 @@ +// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// +// 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 +// +#include "StdMeshersGUI_RadioButtonsGrpWdg.h" + +#include +#include +#include +#include + +#define SPACING 6 +#define MARGIN 11 + +//================================================================================ +/*! + * \brief Creates a QGroupBox with a given title + */ +//================================================================================ + +StdMeshersGUI_RadioButtonsGrpWdg::StdMeshersGUI_RadioButtonsGrpWdg( const QString& title ) + : QGroupBox( title ) +{ + myButtonGrp = new QButtonGroup( this ); +} + +//================================================================================ +/*! + * \brief Creates a given nubmer of button labels with given labels (QString's) + */ +//================================================================================ + +void StdMeshersGUI_RadioButtonsGrpWdg::setButtonLabels( const QStringList& buttonLabels ) +{ + QVBoxLayout* layout = new QVBoxLayout( this ); + layout->setSpacing(SPACING); + layout->setMargin(MARGIN); + + for ( int id = 0; id < buttonLabels.size(); ++id ) + { + QRadioButton* button = new QRadioButton( buttonLabels.at(id), this ); + layout->addWidget( button ); + myButtonGrp->addButton( button, id ); + } +} + +//================================================================================ +/*! + * \brief Set checked a radio button with a give id. + */ +//================================================================================ + +void StdMeshersGUI_RadioButtonsGrpWdg::setChecked(int id) +{ + if ( QAbstractButton* but = myButtonGrp->button( id )) + but->setChecked( true ); +} + +//================================================================================ +/*! + * \brief Return id (zero based) of a checked radio button + */ +//================================================================================ + +int StdMeshersGUI_RadioButtonsGrpWdg::checkedId () const +{ + return myButtonGrp->checkedId(); +} diff --git a/src/StdMeshersGUI/StdMeshersGUI_RadioButtonsGrpWdg.h b/src/StdMeshersGUI/StdMeshersGUI_RadioButtonsGrpWdg.h new file mode 100644 index 000000000..fd8be84a2 --- /dev/null +++ b/src/StdMeshersGUI/StdMeshersGUI_RadioButtonsGrpWdg.h @@ -0,0 +1,53 @@ +// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// +// 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 +// +#ifndef STDMESHERSGUI_RadioButtonsGrpWdg_H +#define STDMESHERSGUI_RadioButtonsGrpWdg_H + +// SMESH includes +#include "SMESH_StdMeshersGUI.hxx" + +// Qt includes +#include + +class QButtonGroup; +class QStringList; + +/*! + * \brief A QGroupBox holding several radio buttons + */ +class STDMESHERSGUI_EXPORT StdMeshersGUI_RadioButtonsGrpWdg : public QGroupBox +{ + Q_OBJECT + +public: + StdMeshersGUI_RadioButtonsGrpWdg (const QString& title); + + void setButtonLabels( const QStringList& buttonLabels ); + + void setChecked(int id); + + int checkedId() const; + + QButtonGroup* getButtonGroup() { return myButtonGrp; } + +private: + QButtonGroup* myButtonGrp; +}; + +#endif // STDMESHERSGUI_RadioButtonsGrpWdg_H diff --git a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx index 1c6007296..493235b15 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx @@ -39,6 +39,7 @@ #include "StdMeshersGUI_ObjectReferenceParamWdg.h" #include "StdMeshersGUI_QuadrangleParamWdg.h" #include "StdMeshersGUI_SubShapeSelectorWdg.h" +#include "StdMeshersGUI_RadioButtonsGrpWdg.h" #include @@ -58,6 +59,7 @@ #include #include #include +#include const double VALUE_MAX = 1.0e+15, // COORD_MAX VALUE_MAX_2 = VALUE_MAX * VALUE_MAX, @@ -708,10 +710,10 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const h->SetVarParameter( params[2].text(), "SetStretchFactor" ); h->SetStretchFactor ( params[2].myValue.toDouble() ); - if ( StdMeshersGUI_SubShapeSelectorWdg* idsWg = - widget< StdMeshersGUI_SubShapeSelectorWdg >( 3 )) + if ( StdMeshersGUI_SubShapeSelectorWdg* idsWg = + widget< StdMeshersGUI_SubShapeSelectorWdg >( 4 )) { - h->SetIgnoreEdges( idsWg->GetListOfIDs() ); + h->SetEdges( idsWg->GetListOfIDs(), params[3].myValue.toInt() ); } } else if( hypType()=="QuadrangleParams" ) @@ -1198,7 +1200,19 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry(); if ( !aMainEntry.isEmpty() ) { - item.myName = tr( "SMESH_EDGES_WO_LAYERS" ); + item.myName = tr("TO_IGNORE_EDGES_OR_NOT"); + p.append( item ); + + StdMeshersGUI_RadioButtonsGrpWdg* ignoreWdg = new StdMeshersGUI_RadioButtonsGrpWdg(""); + ignoreWdg->setButtonLabels ( QStringList() + << tr("NOT_TO_IGNORE_EDGES") + << tr("TO_IGNORE_EDGES") ); + ignoreWdg->setChecked( h->GetIsToIgnoreEdges() ); + connect(ignoreWdg->getButtonGroup(),SIGNAL(buttonClicked(int)),this,SLOT(onValueChanged())); + customWidgets()->append( ignoreWdg ); + + item.myName = + tr( h->GetIsToIgnoreEdges() ? "SMESH_EDGES_WO_LAYERS" : "SMESH_EDGES_WITH_LAYERS" ); p.append( item ); StdMeshersGUI_SubShapeSelectorWdg* idsWg = @@ -1206,7 +1220,7 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const idsWg->SetGeomShapeEntry( aMainEntry ); idsWg->SetMainShapeEntry( aMainEntry ); - idsWg->SetListOfIDs( h->GetIgnoreEdges() ); + idsWg->SetListOfIDs( h->GetEdges() ); idsWg->showPreview( true ); customWidgets()->append ( idsWg ); } @@ -1489,6 +1503,13 @@ bool StdMeshersGUI_StdHypothesisCreator::getParamFromCustomWidget( StdParam & pa //param.myValue = w->isChecked(); return true; } + if ( widget->inherits( "StdMeshersGUI_RadioButtonsGrpWdg" )) + { + const StdMeshersGUI_RadioButtonsGrpWdg * w = + static_cast( widget ); + param.myValue = w->checkedId(); + return true; + } return false; } @@ -1539,6 +1560,14 @@ void StdMeshersGUI_StdHypothesisCreator::valueChanged( QWidget* paramWidget) toCopyGroups->setEnabled( true ); } } + else if ( hypType() == "ViscousLayers2D" && paramWidget->inherits("QButtonGroup")) + { + if ( QLabel* label = getLabel(4) ) + { + bool toIgnore = widget< StdMeshersGUI_RadioButtonsGrpWdg >( 3 )->checkedId(); + label->setText( tr( toIgnore ? "SMESH_EDGES_WO_LAYERS" : "SMESH_EDGES_WITH_LAYERS" )); + } + } } //================================================================================ diff --git a/src/StdMeshersGUI/StdMeshers_msg_en.ts b/src/StdMeshersGUI/StdMeshers_msg_en.ts index 2b506311f..cfc5d535d 100644 --- a/src/StdMeshersGUI/StdMeshers_msg_en.ts +++ b/src/StdMeshersGUI/StdMeshers_msg_en.ts @@ -1,6 +1,21 @@ + + StdMeshersGUI_StdHypothesisCreator + + TO_IGNORE_EDGES_OR_NOT + Specified edges are + + + NOT_TO_IGNORE_EDGES + Edges with layers (walls) + + + TO_IGNORE_EDGES + Edges without layers (inlets and oulets) + + @default @@ -170,8 +185,16 @@ SMESH_EDGES_WO_LAYERS - Edges without layers -(inlets and oulets) + Edges without layers + + + SMESH_FACES_WITH_LAYERS + Faces with layers +(walls) + + + SMESH_EDGES_WITH_LAYERS + Edges with layers SMESH_MAX_LENGTH_TITLE diff --git a/src/StdMeshers_I/StdMeshers_ViscousLayers2D_i.cxx b/src/StdMeshers_I/StdMeshers_ViscousLayers2D_i.cxx index bd709e593..e26f4cae5 100644 --- a/src/StdMeshers_I/StdMeshers_ViscousLayers2D_i.cxx +++ b/src/StdMeshers_I/StdMeshers_ViscousLayers2D_i.cxx @@ -77,15 +77,18 @@ StdMeshers_ViscousLayers2D_i::~StdMeshers_ViscousLayers2D_i() */ //================================================================================ -void StdMeshers_ViscousLayers2D_i::SetIgnoreEdges(const ::SMESH::long_array& edgeIDs) -throw ( SALOME::SALOME_Exception ) +void StdMeshers_ViscousLayers2D_i::SetEdges(const ::SMESH::long_array& edgeIDs, + CORBA::Boolean toIgnore) + throw ( SALOME::SALOME_Exception ) { vector ids( edgeIDs.length() ); for ( unsigned i = 0; i < ids.size(); ++i ) if (( ids[i] = edgeIDs[i] ) < 1 ) THROW_SALOME_CORBA_EXCEPTION( "Invalid edge id", SALOME::BAD_PARAM ); - GetImpl()->SetBndShapesToIgnore( ids ); - SMESH::TPythonDump() << _this() << ".SetIgnoreEdges( " << edgeIDs << " )"; + + GetImpl()->SetBndShapes( ids, toIgnore ); + + SMESH::TPythonDump() << _this() << ".SetEdges( " << edgeIDs << ", " << toIgnore << " )"; } //================================================================================ @@ -94,9 +97,23 @@ throw ( SALOME::SALOME_Exception ) */ //================================================================================ -SMESH::long_array* StdMeshers_ViscousLayers2D_i::GetIgnoreEdges() +void StdMeshers_ViscousLayers2D_i::SetIgnoreEdges(const ::SMESH::long_array& edgeIDs) + throw ( SALOME::SALOME_Exception ) { - vector idsVec = GetImpl()->GetBndShapesToIgnore(); + SMESH::TPythonDump pyDump; + this->SetEdges( edgeIDs, true ); + pyDump<< _this() << ".SetIgnoreEdges( " << edgeIDs << " )"; +} + +//================================================================================ +/*! + * \brief + */ +//================================================================================ + +SMESH::long_array* StdMeshers_ViscousLayers2D_i::GetEdges() +{ + vector idsVec = GetImpl()->GetBndShapes(); SMESH::long_array_var ids = new SMESH::long_array; ids->length( idsVec.size() ); for ( unsigned i = 0; i < idsVec.size(); ++i ) @@ -110,6 +127,30 @@ SMESH::long_array* StdMeshers_ViscousLayers2D_i::GetIgnoreEdges() */ //================================================================================ +SMESH::long_array* StdMeshers_ViscousLayers2D_i::GetIgnoreEdges() +{ + if ( GetImpl()->IsToIgnoreShapes() ) + return this->GetEdges(); + return new SMESH::long_array; +} + +//================================================================================ +/*! + * \brief + */ +//================================================================================ + +CORBA::Boolean StdMeshers_ViscousLayers2D_i::GetIsToIgnoreEdges() +{ + return GetImpl()->IsToIgnoreShapes(); +} + +//================================================================================ +/*! + * \brief + */ +//================================================================================ + void StdMeshers_ViscousLayers2D_i::SetTotalThickness(::CORBA::Double thickness) throw ( SALOME::SALOME_Exception ) { diff --git a/src/StdMeshers_I/StdMeshers_ViscousLayers2D_i.hxx b/src/StdMeshers_I/StdMeshers_ViscousLayers2D_i.hxx index 68723365c..91b072146 100644 --- a/src/StdMeshers_I/StdMeshers_ViscousLayers2D_i.hxx +++ b/src/StdMeshers_I/StdMeshers_ViscousLayers2D_i.hxx @@ -48,9 +48,14 @@ class STDMESHERS_I_EXPORT StdMeshers_ViscousLayers2D_i: // Destructor virtual ~StdMeshers_ViscousLayers2D_i(); - void SetIgnoreEdges(const ::SMESH::long_array& edgeIDs) throw ( SALOME::SALOME_Exception ); + void SetIgnoreEdges(const SMESH::long_array& edgeIDs) throw ( SALOME::SALOME_Exception ); SMESH::long_array* GetIgnoreEdges(); + void SetEdges(const SMESH::long_array& edgeIDs, + CORBA::Boolean toIgnore) throw (SALOME::SALOME_Exception); + SMESH::long_array* GetEdges(); + CORBA::Boolean GetIsToIgnoreEdges(); + void SetTotalThickness(::CORBA::Double thickness) throw ( SALOME::SALOME_Exception ); ::CORBA::Double GetTotalThickness(); diff --git a/src/StdMeshers_I/StdMeshers_ViscousLayers_i.cxx b/src/StdMeshers_I/StdMeshers_ViscousLayers_i.cxx index 99f7f1d6b..5ad82c7ec 100644 --- a/src/StdMeshers_I/StdMeshers_ViscousLayers_i.cxx +++ b/src/StdMeshers_I/StdMeshers_ViscousLayers_i.cxx @@ -85,7 +85,7 @@ throw ( SALOME::SALOME_Exception ) for ( unsigned i = 0; i < ids.size(); ++i ) if (( ids[i] = faceIDs[i] ) < 1 ) THROW_SALOME_CORBA_EXCEPTION( "Invalid face id", SALOME::BAD_PARAM ); - GetImpl()->SetBndShapesToIgnore( ids ); + GetImpl()->SetBndShapes( ids, /*toIgnore=*/true ); SMESH::TPythonDump() << _this() << ".SetIgnoreFaces( " << faceIDs << " )"; } @@ -97,11 +97,14 @@ throw ( SALOME::SALOME_Exception ) SMESH::long_array* StdMeshers_ViscousLayers_i::GetIgnoreFaces() { - vector idsVec = GetImpl()->GetBndShapesToIgnore(); SMESH::long_array_var ids = new SMESH::long_array; - ids->length( idsVec.size() ); - for ( unsigned i = 0; i < idsVec.size(); ++i ) - ids[i] = idsVec[i]; + if ( GetImpl()->IsToIgnoreShapes() ) + { + vector idsVec = GetImpl()->GetBndShapes(); + ids->length( idsVec.size() ); + for ( unsigned i = 0; i < idsVec.size(); ++i ) + ids[i] = idsVec[i]; + } return ids._retn(); }