0019923: EDF 765 SMESH : default values of hypothesis

/*!
+     * Sets number of segments per diagonal of boundary box of geometry by which
+     * default segment length of appropriate 1D hypotheses is defined
+     */
+    void SetBoundaryBoxSegmentation( in long theNbSegments );
This commit is contained in:
eap 2009-01-16 14:51:59 +00:00
parent 0dd6c95e10
commit 2c39bb1e19
5 changed files with 66 additions and 32 deletions

View File

@ -164,6 +164,12 @@ module SMESH
in boolean byMesh)
raises ( SALOME::SALOME_Exception );
/*!
* Sets number of segments per diagonal of boundary box of geometry by which
* default segment length of appropriate 1D hypotheses is defined
*/
void SetBoundaryBoxSegmentation( in long theNbSegments );
/*!
* Set the object name
*/

View File

@ -55,6 +55,7 @@ SMESH_Gen::SMESH_Gen()
MESSAGE("SMESH_Gen::SMESH_Gen");
_localId = 0;
_hypId = 0;
_segmentation = 10;
}
//=============================================================================
@ -703,35 +704,35 @@ StudyContextStruct *SMESH_Gen::GetStudyContext(int studyId)
return myStudyContext;
}
//=============================================================================
/*!
*
*/
//=============================================================================
// //=============================================================================
// /*!
// *
// */
// //=============================================================================
void SMESH_Gen::Save(int studyId, const char *aUrlOfFile)
{
}
// void SMESH_Gen::Save(int studyId, const char *aUrlOfFile)
// {
// }
//=============================================================================
/*!
*
*/
//=============================================================================
// //=============================================================================
// /*!
// *
// */
// //=============================================================================
void SMESH_Gen::Load(int studyId, const char *aUrlOfFile)
{
}
// void SMESH_Gen::Load(int studyId, const char *aUrlOfFile)
// {
// }
//=============================================================================
/*!
*
*/
//=============================================================================
// //=============================================================================
// /*!
// *
// */
// //=============================================================================
void SMESH_Gen::Close(int studyId)
{
}
// void SMESH_Gen::Close(int studyId)
// {
// }
//=============================================================================
/*!

View File

@ -86,6 +86,12 @@ class SMESH_EXPORT SMESH_Gen
// notify on bad state of attached algos, return false
// if Compute() would fail because of some algo bad state
/*!
* \brief Sets number of segments per diagonal of boundary box of geometry by which
* default segment length of appropriate 1D hypotheses is defined
*/
void SetBoundaryBoxSegmentation( int theNbSegments ) { _segmentation = theNbSegments; }
int GetBoundaryBoxSegmentation() const { return _segmentation; }
struct TAlgoStateError
{
@ -117,13 +123,13 @@ class SMESH_EXPORT SMESH_Gen
// inherited methods from SALOMEDS::Driver
void Save(int studyId, const char *aUrlOfFile);
void Load(int studyId, const char *aUrlOfFile);
void Close(int studyId);
const char *ComponentDataType();
// void Save(int studyId, const char *aUrlOfFile);
// void Load(int studyId, const char *aUrlOfFile);
// void Close(int studyId);
// const char *ComponentDataType();
const char *IORToLocalPersistentID(const char *IORString, bool & IsAFile);
const char *LocalPersistentIDToIOR(const char *aLocalPersistentID);
// const char *IORToLocalPersistentID(const char *IORString, bool & IsAFile);
// const char *LocalPersistentIDToIOR(const char *aLocalPersistentID);
int GetANewId();
@ -140,6 +146,10 @@ class SMESH_EXPORT SMESH_Gen
// hypotheses managing
int _hypId;
// number of segments per diagonal of boundary box of geometry by which
// default segment length of appropriate 1D hypotheses is defined
int _segmentation;
};
#endif

View File

@ -461,7 +461,6 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::createMesh()
SMESH_Mesh_i* meshServant = new SMESH_Mesh_i( GetPOA(), this, GetCurrentStudyID() );
// create a new mesh object
meshServant->SetImpl( myGen.CreateMesh( GetCurrentStudyID(), myIsEmbeddedMode ));
meshServant->GetImpl().SetNbElementsPerDiagonal( nbElemPerDiagonal );
// activate the CORBA servant of Mesh
SMESH::SMESH_Mesh_var mesh = SMESH::SMESH_Mesh::_narrow( meshServant->_this() );
@ -727,7 +726,7 @@ SMESH_Gen_i::GetHypothesisParameterValues (const char* theHypType,
diagonal = mesh->GetShapeDiagonalSize();
else
diagonal = ::SMESH_Mesh::GetShapeDiagonalSize( shape );
double elemSize = diagonal / nbElemPerDiagonal;
double elemSize = diagonal / myGen.GetBoundaryBoxSegmentation();
if ( elemSize > 0 ) {
// let the temporary hypothesis initialize it's values
if ( hyp->SetParametersByElementSize( elemSize, mesh ))
@ -738,6 +737,18 @@ SMESH_Gen_i::GetHypothesisParameterValues (const char* theHypType,
return SMESH::SMESH_Hypothesis::_nil();
}
//=============================================================================
/*!
* Sets number of segments per diagonal of boundary box of geometry by which
* default segment length of appropriate 1D hypotheses is defined
*/
//=============================================================================
void SMESH_Gen_i::SetBoundaryBoxSegmentation( CORBA::Long theNbSegments )
{
myGen.SetBoundaryBoxSegmentation( int( theNbSegments ));
}
//=============================================================================
/*!
* SMESH_Gen_i::CreateMesh

View File

@ -206,6 +206,12 @@ public:
CORBA::Boolean byMesh)
throw ( SALOME::SALOME_Exception );
/*!
* Sets number of segments per diagonal of boundary box of geometry by which
* default segment length of appropriate 1D hypotheses is defined
*/
void SetBoundaryBoxSegmentation( CORBA::Long theNbSegments );
// Create empty mesh on a shape
SMESH::SMESH_Mesh_ptr CreateMesh( GEOM::GEOM_Object_ptr theShapeObject )
throw ( SALOME::SALOME_Exception );