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
This commit is contained in:
eap 2012-07-05 09:35:10 +00:00
parent f6d900d8a6
commit 6eeed530c5
10 changed files with 89 additions and 34 deletions

View File

@ -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();
};
/*!

View File

@ -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 );

View File

@ -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

View File

@ -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;
}

View File

@ -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

View File

@ -25,7 +25,6 @@
// Author : Michael Sazonov (OCN)
// Date : 27/03/2006
// Project : SALOME
// $Header$
//=============================================================================
//
#ifndef _NETGENPlugin_Hypothesis_2D_HXX_

View File

@ -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();
// }
//=============================================================================
/*!

View File

@ -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

View File

@ -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

View File

@ -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;