-// Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
_toAddEdges( false ),
_toConsiderInternalFaces( false ),
_toUseThresholdForInternalFaces( false ),
- _toCreateFaces( false )
+ _toCreateFaces( false ),
+ _toUseQuanta(false),
+ _quanta(0.01)
{
_name = "CartesianParameters3D"; // used by "Cartesian_3D"
_param_algo_dim = 3; // 3D
const double p1 = x0 * ( 1. - points[i+1]) + x1 * points[i+1];
const double length = p1 - p0;
- const size_t nbSections = 1000;
+ const int nbSections = 1000;
const double sectionLen = ( p1 - p0 ) / nbSections;
vector< double > nbSegments( nbSections + 1 );
nbSegments[ 0 ] = 0.;
double t, spacing = 0;
- for ( size_t i = 1; i <= nbSections; ++i )
+ for ( int i = 1; i <= nbSections; ++i )
{
t = double( i ) / nbSections;
if ( !fun.value( t, spacing ) || spacing < std::numeric_limits<double>::min() )
if ( coords.empty() ) coords.push_back( p0 );
- for ( size_t iCell = 1, i = 1; i <= nbSections; ++i )
+ for ( int iCell = 1, j = 1; j <= nbSections; ++j )
{
- if ( nbSegments[i]*corr >= iCell )
+ if ( nbSegments[j]*corr >= iCell )
{
- t = (i - ( nbSegments[i] - iCell/corr )/( nbSegments[i] - nbSegments[i-1] )) / nbSections;
+ t = (j - ( nbSegments[j] - iCell/corr )/( nbSegments[j] - nbSegments[j-1] )) / nbSections;
coords.push_back( p0 + t * length );
++iCell;
}
const double tol = minLen * 1e-3;
int iRem = -1;
if (( iF > 1 ) && ( coords[iF] - coords[iF-1] < tol ))
- iRem = iF-1;
+ iRem = (int) iF-1;
else if (( iF < coords.size()-2 ) && ( coords[iF+1] - coords[iF] < tol ))
- iRem = iF+1;
+ iRem = (int) iF+1;
if ( iRem > 0 )
coords.erase( coords.begin() + iRem );
}
}
}
+//=======================================================================
+//function : SetToUseQuanta
+//purpose : Enables use of quanta
+//=======================================================================
+
+void StdMeshers_CartesianParameters3D::SetToUseQuanta(bool toUseQuanta)
+{
+ if ( _toUseQuanta != toUseQuanta )
+ {
+ _toUseQuanta = toUseQuanta;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+//=======================================================================
+//function : SetQuanta
+//purpose : Set size quanta value
+//=======================================================================
+
+void StdMeshers_CartesianParameters3D::SetQuanta(const double quanta)
+{
+ if ( quanta < 1e-6 || quanta > 1.0 )
+ throw SALOME_Exception(LOCALIZED("Quanta must be in the range [0.01,1] "));
+
+ bool changed = (_quanta != quanta);
+ _quanta = quanta;
+
+ if ( changed )
+ NotifySubMeshesHypothesisModification();
+}
+
//=======================================================================
//function : IsDefined
//purpose : Return true if parameters are well defined
save << " " << _toConsiderInternalFaces
<< " " << _toUseThresholdForInternalFaces
- << " " << _toCreateFaces;
+ << " " << _toCreateFaces
+ << " " << _toUseQuanta
+ << " " << _quanta;
return save;
}
load >> _toCreateFaces;
}
+ if ( load >> _toUseQuanta )
+ load >> _quanta;
+
return load;
}