From: eap Date: Thu, 5 Jul 2012 09:35:10 +0000 (+0000) Subject: 0021676: EDF 2283 NETGENPLUGIN: Improve Netgen 1D-2D-3D to generate pyramids in case... X-Git-Tag: V6_6_0a1~17 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6eeed530c5b1cccbb5f81d935bda599db6d43c01;p=plugins%2Fnetgenplugin.git 0021676: EDF 2283 NETGENPLUGIN: Improve Netgen 1D-2D-3D to generate pyramids in case where input 2D mesh includes quadrangles Allow qudrangles in 3D mesh --- diff --git a/idl/NETGENPlugin_Algorithm.idl b/idl/NETGENPlugin_Algorithm.idl index e1eed22..1dd6fc0 100644 --- a/idl/NETGENPlugin_Algorithm.idl +++ b/idl/NETGENPlugin_Algorithm.idl @@ -22,7 +22,6 @@ // File : NETGENPlugin_Algorithm.idl // Author : Julia DOROVSKIKH -// $Header$ // #ifndef _SMESH_NETGENALGORITHM_IDL_ #define _SMESH_NETGENALGORITHM_IDL_ @@ -96,6 +95,9 @@ module NETGENPlugin void SetNbSegPerRadius(in double value); double GetNbSegPerRadius(); + void SetQuadAllowed(in boolean value); + boolean GetQuadAllowed(); + void SetLocalSizeOnShape(in GEOM::GEOM_Object GeomObj, in double localSize); void SetLocalSizeOnEntry(in string entry, in double localSize); double GetLocalSizeOnEntry(in string entry); @@ -108,8 +110,6 @@ module NETGENPlugin */ interface NETGENPlugin_Hypothesis_2D : NETGENPlugin_Hypothesis { - void SetQuadAllowed(in boolean value); - boolean GetQuadAllowed(); }; /*! diff --git a/src/GUI/NETGENPluginGUI_HypothesisCreator.cxx b/src/GUI/NETGENPluginGUI_HypothesisCreator.cxx index 994fd09..58f599f 100644 --- a/src/GUI/NETGENPluginGUI_HypothesisCreator.cxx +++ b/src/GUI/NETGENPluginGUI_HypothesisCreator.cxx @@ -206,7 +206,7 @@ QFrame* NETGENPluginGUI_HypothesisCreator::buildFrame() row++; } myAllowQuadrangles = 0; - if ( myIs2D ) + if ( true /*myIs2D*/ ) // issue 0021676 { myAllowQuadrangles = new QCheckBox( tr( "NETGEN_ALLOW_QUADRANGLES" ), GroupC1 ); aGroupLayout->addWidget( myAllowQuadrangles, row, 0 ); diff --git a/src/NETGENPlugin/NETGENPluginDC.py b/src/NETGENPlugin/NETGENPluginDC.py index 6012a00..f49ba75 100644 --- a/src/NETGENPlugin/NETGENPluginDC.py +++ b/src/NETGENPlugin/NETGENPluginDC.py @@ -148,6 +148,11 @@ class NETGEN_1D2D3D_Algorithm(NETGEN_Algorithm): if self.Parameters(): self.params.SetNbSegPerRadius(theVal) + ## Sets QuadAllowed flag. + def SetQuadAllowed(self, toAllow=True): + if self.Parameters(): + self.params.SetQuadAllowed(toAllow) + ## Sets number of segments overriding the value set by SetLocalLength() # @@ -192,11 +197,6 @@ class NETGEN_1D2D_Algorithm(NETGEN_1D2D3D_Algorithm): def __init__(self, mesh, geom=0): NETGEN_1D2D3D_Algorithm.__init__(self, mesh, geom) - ## Sets QuadAllowed flag. - def SetQuadAllowed(self, toAllow=True): - if self.Parameters(): - self.params.SetQuadAllowed(toAllow) - ## Triangle NETGEN 2D algorithm diff --git a/src/NETGENPlugin/NETGENPlugin_Hypothesis.cxx b/src/NETGENPlugin/NETGENPlugin_Hypothesis.cxx index aa35370..853e76c 100644 --- a/src/NETGENPlugin/NETGENPlugin_Hypothesis.cxx +++ b/src/NETGENPlugin/NETGENPlugin_Hypothesis.cxx @@ -51,7 +51,8 @@ NETGENPlugin_Hypothesis::NETGENPlugin_Hypothesis (int hypId, int studyId, _fineness (GetDefaultFineness()), _secondOrder (GetDefaultSecondOrder()), _optimize (GetDefaultOptimize()), - _localSize (GetDefaultLocalSize()) + _localSize (GetDefaultLocalSize()), + _quadAllowed (GetDefaultQuadAllowed()) { _name = "NETGEN_Parameters"; _param_algo_dim = 3; @@ -244,6 +245,30 @@ void NETGENPlugin_Hypothesis::UnsetLocalSizeOnEntry(const std::string& entry) NotifySubMeshesHypothesisModification(); } +//============================================================================= +/*! + * + */ +//============================================================================= +void NETGENPlugin_Hypothesis::SetQuadAllowed(bool theVal) +{ + if (theVal != _quadAllowed) + { + _quadAllowed = theVal; + NotifySubMeshesHypothesisModification(); + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= +bool NETGENPlugin_Hypothesis::GetDefaultQuadAllowed() +{ + return false; +} + //============================================================================= /*! * @@ -268,6 +293,7 @@ ostream & NETGENPlugin_Hypothesis::SaveTo(ostream & save) save << " " << "__LOCALSIZE_END__"; } save << " " << _minSize; + save << " " << _quadAllowed; return save; } @@ -355,6 +381,10 @@ istream & NETGENPlugin_Hypothesis::LoadFrom(istream & load) if ( !hasLocalSize && !option_or_sm.empty() ) _minSize = atof( option_or_sm.c_str() ); + isOK = ( load >> _quadAllowed ); + if ( !isOK ) + _quadAllowed = GetDefaultQuadAllowed(); + return load; } diff --git a/src/NETGENPlugin/NETGENPlugin_Hypothesis.hxx b/src/NETGENPlugin/NETGENPlugin_Hypothesis.hxx index c150dd5..c96c8c8 100644 --- a/src/NETGENPlugin/NETGENPlugin_Hypothesis.hxx +++ b/src/NETGENPlugin/NETGENPlugin_Hypothesis.hxx @@ -90,6 +90,9 @@ public: const TLocalSize& GetLocalSizesAndEntries() const { return _localSize; } void UnsetLocalSizeOnEntry(const std::string& entry); + void SetQuadAllowed(bool theVal); + bool GetQuadAllowed() const { return _quadAllowed; } + // the default values (taken from NETGEN 4.5 sources) static double GetDefaultMaxSize(); @@ -99,6 +102,7 @@ public: static double GetDefaultNbSegPerRadius(); static bool GetDefaultSecondOrder(); static bool GetDefaultOptimize(); + static bool GetDefaultQuadAllowed(); // Persistence virtual ostream & SaveTo(ostream & save); @@ -129,6 +133,7 @@ private: bool _secondOrder; bool _optimize; TLocalSize _localSize; + bool _quadAllowed; }; #endif diff --git a/src/NETGENPlugin/NETGENPlugin_Hypothesis_2D.hxx b/src/NETGENPlugin/NETGENPlugin_Hypothesis_2D.hxx index 47f00c7..babfc87 100644 --- a/src/NETGENPlugin/NETGENPlugin_Hypothesis_2D.hxx +++ b/src/NETGENPlugin/NETGENPlugin_Hypothesis_2D.hxx @@ -25,7 +25,6 @@ // Author : Michael Sazonov (OCN) // Date : 27/03/2006 // Project : SALOME -// $Header$ //============================================================================= // #ifndef _NETGENPlugin_Hypothesis_2D_HXX_ diff --git a/src/NETGENPlugin/NETGENPlugin_Hypothesis_2D_i.cxx b/src/NETGENPlugin/NETGENPlugin_Hypothesis_2D_i.cxx index b848360..86e5888 100644 --- a/src/NETGENPlugin/NETGENPlugin_Hypothesis_2D_i.cxx +++ b/src/NETGENPlugin/NETGENPlugin_Hypothesis_2D_i.cxx @@ -78,16 +78,16 @@ NETGENPlugin_Hypothesis_2D_i::~NETGENPlugin_Hypothesis_2D_i() * Set QuadAllowed flag */ //============================================================================= -void NETGENPlugin_Hypothesis_2D_i::SetQuadAllowed (CORBA::Boolean theValue) -{ - if ( NETGENPlugin_Hypothesis_i::isToSetParameter( GetQuadAllowed(), - theValue, - METH_SetQuadAllowed )) - { - this->GetImpl()->SetQuadAllowed(theValue); - SMESH::TPythonDump() << _this() << ".SetQuadAllowed( " << theValue << " )"; - } -} +// void NETGENPlugin_Hypothesis_2D_i::SetQuadAllowed (CORBA::Boolean theValue) +// { +// if ( NETGENPlugin_Hypothesis_i::isToSetParameter( GetQuadAllowed(), +// theValue, +// METH_SetQuadAllowed )) +// { +// this->GetImpl()->SetQuadAllowed(theValue); +// SMESH::TPythonDump() << _this() << ".SetQuadAllowed( " << theValue << " )"; +// } +// } //============================================================================= /*! @@ -96,10 +96,10 @@ void NETGENPlugin_Hypothesis_2D_i::SetQuadAllowed (CORBA::Boolean theValue) * Get QuadAllowed flag */ //============================================================================= -CORBA::Boolean NETGENPlugin_Hypothesis_2D_i::GetQuadAllowed() -{ - return this->GetImpl()->GetQuadAllowed(); -} +// CORBA::Boolean NETGENPlugin_Hypothesis_2D_i::GetQuadAllowed() +// { +// return this->GetImpl()->GetQuadAllowed(); +// } //============================================================================= /*! diff --git a/src/NETGENPlugin/NETGENPlugin_Hypothesis_2D_i.hxx b/src/NETGENPlugin/NETGENPlugin_Hypothesis_2D_i.hxx index 267e4a3..e6d0c55 100644 --- a/src/NETGENPlugin/NETGENPlugin_Hypothesis_2D_i.hxx +++ b/src/NETGENPlugin/NETGENPlugin_Hypothesis_2D_i.hxx @@ -54,9 +54,6 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_Hypothesis_2D_i: // Destructor virtual ~NETGENPlugin_Hypothesis_2D_i(); - void SetQuadAllowed(CORBA::Boolean theVal); - CORBA::Boolean GetQuadAllowed(); - // Get implementation ::NETGENPlugin_Hypothesis_2D* GetImpl(); @@ -66,11 +63,11 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_Hypothesis_2D_i: protected: // to remember whether a parameter is already set (issue 0021364) - enum SettingMethod - { - METH_SetQuadAllowed = NETGENPlugin_Hypothesis_i::METH_LAST * 2, - METH_LAST = METH_SetQuadAllowed - }; + // enum SettingMethod + // { + // METH_SetQuadAllowed = NETGENPlugin_Hypothesis_i::METH_LAST * 2, + // METH_LAST = METH_SetQuadAllowed + // }; }; #endif diff --git a/src/NETGENPlugin/NETGENPlugin_Hypothesis_i.cxx b/src/NETGENPlugin/NETGENPlugin_Hypothesis_i.cxx index b51b2a7..17bdd35 100644 --- a/src/NETGENPlugin/NETGENPlugin_Hypothesis_i.cxx +++ b/src/NETGENPlugin/NETGENPlugin_Hypothesis_i.cxx @@ -363,6 +363,26 @@ void NETGENPlugin_Hypothesis_i::UnsetLocalSizeOnEntry(const char* entry) SMESH::TPythonDump() << _this() << ".UnsetLocalSizeOnEntry(" << entry << ")"; } +//============================================================================= + +void NETGENPlugin_Hypothesis_i::SetQuadAllowed (CORBA::Boolean theValue) +{ + if ( NETGENPlugin_Hypothesis_i::isToSetParameter( GetQuadAllowed(), + theValue, + METH_SetQuadAllowed )) + { + this->GetImpl()->SetQuadAllowed(theValue); + SMESH::TPythonDump() << _this() << ".SetQuadAllowed( " << theValue << " )"; + } +} + +//============================================================================= + +CORBA::Boolean NETGENPlugin_Hypothesis_i::GetQuadAllowed() +{ + return this->GetImpl()->GetQuadAllowed(); +} + //============================================================================= /*! * NETGENPlugin_Hypothesis_i::GetImpl diff --git a/src/NETGENPlugin/NETGENPlugin_Hypothesis_i.hxx b/src/NETGENPlugin/NETGENPlugin_Hypothesis_i.hxx index 6a4ffa8..95435b0 100644 --- a/src/NETGENPlugin/NETGENPlugin_Hypothesis_i.hxx +++ b/src/NETGENPlugin/NETGENPlugin_Hypothesis_i.hxx @@ -85,6 +85,9 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_Hypothesis_i: NETGENPlugin::string_array* GetLocalSizeEntries(); void UnsetLocalSizeOnEntry(const char* entry); + void SetQuadAllowed(CORBA::Boolean theVal); + CORBA::Boolean GetQuadAllowed(); + // Get implementation ::NETGENPlugin_Hypothesis* GetImpl(); @@ -105,7 +108,8 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_Hypothesis_i: METH_SetNbSegPerEdge = 64, METH_SetNbSegPerRadius = 128, METH_SetLocalSizeOnEntry = 256, - METH_LAST = METH_SetLocalSizeOnEntry + METH_SetQuadAllowed = METH_SetLocalSizeOnEntry * 2, + METH_LAST = METH_SetQuadAllowed }; int mySetMethodFlags;