Salome HOME
0022104: EDF 2550 SMESH: 2D viscous layer, allow specifying edges with viscous layer
authoreap <eap@opencascade.com>
Thu, 30 May 2013 14:17:56 +0000 (14:17 +0000)
committereap <eap@opencascade.com>
Thu, 30 May 2013 14:17:56 +0000 (14:17 +0000)
doc/salome/gui/SMESH/images/viscous_layers_hyp.png
doc/salome/gui/SMESH/input/additional_hypo.doc
src/StdMeshersGUI/Makefile.am
src/StdMeshersGUI/StdMeshersGUI_RadioButtonsGrpWdg.cxx [new file with mode: 0644]
src/StdMeshersGUI/StdMeshersGUI_RadioButtonsGrpWdg.h [new file with mode: 0644]
src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx
src/StdMeshersGUI/StdMeshers_msg_en.ts
src/StdMeshers_I/StdMeshers_ViscousLayers2D_i.cxx
src/StdMeshers_I/StdMeshers_ViscousLayers2D_i.hxx
src/StdMeshers_I/StdMeshers_ViscousLayers_i.cxx

index 843ff5d09adba4c7c6ed6b4c35b0f5345bfb1e74..9c99303174b63c523c1b60e0786734da882b99af 100644 (file)
Binary files a/doc/salome/gui/SMESH/images/viscous_layers_hyp.png and b/doc/salome/gui/SMESH/images/viscous_layers_hyp.png differ
index 98353ed256b0b828aafdd12da6d22ae1a296f01a..a4699a032ae92ef08abb7a7a2cd9793cdc7b08d9 100644 (file)
@@ -53,8 +53,8 @@ segments on all four sides of the face must be even (divisible by 2).
 <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
@@ -67,13 +67,20 @@ computations.
 <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).
index 8fc16589c6e03c401518411cc6f06b1938508c38..da78f1cd96d1b4932b059c09fb34fd8ef43152eb 100644 (file)
@@ -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 (file)
index 0000000..cca80aa
--- /dev/null
@@ -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 <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();
+}
diff --git a/src/StdMeshersGUI/StdMeshersGUI_RadioButtonsGrpWdg.h b/src/StdMeshersGUI/StdMeshersGUI_RadioButtonsGrpWdg.h
new file mode 100644 (file)
index 0000000..fd8be84
--- /dev/null
@@ -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 <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
index 1c60072962d6e207c182f31bb286f7327a67f640..493235b15b59aa1633bf0f0a62217d3f4964dd74 100644 (file)
@@ -39,6 +39,7 @@
 #include "StdMeshersGUI_ObjectReferenceParamWdg.h"
 #include "StdMeshersGUI_QuadrangleParamWdg.h"
 #include "StdMeshersGUI_SubShapeSelectorWdg.h"
+#include "StdMeshersGUI_RadioButtonsGrpWdg.h"
 
 #include <SALOMEDSClient_Study.hxx>
 
@@ -58,6 +59,7 @@
 #include <QSlider>
 #include <QLabel>
 #include <QCheckBox>
+#include <QButtonGroup>
 
 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<const StdMeshersGUI_RadioButtonsGrpWdg*>( 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" ));
+    }
+  }
 }
 
 //================================================================================
index 2b506311f87a1e9a160b9038afa5c797e1de7892..cfc5d535dd2343f442cf72ad438e04eda06251c4 100644 (file)
@@ -1,6 +1,21 @@
 <?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>
index bd709e593ebb9ee02a4c18fbc05e813e2766f3ec..e26f4cae5f3e7fcfb6e21d0032c582e5e3579e0a 100644 (file)
@@ -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<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 << " )";
 }
 
 //================================================================================
@@ -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<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 )
@@ -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 )
 {
index 68723365c08cd7b4c8d6badbe3106894ea73c11b..91b072146ec197cf53a7fd9bba265f1f8549123f 100644 (file)
@@ -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();
 
index 99f7f1d6bf64a41813da0a06ed181e2062d76e9d..5ad82c7ecbb22ef1dd9b8a2c8d775b25ccc0f63c 100644 (file)
@@ -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<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();
 }