NPAL17873: SMESH add a triangle instead of make quadrangles only.

This commit is contained in:
jfa 2008-02-01 08:07:48 +00:00
parent 1eb94bb23a
commit f27fb702a4
13 changed files with 217 additions and 53 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -54,9 +54,18 @@ locations and 1D mesh elements are constructed on segments.
<b>Average Length</b> hypothesis can be applied for meshing of edges <b>Average Length</b> hypothesis can be applied for meshing of edges
composing your geometrical object. Definition of this hypothesis composing your geometrical object. Definition of this hypothesis
consists of setting the \b length of segments, which will split these consists of setting the \b length of segments, which will split these
edges. The points on the edges generated by these segments will edges, and the \b precision of rounding. The points on the edges
represent nodes of your mesh. Later these nodes will be used for generated by these segments will represent nodes of your mesh.
meshing of the faces abutting to these edges. Later these nodes will be used for meshing of the faces abutting to
these edges.
The \b precision parameter is used to allow rounding a number of
segments, calculated from the edge length and average length of
segment, to the lower integer, if this value outstands from it in
bounds of the precision. Otherwise, the number of segments is rounded
to the higher integer. Use value 0.5 to provide rounding to the
nearest integer, 1.0 for the lower integer, 0.0 for the higher
integer. Default value is 1e-07.
\image html image41.gif \image html image41.gif
@ -155,4 +164,4 @@ minimum and maximum value of this parameter.
\image html image148.gif \image html image148.gif
*/ */

View File

@ -43,13 +43,33 @@ module StdMeshers
/*! /*!
* Sets <length> parameter value * Sets <length> parameter value
*/ */
void SetLength(in double length) void SetLength(in double length)
raises (SALOME::SALOME_Exception);
/*!
* Sets <precision> parameter value
*
* Precision parameter is used to allow rounding a number of segments,
* calculated from the edge length and average length of segment,
* to the lower integer, if this value outstands from it in bounds of the precision.
* Otherwise, the number of segments is rounded to the higher integer.
* Use value 0.5 to provide rounding to the nearest integer,
* 1.0 for the lower integer, 0.0 for the higher integer.
* Default value is 1e-07. In old studies, restored from file,
* this value will be set to zero, what corresponds to the old behaviour.
*/
void SetPrecision(in double precision)
raises (SALOME::SALOME_Exception); raises (SALOME::SALOME_Exception);
/*! /*!
* Returns <length> parameter value * Returns <length> parameter value
*/ */
double GetLength(); double GetLength();
/*!
* Returns <precision> parameter value
*/
double GetPrecision();
}; };
/*! /*!
@ -85,7 +105,7 @@ module StdMeshers
/*! /*!
* Sets <number of segments> parameter value * Sets <number of segments> parameter value
*/ */
void SetNumberOfSegments(in long segmentsNumber) void SetNumberOfSegments(in long segmentsNumber)
raises (SALOME::SALOME_Exception); raises (SALOME::SALOME_Exception);
/*! /*!

View File

@ -119,7 +119,7 @@ namespace {
return; return;
for ( int iE = 0; iE < side.NbEdges(); ++iE ) for ( int iE = 0; iE < side.NbEdges(); ++iE )
{ {
// set listener and its data // set listener and its data
EventListenerData * listenerData = new EventListenerData(true); EventListenerData * listenerData = new EventListenerData(true);
const TopoDS_Edge& edge = side.Edge( iE ); const TopoDS_Edge& edge = side.Edge( iE );
SMESH_subMesh * sm = side.GetMesh()->GetSubMesh( edge ); SMESH_subMesh * sm = side.GetMesh()->GetSubMesh( edge );
@ -333,7 +333,7 @@ bool StdMeshers_CompositeSegment_1D::Compute(SMESH_Mesh & aMesh,
auto_ptr< BRepAdaptor_CompCurve > C3d ( side->GetCurve3d() ); auto_ptr< BRepAdaptor_CompCurve > C3d ( side->GetCurve3d() );
double f = C3d->FirstParameter(), l = C3d->LastParameter(); double f = C3d->FirstParameter(), l = C3d->LastParameter();
list< double > params; list< double > params;
if ( !computeInternalParameters ( *C3d, side->Length(), f, l, params, false )) if ( !computeInternalParameters ( aMesh, *C3d, side->Length(), f, l, params, false ))
return false; return false;
// Redistribute parameters near ends // Redistribute parameters near ends
@ -349,7 +349,7 @@ bool StdMeshers_CompositeSegment_1D::Compute(SMESH_Mesh & aMesh,
const SMDS_MeshNode * nFirst = SMESH_Algo::VertexNode( VFirst, meshDS ); const SMDS_MeshNode * nFirst = SMESH_Algo::VertexNode( VFirst, meshDS );
const SMDS_MeshNode * nLast = SMESH_Algo::VertexNode( VLast, meshDS ); const SMDS_MeshNode * nLast = SMESH_Algo::VertexNode( VLast, meshDS );
if (!nFirst) if (!nFirst)
return error(COMPERR_BAD_INPUT_MESH, TComm("No node on vertex ") return error(COMPERR_BAD_INPUT_MESH, TComm("No node on vertex ")
<<meshDS->ShapeToIndex(VFirst)); <<meshDS->ShapeToIndex(VFirst));
if (!nLast) if (!nLast)
@ -414,4 +414,3 @@ bool StdMeshers_CompositeSegment_1D::Compute(SMESH_Mesh & aMesh,
return true; return true;
} }

View File

@ -43,6 +43,7 @@
#include <TopTools_IndexedMapOfShape.hxx> #include <TopTools_IndexedMapOfShape.hxx>
#include <TopoDS.hxx> #include <TopoDS.hxx>
#include <TopoDS_Edge.hxx> #include <TopoDS_Edge.hxx>
#include <Precision.hxx>
using namespace std; using namespace std;
@ -56,6 +57,7 @@ StdMeshers_LocalLength::StdMeshers_LocalLength(int hypId, int studyId, SMESH_Gen
:SMESH_Hypothesis(hypId, studyId, gen) :SMESH_Hypothesis(hypId, studyId, gen)
{ {
_length = 1.; _length = 1.;
_precision = Precision::Confusion();
_name = "LocalLength"; _name = "LocalLength";
_param_algo_dim = 1; // is used by SMESH_Regular_1D _param_algo_dim = 1; // is used by SMESH_Regular_1D
} }
@ -78,12 +80,13 @@ StdMeshers_LocalLength::~StdMeshers_LocalLength()
void StdMeshers_LocalLength::SetLength(double length) throw(SALOME_Exception) void StdMeshers_LocalLength::SetLength(double length) throw(SALOME_Exception)
{ {
double oldLength = _length; double oldLength = _length;
if (length <= 0) if (length <= 0)
throw SALOME_Exception(LOCALIZED("length must be positive")); throw SALOME_Exception(LOCALIZED("length must be positive"));
_length = length; _length = length;
if (oldLength != _length) const double precision = 1e-7;
NotifySubMeshesHypothesisModification(); if (fabs(oldLength - _length) > precision)
NotifySubMeshesHypothesisModification();
} }
//============================================================================= //=============================================================================
@ -94,7 +97,33 @@ void StdMeshers_LocalLength::SetLength(double length) throw(SALOME_Exception)
double StdMeshers_LocalLength::GetLength() const double StdMeshers_LocalLength::GetLength() const
{ {
return _length; return _length;
}
//=============================================================================
/*!
*
*/
//=============================================================================
void StdMeshers_LocalLength::SetPrecision (double thePrecision) throw(SALOME_Exception)
{
double oldPrecision = _precision;
if (_precision < 0)
throw SALOME_Exception(LOCALIZED("precision cannot be negative"));
_precision = thePrecision;
const double precision = 1e-8;
if (fabs(oldPrecision - _precision) > precision)
NotifySubMeshesHypothesisModification();
}
//=============================================================================
/*!
*
*/
//=============================================================================
double StdMeshers_LocalLength::GetPrecision() const
{
return _precision;
} }
//============================================================================= //=============================================================================
@ -105,7 +134,7 @@ double StdMeshers_LocalLength::GetLength() const
ostream & StdMeshers_LocalLength::SaveTo(ostream & save) ostream & StdMeshers_LocalLength::SaveTo(ostream & save)
{ {
save << this->_length; save << this->_length << " " << this->_precision;
return save; return save;
} }
@ -119,11 +148,23 @@ istream & StdMeshers_LocalLength::LoadFrom(istream & load)
{ {
bool isOK = true; bool isOK = true;
double a; double a;
isOK = (load >> a); isOK = (load >> a);
if (isOK) if (isOK)
this->_length = a; this->_length = a;
else else
load.clear(ios::badbit | load.rdstate()); load.clear(ios::badbit | load.rdstate());
isOK = (load >> a);
if (isOK)
this->_precision = a;
else
{
load.clear(ios::badbit | load.rdstate());
// old format, without precision
_precision = 0.;
}
return load; return load;
} }
@ -190,5 +231,7 @@ bool StdMeshers_LocalLength::SetParametersByMesh(const SMESH_Mesh* theMesh,
if ( nbEdges ) if ( nbEdges )
_length /= nbEdges; _length /= nbEdges;
_precision = Precision::Confusion();
return nbEdges; return nbEdges;
} }

View File

@ -35,15 +35,17 @@
#include "SMESH_Hypothesis.hxx" #include "SMESH_Hypothesis.hxx"
#include "Utils_SALOME_Exception.hxx" #include "Utils_SALOME_Exception.hxx"
class STDMESHERS_EXPORT StdMeshers_LocalLength:public SMESH_Hypothesis class STDMESHERS_EXPORT StdMeshers_LocalLength: public SMESH_Hypothesis
{ {
public: public:
StdMeshers_LocalLength(int hypId, int studyId, SMESH_Gen * gen); StdMeshers_LocalLength(int hypId, int studyId, SMESH_Gen * gen);
virtual ~ StdMeshers_LocalLength(); virtual ~ StdMeshers_LocalLength();
void SetLength(double length) throw(SALOME_Exception); void SetLength(double length) throw(SALOME_Exception);
void SetPrecision(double precision) throw(SALOME_Exception);
double GetLength() const; double GetLength() const;
double GetPrecision() const;
virtual std::ostream & SaveTo(std::ostream & save); virtual std::ostream & SaveTo(std::ostream & save);
virtual std::istream & LoadFrom(std::istream & load); virtual std::istream & LoadFrom(std::istream & load);
@ -60,6 +62,7 @@ class STDMESHERS_EXPORT StdMeshers_LocalLength:public SMESH_Hypothesis
protected: protected:
double _length; double _length;
double _precision;
}; };
#endif #endif

View File

@ -160,7 +160,7 @@ bool StdMeshers_RadialPrism_3D::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& a
// to delete helper at exit from Compute() // to delete helper at exit from Compute()
std::auto_ptr<SMESH_MesherHelper> helperDeleter( myHelper ); std::auto_ptr<SMESH_MesherHelper> helperDeleter( myHelper );
// get 2 shells // get 2 shells
TopoDS_Solid solid = TopoDS::Solid( aShape ); TopoDS_Solid solid = TopoDS::Solid( aShape );
TopoDS_Shell outerShell = BRepTools::OuterShell( solid ); TopoDS_Shell outerShell = BRepTools::OuterShell( solid );
TopoDS_Shape innerShell; TopoDS_Shape innerShell;
@ -336,7 +336,7 @@ public:
BRepAdaptor_Curve C3D(edge); BRepAdaptor_Curve C3D(edge);
double f = C3D.FirstParameter(), l = C3D.LastParameter(); double f = C3D.FirstParameter(), l = C3D.LastParameter();
list< double > params; list< double > params;
if ( !StdMeshers_Regular_1D::computeInternalParameters( C3D, len, f, l, params, false )) if ( !StdMeshers_Regular_1D::computeInternalParameters( aMesh, C3D, len, f, l, params, false ))
return error("StdMeshers_Regular_1D failed to compute layers distribution"); return error("StdMeshers_Regular_1D failed to compute layers distribution");
positions.clear(); positions.clear();

View File

@ -146,7 +146,9 @@ bool StdMeshers_Regular_1D::CheckHypothesis
const StdMeshers_LocalLength * hyp = const StdMeshers_LocalLength * hyp =
dynamic_cast <const StdMeshers_LocalLength * >(theHyp); dynamic_cast <const StdMeshers_LocalLength * >(theHyp);
ASSERT(hyp); ASSERT(hyp);
_value[ BEG_LENGTH_IND ] = _value[ END_LENGTH_IND ] = hyp->GetLength(); //_value[ BEG_LENGTH_IND ] = _value[ END_LENGTH_IND ] = hyp->GetLength();
_value[ BEG_LENGTH_IND ] = hyp->GetLength();
_value[ END_LENGTH_IND ] = hyp->GetPrecision();
ASSERT( _value[ BEG_LENGTH_IND ] > 0 ); ASSERT( _value[ BEG_LENGTH_IND ] > 0 );
_hypType = LOCAL_LENGTH; _hypType = LOCAL_LENGTH;
aStatus = SMESH_Hypothesis::HYP_OK; aStatus = SMESH_Hypothesis::HYP_OK;
@ -224,7 +226,9 @@ bool StdMeshers_Regular_1D::CheckHypothesis
StdMeshers_AutomaticLength * hyp = const_cast<StdMeshers_AutomaticLength *> StdMeshers_AutomaticLength * hyp = const_cast<StdMeshers_AutomaticLength *>
(dynamic_cast <const StdMeshers_AutomaticLength * >(theHyp)); (dynamic_cast <const StdMeshers_AutomaticLength * >(theHyp));
ASSERT(hyp); ASSERT(hyp);
_value[ BEG_LENGTH_IND ] = _value[ END_LENGTH_IND ] = hyp->GetLength( &aMesh, aShape ); //_value[ BEG_LENGTH_IND ] = _value[ END_LENGTH_IND ] = hyp->GetLength( &aMesh, aShape );
_value[ BEG_LENGTH_IND ] = hyp->GetLength( &aMesh, aShape );
_value[ END_LENGTH_IND ] = Precision::Confusion(); // ?? or set to zero?
ASSERT( _value[ BEG_LENGTH_IND ] > 0 ); ASSERT( _value[ BEG_LENGTH_IND ] > 0 );
_hypType = LOCAL_LENGTH; _hypType = LOCAL_LENGTH;
aStatus = SMESH_Hypothesis::HYP_OK; aStatus = SMESH_Hypothesis::HYP_OK;
@ -243,7 +247,7 @@ static bool computeParamByFunc(Adaptor3d_Curve& C3d, double first, double last,
// never do this way // never do this way
//OSD::SetSignal( true ); //OSD::SetSignal( true );
if( nbSeg<=0 ) if (nbSeg <= 0)
return false; return false;
MESSAGE( "computeParamByFunc" ); MESSAGE( "computeParamByFunc" );
@ -251,12 +255,12 @@ static bool computeParamByFunc(Adaptor3d_Curve& C3d, double first, double last,
int nbPnt = 1 + nbSeg; int nbPnt = 1 + nbSeg;
vector<double> x(nbPnt, 0.); vector<double> x(nbPnt, 0.);
if( !buildDistribution( func, 0.0, 1.0, nbSeg, x, 1E-4 ) ) if (!buildDistribution(func, 0.0, 1.0, nbSeg, x, 1E-4))
return false; return false;
MESSAGE( "Points:\n" ); MESSAGE( "Points:\n" );
char buf[1024]; char buf[1024];
for( int i=0; i<=nbSeg; i++ ) for ( int i=0; i<=nbSeg; i++ )
{ {
sprintf( buf, "%f\n", float(x[i] ) ); sprintf( buf, "%f\n", float(x[i] ) );
MESSAGE( buf ); MESSAGE( buf );
@ -524,7 +528,7 @@ void StdMeshers_Regular_1D::redistributeNearVertices (SMESH_Mesh & theM
std::swap( algo._value[ BEG_LENGTH_IND ], algo._value[ END_LENGTH_IND ]); std::swap( algo._value[ BEG_LENGTH_IND ], algo._value[ END_LENGTH_IND ]);
} }
list<double> params; list<double> params;
if ( algo.computeInternalParameters( theC3d, L, from, to, params, false )) if ( algo.computeInternalParameters( theMesh, theC3d, L, from, to, params, false ))
{ {
if ( isEnd1 ) params.reverse(); if ( isEnd1 ) params.reverse();
while ( 1 + nHalf-- ) while ( 1 + nHalf-- )
@ -547,12 +551,14 @@ void StdMeshers_Regular_1D::redistributeNearVertices (SMESH_Mesh & theM
* *
*/ */
//============================================================================= //=============================================================================
bool StdMeshers_Regular_1D::computeInternalParameters(Adaptor3d_Curve& theC3d, bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
Adaptor3d_Curve& theC3d,
double theLength, double theLength,
double theFirstU, double theFirstU,
double theLastU, double theLastU,
list<double> & theParams, list<double> & theParams,
const bool theReverse) const bool theReverse,
bool theConsiderPropagation)
{ {
theParams.clear(); theParams.clear();
@ -568,6 +574,38 @@ bool StdMeshers_Regular_1D::computeInternalParameters(Adaptor3d_Curve& theC3d,
{ {
// Local Length hypothesis // Local Length hypothesis
double nbseg = ceil(theLength / _value[ BEG_LENGTH_IND ]); // integer sup double nbseg = ceil(theLength / _value[ BEG_LENGTH_IND ]); // integer sup
// NPAL17873:
bool isFound = false;
if (theConsiderPropagation && !_mainEdge.IsNull()) // propagated from some other edge
{
// Advanced processing to assure equal number of segments in case of Propagation
SMESH_subMesh* sm = theMesh.GetSubMeshContaining(_mainEdge);
if (sm) {
bool computed = sm->IsMeshComputed();
if (!computed) {
if (sm->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE) {
sm->ComputeStateEngine(SMESH_subMesh::COMPUTE);
computed = sm->IsMeshComputed();
}
}
if (computed) {
SMESHDS_SubMesh* smds = sm->GetSubMeshDS();
int nb_segments = smds->NbElements();
if (nbseg - 1 <= nb_segments && nb_segments <= nbseg + 1) {
isFound = true;
nbseg = nb_segments;
}
}
}
}
if (!isFound) // not found by meshed edge in the propagation chain, use precision
{
double aPrecision = _value[ END_LENGTH_IND ];
double nbseg_prec = ceil((theLength / _value[ BEG_LENGTH_IND ]) - aPrecision);
if (nbseg_prec == (nbseg - 1)) nbseg--;
}
if (nbseg <= 0) if (nbseg <= 0)
nbseg = 1; // degenerated edge nbseg = 1; // degenerated edge
eltSize = theLength / nbseg; eltSize = theLength / nbseg;
@ -736,14 +774,14 @@ bool StdMeshers_Regular_1D::computeInternalParameters(Adaptor3d_Curve& theC3d,
*/ */
//============================================================================= //=============================================================================
bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape) bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & theShape)
{ {
if ( _hypType == NONE ) if ( _hypType == NONE )
return false; return false;
SMESHDS_Mesh * meshDS = aMesh.GetMeshDS(); SMESHDS_Mesh * meshDS = theMesh.GetMeshDS();
const TopoDS_Edge & EE = TopoDS::Edge(aShape); const TopoDS_Edge & EE = TopoDS::Edge(theShape);
TopoDS_Edge E = TopoDS::Edge(EE.Oriented(TopAbs_FORWARD)); TopoDS_Edge E = TopoDS::Edge(EE.Oriented(TopAbs_FORWARD));
int shapeID = meshDS->ShapeToIndex( E ); int shapeID = meshDS->ShapeToIndex( E );
@ -769,10 +807,10 @@ bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aSh
BRepAdaptor_Curve C3d( E ); BRepAdaptor_Curve C3d( E );
double length = EdgeLength( E ); double length = EdgeLength( E );
if ( ! computeInternalParameters( C3d, length, f, l, params, reversed )) { if ( ! computeInternalParameters( theMesh, C3d, length, f, l, params, reversed, true )) {
return false; return false;
} }
redistributeNearVertices( aMesh, C3d, length, params, VFirst, VLast ); redistributeNearVertices( theMesh, C3d, length, params, VFirst, VLast );
// edge extrema (indexes : 1 & NbPoints) already in SMDS (TopoDS_Vertex) // edge extrema (indexes : 1 & NbPoints) already in SMDS (TopoDS_Vertex)
// only internal nodes receive an edge position with param on curve // only internal nodes receive an edge position with param on curve

View File

@ -73,12 +73,14 @@ public:
protected: protected:
virtual bool computeInternalParameters (Adaptor3d_Curve & theC3d, virtual bool computeInternalParameters (SMESH_Mesh & theMesh,
double theLength, Adaptor3d_Curve & theC3d,
double theFirstU, double theLength,
double theLastU, double theFirstU,
std::list< double > & theParameters, double theLastU,
const bool theReverse); std::list<double> & theParameters,
const bool theReverse,
bool theConsiderPropagation = false);
virtual void redistributeNearVertices (SMESH_Mesh & theMesh, virtual void redistributeNearVertices (SMESH_Mesh & theMesh,
Adaptor3d_Curve & theC3d, Adaptor3d_Curve & theC3d,
@ -101,12 +103,12 @@ protected:
BEG_LENGTH_IND = 0, BEG_LENGTH_IND = 0,
END_LENGTH_IND = 1, END_LENGTH_IND = 1,
DEFLECTION_IND = 0 DEFLECTION_IND = 0
}; };
enum IValueIndex { enum IValueIndex {
NB_SEGMENTS_IND = 0, NB_SEGMENTS_IND = 0,
DISTR_TYPE_IND = 1, DISTR_TYPE_IND = 1,
CONV_MODE_IND = 2 CONV_MODE_IND = 2
}; };
enum VValueIndex { enum VValueIndex {

View File

@ -388,6 +388,7 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
StdMeshers::StdMeshers_LocalLength::_narrow( hypothesis() ); StdMeshers::StdMeshers_LocalLength::_narrow( hypothesis() );
h->SetLength( params[0].myValue.toDouble() ); h->SetLength( params[0].myValue.toDouble() );
h->SetPrecision( params[1].myValue.toDouble() );
} }
else if( hypType()=="SegmentLengthAroundVertex" ) else if( hypType()=="SegmentLengthAroundVertex" )
{ {
@ -535,6 +536,9 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
item.myName = tr("SMESH_LOCAL_LENGTH_PARAM"); item.myName = tr("SMESH_LOCAL_LENGTH_PARAM");
item.myValue = h->GetLength(); item.myValue = h->GetLength();
p.append( item ); p.append( item );
item.myName = tr("SMESH_LOCAL_LENGTH_PRECISION");
item.myValue = h->GetPrecision();
p.append( item );
} }
else if( hypType()=="SegmentLengthAroundVertex" ) else if( hypType()=="SegmentLengthAroundVertex" )
{ {
@ -704,12 +708,15 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
*/ */
//================================================================================ //================================================================================
void StdMeshersGUI_StdHypothesisCreator::attuneStdWidget( QWidget* w, const int ) const void StdMeshersGUI_StdHypothesisCreator::attuneStdWidget (QWidget* w, const int param) const
{ {
SMESHGUI_SpinBox* sb = w->inherits( "SMESHGUI_SpinBox" ) ? ( SMESHGUI_SpinBox* )w : 0; SMESHGUI_SpinBox* sb = w->inherits( "SMESHGUI_SpinBox" ) ? ( SMESHGUI_SpinBox* )w : 0;
if( hypType()=="LocalLength" && sb ) if( hypType()=="LocalLength" && sb )
{ {
sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, 6 ); if (param == 0) // Length
sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, 6 );
else // Precision
sb->RangeStepAndValidator( 0.0, 1.0, 0.05, 6 );
} }
else if( hypType()=="Arithmetic1D" && sb ) else if( hypType()=="Arithmetic1D" && sb )
{ {

View File

@ -37,6 +37,9 @@ msgstr "Average Length"
msgid "SMESH_LOCAL_LENGTH_PARAM" msgid "SMESH_LOCAL_LENGTH_PARAM"
msgstr "Length" msgstr "Length"
msgid "SMESH_LOCAL_LENGTH_PRECISION"
msgstr "Precision"
msgid "SMESH_LOCAL_LENGTH_TITLE" msgid "SMESH_LOCAL_LENGTH_TITLE"
msgstr "Hypothesis Construction" msgstr "Hypothesis Construction"

View File

@ -48,15 +48,15 @@ using namespace std;
//============================================================================= //=============================================================================
StdMeshers_LocalLength_i::StdMeshers_LocalLength_i( PortableServer::POA_ptr thePOA, StdMeshers_LocalLength_i::StdMeshers_LocalLength_i( PortableServer::POA_ptr thePOA,
int theStudyId, int theStudyId,
::SMESH_Gen* theGenImpl ) ::SMESH_Gen* theGenImpl )
: SALOME::GenericObj_i( thePOA ), : SALOME::GenericObj_i( thePOA ),
SMESH_Hypothesis_i( thePOA ) SMESH_Hypothesis_i( thePOA )
{ {
MESSAGE( "StdMeshers_LocalLength_i::StdMeshers_LocalLength_i" ); MESSAGE( "StdMeshers_LocalLength_i::StdMeshers_LocalLength_i" );
myBaseImpl = new ::StdMeshers_LocalLength( theGenImpl->GetANewId(), myBaseImpl = new ::StdMeshers_LocalLength( theGenImpl->GetANewId(),
theStudyId, theStudyId,
theGenImpl ); theGenImpl );
} }
//============================================================================= //=============================================================================
@ -79,7 +79,6 @@ StdMeshers_LocalLength_i::~StdMeshers_LocalLength_i()
* Set length * Set length
*/ */
//============================================================================= //=============================================================================
void StdMeshers_LocalLength_i::SetLength( CORBA::Double theLength ) void StdMeshers_LocalLength_i::SetLength( CORBA::Double theLength )
throw ( SALOME::SALOME_Exception ) throw ( SALOME::SALOME_Exception )
{ {
@ -97,6 +96,30 @@ void StdMeshers_LocalLength_i::SetLength( CORBA::Double theLength )
SMESH::TPythonDump() << _this() << ".SetLength( " << theLength << " )"; SMESH::TPythonDump() << _this() << ".SetLength( " << theLength << " )";
} }
//=============================================================================
/*!
* StdMeshers_LocalLength_i::SetPrecision
*
* Set length
*/
//=============================================================================
void StdMeshers_LocalLength_i::SetPrecision( CORBA::Double thePrecision )
throw ( SALOME::SALOME_Exception )
{
MESSAGE( "StdMeshers_LocalLength_i::SetPrecision" );
ASSERT( myBaseImpl );
try {
this->GetImpl()->SetPrecision( thePrecision );
}
catch ( SALOME_Exception& S_ex ) {
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
SALOME::BAD_PARAM );
}
// Update Python script
SMESH::TPythonDump() << _this() << ".SetPrecision( " << thePrecision << " )";
}
//============================================================================= //=============================================================================
/*! /*!
* StdMeshers_LocalLength_i::GetLength * StdMeshers_LocalLength_i::GetLength
@ -104,7 +127,6 @@ void StdMeshers_LocalLength_i::SetLength( CORBA::Double theLength )
* Get length * Get length
*/ */
//============================================================================= //=============================================================================
CORBA::Double StdMeshers_LocalLength_i::GetLength() CORBA::Double StdMeshers_LocalLength_i::GetLength()
{ {
MESSAGE( "StdMeshers_LocalLength_i::GetLength" ); MESSAGE( "StdMeshers_LocalLength_i::GetLength" );
@ -112,6 +134,20 @@ CORBA::Double StdMeshers_LocalLength_i::GetLength()
return this->GetImpl()->GetLength(); return this->GetImpl()->GetLength();
} }
//=============================================================================
/*!
* StdMeshers_LocalLength_i::GetPrecision
*
* Get precision
*/
//=============================================================================
CORBA::Double StdMeshers_LocalLength_i::GetPrecision()
{
MESSAGE( "StdMeshers_LocalLength_i::GetPrecision" );
ASSERT( myBaseImpl );
return this->GetImpl()->GetPrecision();
}
//============================================================================= //=============================================================================
/*! /*!
* StdMeshers_LocalLength_i::GetImpl * StdMeshers_LocalLength_i::GetImpl
@ -119,7 +155,6 @@ CORBA::Double StdMeshers_LocalLength_i::GetLength()
* Get implementation * Get implementation
*/ */
//============================================================================= //=============================================================================
::StdMeshers_LocalLength* StdMeshers_LocalLength_i::GetImpl() ::StdMeshers_LocalLength* StdMeshers_LocalLength_i::GetImpl()
{ {
MESSAGE( "StdMeshers_LocalLength_i::GetImpl" ); MESSAGE( "StdMeshers_LocalLength_i::GetImpl" );
@ -139,4 +174,3 @@ CORBA::Boolean StdMeshers_LocalLength_i::IsDimSupported( SMESH::Dimension type )
{ {
return type == SMESH::DIM_1D; return type == SMESH::DIM_1D;
} }

View File

@ -58,8 +58,14 @@ public:
// Set length // Set length
void SetLength( CORBA::Double theLength ) void SetLength( CORBA::Double theLength )
throw ( SALOME::SALOME_Exception ); throw ( SALOME::SALOME_Exception );
// Set precision
void SetPrecision( CORBA::Double thePrecision )
throw ( SALOME::SALOME_Exception );
// Get length // Get length
CORBA::Double GetLength(); CORBA::Double GetLength();
// Get precision
CORBA::Double GetPrecision();
// Get implementation // Get implementation
::StdMeshers_LocalLength* GetImpl(); ::StdMeshers_LocalLength* GetImpl();