0019923: EDF 765 SMESH : default values of hypothesis

+   * \brief Initialize my parameter values by linear size of mesh element.
+   *  \retval bool - true if parameter values have been successfully defined
+   */
+  virtual bool SetParametersByElementSize(double elemLenght, const SMESH_Mesh* theMesh=0)=0;
This commit is contained in:
eap 2009-01-13 12:46:38 +00:00
parent f35204c6bd
commit 2420f68007
45 changed files with 458 additions and 38 deletions

View File

@ -286,12 +286,7 @@ bool SMESH_Algo::IsReversedSubMesh (const TopoDS_Face& theFace,
//================================================================================
/*!
* \brief Initialize my parameter values by the mesh built on the geometry
* \param theMesh - the built mesh
* \param theShape - the geometry of interest
* \retval bool - true if parameter values have been successfully defined
*
* Just return false as the algorithm does not hold parameters values
* \brief Just return false as the algorithm does not hold parameters values
*/
//================================================================================
@ -300,7 +295,10 @@ bool SMESH_Algo::SetParametersByMesh(const SMESH_Mesh* /*theMesh*/,
{
return false;
}
bool SMESH_Algo::SetParametersByElementSize(double, const SMESH_Mesh*)
{
return false;
}
//================================================================================
/*!
* \brief Fill vector of node parameters on geometrical edge, including vertex nodes

View File

@ -164,12 +164,10 @@ public:
bool InitCompatibleHypoFilter( SMESH_HypoFilter & theFilter,
const bool ignoreAuxiliary) const;
/*!
* \brief Initialize my parameter values by the mesh built on the geometry
*
* Just return false as the algorithm does not hold parameters values
* \brief Just return false as the algorithm does not hold parameters values
*/
virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh,
const TopoDS_Shape& theShape);
virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
virtual bool SetParametersByElementSize(double elemLenght, const SMESH_Mesh* theMesh=0);
/*!
* \brief return compute error
*/

View File

@ -80,12 +80,18 @@ public:
/*!
* \brief Initialize my parameter values by the mesh built on the geometry
* \param theMesh - the built mesh
* \param theShape - the geometry of interest
* \retval bool - true if parameter values have been successfully defined
* \param theMesh - the built mesh
* \param theShape - the geometry of interest
* \retval bool - true if parameter values have been successfully defined
*/
virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape)=0;
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
virtual bool SetParametersByElementSize(double elemLenght, const SMESH_Mesh* theMesh=0)=0;
/*!
* \brief Return true if me is an auxiliary hypothesis
* \retval bool - auxiliary or not

View File

@ -197,3 +197,17 @@ bool StdMeshers_Arithmetic1D::SetParametersByMesh(const SMESH_Mesh* theMesh,
}
return nbEdges;
}
//================================================================================
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
//================================================================================
bool StdMeshers_Arithmetic1D::SetParametersByElementSize(double elemLenght,
const SMESH_Mesh* /*mesh*/)
{
return bool( _begLength = _endLength = elemLenght );
}

View File

@ -58,6 +58,12 @@ public:
*/
virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
virtual bool SetParametersByElementSize( double elemLenght, const SMESH_Mesh* theMesh=0);
protected:
double _begLength, _endLength;
};

View File

@ -368,3 +368,37 @@ bool StdMeshers_AutomaticLength::SetParametersByMesh(const SMESH_Mesh* theMesh
return nbEdges;
}
//================================================================================
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
//================================================================================
bool StdMeshers_AutomaticLength::SetParametersByElementSize(double elemLenght,
const SMESH_Mesh* theMesh)
{
return false;
// assure the base automatic length is stored in _TShapeToLength
// GetLength( theMesh, elemLenght );
// // find maximal edge length
// double maxLen = 0;
// map<const TopoDS_TShape*, double>::iterator
// tshape_length = _TShapeToLength.begin(), slEnd = _TShapeToLength.end();
// for ( ; tshape_length != slEnd; ++tshape_length )
// if ( tshape_length->second > maxLen )
// maxLen = tshape_length->second;
// // automatic length for longest element
// double autoLen = GetLength( theMesh, maxLen );
// // elemLenght = autoLen / (theCoarseConst + theFineConst * _fineness) -->
// _fineness = ( autoLen / elemLenght - theCoarseConst ) / theFineConst;
// return true;
}

View File

@ -97,6 +97,12 @@ public:
*/
virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
virtual bool SetParametersByElementSize( double elemLenght, const SMESH_Mesh* theMesh=0);
protected:
std::map<const TopoDS_TShape*, double> _TShapeToLength;
const SMESH_Mesh* _mesh;

View File

@ -222,3 +222,16 @@ bool StdMeshers_Deflection1D::SetParametersByMesh(const SMESH_Mesh* theMesh,
}
return nbEdges;
}
//================================================================================
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
//================================================================================
bool StdMeshers_Deflection1D::SetParametersByElementSize(double /*elemLenght*/,
const SMESH_Mesh* /*theMesh*/)
{
return false;
}

View File

@ -56,7 +56,13 @@ class STDMESHERS_EXPORT StdMeshers_Deflection1D:public SMESH_Hypothesis
*/
virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
protected:
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
virtual bool SetParametersByElementSize( double elemLenght, const SMESH_Mesh* theMesh=0);
protected:
double _value;
};

View File

@ -146,3 +146,15 @@ bool StdMeshers_LayerDistribution::SetParametersByMesh(const SMESH_Mesh* ,
{
return false;
}
//================================================================================
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
//================================================================================
bool StdMeshers_LayerDistribution::SetParametersByElementSize(double elemLenght,
const SMESH_Mesh* theMesh)
{
return myHyp ? myHyp->SetParametersByElementSize(elemLenght,theMesh) : false;
}

View File

@ -84,6 +84,12 @@ public:
*/
virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
virtual bool SetParametersByElementSize( double elemLenght, const SMESH_Mesh* theMesh=0);
protected:
SMESH_Hypothesis* myHyp;
std::string mySavedHyp;

View File

@ -153,3 +153,15 @@ bool StdMeshers_LengthFromEdges::SetParametersByMesh(const SMESH_Mesh* /*theMesh
{
return false;
}
//================================================================================
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
//================================================================================
bool StdMeshers_LengthFromEdges::SetParametersByElementSize(double /*elemLenght*/,
const SMESH_Mesh* /*theMesh*/)
{
return true;
}

View File

@ -62,6 +62,12 @@ public:
*/
virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
virtual bool SetParametersByElementSize( double elemLenght, const SMESH_Mesh* theMesh=0);
protected:
int _mode;
};

View File

@ -235,3 +235,16 @@ bool StdMeshers_LocalLength::SetParametersByMesh(const SMESH_Mesh* theMesh,
return nbEdges;
}
//================================================================================
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
//================================================================================
bool StdMeshers_LocalLength::SetParametersByElementSize(double elemLenght,
const SMESH_Mesh* /*theMesh*/)
{
return bool( _length = elemLenght );
}

View File

@ -60,6 +60,12 @@ class STDMESHERS_EXPORT StdMeshers_LocalLength: public SMESH_Hypothesis
*/
virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
virtual bool SetParametersByElementSize( double elemLenght, const SMESH_Mesh* theMesh=0);
protected:
double _length;
double _precision;

View File

@ -186,3 +186,16 @@ bool StdMeshers_MaxElementArea::SetParametersByMesh(const SMESH_Mesh* theMesh,
}
return _maxArea > 0;
}
//================================================================================
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
//================================================================================
bool StdMeshers_MaxElementArea::SetParametersByElementSize(double elemLenght,
const SMESH_Mesh* /*theMesh*/)
{
return bool( _maxArea = elemLenght*elemLenght );
}

View File

@ -58,6 +58,12 @@ public:
*/
virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
virtual bool SetParametersByElementSize( double elemLenght, const SMESH_Mesh* theMesh=0);
protected:
double _maxArea;
};

View File

@ -198,3 +198,16 @@ bool StdMeshers_MaxElementVolume::SetParametersByMesh(const SMESH_Mesh* theMes
}
return _maxVolume > 0;
}
//================================================================================
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
//================================================================================
bool StdMeshers_MaxElementVolume::SetParametersByElementSize(double elemLenght,
const SMESH_Mesh* /*theMesh*/)
{
return bool( _maxVolume = elemLenght*elemLenght*elemLenght );
}

View File

@ -60,6 +60,12 @@ public:
*/
virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
virtual bool SetParametersByElementSize( double elemLenght, const SMESH_Mesh* theMesh=0);
protected:
double _maxVolume;
};

View File

@ -111,5 +111,18 @@ istream & operator >> (istream & load, StdMeshers_NotConformAllowed & hyp)
bool StdMeshers_NotConformAllowed::SetParametersByMesh(const SMESH_Mesh* /*theMesh*/,
const TopoDS_Shape& /*theShape*/)
{
return false;
return true;
}
//================================================================================
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
//================================================================================
bool StdMeshers_NotConformAllowed::SetParametersByElementSize(double /*elemLenght*/,
const SMESH_Mesh* /*theMesh*/)
{
return true;
}

View File

@ -56,6 +56,12 @@ public:
*/
virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
virtual bool SetParametersByElementSize( double elemLenght, const SMESH_Mesh* theMesh=0);
};
#endif

View File

@ -29,6 +29,7 @@
#include "StdMeshers_NumberOfLayers.hxx"
#include "SMESH_Mesh.hxx"
#include "utilities.h"
using namespace std;
@ -160,3 +161,17 @@ bool StdMeshers_NumberOfLayers::SetParametersByMesh(const SMESH_Mesh* ,
{
return false;
}
//================================================================================
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
//================================================================================
bool StdMeshers_NumberOfLayers::SetParametersByElementSize(double elemLenght,
const SMESH_Mesh* theMesh)
{
return bool( theMesh ? _nbLayers = int( theMesh->GetShapeDiagonalSize() / elemLenght/ 2.) : 0);
}

View File

@ -75,6 +75,12 @@ public:
*/
virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
virtual bool SetParametersByElementSize( double elemLenght, const SMESH_Mesh* theMesh=0);
protected:
int _nbLayers;
};

View File

@ -65,7 +65,7 @@ StdMeshers_NumberOfSegments::StdMeshers_NumberOfSegments(int hypId,
int studyId,
SMESH_Gen * gen)
: SMESH_Hypothesis(hypId, studyId, gen),
_numberOfSegments(1),
_numberOfSegments(15),//issue 19923
_distrType(DT_Regular),
_scaleFactor(1.),
_convMode(1) //cut negative by default
@ -684,3 +684,16 @@ bool StdMeshers_NumberOfSegments::SetParametersByMesh(const SMESH_Mesh* theMes
return nbEdges;
}
//================================================================================
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
//================================================================================
bool StdMeshers_NumberOfSegments::SetParametersByElementSize(double elemLenght,
const SMESH_Mesh* /*theMesh*/)
{
return false;
}

View File

@ -172,6 +172,12 @@ public:
*/
virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
virtual bool SetParametersByElementSize( double elemLenght, const SMESH_Mesh* theMesh=0);
virtual std::ostream & SaveTo(std::ostream & save);
virtual std::istream & LoadFrom(std::istream & load);
friend std::ostream& operator << (std::ostream & save, StdMeshers_NumberOfSegments & hyp);

View File

@ -230,3 +230,16 @@ void StdMeshers_ProjectionSource1D::RestoreParams(const TopoDS_Shape& s1,
_sourceMesh = mesh;
}
//================================================================================
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
//================================================================================
bool StdMeshers_ProjectionSource1D::SetParametersByElementSize(double /*elemLenght*/,
const SMESH_Mesh* /*theMesh*/)
{
return false;
}

View File

@ -138,6 +138,12 @@ public:
*/
virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
virtual bool SetParametersByElementSize( double elemLenght, const SMESH_Mesh* theMesh=0);
protected:
TopoDS_Shape _sourceEdge;

View File

@ -298,3 +298,17 @@ void StdMeshers_ProjectionSource2D::RestoreParams(const TopoDS_Shape& s1,
_targetVertex2 = TopoDS::Vertex( s5 );
_sourceMesh = mesh;
}
//================================================================================
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
//================================================================================
bool StdMeshers_ProjectionSource2D::SetParametersByElementSize(double /*elemLenght*/,
const SMESH_Mesh* /*theMesh*/)
{
return false;
}

View File

@ -148,6 +148,12 @@ public:
*/
virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
virtual bool SetParametersByElementSize( double elemLenght, const SMESH_Mesh* theMesh=0);
protected:
TopoDS_Shape _sourceFace;

View File

@ -297,3 +297,17 @@ void StdMeshers_ProjectionSource3D::RestoreParams(const TopoDS_Shape& s1,
_targetVertex2 = TopoDS::Vertex( s5 );
_sourceMesh = mesh;
}
//================================================================================
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
//================================================================================
bool StdMeshers_ProjectionSource3D::SetParametersByElementSize(double /*elemLenght*/,
const SMESH_Mesh* /*theMesh*/)
{
return false;
}

View File

@ -140,6 +140,12 @@ public:
*/
virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
virtual bool SetParametersByElementSize( double elemLenght, const SMESH_Mesh* theMesh=0);
protected:
TopoDS_Shape _sourceShape;

View File

@ -97,6 +97,7 @@ ostream & operator << (ostream & save, StdMeshers_Propagation & hyp) { return
istream & operator >> (istream & load, StdMeshers_Propagation & hyp) { return hyp.LoadFrom(load); }
bool StdMeshers_Propagation::SetParametersByMesh(const SMESH_Mesh*,
const TopoDS_Shape& ) { return false; }
bool StdMeshers_Propagation::SetParametersByElementSize(double,const SMESH_Mesh*) { return false; }
void StdMeshers_Propagation::SetPropagationMgr(SMESH_subMesh* subMesh) { PropagationMgr::Set( subMesh ); }
/*!
* \brief Return an edge from which hypotheses are propagated from

View File

@ -80,5 +80,12 @@ class STDMESHERS_EXPORT StdMeshers_Propagation:public SMESH_Hypothesis
* Just return false as this hypothesis does not have parameters values
*/
virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
virtual bool SetParametersByElementSize( double elemLenght, const SMESH_Mesh* theMesh=0);
};
#endif

View File

@ -114,3 +114,17 @@ bool StdMeshers_QuadranglePreference::SetParametersByMesh(const SMESH_Mesh* /*th
{
return false;
}
//================================================================================
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
//================================================================================
bool StdMeshers_QuadranglePreference::SetParametersByElementSize(double /*elemLenght*/,
const SMESH_Mesh* /*theMesh*/)
{
return false;
}

View File

@ -60,6 +60,12 @@ class STDMESHERS_EXPORT StdMeshers_QuadranglePreference:public SMESH_Hypothesis
*/
virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
virtual bool SetParametersByElementSize( double elemLenght, const SMESH_Mesh* theMesh=0);
};
#endif

View File

@ -109,3 +109,17 @@ bool StdMeshers_QuadraticMesh::SetParametersByMesh(const SMESH_Mesh*, const Topo
{
return false;
}
//================================================================================
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
//================================================================================
bool StdMeshers_QuadraticMesh::SetParametersByElementSize(double /*elemLenght*/,
const SMESH_Mesh* /*theMesh*/)
{
return false;
}

View File

@ -62,6 +62,12 @@ class STDMESHERS_EXPORT StdMeshers_QuadraticMesh:public SMESH_Hypothesis
*/
virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
virtual bool SetParametersByElementSize( double elemLenght, const SMESH_Mesh* theMesh=0);
};
#endif

View File

@ -30,14 +30,15 @@
#include "StdMeshers_Regular_1D.hxx"
#include "StdMeshers_Distribution.hxx"
#include "StdMeshers_LocalLength.hxx"
#include "StdMeshers_NumberOfSegments.hxx"
#include "StdMeshers_Arithmetic1D.hxx"
#include "StdMeshers_StartEndLength.hxx"
#include "StdMeshers_Deflection1D.hxx"
#include "StdMeshers_AutomaticLength.hxx"
#include "StdMeshers_SegmentLengthAroundVertex.hxx"
#include "StdMeshers_Deflection1D.hxx"
#include "StdMeshers_LocalLength.hxx"
#include "StdMeshers_MaxLength.hxx"
#include "StdMeshers_NumberOfSegments.hxx"
#include "StdMeshers_Propagation.hxx"
#include "StdMeshers_SegmentLengthAroundVertex.hxx"
#include "StdMeshers_StartEndLength.hxx"
#include "SMESH_Gen.hxx"
#include "SMESH_Mesh.hxx"
@ -81,6 +82,7 @@ StdMeshers_Regular_1D::StdMeshers_Regular_1D(int hypId, int studyId,
_shapeType = (1 << TopAbs_EDGE);
_compatibleHypothesis.push_back("LocalLength");
_compatibleHypothesis.push_back("MaxLength");
_compatibleHypothesis.push_back("NumberOfSegments");
_compatibleHypothesis.push_back("StartEndLength");
_compatibleHypothesis.push_back("Deflection1D");
@ -146,14 +148,28 @@ bool StdMeshers_Regular_1D::CheckHypothesis
const StdMeshers_LocalLength * hyp =
dynamic_cast <const StdMeshers_LocalLength * >(theHyp);
ASSERT(hyp);
//_value[ BEG_LENGTH_IND ] = _value[ END_LENGTH_IND ] = hyp->GetLength();
_value[ BEG_LENGTH_IND ] = hyp->GetLength();
_value[ END_LENGTH_IND ] = hyp->GetPrecision();
_value[ PRECISION_IND ] = hyp->GetPrecision();
ASSERT( _value[ BEG_LENGTH_IND ] > 0 );
_hypType = LOCAL_LENGTH;
aStatus = SMESH_Hypothesis::HYP_OK;
}
else if (hypName == "MaxLength")
{
const StdMeshers_MaxLength * hyp =
dynamic_cast <const StdMeshers_MaxLength * >(theHyp);
ASSERT(hyp);
_value[ BEG_LENGTH_IND ] = hyp->GetLength();
if ( hyp->GetUsePreestimatedLength() ) {
if ( int nbSeg = aMesh.GetNbElementsPerDiagonal() )
_value[ BEG_LENGTH_IND ] = aMesh.GetShapeDiagonalSize() / nbSeg;
}
ASSERT( _value[ BEG_LENGTH_IND ] > 0 );
_hypType = MAX_LENGTH;
aStatus = SMESH_Hypothesis::HYP_OK;
}
else if (hypName == "NumberOfSegments")
{
const StdMeshers_NumberOfSegments * hyp =
@ -226,11 +242,11 @@ bool StdMeshers_Regular_1D::CheckHypothesis
StdMeshers_AutomaticLength * hyp = const_cast<StdMeshers_AutomaticLength *>
(dynamic_cast <const StdMeshers_AutomaticLength * >(theHyp));
ASSERT(hyp);
//_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?
_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 );
_hypType = LOCAL_LENGTH;
_hypType = MAX_LENGTH;
aStatus = SMESH_Hypothesis::HYP_OK;
}
else
@ -413,11 +429,6 @@ static void compensateError(double a1, double an,
void StdMeshers_Regular_1D::SetEventListener(SMESH_subMesh* subMesh)
{
// static VertexEventListener listener;
// SMESH_subMeshIteratorPtr smIt = subMesh->getDependsOnIterator(false,false);
// while (smIt->more()) {
// subMesh->SetEventListener( &listener, 0, smIt->next() );
// }
StdMeshers_Propagation::SetPropagationMgr( subMesh );
}
@ -567,10 +578,18 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
switch( _hypType )
{
case LOCAL_LENGTH:
case MAX_LENGTH:
case NB_SEGMENTS: {
double eltSize = 1;
if ( _hypType == LOCAL_LENGTH )
if ( _hypType == MAX_LENGTH )
{
double nbseg = ceil(theLength / _value[ BEG_LENGTH_IND ]); // integer sup
if (nbseg <= 0)
nbseg = 1; // degenerated edge
eltSize = theLength / nbseg;
}
else if ( _hypType == LOCAL_LENGTH )
{
// Local Length hypothesis
double nbseg = ceil(theLength / _value[ BEG_LENGTH_IND ]); // integer sup
@ -601,7 +620,7 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
}
if (!isFound) // not found by meshed edge in the propagation chain, use precision
{
double aPrecision = _value[ END_LENGTH_IND ];
double aPrecision = _value[ PRECISION_IND ];
double nbseg_prec = ceil((theLength / _value[ BEG_LENGTH_IND ]) - aPrecision);
if (nbseg_prec == (nbseg - 1)) nbseg--;
}

View File

@ -96,13 +96,14 @@ protected:
StdMeshers_SegmentLengthAroundVertex* getVertexHyp(SMESH_Mesh & theMesh,
const TopoDS_Vertex & theV);
enum HypothesisType { LOCAL_LENGTH, NB_SEGMENTS, BEG_END_LENGTH, DEFLECTION, ARITHMETIC_1D, NONE };
enum HypothesisType { LOCAL_LENGTH, MAX_LENGTH, NB_SEGMENTS, BEG_END_LENGTH, DEFLECTION, ARITHMETIC_1D, NONE };
enum ValueIndex {
SCALE_FACTOR_IND = 0,
BEG_LENGTH_IND = 0,
END_LENGTH_IND = 1,
DEFLECTION_IND = 0
DEFLECTION_IND = 0,
PRECISION_IND = 0
};
enum IValueIndex {

View File

@ -202,3 +202,17 @@ bool StdMeshers_SegmentLengthAroundVertex::SetParametersByMesh(const SMESH_Mesh*
return nbSegs;
}
//================================================================================
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
//================================================================================
bool StdMeshers_SegmentLengthAroundVertex::SetParametersByElementSize(double,
const SMESH_Mesh*)
{
return false;
}

View File

@ -61,6 +61,12 @@ class STDMESHERS_EXPORT StdMeshers_SegmentLengthAroundVertex:public SMESH_Hypoth
*/
virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
virtual bool SetParametersByElementSize( double elemLenght, const SMESH_Mesh* theMesh=0);
protected:
double _length;
};

View File

@ -198,3 +198,17 @@ bool StdMeshers_StartEndLength::SetParametersByMesh(const SMESH_Mesh* theMesh,
}
return nbEdges;
}
//================================================================================
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
//================================================================================
bool StdMeshers_StartEndLength::SetParametersByElementSize(double elemLenght,
const SMESH_Mesh* /*theMesh*/)
{
return bool(_begLength = _endLength = elemLenght );
}

View File

@ -57,6 +57,12 @@ class STDMESHERS_EXPORT StdMeshers_StartEndLength:public SMESH_Hypothesis
*/
virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
virtual bool SetParametersByElementSize( double elemLenght, const SMESH_Mesh* theMesh=0);
protected:
double _begLength, _endLength;
};

View File

@ -114,3 +114,17 @@ bool StdMeshers_TrianglePreference::SetParametersByMesh(const SMESH_Mesh* /*theM
{
return false;
}
//================================================================================
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
//================================================================================
bool StdMeshers_TrianglePreference::SetParametersByElementSize(double /*elemLenght*/,
const SMESH_Mesh* /*theMesh*/)
{
return false;
}

View File

@ -59,6 +59,12 @@ class STDMESHERS_EXPORT StdMeshers_TrianglePreference:public SMESH_Hypothesis
*/
virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
/*!
* \brief Initialize my parameter values by linear size of mesh element.
* \retval bool - true if parameter values have been successfully defined
*/
virtual bool SetParametersByElementSize( double elemLenght, const SMESH_Mesh* theMesh=0);
};
#endif