mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-18 23:50:33 +05:00
0021543: EDF 1978 SMESH: Viscous layer for 2D meshes
Fix shrink()
This commit is contained in:
parent
1b48eab880
commit
4226c05219
@ -1175,7 +1175,7 @@ bool _ViscousBuilder2D::shrink()
|
|||||||
UVPtStructVec nodeDataVec( & points[ iPFrom ], & points[ iPTo + 1 ]);
|
UVPtStructVec nodeDataVec( & points[ iPFrom ], & points[ iPTo + 1 ]);
|
||||||
|
|
||||||
double normSize = nodeDataVec.back().normParam - nodeDataVec.front().normParam;
|
double normSize = nodeDataVec.back().normParam - nodeDataVec.front().normParam;
|
||||||
for ( size_t iP = 0; iP < nodeDataVec.size(); ++iP )
|
for ( int iP = nodeDataVec.size()-1; iP >= 0 ; --iP )
|
||||||
nodeDataVec[iP].normParam =
|
nodeDataVec[iP].normParam =
|
||||||
( nodeDataVec[iP].normParam - nodeDataVec[0].normParam ) / normSize;
|
( nodeDataVec[iP].normParam - nodeDataVec[0].normParam ) / normSize;
|
||||||
|
|
||||||
@ -1350,8 +1350,8 @@ bool _ViscousBuilder2D::shrink()
|
|||||||
|
|
||||||
// Shrink edges to fit in between the layers at EDGE ends
|
// Shrink edges to fit in between the layers at EDGE ends
|
||||||
|
|
||||||
double newLength = GCPnts_AbscissaPoint::Length( curve, u1, u2 );
|
const double newLength = GCPnts_AbscissaPoint::Length( curve, u1, u2 );
|
||||||
double lenRatio = newLength / edgeLen * ( edgeReversed ? -1. : 1. );
|
const double lenRatio = newLength / edgeLen * ( edgeReversed ? -1. : 1. );
|
||||||
for ( size_t iP = 1; iP < nodeDataVec.size()-1; ++iP )
|
for ( size_t iP = 1; iP < nodeDataVec.size()-1; ++iP )
|
||||||
{
|
{
|
||||||
const SMDS_MeshNode* oldNode = nodeDataVec[iP].node;
|
const SMDS_MeshNode* oldNode = nodeDataVec[iP].node;
|
||||||
@ -1382,19 +1382,27 @@ bool _ViscousBuilder2D::shrink()
|
|||||||
// add nodeDataForAdjacent to nodeDataVec
|
// add nodeDataForAdjacent to nodeDataVec
|
||||||
if ( !nodeDataForAdjacent.empty() )
|
if ( !nodeDataForAdjacent.empty() )
|
||||||
{
|
{
|
||||||
double lenDelta = GCPnts_AbscissaPoint::Length( curve,
|
const double par1 = isRShrinkedForAdjacent ? u2 : uf;
|
||||||
nodeDataForAdjacent.front().param,
|
const double par2 = isRShrinkedForAdjacent ? ul : u1;
|
||||||
nodeDataForAdjacent.back().param );
|
const double shrinkLen = GCPnts_AbscissaPoint::Length( curve, par1, par2 );
|
||||||
lenRatio = newLength / ( newLength + lenDelta );
|
|
||||||
|
// compute new normParam for nodeDataVec
|
||||||
|
for ( size_t iP = 0; iP < nodeDataVec.size()-1; ++iP )
|
||||||
|
nodeDataVec[iP+1].normParam = segLengths[iP] / ( edgeLen + shrinkLen );
|
||||||
|
double normDelta = 1 - nodeDataVec.back().normParam;
|
||||||
|
if ( !isRShrinkedForAdjacent )
|
||||||
for ( size_t iP = 0; iP < nodeDataVec.size(); ++iP )
|
for ( size_t iP = 0; iP < nodeDataVec.size(); ++iP )
|
||||||
nodeDataVec[iP].normParam *= lenRatio;
|
nodeDataVec[iP+1].normParam += normDelta;
|
||||||
|
|
||||||
newLength = newLength + lenDelta;
|
|
||||||
for ( size_t iP = 1; iP < nodeDataForAdjacent.size(); ++iP )
|
|
||||||
nodeDataForAdjacent[iP].normParam =
|
|
||||||
GCPnts_AbscissaPoint::Length( curve, u1,
|
|
||||||
nodeDataForAdjacent[iP].param ) / newLength;
|
|
||||||
|
|
||||||
|
// compute new normParam for nodeDataForAdjacent
|
||||||
|
const double deltaR = isRShrinkedForAdjacent ? nodeDataVec.back().normParam : 0;
|
||||||
|
for ( size_t iP = !isRShrinkedForAdjacent; iP < nodeDataForAdjacent.size(); ++iP )
|
||||||
|
{
|
||||||
|
double lenFromPar1 =
|
||||||
|
GCPnts_AbscissaPoint::Length( curve, par1, nodeDataForAdjacent[iP].param );
|
||||||
|
nodeDataForAdjacent[iP].normParam = deltaR + normDelta * lenFromPar1 / shrinkLen;
|
||||||
|
}
|
||||||
|
// concatenate nodeDataVec and nodeDataForAdjacent
|
||||||
nodeDataVec.insert( isRShrinkedForAdjacent ? nodeDataVec.end() : nodeDataVec.begin(),
|
nodeDataVec.insert( isRShrinkedForAdjacent ? nodeDataVec.end() : nodeDataVec.begin(),
|
||||||
nodeDataForAdjacent.begin(), nodeDataForAdjacent.end() );
|
nodeDataForAdjacent.begin(), nodeDataForAdjacent.end() );
|
||||||
}
|
}
|
||||||
@ -1825,3 +1833,5 @@ bool _SegmentTree::_SegBox::IsOut( const gp_Ax2d& ray ) const
|
|||||||
|
|
||||||
return Abs( distBoxCenter2Ray ) > 0.5 * boxSectionDiam;
|
return Abs( distBoxCenter2Ray ) > 0.5 * boxSectionDiam;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user