<h2>Viscous Layers and Viscous Layers 2D</h2>
<b>Viscous Layers</b> and <b>Viscous Layers 2D </b> 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
<li><b>Total thickness</b> - gives the total thickness of element layers.</li>
<li><b>Number of layers</b> - defines the number of element layers.</li>
<li><b>Stretch factor</b> - defines the growth factor of element height
-from the mesh boundary inwards.</li>
-<li><b>Faces (Edges) without layers</b> - 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.</li>
+<li><b>Specified Edges are</b> - defines how the shapes specified by
+ the next parameter are used.
+<li><b>Faces without layers</b> and <b>Edges with/without layers</b> -
+ 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
+ (<b>Specified Edges are</b>). 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).
StdMeshersGUI_LayerDistributionParamWdg.h \
StdMeshersGUI_FixedPointsParamWdg.h \
StdMeshersGUI_SubShapeSelectorWdg.h \
- StdMeshersGUI_CartesianParamCreator.h
+ StdMeshersGUI_CartesianParamCreator.h \
+ StdMeshersGUI_RadioButtonsGrpWdg.h
# Libraries targets
lib_LTLIBRARIES = libStdMeshersGUI.la
StdMeshersGUI_LayerDistributionParamWdg.cxx \
StdMeshersGUI_FixedPointsParamWdg.cxx \
StdMeshersGUI_SubShapeSelectorWdg.cxx \
- StdMeshersGUI_CartesianParamCreator.cxx
+ StdMeshersGUI_CartesianParamCreator.cxx \
+ StdMeshersGUI_RadioButtonsGrpWdg.cxx
MOC_FILES = \
StdMeshersGUI_StdHypothesisCreator_moc.cxx \
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)
--- /dev/null
+// 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 <QVBoxLayout>
+#include <QRadioButton>
+#include <QButtonGroup>
+#include <QStringList>
+
+#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();
+}
--- /dev/null
+// 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 <QGroupBox>
+
+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
#include "StdMeshersGUI_ObjectReferenceParamWdg.h"
#include "StdMeshersGUI_QuadrangleParamWdg.h"
#include "StdMeshersGUI_SubShapeSelectorWdg.h"
+#include "StdMeshersGUI_RadioButtonsGrpWdg.h"
#include <SALOMEDSClient_Study.hxx>
#include <QSlider>
#include <QLabel>
#include <QCheckBox>
+#include <QButtonGroup>
const double VALUE_MAX = 1.0e+15, // COORD_MAX
VALUE_MAX_2 = VALUE_MAX * VALUE_MAX,
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" )
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 =
idsWg->SetGeomShapeEntry( aMainEntry );
idsWg->SetMainShapeEntry( aMainEntry );
- idsWg->SetListOfIDs( h->GetIgnoreEdges() );
+ idsWg->SetListOfIDs( h->GetEdges() );
idsWg->showPreview( true );
customWidgets()->append ( idsWg );
}
//param.myValue = w->isChecked();
return true;
}
+ if ( widget->inherits( "StdMeshersGUI_RadioButtonsGrpWdg" ))
+ {
+ const StdMeshersGUI_RadioButtonsGrpWdg * w =
+ static_cast<const StdMeshersGUI_RadioButtonsGrpWdg*>( widget );
+ param.myValue = w->checkedId();
+ return true;
+ }
return false;
}
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" ));
+ }
+ }
}
//================================================================================
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="en_US">
+<context>
+ <name>StdMeshersGUI_StdHypothesisCreator</name>
+ <message>
+ <source>TO_IGNORE_EDGES_OR_NOT</source>
+ <translation>Specified edges are</translation>
+ </message>
+ <message>
+ <source>NOT_TO_IGNORE_EDGES</source>
+ <translation>Edges with layers (walls)</translation>
+ </message>
+ <message>
+ <source>TO_IGNORE_EDGES</source>
+ <translation>Edges without layers (inlets and oulets)</translation>
+ </message>
+</context>
<context>
<name>@default</name>
<message>
</message>
<message>
<source>SMESH_EDGES_WO_LAYERS</source>
- <translation>Edges without layers
-(inlets and oulets)</translation>
+ <translation>Edges without layers</translation>
+ </message>
+ <message>
+ <source>SMESH_FACES_WITH_LAYERS</source>
+ <translation>Faces with layers
+(walls)</translation>
+ </message>
+ <message>
+ <source>SMESH_EDGES_WITH_LAYERS</source>
+ <translation>Edges with layers</translation>
</message>
<message>
<source>SMESH_MAX_LENGTH_TITLE</source>
*/
//================================================================================
-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<int> 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 << " )";
}
//================================================================================
*/
//================================================================================
-SMESH::long_array* StdMeshers_ViscousLayers2D_i::GetIgnoreEdges()
+void StdMeshers_ViscousLayers2D_i::SetIgnoreEdges(const ::SMESH::long_array& edgeIDs)
+ throw ( SALOME::SALOME_Exception )
{
- vector<int> idsVec = GetImpl()->GetBndShapesToIgnore();
+ SMESH::TPythonDump pyDump;
+ this->SetEdges( edgeIDs, true );
+ pyDump<< _this() << ".SetIgnoreEdges( " << edgeIDs << " )";
+}
+
+//================================================================================
+/*!
+ * \brief
+ */
+//================================================================================
+
+SMESH::long_array* StdMeshers_ViscousLayers2D_i::GetEdges()
+{
+ vector<int> idsVec = GetImpl()->GetBndShapes();
SMESH::long_array_var ids = new SMESH::long_array;
ids->length( idsVec.size() );
for ( unsigned i = 0; i < idsVec.size(); ++i )
*/
//================================================================================
+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 )
{
// 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();
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 << " )";
}
SMESH::long_array* StdMeshers_ViscousLayers_i::GetIgnoreFaces()
{
- vector<int> 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<int> idsVec = GetImpl()->GetBndShapes();
+ ids->length( idsVec.size() );
+ for ( unsigned i = 0; i < idsVec.size(); ++i )
+ ids[i] = idsVec[i];
+ }
return ids._retn();
}