Back to index

salome-smesh  6.5.0
Public Member Functions | Public Attributes
VISCOUS::_LayerEdge Struct Reference

Edge normal to surface, connecting a node on solid surface (_nodes[0]) and a node of the most internal layer (_nodes.back()) More...

Collaboration diagram for VISCOUS::_LayerEdge:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void SetNewLength (double len, SMESH_MesherHelper &helper)
 Add a new segment to _LayerEdge during inflation.
bool SetNewLength2d (Handle(Geom_Surface)&surface, const TopoDS_Face &F, SMESH_MesherHelper &helper)
 Move target node to it's final position on the FACE during shrinking.
void SetDataByNeighbors (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, SMESH_MesherHelper &helper)
 Set _curvature and _2neibors->_plnNorm by 2 neigbor nodes residing the same EDGE.
void InvalidateStep (int curStep)
 Remove last inflation step.
bool Smooth (int &badNb)
 Perform laplacian smooth in 3D of nodes inflated from FACE.
bool SmoothOnEdge (Handle(Geom_Surface)&surface, const TopoDS_Face &F, SMESH_MesherHelper &helper)
 Perform smooth of _LayerEdge's based on EDGE's.
bool FindIntersection (SMESH_ElementSearcher &searcher, double &distance, const double &epsilon, const SMDS_MeshElement **face=0)
 Looks for intersection of it's last segment with faces.
bool SegTriaInter (const gp_Ax1 &lastSegment, const SMDS_MeshNode *n0, const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, double &dist, const double &epsilon) const
 Test intersection of the last segment with a given triangle using Moller-Trumbore algorithm Intersection is detected if distance to intersection is less than _LayerEdge._len.
gp_Ax1 LastSegment (double &segLen) const
 Returns size and direction of the last segment.
bool IsOnEdge () const
void Copy (_LayerEdge &other, SMESH_MesherHelper &helper)
 Copy data from a _LayerEdge of other SOLID and based on the same node; this and other _LayerEdge's are inflated along a FACE or an EDGE.
void SetCosin (double cosin)
 Set _cosin and _lenFactor.

Public Attributes

vector< const SMDS_MeshNode * > _nodes
gp_XYZ _normal
vector< gp_XYZ > _pos
double _len
double _cosin
double _lenFactor
TopoDS_Shape _sWOL
vector< _Simplex_simplices
_2NearEdges_2neibors
_Curvature_curvature

Detailed Description

Edge normal to surface, connecting a node on solid surface (_nodes[0]) and a node of the most internal layer (_nodes.back())

Definition at line 302 of file StdMeshers_ViscousLayers.cxx.


Member Function Documentation

void _LayerEdge::Copy ( _LayerEdge other,
SMESH_MesherHelper &  helper 
)

Copy data from a _LayerEdge of other SOLID and based on the same node; this and other _LayerEdge's are inflated along a FACE or an EDGE.

Definition at line 1882 of file StdMeshers_ViscousLayers.cxx.

{
  _nodes     = other._nodes;
  _normal    = other._normal;
  _len       = 0;
  _lenFactor = other._lenFactor;
  _cosin     = other._cosin;
  _sWOL      = other._sWOL;
  _2neibors  = other._2neibors;
  _curvature = 0; std::swap( _curvature, other._curvature );
  _2neibors  = 0; std::swap( _2neibors,  other._2neibors );

  if ( _sWOL.ShapeType() == TopAbs_EDGE )
  {
    double u = helper.GetNodeU( TopoDS::Edge( _sWOL ), _nodes[0] );
    _pos.push_back( gp_XYZ( u, 0, 0));
  }
  else // TopAbs_FACE
  {
    gp_XY uv = helper.GetNodeUV( TopoDS::Face( _sWOL ), _nodes[0]);
    _pos.push_back( gp_XYZ( uv.X(), uv.Y(), 0));
  }
}

Here is the caller graph for this function:

bool _LayerEdge::FindIntersection ( SMESH_ElementSearcher searcher,
double &  distance,
const double &  epsilon,
const SMDS_MeshElement **  face = 0 
)

Looks for intersection of it's last segment with faces.

Parameters:
distance- returns shortest distance from the last node to intersection

Definition at line 2803 of file StdMeshers_ViscousLayers.cxx.

{
  vector< const SMDS_MeshElement* > suspectFaces;
  double segLen;
  gp_Ax1 lastSegment = LastSegment(segLen);
  searcher.GetElementsNearLine( lastSegment, SMDSAbs_Face, suspectFaces );

  bool segmentIntersected = false;
  distance = Precision::Infinite();
  int iFace = -1; // intersected face
  for ( unsigned j = 0 ; j < suspectFaces.size() && !segmentIntersected; ++j )
  {
    const SMDS_MeshElement* face = suspectFaces[j];
    if ( face->GetNodeIndex( _nodes.back() ) >= 0 ||
         face->GetNodeIndex( _nodes[0]     ) >= 0 )
      continue; // face sharing _LayerEdge node
    const int nbNodes = face->NbCornerNodes();
    bool intFound = false;
    double dist;
    SMDS_MeshElement::iterator nIt = face->begin_nodes();
    if ( nbNodes == 3 )
    {
      intFound = SegTriaInter( lastSegment, *nIt++, *nIt++, *nIt++, dist, epsilon );
    }
    else
    {
      const SMDS_MeshNode* tria[3];
      tria[0] = *nIt++;
      tria[1] = *nIt++;;
      for ( int n2 = 2; n2 < nbNodes && !intFound; ++n2 )
      {
        tria[2] = *nIt++;
        intFound = SegTriaInter(lastSegment, tria[0], tria[1], tria[2], dist, epsilon );
        tria[1] = tria[2];
      }
    }
    if ( intFound )
    {
      if ( dist < segLen*(1.01))
        segmentIntersected = true;
      if ( distance > dist )
        distance = dist, iFace = j;
    }
  }
  if ( iFace != -1 && face ) *face = suspectFaces[iFace];
//   if ( distance && iFace > -1 )
//   {
//     // distance is used to limit size of inflation step which depends on
//     // whether the intersected face bears viscous layers or not
//     bool faceHasVL = suspectFaces[iFace]->GetID() < 1;
//     if ( faceHasVL )
//       *distance /= 2;
//   }
  if ( segmentIntersected )
  {
#ifdef __myDEBUG
    SMDS_MeshElement::iterator nIt = suspectFaces[iFace]->begin_nodes();
    gp_XYZ intP( lastSegment.Location().XYZ() + lastSegment.Direction().XYZ() * distance );
    cout << "nodes: tgt " << _nodes.back()->GetID() << " src " << _nodes[0]->GetID()
         << ", intersection with face ("
         << (*nIt++)->GetID()<<" "<< (*nIt++)->GetID()<<" "<< (*nIt++)->GetID()
         << ") at point (" << intP.X() << ", " << intP.Y() << ", " << intP.Z()
         << ") distance = " << distance - segLen<< endl;
#endif
  }

  distance -= segLen;

  return segmentIntersected;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void _LayerEdge::InvalidateStep ( int  curStep)

Remove last inflation step.

Definition at line 3203 of file StdMeshers_ViscousLayers.cxx.

{
  if ( _pos.size() > curStep )
  {
    _pos.resize( curStep );
    gp_Pnt nXYZ = _pos.back();
    SMDS_MeshNode* n = const_cast< SMDS_MeshNode*>( _nodes.back() );
    if ( !_sWOL.IsNull() )
    {
      TopLoc_Location loc;
      if ( _sWOL.ShapeType() == TopAbs_EDGE )
      {
        SMDS_EdgePosition* pos = static_cast<SMDS_EdgePosition*>( n->GetPosition() );
        pos->SetUParameter( nXYZ.X() );
        double f,l;
        Handle(Geom_Curve) curve = BRep_Tool::Curve( TopoDS::Edge( _sWOL ), loc, f,l);
        nXYZ = curve->Value( nXYZ.X() ).Transformed( loc );
      }
      else
      {
        SMDS_FacePosition* pos = static_cast<SMDS_FacePosition*>( n->GetPosition() );
        pos->SetUParameter( nXYZ.X() );
        pos->SetVParameter( nXYZ.Y() );
        Handle(Geom_Surface) surface = BRep_Tool::Surface( TopoDS::Face(_sWOL), loc );
        nXYZ = surface->Value( nXYZ.X(), nXYZ.Y() ).Transformed( loc );
      }
    }
    n->setXYZ( nXYZ.X(), nXYZ.Y(), nXYZ.Z() );
    dumpMove( n );
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool VISCOUS::_LayerEdge::IsOnEdge ( ) const [inline]

Definition at line 346 of file StdMeshers_ViscousLayers.cxx.

{ return _2neibors; }

Here is the caller graph for this function:

gp_Ax1 _LayerEdge::LastSegment ( double &  segLen) const

Returns size and direction of the last segment.

Definition at line 2883 of file StdMeshers_ViscousLayers.cxx.

{
  // find two non-coincident positions
  gp_XYZ orig = _pos.back();
  gp_XYZ dir;
  int iPrev = _pos.size() - 2;
  while ( iPrev >= 0 )
  {
    dir = orig - _pos[iPrev];
    if ( dir.SquareModulus() > 1e-100 )
      break;
    else
      iPrev--;
  }

  // make gp_Ax1
  gp_Ax1 segDir;
  if ( iPrev < 0 )
  {
    segDir.SetLocation( SMESH_TNodeXYZ( _nodes[0] ));
    segDir.SetDirection( _normal );
    segLen = 0;
  }
  else
  {
    gp_Pnt pPrev = _pos[ iPrev ];
    if ( !_sWOL.IsNull() )
    {
      TopLoc_Location loc;
      if ( _sWOL.ShapeType() == TopAbs_EDGE )
      {
        double f,l;
        Handle(Geom_Curve) curve = BRep_Tool::Curve( TopoDS::Edge( _sWOL ), loc, f,l);
        pPrev = curve->Value( pPrev.X() ).Transformed( loc );
      }
      else
      {
        Handle(Geom_Surface) surface = BRep_Tool::Surface( TopoDS::Face(_sWOL), loc );
        pPrev = surface->Value( pPrev.X(), pPrev.Y() ).Transformed( loc );
      }
      dir = SMESH_TNodeXYZ( _nodes.back() ) - pPrev.XYZ();
    }
    segDir.SetLocation( pPrev );
    segDir.SetDirection( dir );
    segLen = dir.Modulus();
  }

  return segDir;
}

Here is the call graph for this function:

bool _LayerEdge::SegTriaInter ( const gp_Ax1 &  lastSegment,
const SMDS_MeshNode *  n0,
const SMDS_MeshNode *  n1,
const SMDS_MeshNode *  n2,
double &  dist,
const double &  epsilon 
) const

Test intersection of the last segment with a given triangle using Moller-Trumbore algorithm Intersection is detected if distance to intersection is less than _LayerEdge._len.

Definition at line 2941 of file StdMeshers_ViscousLayers.cxx.

{
  //const double EPSILON = 1e-6;

  gp_XYZ orig = lastSegment.Location().XYZ();
  gp_XYZ dir  = lastSegment.Direction().XYZ();

  SMESH_TNodeXYZ vert0( n0 );
  SMESH_TNodeXYZ vert1( n1 );
  SMESH_TNodeXYZ vert2( n2 );

  /* calculate distance from vert0 to ray origin */
  gp_XYZ tvec = orig - vert0;

  if ( tvec * dir > EPSILON )
    // intersected face is at back side of the temporary face this _LayerEdge belongs to
    return false;

  gp_XYZ edge1 = vert1 - vert0;
  gp_XYZ edge2 = vert2 - vert0;

  /* begin calculating determinant - also used to calculate U parameter */
  gp_XYZ pvec = dir ^ edge2;

  /* if determinant is near zero, ray lies in plane of triangle */
  double det = edge1 * pvec;

  if (det > -EPSILON && det < EPSILON)
    return 0;
  double inv_det = 1.0 / det;

  /* calculate U parameter and test bounds */
  double u = ( tvec * pvec ) * inv_det;
  if (u < 0.0 || u > 1.0)
    return 0;

  /* prepare to test V parameter */
  gp_XYZ qvec = tvec ^ edge1;

  /* calculate V parameter and test bounds */
  double v = (dir * qvec) * inv_det;
  if ( v < 0.0 || u + v > 1.0 )
    return 0;

  /* calculate t, ray intersects triangle */
  t = (edge2 * qvec) * inv_det;

  //   if (det < EPSILON)
  //     return false;

  //   /* calculate distance from vert0 to ray origin */
  //   gp_XYZ tvec = orig - vert0;

  //   /* calculate U parameter and test bounds */
  //   double u = tvec * pvec;
  //   if (u < 0.0 || u > det)
//     return 0;

//   /* prepare to test V parameter */
//   gp_XYZ qvec = tvec ^ edge1;

//   /* calculate V parameter and test bounds */
//   double v = dir * qvec;
//   if (v < 0.0 || u + v > det)
//     return 0;

//   /* calculate t, scale parameters, ray intersects triangle */
//   double t = edge2 * qvec;
//   double inv_det = 1.0 / det;
//   t *= inv_det;
//   //u *= inv_det;
//   //v *= inv_det;

  return true;
}
void _LayerEdge::SetCosin ( double  cosin)

Set _cosin and _lenFactor.

Definition at line 1912 of file StdMeshers_ViscousLayers.cxx.

{
  _cosin = cosin;
  _lenFactor = ( _cosin > 0.1 ) ?  1./sqrt(1-_cosin*_cosin) : 1.0;
}

Here is the caller graph for this function:

void _LayerEdge::SetDataByNeighbors ( const SMDS_MeshNode *  n1,
const SMDS_MeshNode *  n2,
SMESH_MesherHelper &  helper 
)

Set _curvature and _2neibors->_plnNorm by 2 neigbor nodes residing the same EDGE.

Definition at line 1830 of file StdMeshers_ViscousLayers.cxx.

{
  if ( _nodes[0]->GetPosition()->GetTypeOfPosition() != SMDS_TOP_EDGE )
    return;

  gp_XYZ pos = SMESH_TNodeXYZ( _nodes[0] );
  gp_XYZ vec1 = pos - SMESH_TNodeXYZ( n1 );
  gp_XYZ vec2 = pos - SMESH_TNodeXYZ( n2 );

  // Set _curvature

  double sumLen = vec1.Modulus() + vec2.Modulus();
  _2neibors->_wgt[0] = 1 - vec1.Modulus() / sumLen;
  _2neibors->_wgt[1] = 1 - vec2.Modulus() / sumLen;
  double avgNormProj = 0.5 * ( _normal * vec1 + _normal * vec2 );
  double avgLen = 0.5 * ( vec1.Modulus() + vec2.Modulus() );
  if ( _curvature ) delete _curvature;
  _curvature = _Curvature::New( avgNormProj, avgLen );
#ifdef __myDEBUG
//     if ( _curvature )
//       cout << _nodes[0]->GetID()
//            << " CURV r,k: " << _curvature->_r<<","<<_curvature->_k
//            << " proj = "<<avgNormProj<< " len = " << avgLen << "| lenDelta(0) = "
//            << _curvature->lenDelta(0) << endl;
#endif

  // Set _plnNorm

  if ( _sWOL.IsNull() )
  {
    TopoDS_Shape S = helper.GetSubShapeByNode( _nodes[0], helper.GetMeshDS() );
    gp_XYZ dirE = getEdgeDir( TopoDS::Edge( S ), _nodes[0], helper );
    gp_XYZ plnNorm = dirE ^ _normal;
    double proj0 = plnNorm * vec1;
    double proj1 = plnNorm * vec2;
    if ( fabs( proj0 ) > 1e-10 || fabs( proj1 ) > 1e-10 )
    {
      if ( _2neibors->_plnNorm ) delete _2neibors->_plnNorm;
      _2neibors->_plnNorm = new gp_XYZ( plnNorm.Normalized() );
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void _LayerEdge::SetNewLength ( double  len,
SMESH_MesherHelper &  helper 
)

Add a new segment to _LayerEdge during inflation.

Definition at line 3157 of file StdMeshers_ViscousLayers.cxx.

{
  if ( _len - len > -1e-6 )
  {
    _pos.push_back( _pos.back() );
    return;
  }

  SMDS_MeshNode* n = const_cast< SMDS_MeshNode*>( _nodes.back() );
  SMESH_TNodeXYZ oldXYZ( n );
  gp_XYZ nXYZ = oldXYZ + _normal * ( len - _len ) * _lenFactor;
  n->setXYZ( nXYZ.X(), nXYZ.Y(), nXYZ.Z() );

  _pos.push_back( nXYZ );
  _len = len;
  if ( !_sWOL.IsNull() )
  {
    double distXYZ[4];
    if ( _sWOL.ShapeType() == TopAbs_EDGE )
    {
      double u = Precision::Infinite(); // to force projection w/o distance check
      helper.CheckNodeU( TopoDS::Edge( _sWOL ), n, u, 1e-10, /*force=*/true, distXYZ );
      _pos.back().SetCoord( u, 0, 0 );
      SMDS_EdgePosition* pos = static_cast<SMDS_EdgePosition*>( n->GetPosition() );
      pos->SetUParameter( u );
    }
    else //  TopAbs_FACE
    {
      gp_XY uv( Precision::Infinite(), 0 );
      helper.CheckNodeUV( TopoDS::Face( _sWOL ), n, uv, 1e-10, /*force=*/true, distXYZ );
      _pos.back().SetCoord( uv.X(), uv.Y(), 0 );
      SMDS_FacePosition* pos = static_cast<SMDS_FacePosition*>( n->GetPosition() );
      pos->SetUParameter( uv.X() );
      pos->SetVParameter( uv.Y() );
    }
    n->setXYZ( distXYZ[1], distXYZ[2], distXYZ[3]);
  }
  dumpMove( n ); //debug
}

Here is the caller graph for this function:

bool _LayerEdge::SetNewLength2d ( Handle(Geom_Surface)&  surface,
const TopoDS_Face &  F,
SMESH_MesherHelper &  helper 
)

Move target node to it's final position on the FACE during shrinking.

Definition at line 3987 of file StdMeshers_ViscousLayers.cxx.

{
  if ( _pos.empty() )
    return false; // already at the target position

  SMDS_MeshNode* tgtNode = const_cast< SMDS_MeshNode*& >( _nodes.back() );

  if ( _sWOL.ShapeType() == TopAbs_FACE )
  {
    gp_XY    curUV = helper.GetNodeUV( F, tgtNode );
    gp_Pnt2d tgtUV( _pos[0].X(), _pos[0].Y());
    gp_Vec2d uvDir( _normal.X(), _normal.Y() );
    const double uvLen = tgtUV.Distance( curUV );

    // Select shrinking step such that not to make faces with wrong orientation.
    const double kSafe = 0.8;
    const double minStepSize = uvLen / 10;
    double stepSize = uvLen;
    for ( unsigned i = 0; i < _simplices.size(); ++i )
    {
      const SMDS_MeshNode* nn[2] = { _simplices[i]._nPrev, _simplices[i]._nNext };
      for ( int j = 0; j < 2; ++j )
        if ( const SMDS_MeshNode* n = nn[j] )
        {
          gp_XY uv = helper.GetNodeUV( F, n );
          gp_Vec2d uvDirN( curUV, uv );
          double proj = uvDirN * uvDir * kSafe;
          if ( proj < stepSize && proj > minStepSize )
            stepSize = proj;
        }
    }

    gp_Pnt2d newUV;
    if ( stepSize == uvLen )
    {
      newUV = tgtUV;
      _pos.clear();
    }
    else
    {
      newUV = curUV + uvDir.XY() * stepSize;
    }

    SMDS_FacePosition* pos = static_cast<SMDS_FacePosition*>( tgtNode->GetPosition() );
    pos->SetUParameter( newUV.X() );
    pos->SetVParameter( newUV.Y() );

#ifdef __myDEBUG
    gp_Pnt p = surface->Value( newUV.X(), newUV.Y() );
    tgtNode->setXYZ( p.X(), p.Y(), p.Z() );
    dumpMove( tgtNode );
#endif
  }
  else // _sWOL is TopAbs_EDGE
  {
    TopoDS_Edge E = TopoDS::Edge( _sWOL );
    const SMDS_MeshNode* n2 = _simplices[0]._nPrev;

    const double u2 = helper.GetNodeU( E, n2, tgtNode );
    const double uSrc   = _pos[0].Coord( U_SRC );
    const double lenTgt = _pos[0].Coord( LEN_TGT );

    double newU = _pos[0].Coord( U_TGT );
    if ( lenTgt < 0.99 * fabs( uSrc-u2 ))
    {
      _pos.clear();
    }
    else
    {
      newU = 0.1 * uSrc + 0.9 * u2;
    }
    SMDS_EdgePosition* pos = static_cast<SMDS_EdgePosition*>( tgtNode->GetPosition() );
    pos->SetUParameter( newU );
#ifdef __myDEBUG
    gp_XY newUV = helper.GetNodeUV( F, tgtNode, _nodes[0]);
    gp_Pnt p = surface->Value( newUV.X(), newUV.Y() );
    tgtNode->setXYZ( p.X(), p.Y(), p.Z() );
    dumpMove( tgtNode );
#endif
  }
  return true;
}
bool _LayerEdge::Smooth ( int &  badNb)

Perform laplacian smooth in 3D of nodes inflated from FACE.

Return values:
bool- true if _tgtNode has been moved

Definition at line 3096 of file StdMeshers_ViscousLayers.cxx.

{
  if ( _simplices.size() < 2 )
    return false; // _LayerEdge inflated along EDGE or FACE

  // compute new position for the last _pos
  gp_XYZ newPos (0,0,0);
  for ( unsigned i = 0; i < _simplices.size(); ++i )
    newPos += SMESH_TNodeXYZ( _simplices[i]._nPrev );
  newPos /= _simplices.size();

  if ( _curvature )
    newPos += _normal * _curvature->lenDelta( _len );

  gp_Pnt prevPos( _pos[ _pos.size()-2 ]);
//   if ( _cosin < -0.1)
//   {
//     // Avoid decreasing length of edge on concave surface
//     //gp_Vec oldMove( _pos[ _pos.size()-2 ], _pos.back() );
//     gp_Vec newMove( prevPos, newPos );
//     newPos = _pos.back() + newMove.XYZ();
//   }
//   else if ( _cosin > 0.3 )
//   {
//     // Avoid increasing length of edge too much

//   }
  // count quality metrics (orientation) of tetras around _tgtNode
  int nbOkBefore = 0;
  SMESH_TNodeXYZ tgtXYZ( _nodes.back() );
  for ( unsigned i = 0; i < _simplices.size(); ++i )
    nbOkBefore += _simplices[i].IsForward( _nodes[0], &tgtXYZ );

  int nbOkAfter = 0;
  for ( unsigned i = 0; i < _simplices.size(); ++i )
    nbOkAfter += _simplices[i].IsForward( _nodes[0], &newPos );

  if ( nbOkAfter < nbOkBefore )
    return false;

  SMDS_MeshNode* n = const_cast< SMDS_MeshNode* >( _nodes.back() );

  _len -= prevPos.Distance(SMESH_TNodeXYZ( n ));
  _len += prevPos.Distance(newPos);

  n->setXYZ( newPos.X(), newPos.Y(), newPos.Z());
  _pos.back() = newPos;

  badNb += _simplices.size() - nbOkAfter;

  dumpMove( n );

  return true;
}

Here is the call graph for this function:

bool _LayerEdge::SmoothOnEdge ( Handle(Geom_Surface)&  surface,
const TopoDS_Face &  F,
SMESH_MesherHelper &  helper 
)

Perform smooth of _LayerEdge's based on EDGE's.

Return values:
bool- true if node has been moved

Definition at line 3029 of file StdMeshers_ViscousLayers.cxx.

{
  ASSERT( IsOnEdge() );

  SMDS_MeshNode* tgtNode = const_cast<SMDS_MeshNode*>( _nodes.back() );
  SMESH_TNodeXYZ oldPos( tgtNode );
  double dist01, distNewOld;
  
  SMESH_TNodeXYZ p0( _2neibors->_nodes[0]);
  SMESH_TNodeXYZ p1( _2neibors->_nodes[1]);
  dist01 = p0.Distance( _2neibors->_nodes[1] );

  gp_Pnt newPos = p0 * _2neibors->_wgt[0] + p1 * _2neibors->_wgt[1];
  double lenDelta = 0;
  if ( _curvature )
  {
    lenDelta = _curvature->lenDelta( _len );
    newPos.ChangeCoord() += _normal * lenDelta;
  }

  distNewOld = newPos.Distance( oldPos );

  if ( F.IsNull() )
  {
    if ( _2neibors->_plnNorm )
    {
      // put newPos on the plane defined by source node and _plnNorm
      gp_XYZ new2src = SMESH_TNodeXYZ( _nodes[0] ) - newPos.XYZ();
      double new2srcProj = (*_2neibors->_plnNorm) * new2src;
      newPos.ChangeCoord() += (*_2neibors->_plnNorm) * new2srcProj;
    }
    tgtNode->setXYZ( newPos.X(), newPos.Y(), newPos.Z() );
    _pos.back() = newPos.XYZ();
  }
  else
  {
    tgtNode->setXYZ( newPos.X(), newPos.Y(), newPos.Z() );
    gp_XY uv( Precision::Infinite(), 0 );
    helper.CheckNodeUV( F, tgtNode, uv, 1e-10, /*force=*/true );
    _pos.back().SetCoord( uv.X(), uv.Y(), 0 );

    newPos = surface->Value( uv.X(), uv.Y() );
    tgtNode->setXYZ( newPos.X(), newPos.Y(), newPos.Z() );
  }

  if ( _curvature && lenDelta < 0 )
  {
    gp_Pnt prevPos( _pos[ _pos.size()-2 ]);
    _len -= prevPos.Distance( oldPos );
    _len += prevPos.Distance( newPos );
  }
  bool moved = distNewOld > dist01/50;
  //if ( moved )
  dumpMove( tgtNode ); // debug

  return moved;
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 318 of file StdMeshers_ViscousLayers.cxx.

Definition at line 309 of file StdMeshers_ViscousLayers.cxx.

Definition at line 320 of file StdMeshers_ViscousLayers.cxx.

Definition at line 308 of file StdMeshers_ViscousLayers.cxx.

Definition at line 310 of file StdMeshers_ViscousLayers.cxx.

vector< const SMDS_MeshNode*> VISCOUS::_LayerEdge::_nodes

Definition at line 304 of file StdMeshers_ViscousLayers.cxx.

Definition at line 306 of file StdMeshers_ViscousLayers.cxx.

vector<gp_XYZ> VISCOUS::_LayerEdge::_pos

Definition at line 307 of file StdMeshers_ViscousLayers.cxx.

Definition at line 316 of file StdMeshers_ViscousLayers.cxx.

Definition at line 313 of file StdMeshers_ViscousLayers.cxx.


The documentation for this struct was generated from the following file: