From: eap Date: Fri, 16 Jan 2009 14:51:59 +0000 (+0000) Subject: 0019923: EDF 765 SMESH : default values of hypothesis X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2c39bb1e19fea144e0f363703ff73e37f468e9ca;p=modules%2Fsmesh.git 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 ); --- diff --git a/idl/SMESH_Gen.idl b/idl/SMESH_Gen.idl index a928552f7..39b13c582 100644 --- a/idl/SMESH_Gen.idl +++ b/idl/SMESH_Gen.idl @@ -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 */ diff --git a/src/SMESH/SMESH_Gen.cxx b/src/SMESH/SMESH_Gen.cxx index 009bb1510..d65842adb 100644 --- a/src/SMESH/SMESH_Gen.cxx +++ b/src/SMESH/SMESH_Gen.cxx @@ -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::Load(int studyId, const char *aUrlOfFile) -{ -} - -//============================================================================= -/*! - * - */ -//============================================================================= - -void SMESH_Gen::Close(int studyId) -{ -} +// //============================================================================= +// /*! +// * +// */ +// //============================================================================= + +// void SMESH_Gen::Save(int studyId, const char *aUrlOfFile) +// { +// } + +// //============================================================================= +// /*! +// * +// */ +// //============================================================================= + +// void SMESH_Gen::Load(int studyId, const char *aUrlOfFile) +// { +// } + +// //============================================================================= +// /*! +// * +// */ +// //============================================================================= + +// void SMESH_Gen::Close(int studyId) +// { +// } //============================================================================= /*! diff --git a/src/SMESH/SMESH_Gen.hxx b/src/SMESH/SMESH_Gen.hxx index a6a04436a..33e0c06e8 100644 --- a/src/SMESH/SMESH_Gen.hxx +++ b/src/SMESH/SMESH_Gen.hxx @@ -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 diff --git a/src/SMESH_I/SMESH_Gen_i.cxx b/src/SMESH_I/SMESH_Gen_i.cxx index c0e26f6d7..893f7c548 100644 --- a/src/SMESH_I/SMESH_Gen_i.cxx +++ b/src/SMESH_I/SMESH_Gen_i.cxx @@ -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 diff --git a/src/SMESH_I/SMESH_Gen_i.hxx b/src/SMESH_I/SMESH_Gen_i.hxx index 8012fee65..9b9b5f169 100644 --- a/src/SMESH_I/SMESH_Gen_i.hxx +++ b/src/SMESH_I/SMESH_Gen_i.hxx @@ -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 );