Implement IMP: Mantis issue 0020834: EDF 1362 SMESH : Add a 2D quadrangle mesher of reduced type.

This commit is contained in:
jfa 2010-10-12 13:45:40 +00:00
parent a5001f9559
commit 5abf3879fd
21 changed files with 1897 additions and 457 deletions

View File

@ -753,6 +753,16 @@ module StdMeshers
/*! /*!
* StdMeshers_QuadrangleParams: interface of "Quadrangle Params" hypothesis * StdMeshers_QuadrangleParams: interface of "Quadrangle Params" hypothesis
*/ */
enum QuadType
{
QUAD_STANDARD,
QUAD_TRIANGLE_PREF,
QUAD_QUADRANGLE_PREF,
QUAD_QUADRANGLE_PREF_REVERSED,
QUAD_REDUCED,
QUAD_NB_TYPES /* this is not a type of quadrangulation */
};
interface StdMeshers_QuadrangleParams : SMESH::SMESH_Hypothesis interface StdMeshers_QuadrangleParams : SMESH::SMESH_Hypothesis
{ {
/*! /*!
@ -774,6 +784,16 @@ module StdMeshers
* Get the entry of the main object * Get the entry of the main object
*/ */
string GetObjectEntry(); string GetObjectEntry();
/*!
* Set the type of quadrangulation
*/
void SetQuadType( in QuadType type );
/*!
* Get the type of quadrangulation
*/
QuadType GetQuadType();
}; };
/*! /*!

View File

@ -70,6 +70,11 @@ dist_salomeres_DATA = \
mesh_pyramid.png \ mesh_pyramid.png \
mesh_quad_n.png \ mesh_quad_n.png \
mesh_quad.png \ mesh_quad.png \
mesh_quadrangle_quadpref.png \
mesh_quadrangle_quadpref_reversed.png \
mesh_quadrangle_reduced.png \
mesh_quadrangle_standard.png \
mesh_quadrangle_triapref.png \
mesh_rem_element.png \ mesh_rem_element.png \
mesh_rem_node.png \ mesh_rem_node.png \
mesh_rem_orphan_nodes.png \ mesh_rem_orphan_nodes.png \

View File

@ -122,7 +122,7 @@
<hypothesis type="MaxElementVolume" <hypothesis type="MaxElementVolume"
label-id="Max. Element Volume" label-id="Max. Element Volume"
icon-id="mesh_hypo_volume.png" icon-id="mesh_hypo_volume.png"
need-geom = "false" need-geom="false"
dim="3"/> dim="3"/>
<hypothesis type="ProjectionSource3D" <hypothesis type="ProjectionSource3D"

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 459 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 391 B

View File

@ -16,12 +16,11 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// SMESH SMESH : implementaion of SMESH idl descriptions // SMESH SMESH : implementaion of SMESH idl descriptions
// File : StdMeshers_QuadrangleParams.cxx // File : StdMeshers_QuadrangleParams.cxx
// Author : Sergey KUUL, OCC // Author : Sergey KUUL, OCC
// Module : SMESH // Module : SMESH
//
#include "StdMeshers_QuadrangleParams.hxx" #include "StdMeshers_QuadrangleParams.hxx"
#include "SMESH_Algo.hxx" #include "SMESH_Algo.hxx"
@ -44,14 +43,14 @@ using namespace std;
* *
*/ */
//============================================================================= //=============================================================================
StdMeshers_QuadrangleParams::StdMeshers_QuadrangleParams(int hypId, int studyId, StdMeshers_QuadrangleParams::StdMeshers_QuadrangleParams(int hypId, int studyId,
SMESH_Gen * gen) SMESH_Gen * gen)
:SMESH_Hypothesis(hypId, studyId, gen) : SMESH_Hypothesis(hypId, studyId, gen)
{ {
_name = "QuadrangleParams"; _name = "QuadrangleParams";
_param_algo_dim = 2; _param_algo_dim = 2;
_triaVertexID = -1; _triaVertexID = -1;
_quadType = QUAD_STANDARD;
} }
//============================================================================= //=============================================================================
@ -59,7 +58,6 @@ StdMeshers_QuadrangleParams::StdMeshers_QuadrangleParams(int hypId, int studyId,
* *
*/ */
//============================================================================= //=============================================================================
StdMeshers_QuadrangleParams::~StdMeshers_QuadrangleParams() StdMeshers_QuadrangleParams::~StdMeshers_QuadrangleParams()
{ {
} }
@ -69,10 +67,9 @@ StdMeshers_QuadrangleParams::~StdMeshers_QuadrangleParams()
* *
*/ */
//============================================================================= //=============================================================================
void StdMeshers_QuadrangleParams::SetTriaVertex (int id)
void StdMeshers_QuadrangleParams::SetTriaVertex(int id)
{ {
if ( id != _triaVertexID ) { if (id != _triaVertexID) {
_triaVertexID = id; _triaVertexID = id;
NotifySubMeshesHypothesisModification(); NotifySubMeshesHypothesisModification();
} }
@ -83,10 +80,25 @@ void StdMeshers_QuadrangleParams::SetTriaVertex(int id)
* *
*/ */
//============================================================================= //=============================================================================
void StdMeshers_QuadrangleParams::SetQuadType (StdMeshers_QuadType type)
{
if (type != _quadType) {
_quadType = type;
NotifySubMeshesHypothesisModification();
}
}
//=============================================================================
/*!
*
*/
//=============================================================================
ostream & StdMeshers_QuadrangleParams::SaveTo(ostream & save) ostream & StdMeshers_QuadrangleParams::SaveTo(ostream & save)
{ {
save << _triaVertexID << " " << _objEntry; if (_objEntry.size() == 0)
save << _triaVertexID << " UNDEFINED " << int(_quadType);
else
save << _triaVertexID << " " << _objEntry << " " << int(_quadType);
return save; return save;
} }
@ -95,7 +107,6 @@ ostream & StdMeshers_QuadrangleParams::SaveTo(ostream & save)
* *
*/ */
//============================================================================= //=============================================================================
istream & StdMeshers_QuadrangleParams::LoadFrom(istream & load) istream & StdMeshers_QuadrangleParams::LoadFrom(istream & load)
{ {
bool isOK = true; bool isOK = true;
@ -104,6 +115,13 @@ istream & StdMeshers_QuadrangleParams::LoadFrom(istream & load)
load.clear(ios::badbit | load.rdstate()); load.clear(ios::badbit | load.rdstate());
isOK = (load >> _objEntry); isOK = (load >> _objEntry);
if (!isOK)
load.clear(ios::badbit | load.rdstate());
int type;
isOK = (load >> type);
if (isOK)
_quadType = StdMeshers_QuadType(type);
return load; return load;
} }
@ -113,7 +131,6 @@ istream & StdMeshers_QuadrangleParams::LoadFrom(istream & load)
* *
*/ */
//============================================================================= //=============================================================================
ostream & operator <<(ostream & save, StdMeshers_QuadrangleParams & hyp) ostream & operator <<(ostream & save, StdMeshers_QuadrangleParams & hyp)
{ {
return hyp.SaveTo( save ); return hyp.SaveTo( save );
@ -124,7 +141,6 @@ ostream & operator <<(ostream & save, StdMeshers_QuadrangleParams & hyp)
* *
*/ */
//============================================================================= //=============================================================================
istream & operator >>(istream & load, StdMeshers_QuadrangleParams & hyp) istream & operator >>(istream & load, StdMeshers_QuadrangleParams & hyp)
{ {
return hyp.LoadFrom( load ); return hyp.LoadFrom( load );
@ -138,7 +154,6 @@ istream & operator >>(istream & load, StdMeshers_QuadrangleParams & hyp)
* \retval bool - true if parameter values have been successfully defined * \retval bool - true if parameter values have been successfully defined
*/ */
//================================================================================ //================================================================================
bool StdMeshers_QuadrangleParams::SetParametersByMesh(const SMESH_Mesh* theMesh, bool StdMeshers_QuadrangleParams::SetParametersByMesh(const SMESH_Mesh* theMesh,
const TopoDS_Shape& theShape) const TopoDS_Shape& theShape)
{ {
@ -154,10 +169,8 @@ bool StdMeshers_QuadrangleParams::SetParametersByMesh(const SMESH_Mesh* theMesh,
* \retval bool - true if parameter values have been successfully defined * \retval bool - true if parameter values have been successfully defined
*/ */
//================================================================================ //================================================================================
bool StdMeshers_QuadrangleParams::SetParametersByDefaults(const TDefaults& dflts, bool StdMeshers_QuadrangleParams::SetParametersByDefaults(const TDefaults& dflts,
const SMESH_Mesh* /*mesh*/) const SMESH_Mesh* /*mesh*/)
{ {
return true; return true;
} }

View File

@ -16,22 +16,29 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// SMESH SMESH : implementaion of SMESH idl descriptions // SMESH SMESH : implementaion of SMESH idl descriptions
// File : StdMeshers_QuadrangleParams.hxx // File : StdMeshers_QuadrangleParams.hxx
// Author : Sergey KUUL, OCC // Author : Sergey KUUL, OCC
// Module : SMESH // Module : SMESH
//
#ifndef _SMESH_QUADRANGLEPARAMS_HXX_ #ifndef _SMESH_QUADRANGLEPARAMS_HXX_
#define _SMESH_QUADRANGLEPARAMS_HXX_ #define _SMESH_QUADRANGLEPARAMS_HXX_
#include "SMESH_StdMeshers.hxx" #include "SMESH_StdMeshers.hxx"
#include "SMESH_Hypothesis.hxx" #include "SMESH_Hypothesis.hxx"
#include "Utils_SALOME_Exception.hxx" #include "Utils_SALOME_Exception.hxx"
enum StdMeshers_QuadType
{
QUAD_STANDARD,
QUAD_TRIANGLE_PREF,
QUAD_QUADRANGLE_PREF,
QUAD_QUADRANGLE_PREF_REVERSED,
QUAD_REDUCED,
QUAD_NB_TYPES
};
class STDMESHERS_EXPORT StdMeshers_QuadrangleParams: class STDMESHERS_EXPORT StdMeshers_QuadrangleParams:
public SMESH_Hypothesis public SMESH_Hypothesis
{ {
@ -39,13 +46,14 @@ public:
StdMeshers_QuadrangleParams(int hypId, int studyId, SMESH_Gen* gen); StdMeshers_QuadrangleParams(int hypId, int studyId, SMESH_Gen* gen);
virtual ~StdMeshers_QuadrangleParams(); virtual ~StdMeshers_QuadrangleParams();
void SetTriaVertex(int id); void SetTriaVertex (int id);
int GetTriaVertex() const { return _triaVertexID; }
void SetObjectEntry( const char* entry ) { _objEntry = entry; }
void SetObjectEntry (const char* entry) { _objEntry = entry; }
const char* GetObjectEntry() { return _objEntry.c_str(); } const char* GetObjectEntry() { return _objEntry.c_str(); }
int GetTriaVertex() const { return _triaVertexID; } void SetQuadType (StdMeshers_QuadType type);
StdMeshers_QuadType GetQuadType() const { return _quadType; }
virtual std::ostream & SaveTo(std::ostream & save); virtual std::ostream & SaveTo(std::ostream & save);
virtual std::istream & LoadFrom(std::istream & load); virtual std::istream & LoadFrom(std::istream & load);
@ -73,6 +81,7 @@ public:
protected: protected:
int _triaVertexID; int _triaVertexID;
std::string _objEntry; std::string _objEntry;
StdMeshers_QuadType _quadType;
}; };
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@ -19,19 +19,20 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// SMESH SMESH : implementaion of SMESH idl descriptions // SMESH SMESH : implementaion of SMESH idl descriptions
// File : StdMeshers_Quadrangle_2D.hxx // File : StdMeshers_Quadrangle_2D.hxx
// Moved here from SMESH_Quadrangle_2D.hxx // Moved here from SMESH_Quadrangle_2D.hxx
// Author : Paul RASCLE, EDF // Author : Paul RASCLE, EDF
// Module : SMESH // Module : SMESH
// $Header$ // $Header$
//
#ifndef _SMESH_QUADRANGLE_2D_HXX_ #ifndef _SMESH_QUADRANGLE_2D_HXX_
#define _SMESH_QUADRANGLE_2D_HXX_ #define _SMESH_QUADRANGLE_2D_HXX_
#include "SMESH_StdMeshers.hxx" #include "SMESH_StdMeshers.hxx"
#include "StdMeshers_QuadrangleParams.hxx"
#include "SMESH_2D_Algo.hxx" #include "SMESH_2D_Algo.hxx"
#include "Utils_SALOME_Exception.hxx" #include "Utils_SALOME_Exception.hxx"
@ -120,6 +121,10 @@ protected:
const TopoDS_Face& F, const TopoDS_Edge& E, const TopoDS_Face& F, const TopoDS_Edge& E,
double first, double last, int nb_segm); double first, double last, int nb_segm);
bool ComputeReduced (SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape,
FaceQuadStruct* quad);
// true if QuadranglePreference hypothesis is assigned that forces // true if QuadranglePreference hypothesis is assigned that forces
// construction of quadrangles if the number of nodes on opposite edges // construction of quadrangles if the number of nodes on opposite edges
// is not the same in the case where the global number of nodes on edges // is not the same in the case where the global number of nodes on edges
@ -130,6 +135,8 @@ protected:
int myTriaVertexID; int myTriaVertexID;
StdMeshers_QuadType myQuadType;
SMESH_MesherHelper* myTool; // tool for working with quadratic elements SMESH_MesherHelper* myTool; // tool for working with quadratic elements
}; };

View File

@ -16,13 +16,12 @@
# #
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
# #
# SMESH StdMeshersGUI : GUI for StdMeshers plugin # SMESH StdMeshersGUI : GUI for StdMeshers plugin
# File : Makefile.in # File : Makefile.in
# Author : Julia DOROVSKIKH # Author : Julia DOROVSKIKH
# Modified by : Alexander BORODIN (OCN) - autotools usage # Modified by : Alexander BORODIN (OCN) - autotools usage
# Module : SMESH # Module : SMESH
#
include $(top_srcdir)/adm_local/unix/make_common_starter.am include $(top_srcdir)/adm_local/unix/make_common_starter.am
# header files # header files
@ -33,12 +32,14 @@ salomeinclude_HEADERS = \
StdMeshersGUI_DistrTable.h \ StdMeshersGUI_DistrTable.h \
StdMeshersGUI_NbSegmentsCreator.h \ StdMeshersGUI_NbSegmentsCreator.h \
StdMeshersGUI_ObjectReferenceParamWdg.h \ StdMeshersGUI_ObjectReferenceParamWdg.h \
StdMeshersGUI_QuadrangleParamWdg.h \
StdMeshersGUI_LayerDistributionParamWdg.h \ StdMeshersGUI_LayerDistributionParamWdg.h \
StdMeshersGUI_FixedPointsParamWdg.h \ StdMeshersGUI_FixedPointsParamWdg.h \
StdMeshersGUI_SubShapeSelectorWdg.h StdMeshersGUI_SubShapeSelectorWdg.h
# Libraries targets # Libraries targets
lib_LTLIBRARIES = libStdMeshersGUI.la lib_LTLIBRARIES = libStdMeshersGUI.la
dist_libStdMeshersGUI_la_SOURCES = \ dist_libStdMeshersGUI_la_SOURCES = \
StdMeshersGUI.cxx \ StdMeshersGUI.cxx \
StdMeshersGUI_StdHypothesisCreator.cxx \ StdMeshersGUI_StdHypothesisCreator.cxx \
@ -46,6 +47,7 @@ dist_libStdMeshersGUI_la_SOURCES = \
StdMeshersGUI_DistrTable.cxx \ StdMeshersGUI_DistrTable.cxx \
StdMeshersGUI_NbSegmentsCreator.cxx \ StdMeshersGUI_NbSegmentsCreator.cxx \
StdMeshersGUI_ObjectReferenceParamWdg.cxx \ StdMeshersGUI_ObjectReferenceParamWdg.cxx \
StdMeshersGUI_QuadrangleParamWdg.cxx \
StdMeshersGUI_LayerDistributionParamWdg.cxx \ StdMeshersGUI_LayerDistributionParamWdg.cxx \
StdMeshersGUI_FixedPointsParamWdg.cxx \ StdMeshersGUI_FixedPointsParamWdg.cxx \
StdMeshersGUI_SubShapeSelectorWdg.cxx StdMeshersGUI_SubShapeSelectorWdg.cxx
@ -56,6 +58,7 @@ MOC_FILES = \
StdMeshersGUI_DistrTable_moc.cxx \ StdMeshersGUI_DistrTable_moc.cxx \
StdMeshersGUI_NbSegmentsCreator_moc.cxx \ StdMeshersGUI_NbSegmentsCreator_moc.cxx \
StdMeshersGUI_ObjectReferenceParamWdg_moc.cxx \ StdMeshersGUI_ObjectReferenceParamWdg_moc.cxx \
StdMeshersGUI_QuadrangleParamWdg_moc.cxx \
StdMeshersGUI_LayerDistributionParamWdg_moc.cxx \ StdMeshersGUI_LayerDistributionParamWdg_moc.cxx \
StdMeshersGUI_FixedPointsParamWdg_moc.cxx \ StdMeshersGUI_FixedPointsParamWdg_moc.cxx \
StdMeshersGUI_SubShapeSelectorWdg_moc.cxx StdMeshersGUI_SubShapeSelectorWdg_moc.cxx

View File

@ -92,7 +92,7 @@ private:
QLabel *myLScale, *myLTable, *myLExpr, *myInfo; QLabel *myLScale, *myLTable, *myLExpr, *myInfo;
QGridLayout* myGroupLayout; QGridLayout* myGroupLayout;
int myTableRow, myPreviewRow; int myTableRow, myPreviewRow;
QRadioButton* myCutNeg; //QRadioButton* myCutNeg;
QGroupBox* myReversedEdgesBox; QGroupBox* myReversedEdgesBox;
StdMeshersGUI_SubShapeSelectorWdg* myDirectionWidget; StdMeshersGUI_SubShapeSelectorWdg* myDirectionWidget;

View File

@ -0,0 +1,100 @@
// Copyright (C) 2007-2010 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
//
// File : StdMeshersGUI_QuadrangleParamWdg.cxx
// Author : Open CASCADE S.A.S. (jfa)
// SMESH includes
#include "StdMeshersGUI_QuadrangleParamWdg.h"
#include "SMESHGUI.h"
#include "SUIT_ResourceMgr.h"
// Qt includes
#include <QButtonGroup>
#include <QRadioButton>
#include <QLabel>
#include <QGridLayout>
// IDL includes
#include <SALOMEconfig.h>
#include CORBA_CLIENT_HEADER(SMESH_BasicHypothesis)
#define SPACING 6
#define MARGIN 0
//================================================================================
// function : Constructor
// purpose :
//================================================================================
StdMeshersGUI_QuadrangleParamWdg::StdMeshersGUI_QuadrangleParamWdg (QWidget * parent)
: QWidget(parent),
myType(0)
{
myType = new QButtonGroup (this);
QGridLayout* typeLay = new QGridLayout( this );
typeLay->setMargin(MARGIN);
typeLay->setSpacing(SPACING);
QString aTypeKey ("SMESH_QUAD_TYPE_%1");
QString aPictKey ("ICON_StdMeshers_Quadrangle_Params_%1");
int itype = 0;
for (; itype < int(StdMeshers::QUAD_NB_TYPES); itype++) {
QRadioButton* rbi = new QRadioButton (tr(aTypeKey.arg(itype).toLatin1()), this);
QPixmap pmi (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr(aPictKey.arg(itype).toLatin1())));
QLabel* pli = new QLabel (this);
pli->setPixmap(pmi);
typeLay->addWidget(rbi, itype, 0, 1, 1);
typeLay->addWidget(pli, itype, 1, 1, 1);
myType->addButton(rbi, itype);
}
myType->button(0)->setChecked(true);
setLayout(typeLay);
setMinimumWidth(300);
}
//================================================================================
// function : Destructor
// purpose :
//================================================================================
StdMeshersGUI_QuadrangleParamWdg::~StdMeshersGUI_QuadrangleParamWdg()
{
}
//=================================================================================
// function : SetType
// purpose :
//=================================================================================
void StdMeshersGUI_QuadrangleParamWdg::SetType (int theType)
{
myType->button(theType)->setChecked(true);
}
//=================================================================================
// function : GetType
// purpose :
//=================================================================================
int StdMeshersGUI_QuadrangleParamWdg::GetType()
{
return myType->checkedId();
}

View File

@ -0,0 +1,49 @@
// Copyright (C) 2007-2010 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
//
// File : StdMeshersGUI_QuadrangleParamWdg.h
// Author : Open CASCADE S.A.S. (jfa)
#ifndef STDMESHERSGUI_QUADRANGLEPARAMWDG_H
#define STDMESHERSGUI_QUADRANGLEPARAMWDG_H
// SMESH includes
#include "SMESH_StdMeshersGUI.hxx"
// Qt includes
#include <QWidget>
class QButtonGroup;
class STDMESHERSGUI_EXPORT StdMeshersGUI_QuadrangleParamWdg : public QWidget
{
Q_OBJECT
public:
StdMeshersGUI_QuadrangleParamWdg (QWidget* parent = 0);
~StdMeshersGUI_QuadrangleParamWdg();
void SetType (int theType);
int GetType ();
private:
// Quadranle preference, Triangle preference, Reduced
QButtonGroup* myType;
};
#endif // STDMESHERSGUI_QUADRANGLEPARAMWDG_H

View File

@ -19,23 +19,26 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : StdMeshersGUI_StdHypothesisCreator.cxx // File : StdMeshersGUI_StdHypothesisCreator.cxx
// Author : Alexander SOLOVYOV, Open CASCADE S.A.S. // Author : Alexander SOLOVYOV, Open CASCADE S.A.S.
// SMESH includes // SMESH includes
//
#include "StdMeshersGUI_StdHypothesisCreator.h" #include "StdMeshersGUI_StdHypothesisCreator.h"
#include <SMESHGUI.h> #include <SMESHGUI.h>
#include <SMESHGUI_SpinBox.h> #include <SMESHGUI_SpinBox.h>
#include <SMESHGUI_HypothesesUtils.h> #include <SMESHGUI_HypothesesUtils.h>
#include <SMESHGUI_Utils.h> #include <SMESHGUI_Utils.h>
#include <SMESH_TypeFilter.hxx> #include <SMESH_TypeFilter.hxx>
#include <SMESH_NumberFilter.hxx> #include <SMESH_NumberFilter.hxx>
#include "StdMeshersGUI_ObjectReferenceParamWdg.h"
#include "StdMeshersGUI_LayerDistributionParamWdg.h"
#include "StdMeshersGUI_SubShapeSelectorWdg.h"
#include "StdMeshersGUI_FixedPointsParamWdg.h" #include "StdMeshersGUI_FixedPointsParamWdg.h"
#include "StdMeshersGUI_LayerDistributionParamWdg.h"
#include "StdMeshersGUI_ObjectReferenceParamWdg.h"
#include "StdMeshersGUI_QuadrangleParamWdg.h"
#include "StdMeshersGUI_SubShapeSelectorWdg.h"
#include <SALOMEDSClient_Study.hxx> #include <SALOMEDSClient_Study.hxx>
// SALOME GUI includes // SALOME GUI includes
@ -387,9 +390,11 @@ bool StdMeshersGUI_StdHypothesisCreator::checkParams( QString& msg ) const
} }
else if ( hypType() == "QuadrangleParams" ) else if ( hypType() == "QuadrangleParams" )
{ {
StdMeshersGUI_SubShapeSelectorWdg* w = //StdMeshersGUI_SubShapeSelectorWdg* w =
widget< StdMeshersGUI_SubShapeSelectorWdg >( 0 ); // widget< StdMeshersGUI_SubShapeSelectorWdg >( 0 );
ok = ( w->GetListSize() > 0 ); //ok = ( w->GetListSize() > 0 );
//StdMeshersGUI_QuadrangleParamWdg* w =
// widget< StdMeshersGUI_QuadrangleParamWdg >( 1 );
} }
return ok; return ok;
} }
@ -608,14 +613,17 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
{ {
StdMeshers::StdMeshers_QuadrangleParams_var h = StdMeshers::StdMeshers_QuadrangleParams_var h =
StdMeshers::StdMeshers_QuadrangleParams::_narrow( hypothesis() ); StdMeshers::StdMeshers_QuadrangleParams::_narrow( hypothesis() );
StdMeshersGUI_SubShapeSelectorWdg* w = StdMeshersGUI_SubShapeSelectorWdg* w1 =
widget< StdMeshersGUI_SubShapeSelectorWdg >( 0 ); widget< StdMeshersGUI_SubShapeSelectorWdg >( 0 );
if (w) { StdMeshersGUI_QuadrangleParamWdg* w2 =
if( w->GetListSize() > 0 ) { widget< StdMeshersGUI_QuadrangleParamWdg >( 1 );
h->SetTriaVertex( w->GetListOfIDs()[0] ); // getlist must be called once if (w1 && w2) {
const char * entry = w->GetMainShapeEntry(); if (w1->GetListSize() > 0) {
h->SetObjectEntry( entry ); h->SetTriaVertex(w1->GetListOfIDs()[0]); // getlist must be called once
const char * entry = w1->GetMainShapeEntry();
h->SetObjectEntry(entry);
} }
h->SetQuadType(StdMeshers::QuadType(w2->GetType()));
} }
} }
} }
@ -984,13 +992,13 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ), customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
h->GetTargetVertex( 2 ))); h->GetTargetVertex( 2 )));
} }
else if( hypType()=="QuadrangleParams" ) else if (hypType() == "QuadrangleParams")
{ {
StdMeshers::StdMeshers_QuadrangleParams_var h = StdMeshers::StdMeshers_QuadrangleParams_var h =
StdMeshers::StdMeshers_QuadrangleParams::_narrow( hyp ); StdMeshers::StdMeshers_QuadrangleParams::_narrow(hyp);
item.myName = tr( "SMESH_BASE_VERTEX" ); item.myName = tr("SMESH_BASE_VERTEX");
p.append( item ); p.append(item);
StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget = StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget =
new StdMeshersGUI_SubShapeSelectorWdg(); new StdMeshersGUI_SubShapeSelectorWdg();
@ -998,21 +1006,32 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
aDirectionWidget->SetSubShType(TopAbs_VERTEX); aDirectionWidget->SetSubShType(TopAbs_VERTEX);
QString anEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry(); QString anEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry(); QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
if ( anEntry == "" ) if (anEntry == "")
anEntry = h->GetObjectEntry(); anEntry = h->GetObjectEntry();
aDirectionWidget->SetGeomShapeEntry( anEntry ); aDirectionWidget->SetGeomShapeEntry(anEntry);
aDirectionWidget->SetMainShapeEntry( aMainEntry ); aDirectionWidget->SetMainShapeEntry(aMainEntry);
if ( !isCreation() ) { if (!isCreation()) {
SMESH::long_array_var aVec = new SMESH::long_array; SMESH::long_array_var aVec = new SMESH::long_array;
int vertID = h->GetTriaVertex(); int vertID = h->GetTriaVertex();
if(vertID>0) { if (vertID > 0) {
aVec->length(1); aVec->length(1);
aVec[0] = vertID; aVec[0] = vertID;
aDirectionWidget->SetListOfIDs( aVec ); aDirectionWidget->SetListOfIDs(aVec);
} }
} }
aDirectionWidget->showPreview( true ); aDirectionWidget->showPreview(true);
customWidgets()->append ( aDirectionWidget );
item.myName = tr("SMESH_QUAD_TYPE");
p.append(item);
StdMeshersGUI_QuadrangleParamWdg* aTypeWidget =
new StdMeshersGUI_QuadrangleParamWdg();
if (!isCreation()) {
aTypeWidget->SetType(int(h->GetQuadType()));
}
customWidgets()->append(aDirectionWidget);
customWidgets()->append(aTypeWidget);
} }
else else
res = false; res = false;
@ -1217,6 +1236,13 @@ bool StdMeshersGUI_StdHypothesisCreator::getParamFromCustomWidget( StdParam & pa
param.myValue = w->GetValue(); param.myValue = w->GetValue();
return true; return true;
} }
if ( widget->inherits( "StdMeshersGUI_QuadrangleParamWdg" ))
{
//const StdMeshersGUI_QuadrangleParamWdg * w =
// static_cast<const StdMeshersGUI_QuadrangleParamWdg*>( widget );
param.myValue = "QuadType";
return true;
}
if ( widget->inherits( "StdMeshersGUI_FixedPointsParamWdg" )) if ( widget->inherits( "StdMeshersGUI_FixedPointsParamWdg" ))
{ {
const StdMeshersGUI_FixedPointsParamWdg * w = const StdMeshersGUI_FixedPointsParamWdg * w =

View File

@ -89,6 +89,10 @@
<source>ICON_DLG_PROJECTION_SOURCE_3D</source> <source>ICON_DLG_PROJECTION_SOURCE_3D</source>
<translation>mesh_hypo_source_3d.png</translation> <translation>mesh_hypo_source_3d.png</translation>
</message> </message>
<message>
<source>ICON_DLG_QUADRANGLE_PARAMS</source>
<translation>mesh_hypo_length.png</translation>
</message>
<message> <message>
<source>ICON_DLG_SEGMENT_LENGTH_AROUND_VERTEX</source> <source>ICON_DLG_SEGMENT_LENGTH_AROUND_VERTEX</source>
<translation>mesh_hypo_length.png</translation> <translation>mesh_hypo_length.png</translation>
@ -241,9 +245,28 @@
<source>ICON_SMESH_TREE_HYPO_StartEndLength</source> <source>ICON_SMESH_TREE_HYPO_StartEndLength</source>
<translation>mesh_tree_hypo_length.png</translation> <translation>mesh_tree_hypo_length.png</translation>
</message> </message>
</context>
<context>
<name>StdMeshersGUI_QuadrangleParamWdg</name>
<message> <message>
<source>ICON_DLG_QUADRANGLE_PARAMS</source> <source>ICON_StdMeshers_Quadrangle_Params_0</source>
<translation>mesh_hypo_length.png</translation> <translation>mesh_quadrangle_standard.png</translation>
</message>
<message>
<source>ICON_StdMeshers_Quadrangle_Params_1</source>
<translation>mesh_quadrangle_triapref.png</translation>
</message>
<message>
<source>ICON_StdMeshers_Quadrangle_Params_2</source>
<translation>mesh_quadrangle_quadpref.png</translation>
</message>
<message>
<source>ICON_StdMeshers_Quadrangle_Params_3</source>
<translation>mesh_quadrangle_quadpref_reversed.png</translation>
</message>
<message>
<source>ICON_StdMeshers_Quadrangle_Params_4</source>
<translation>mesh_quadrangle_reduced.png</translation>
</message> </message>
</context> </context>
</TS> </TS>

View File

@ -339,6 +339,33 @@
<source>SMESH_QUADRANGLE_PARAMS_TITLE</source> <source>SMESH_QUADRANGLE_PARAMS_TITLE</source>
<translation>Hypothesis Construction</translation> <translation>Hypothesis Construction</translation>
</message> </message>
<message>
<source>SMESH_QUAD_TYPE</source>
<translation>Type</translation>
</message>
</context>
<context>
<name>StdMeshersGUI_QuadrangleParamWdg</name>
<message>
<source>SMESH_QUAD_TYPE_0</source>
<translation>Standard</translation>
</message>
<message>
<source>SMESH_QUAD_TYPE_1</source>
<translation>Triangle preference</translation>
</message>
<message>
<source>SMESH_QUAD_TYPE_2</source>
<translation>Quadrangle preference</translation>
</message>
<message>
<source>SMESH_QUAD_TYPE_3</source>
<translation>Quadrangle preference (reversed)</translation>
</message>
<message>
<source>SMESH_QUAD_TYPE_4</source>
<translation>Reduced</translation>
</message>
</context> </context>
<context> <context>
<name>StdMeshersGUI_LayerDistributionParamWdg</name> <name>StdMeshersGUI_LayerDistributionParamWdg</name>

View File

@ -16,13 +16,11 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
// File : StdMeshers_QuadrangleParams_i.cxx // File : StdMeshers_QuadrangleParams_i.cxx
// Author : Sergey KUUL, OCC // Author : Sergey KUUL, OCC
// Module : SMESH // Module : SMESH
// $Header$
//
#include "StdMeshers_QuadrangleParams_i.hxx" #include "StdMeshers_QuadrangleParams_i.hxx"
#include "SMESH_Gen_i.hxx" #include "SMESH_Gen_i.hxx"
#include "SMESH_Gen.hxx" #include "SMESH_Gen.hxx"
@ -94,6 +92,21 @@ void StdMeshers_QuadrangleParams_i::SetTriaVertex(CORBA::Long vertID)
<< vertID << " )"; << vertID << " )";
} }
//=============================================================================
/*!
* StdMeshers_QuadrangleParams_i::GetTriaVertex
*
* Get base vertex for triangles
*/
//=============================================================================
CORBA::Long StdMeshers_QuadrangleParams_i::GetTriaVertex()
{
MESSAGE( "StdMeshers_QuadrangleParams_i::GetTriaVertex" );
ASSERT( myBaseImpl );
return this->GetImpl()->GetTriaVertex();
}
//============================================================================= //=============================================================================
/*! /*!
* StdMeshers_QuadrangleParams_i::SetObjectEntry * StdMeshers_QuadrangleParams_i::SetObjectEntry
@ -143,17 +156,65 @@ char* StdMeshers_QuadrangleParams_i::GetObjectEntry()
//============================================================================= //=============================================================================
/*! /*!
* StdMeshers_QuadrangleParams_i::GetTriaVertex * StdMeshers_QuadrangleParams_i::SetQuadType
* *
* Get base vertex for triangles * Set the type of quadrangulation
*/ */
//============================================================================= //=============================================================================
void StdMeshers_QuadrangleParams_i::SetQuadType(StdMeshers::QuadType type)
CORBA::Long StdMeshers_QuadrangleParams_i::GetTriaVertex()
{ {
MESSAGE( "StdMeshers_QuadrangleParams_i::GetTriaVertex" ); //static char* quadTypes[5] = {"StdMeshers.QUAD_STANDARD",
ASSERT( myBaseImpl ); // "StdMeshers.QUAD_TRIANGLE_PREF",
return this->GetImpl()->GetTriaVertex(); // "StdMeshers.QUAD_QUADRANGLE_PREF",
// "StdMeshers.QUAD_QUADRANGLE_PREF_REVERSED",
// "StdMeshers.QUAD_REDUCED"};
MESSAGE("StdMeshers_QuadrangleParams_i::SetQuadType");
ASSERT(myBaseImpl);
if (int(type) >= int(StdMeshers::QUAD_NB_TYPES)) {
THROW_SALOME_CORBA_EXCEPTION("Bad type of quadrangulation", SALOME::BAD_PARAM);
}
try {
this->GetImpl()->SetQuadType(StdMeshers_QuadType(int(type)));
}
catch (SALOME_Exception& S_ex) {
THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM);
}
// Update Python script
const char* quadType;
switch (type) {
case StdMeshers::QUAD_STANDARD:
quadType = "StdMeshers.QUAD_STANDARD"; break;
case StdMeshers::QUAD_TRIANGLE_PREF:
quadType = "StdMeshers.QUAD_TRIANGLE_PREF"; break;
case StdMeshers::QUAD_QUADRANGLE_PREF:
quadType = "StdMeshers.QUAD_QUADRANGLE_PREF"; break;
case StdMeshers::QUAD_QUADRANGLE_PREF_REVERSED:
quadType = "StdMeshers.QUAD_QUADRANGLE_PREF_REVERSED"; break;
case StdMeshers::QUAD_REDUCED:
quadType = "StdMeshers.QUAD_REDUCED"; break;
default:
quadType = "UNKNOWN";
}
SMESH::TPythonDump() << _this() << ".SetQuadType( " << quadType << " )";
//SMESH::TPythonDump() << _this() << ".SetQuadType( " << quadTypes[int(type)] << " )";
}
//=============================================================================
/*!
* StdMeshers_QuadrangleParams_i::GetQuadType
*
* Get the type of quadrangulation
*/
//=============================================================================
StdMeshers::QuadType StdMeshers_QuadrangleParams_i::GetQuadType()
{
MESSAGE("StdMeshers_QuadrangleParams_i::GetQuadType");
ASSERT(myBaseImpl);
return StdMeshers::QuadType(int(this->GetImpl()->GetQuadType()));
} }
//============================================================================= //=============================================================================
@ -183,4 +244,3 @@ CORBA::Boolean StdMeshers_QuadrangleParams_i::IsDimSupported( SMESH::Dimension t
{ {
return type == SMESH::DIM_2D; return type == SMESH::DIM_2D;
} }

View File

@ -16,13 +16,12 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's classes
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
// File : StdMeshers_QuadrangleParams_i.hxx // File : StdMeshers_QuadrangleParams_i.hxx
// Author : Sergey KUUL, OCC // Author : Sergey KUUL, OCC
// Module : SMESH // Module : SMESH
// $Header$ // $Header$
//
#ifndef _SMESH_QUADRANGLEPARAMS_I_HXX_ #ifndef _SMESH_QUADRANGLEPARAMS_I_HXX_
#define _SMESH_QUADRANGLEPARAMS_I_HXX_ #define _SMESH_QUADRANGLEPARAMS_I_HXX_
@ -43,9 +42,9 @@ class STDMESHERS_I_EXPORT StdMeshers_QuadrangleParams_i:
{ {
public: public:
// Constructor // Constructor
StdMeshers_QuadrangleParams_i( PortableServer::POA_ptr thePOA, StdMeshers_QuadrangleParams_i (PortableServer::POA_ptr thePOA,
int theStudyId, int theStudyId,
::SMESH_Gen* theGenImpl ); ::SMESH_Gen* theGenImpl);
// Destructor // Destructor
virtual ~StdMeshers_QuadrangleParams_i(); virtual ~StdMeshers_QuadrangleParams_i();
@ -56,18 +55,24 @@ public:
// Get length // Get length
//CORBA::Double GetLength(CORBA::Boolean theIsStart); //CORBA::Double GetLength(CORBA::Boolean theIsStart);
//Set base vertex for triangles // Set base vertex for triangles
void SetTriaVertex(CORBA::Long vertID); void SetTriaVertex (CORBA::Long vertID);
//Get base vertex for triangles // Get base vertex for triangles
CORBA::Long GetTriaVertex(); CORBA::Long GetTriaVertex();
//Set the Entry of the Object // Set the Entry of the Object
void SetObjectEntry(const char* theEntry); void SetObjectEntry (const char* theEntry);
//Get Object Entry // Get Object Entry
char* GetObjectEntry(); char* GetObjectEntry();
// Set the type of quadrangulation
void SetQuadType (StdMeshers::QuadType type);
// Get the type of quadrangulation
StdMeshers::QuadType GetQuadType();
// Get implementation // Get implementation
::StdMeshers_QuadrangleParams* GetImpl(); ::StdMeshers_QuadrangleParams* GetImpl();