mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-03-26 01:37:54 +05:00
0019941: EDF 766 SMESH : Max length hypothesis
+ /*! + * \brief Sets default number of segments per edge + */ + void SetDefaultNbSegments( in long theNbSegments) raises ( SALOME::SALOME_Exception );
This commit is contained in:
parent
a9f9e27b93
commit
1249a4ae05
@ -167,7 +167,11 @@ module SMESH
|
|||||||
* Sets number of segments per diagonal of boundary box of geometry by which
|
* Sets number of segments per diagonal of boundary box of geometry by which
|
||||||
* default segment length of appropriate 1D hypotheses is defined
|
* default segment length of appropriate 1D hypotheses is defined
|
||||||
*/
|
*/
|
||||||
void SetBoundaryBoxSegmentation( in long theNbSegments );
|
void SetBoundaryBoxSegmentation( in long theNbSegments ) raises ( SALOME::SALOME_Exception );
|
||||||
|
/*!
|
||||||
|
* \brief Sets default number of segments per edge
|
||||||
|
*/
|
||||||
|
void SetDefaultNbSegments( in long theNbSegments) raises ( SALOME::SALOME_Exception );
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Set the object name
|
* Set the object name
|
||||||
|
@ -91,6 +91,11 @@ class SMESH_EXPORT SMESH_Gen
|
|||||||
*/
|
*/
|
||||||
void SetBoundaryBoxSegmentation( int theNbSegments ) { _segmentation = theNbSegments; }
|
void SetBoundaryBoxSegmentation( int theNbSegments ) { _segmentation = theNbSegments; }
|
||||||
int GetBoundaryBoxSegmentation() const { return _segmentation; }
|
int GetBoundaryBoxSegmentation() const { return _segmentation; }
|
||||||
|
/*!
|
||||||
|
* \brief Sets default number of segments per edge
|
||||||
|
*/
|
||||||
|
void SetDefaultNbSegments(int nb) { _nbSegments = nb; }
|
||||||
|
int GetDefaultNbSegments() const { return _nbSegments; }
|
||||||
|
|
||||||
struct TAlgoStateError
|
struct TAlgoStateError
|
||||||
{
|
{
|
||||||
@ -149,6 +154,8 @@ class SMESH_EXPORT SMESH_Gen
|
|||||||
// number of segments per diagonal of boundary box of geometry by which
|
// number of segments per diagonal of boundary box of geometry by which
|
||||||
// default segment length of appropriate 1D hypotheses is defined
|
// default segment length of appropriate 1D hypotheses is defined
|
||||||
int _segmentation;
|
int _segmentation;
|
||||||
|
// default of segments
|
||||||
|
int _nbSegments;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1072,8 +1072,10 @@ SalomeApp_Module( "SMESH" )
|
|||||||
|
|
||||||
// 0019923: EDF 765 SMESH : default values of hypothesis
|
// 0019923: EDF 765 SMESH : default values of hypothesis
|
||||||
SUIT_ResourceMgr* aResourceMgr = SMESH::GetResourceMgr(this);
|
SUIT_ResourceMgr* aResourceMgr = SMESH::GetResourceMgr(this);
|
||||||
int nbSeg = aResourceMgr->integerValue( "SMESH", "segmentation" );
|
int nbSeg = aResourceMgr->integerValue( "SMESH", "segmentation", 10 );
|
||||||
myComponentSMESH->SetBoundaryBoxSegmentation( nbSeg );
|
myComponentSMESH->SetBoundaryBoxSegmentation( nbSeg );
|
||||||
|
nbSeg = aResourceMgr->integerValue( "SMESH", "nb_segments_per_edge", 15 );
|
||||||
|
myComponentSMESH->SetDefaultNbSegments( nbSeg );
|
||||||
}
|
}
|
||||||
|
|
||||||
myActiveDialogBox = 0;
|
myActiveDialogBox = 0;
|
||||||
@ -3464,6 +3466,10 @@ void SMESHGUI::createPreferences()
|
|||||||
"SMESH", "segmentation" );
|
"SMESH", "segmentation" );
|
||||||
setPreferenceProperty( segLen, "min", 1 );
|
setPreferenceProperty( segLen, "min", 1 );
|
||||||
setPreferenceProperty( segLen, "max", 10000000 );
|
setPreferenceProperty( segLen, "max", 10000000 );
|
||||||
|
int nbSeg = addPreference( tr( "PREF_NB_SEGMENTS" ), segGroup, LightApp_Preferences::IntSpin,
|
||||||
|
"SMESH", "nb_segments_per_edge" );
|
||||||
|
setPreferenceProperty( nbSeg, "min", 1 );
|
||||||
|
setPreferenceProperty( nbSeg, "max", 10000000 );
|
||||||
|
|
||||||
// Mesh tab ------------------------------------------------------------------------
|
// Mesh tab ------------------------------------------------------------------------
|
||||||
int meshTab = addPreference( tr( "PREF_TAB_MESH" ) );
|
int meshTab = addPreference( tr( "PREF_TAB_MESH" ) );
|
||||||
@ -3666,9 +3672,13 @@ void SMESHGUI::preferencesChanged( const QString& sect, const QString& name )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( name == "segmentation" ) {
|
else if ( name == "segmentation" ) {
|
||||||
int nbSeg = aResourceMgr->integerValue( "SMESH", "segmentation" );
|
int nbSeg = aResourceMgr->integerValue( "SMESH", "segmentation", 10 );
|
||||||
myComponentSMESH->SetBoundaryBoxSegmentation( nbSeg );
|
myComponentSMESH->SetBoundaryBoxSegmentation( nbSeg );
|
||||||
}
|
}
|
||||||
|
else if ( name == "nb_segments_per_edge" ) {
|
||||||
|
int nbSeg = aResourceMgr->integerValue( "SMESH", "nb_segments_per_edge", 15 );
|
||||||
|
myComponentSMESH->SetDefaultNbSegments( nbSeg );
|
||||||
|
}
|
||||||
|
|
||||||
if(aWarning.size() != 0){
|
if(aWarning.size() != 0){
|
||||||
aWarning += "The default values are applied instead.";
|
aWarning += "The default values are applied instead.";
|
||||||
|
@ -663,10 +663,10 @@ SMESH_Gen_i::GetHypothesisParameterValues (const char* theHypType,
|
|||||||
throw ( SALOME::SALOME_Exception )
|
throw ( SALOME::SALOME_Exception )
|
||||||
{
|
{
|
||||||
Unexpect aCatch(SALOME_SalomeException);
|
Unexpect aCatch(SALOME_SalomeException);
|
||||||
if ( CORBA::is_nil( theMesh ) && byMesh )
|
if ( byMesh && CORBA::is_nil( theMesh ) )
|
||||||
THROW_SALOME_CORBA_EXCEPTION( "bad Mesh reference", SALOME::BAD_PARAM );
|
return SMESH::SMESH_Hypothesis::_nil();
|
||||||
if ( CORBA::is_nil( theGeom ) )
|
if ( byMesh && CORBA::is_nil( theGeom ) )
|
||||||
THROW_SALOME_CORBA_EXCEPTION( "bad shape object reference", SALOME::BAD_PARAM );
|
return SMESH::SMESH_Hypothesis::_nil();
|
||||||
|
|
||||||
// -----------------------------------------------
|
// -----------------------------------------------
|
||||||
// find hypothesis used to mesh theGeom
|
// find hypothesis used to mesh theGeom
|
||||||
@ -675,13 +675,10 @@ SMESH_Gen_i::GetHypothesisParameterValues (const char* theHypType,
|
|||||||
// get mesh and shape
|
// get mesh and shape
|
||||||
SMESH_Mesh_i* meshServant = SMESH::DownCast<SMESH_Mesh_i*>( theMesh );
|
SMESH_Mesh_i* meshServant = SMESH::DownCast<SMESH_Mesh_i*>( theMesh );
|
||||||
TopoDS_Shape shape = GeomObjectToShape( theGeom );
|
TopoDS_Shape shape = GeomObjectToShape( theGeom );
|
||||||
if ( !meshServant && byMesh || shape.IsNull() )
|
if ( byMesh && ( !meshServant || meshServant->NbNodes()==0 || shape.IsNull() ))
|
||||||
return SMESH::SMESH_Hypothesis::_nil();
|
return SMESH::SMESH_Hypothesis::_nil();
|
||||||
::SMESH_Mesh* mesh = meshServant ? &meshServant->GetImpl() : (::SMESH_Mesh*)0;
|
::SMESH_Mesh* mesh = meshServant ? &meshServant->GetImpl() : (::SMESH_Mesh*)0;
|
||||||
|
|
||||||
if ( byMesh && mesh->NbNodes() == 0 ) // empty mesh
|
|
||||||
return SMESH::SMESH_Hypothesis::_nil();
|
|
||||||
|
|
||||||
// create a temporary hypothesis to know its dimention
|
// create a temporary hypothesis to know its dimention
|
||||||
SMESH::SMESH_Hypothesis_var tmpHyp = this->createHypothesis( theHypType, theLibName );
|
SMESH::SMESH_Hypothesis_var tmpHyp = this->createHypothesis( theHypType, theLibName );
|
||||||
SMESH_Hypothesis_i* hypServant = SMESH::DownCast<SMESH_Hypothesis_i*>( tmpHyp );
|
SMESH_Hypothesis_i* hypServant = SMESH::DownCast<SMESH_Hypothesis_i*>( tmpHyp );
|
||||||
@ -724,12 +721,12 @@ SMESH_Gen_i::GetHypothesisParameterValues (const char* theHypType,
|
|||||||
diagonal = mesh->GetShapeDiagonalSize();
|
diagonal = mesh->GetShapeDiagonalSize();
|
||||||
else
|
else
|
||||||
diagonal = ::SMESH_Mesh::GetShapeDiagonalSize( shape );
|
diagonal = ::SMESH_Mesh::GetShapeDiagonalSize( shape );
|
||||||
double elemSize = diagonal / myGen.GetBoundaryBoxSegmentation();
|
::SMESH_Hypothesis::TDefaults dflts;
|
||||||
if ( elemSize > 0 ) {
|
dflts._elemLength = diagonal / myGen.GetBoundaryBoxSegmentation();
|
||||||
// let the temporary hypothesis initialize it's values
|
dflts._nbSegments = myGen.GetDefaultNbSegments();
|
||||||
if ( hyp->SetParametersByElementSize( elemSize, mesh ))
|
// let the temporary hypothesis initialize it's values
|
||||||
return SMESH::SMESH_Hypothesis::_duplicate( tmpHyp );
|
if ( hyp->SetParametersByDefaults( dflts, mesh ))
|
||||||
}
|
return SMESH::SMESH_Hypothesis::_duplicate( tmpHyp );
|
||||||
}
|
}
|
||||||
|
|
||||||
return SMESH::SMESH_Hypothesis::_nil();
|
return SMESH::SMESH_Hypothesis::_nil();
|
||||||
@ -743,8 +740,25 @@ SMESH_Gen_i::GetHypothesisParameterValues (const char* theHypType,
|
|||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
void SMESH_Gen_i::SetBoundaryBoxSegmentation( CORBA::Long theNbSegments )
|
void SMESH_Gen_i::SetBoundaryBoxSegmentation( CORBA::Long theNbSegments )
|
||||||
|
throw ( SALOME::SALOME_Exception )
|
||||||
{
|
{
|
||||||
myGen.SetBoundaryBoxSegmentation( int( theNbSegments ));
|
if ( theNbSegments > 0 )
|
||||||
|
myGen.SetBoundaryBoxSegmentation( int( theNbSegments ));
|
||||||
|
else
|
||||||
|
THROW_SALOME_CORBA_EXCEPTION( "non-positive number of segments", SALOME::BAD_PARAM );
|
||||||
|
}
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Sets default number of segments per edge
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
void SMESH_Gen_i::SetDefaultNbSegments(CORBA::Long theNbSegments)
|
||||||
|
throw ( SALOME::SALOME_Exception )
|
||||||
|
{
|
||||||
|
if ( theNbSegments )
|
||||||
|
myGen.SetDefaultNbSegments( int(theNbSegments) );
|
||||||
|
else
|
||||||
|
THROW_SALOME_CORBA_EXCEPTION( "non-positive number of segments", SALOME::BAD_PARAM );
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
@ -208,7 +208,11 @@ public:
|
|||||||
* Sets number of segments per diagonal of boundary box of geometry by which
|
* Sets number of segments per diagonal of boundary box of geometry by which
|
||||||
* default segment length of appropriate 1D hypotheses is defined
|
* default segment length of appropriate 1D hypotheses is defined
|
||||||
*/
|
*/
|
||||||
void SetBoundaryBoxSegmentation( CORBA::Long theNbSegments );
|
void SetBoundaryBoxSegmentation( CORBA::Long theNbSegments ) throw ( SALOME::SALOME_Exception );
|
||||||
|
/*!
|
||||||
|
* \brief Sets default number of segments per edge
|
||||||
|
*/
|
||||||
|
void SetDefaultNbSegments(CORBA::Long theNbSegments) throw ( SALOME::SALOME_Exception );
|
||||||
|
|
||||||
// Create empty mesh on a shape
|
// Create empty mesh on a shape
|
||||||
SMESH::SMESH_Mesh_ptr CreateMesh( GEOM::GEOM_Object_ptr theShapeObject )
|
SMESH::SMESH_Mesh_ptr CreateMesh( GEOM::GEOM_Object_ptr theShapeObject )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user