// Moved here from SMESH_Regular_1D.cxx
// Author : Paul RASCLE, EDF
// Module : SMESH
-// $Header$
-//
+
#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"
_shapeType = (1 << TopAbs_EDGE);
_compatibleHypothesis.push_back("LocalLength");
+ _compatibleHypothesis.push_back("MaxLength");
_compatibleHypothesis.push_back("NumberOfSegments");
_compatibleHypothesis.push_back("StartEndLength");
_compatibleHypothesis.push_back("Deflection1D");
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.GetGen()->GetBoundaryBoxSegmentation() )
+ _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 =
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
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 );
}
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
}
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--;
}