Salome HOME
projects
/
modules
/
smesh.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Try to use length of edges for association in case of a 2-edges wire
[modules/smesh.git]
/
src
/
StdMeshers
/
StdMeshers_Regular_1D.cxx
diff --git
a/src/StdMeshers/StdMeshers_Regular_1D.cxx
b/src/StdMeshers/StdMeshers_Regular_1D.cxx
index f075e0f03cf184bccff10bffec39c6e427a8001e..6ea520001c195e66985a5b9e329d9c9ff0e0c099 100644
(file)
--- a/
src/StdMeshers/StdMeshers_Regular_1D.cxx
+++ b/
src/StdMeshers/StdMeshers_Regular_1D.cxx
@@
-1,4
+1,4
@@
-// Copyright (C) 2007-201
1
CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-201
2
CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@
-20,7
+20,6
@@
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-// SMESH SMESH : implementaion of SMESH idl descriptions
// File : StdMeshers_Regular_1D.cxx
// Moved here from SMESH_Regular_1D.cxx
// Author : Paul RASCLE, EDF
// File : StdMeshers_Regular_1D.cxx
// Moved here from SMESH_Regular_1D.cxx
// Author : Paul RASCLE, EDF
@@
-62,6
+61,7
@@
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
+#include <TopoDS_Vertex.hxx>
#include <string>
#include <limits>
#include <string>
#include <limits>
@@
-354,7
+354,7
@@
static void compensateError(double a1, double an,
bool adjustNeighbors2an = false)
{
int i, nPar = theParams.size();
bool adjustNeighbors2an = false)
{
int i, nPar = theParams.size();
- if ( a1 + an < length && nPar > 1 )
+ if ( a1 + an <
=
length && nPar > 1 )
{
bool reverse = ( U1 > Un );
GCPnts_AbscissaPoint Discret(C3d, reverse ? an : -an, Un);
{
bool reverse = ( U1 > Un );
GCPnts_AbscissaPoint Discret(C3d, reverse ? an : -an, Un);
@@
-375,10
+375,9
@@
static void compensateError(double a1, double an,
dUn = Utgt - theParams.back();
}
dUn = Utgt - theParams.back();
}
- double q = dUn / ( nPar - 1 );
if ( !adjustNeighbors2an )
{
if ( !adjustNeighbors2an )
{
- q = dUn / ( Utgt - Un ); // (signed) factor of segment length change
+
double
q = dUn / ( Utgt - Un ); // (signed) factor of segment length change
for ( itU = theParams.rbegin(), i = 1; i < nPar; i++ ) {
double prevU = *itU;
(*itU) += dUn;
for ( itU = theParams.rbegin(), i = 1; i < nPar; i++ ) {
double prevU = *itU;
(*itU) += dUn;
@@
-386,7
+385,13
@@
static void compensateError(double a1, double an,
dUn = q * (*itU - prevU) * (prevU-U1)/(Un-U1);
}
}
dUn = q * (*itU - prevU) * (prevU-U1)/(Un-U1);
}
}
- else {
+ else if ( nPar == 1 )
+ {
+ theParams.back() += dUn;
+ }
+ else
+ {
+ double q = dUn / ( nPar - 1 );
theParams.back() += dUn;
double sign = reverse ? -1 : 1;
double prevU = theParams.back();
theParams.back() += dUn;
double sign = reverse ? -1 : 1;
double prevU = theParams.back();
@@
-608,12
+613,14
@@
bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
case NB_SEGMENTS: {
double eltSize = 1;
case NB_SEGMENTS: {
double eltSize = 1;
+ int nbSegments;
if ( _hypType == MAX_LENGTH )
{
double nbseg = ceil(theLength / _value[ BEG_LENGTH_IND ]); // integer sup
if (nbseg <= 0)
nbseg = 1; // degenerated edge
eltSize = theLength / nbseg;
if ( _hypType == MAX_LENGTH )
{
double nbseg = ceil(theLength / _value[ BEG_LENGTH_IND ]); // integer sup
if (nbseg <= 0)
nbseg = 1; // degenerated edge
eltSize = theLength / nbseg;
+ nbSegments = (int) nbseg;
}
else if ( _hypType == LOCAL_LENGTH )
{
}
else if ( _hypType == LOCAL_LENGTH )
{
@@
-654,13
+661,14
@@
bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
if (nbseg <= 0)
nbseg = 1; // degenerated edge
eltSize = theLength / nbseg;
if (nbseg <= 0)
nbseg = 1; // degenerated edge
eltSize = theLength / nbseg;
+ nbSegments = (int) nbseg;
}
else
{
// Number Of Segments hypothesis
}
else
{
// Number Of Segments hypothesis
-
int NbSegm
= _ivalue[ NB_SEGMENTS_IND ];
- if (
NbSegm
< 1 ) return false;
- if (
NbSegm
== 1 ) return true;
+
nbSegments
= _ivalue[ NB_SEGMENTS_IND ];
+ if (
nbSegments
< 1 ) return false;
+ if (
nbSegments
== 1 ) return true;
switch (_ivalue[ DISTR_TYPE_IND ])
{
switch (_ivalue[ DISTR_TYPE_IND ])
{
@@
-670,8
+678,8
@@
bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
if (fabs(scale - 1.0) < Precision::Confusion()) {
// special case to avoid division by zero
if (fabs(scale - 1.0) < Precision::Confusion()) {
// special case to avoid division by zero
- for (int i = 1; i <
NbSegm
; i++) {
- double param = f + (l - f) * i /
NbSegm
;
+ for (int i = 1; i <
nbSegments
; i++) {
+ double param = f + (l - f) * i /
nbSegments
;
theParams.push_back( param );
}
} else {
theParams.push_back( param );
}
} else {
@@
-679,10
+687,10
@@
bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
if ( theReverse )
scale = 1.0 / scale;
if ( theReverse )
scale = 1.0 / scale;
- double alpha = pow(scale, 1.0 / (
NbSegm
- 1));
- double factor = (l - f) / (1.0 - pow(alpha,
NbSegm
));
+ double alpha = pow(scale, 1.0 / (
nbSegments
- 1));
+ double factor = (l - f) / (1.0 - pow(alpha,
nbSegments
));
- for (int i = 1; i <
NbSegm
; i++) {
+ for (int i = 1; i <
nbSegments
; i++) {
double param = f + factor * (1.0 - pow(alpha, i));
theParams.push_back( param );
}
double param = f + factor * (1.0 - pow(alpha, i));
theParams.push_back( param );
}
@@
-715,7
+723,7
@@
bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
}
break;
case StdMeshers_NumberOfSegments::DT_Regular:
}
break;
case StdMeshers_NumberOfSegments::DT_Regular:
- eltSize = theLength /
_ivalue[ NB_SEGMENTS_IND ]
;
+ eltSize = theLength /
nbSegments
;
break;
default:
return false;
break;
default:
return false;
@@
-725,13
+733,13
@@
bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
if ( !Discret.IsDone() )
return error( "GCPnts_UniformAbscissa failed");
if ( !Discret.IsDone() )
return error( "GCPnts_UniformAbscissa failed");
- int NbPoints =
Discret.NbPoints(
);
- for ( int i = 2; i < NbPoints; i++ )
+ int NbPoints =
Min( Discret.NbPoints(), nbSegments + 1
);
+ for ( int i = 2; i < NbPoints; i++ )
// skip 1st and last points
{
double param = Discret.Parameter(i);
theParams.push_back( param );
}
{
double param = Discret.Parameter(i);
theParams.push_back( param );
}
- compensateError( eltSize, eltSize, f, l, theLength, theC3d, theParams ); // for PAL9899
+ compensateError( eltSize, eltSize, f, l, theLength, theC3d, theParams
, true
); // for PAL9899
return true;
}
return true;
}