Version: 6.3.1
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes

StdMeshers_CompositeSegment_1D Class Reference

#include <StdMeshers_CompositeSegment_1D.hxx>

Inheritance diagram for StdMeshers_CompositeSegment_1D:
Inheritance graph
[legend]

Public Member Functions

 StdMeshers_CompositeSegment_1D (int hypId, int studyId, SMESH_Gen *gen)
virtual ~StdMeshers_CompositeSegment_1D ()
virtual bool Compute (SMESH_Mesh &aMesh, const TopoDS_Shape &aShape)
 Computes mesh on a shape.
virtual void SetEventListener (SMESH_subMesh *subMesh)
 Sets event listener to submeshes if necessary.
virtual bool CheckHypothesis (SMESH_Mesh &aMesh, const TopoDS_Shape &aShape, SMESH_Hypothesis::Hypothesis_Status &aStatus)
 Check hypothesis definition to mesh a shape.
virtual bool Compute (SMESH_Mesh &aMesh, SMESH_MesherHelper *aHelper)
 Computes mesh without geometry.
virtual bool Evaluate (SMESH_Mesh &aMesh, const TopoDS_Shape &aShape, MapShapeNbElems &aResMap)
 evaluates size of prospective mesh on a shape
virtual const std::list< const
SMESHDS_Hypothesis * > & 
GetUsedHypothesis (SMESH_Mesh &aMesh, const TopoDS_Shape &aShape, const bool=true)
 List the hypothesis used by the algorithm associated to the shape.
void SubmeshRestored (SMESH_subMesh *subMesh)
 Allow algo to do something after persistent restoration.
virtual std::ostream & SaveTo (std::ostream &save)
 Saves nothing in a stream.
virtual std::istream & LoadFrom (std::istream &load)
 Loads nothing from a stream.
const std::vector< std::string > & GetCompatibleHypothesis ()
 Returns all types of compatible hypotheses.
const list< const
SMESHDS_Hypothesis * > & 
GetAppliedHypothesis (SMESH_Mesh &aMesh, const TopoDS_Shape &aShape, const bool ignoreAuxiliary=true)
 Returns a list of compatible hypotheses assigned to a shape in a mesh.
bool InitCompatibleHypoFilter (SMESH_HypoFilter &theFilter, const bool ignoreAuxiliary) const
 Make the filter recognize only compatible hypotheses.
virtual bool SetParametersByMesh (const SMESH_Mesh *theMesh, const TopoDS_Shape &theShape)
 Just return false as the algorithm does not hold parameters values.
virtual bool SetParametersByDefaults (const TDefaults &dflts, const SMESH_Mesh *theMesh=0)
SMESH_ComputeErrorPtr GetComputeError () const
 return compute error
void InitComputeError ()
 initialize compute error
bool OnlyUnaryInput () const
bool NeedDescretBoundary () const
bool NeedShape () const
bool SupportSubmeshes () const

Static Public Member Functions

static StdMeshers_FaceSideGetFaceSide (SMESH_Mesh &aMesh, const TopoDS_Edge &anEdge, const TopoDS_Face &aFace, const bool ignoreMeshed)
 Return a face side the edge belongs to.
static bool GetNodeParamOnEdge (const SMESHDS_Mesh *theMesh, const TopoDS_Edge &theEdge, std::vector< double > &theParams)
 Fill vector of node parameters on geometrical edge, including vertex nodes.
static bool GetSortedNodesOnEdge (const SMESHDS_Mesh *theMesh, const TopoDS_Edge &theEdge, const bool ignoreMediumNodes, std::map< double, const SMDS_MeshNode * > &theNodes)
 Fill map of node parameter on geometrical edge to node it-self.
static bool IsReversedSubMesh (const TopoDS_Face &theFace, SMESHDS_Mesh *theMeshDS)
 Find out elements orientation on a geometrical face.
static double EdgeLength (const TopoDS_Edge &E)
 Compute length of an edge.
static bool FaceNormal (const SMDS_MeshElement *F, gp_XYZ &normal, bool normalized=true)
 Calculate normal of a mesh face.
static GeomAbs_Shape Continuity (TopoDS_Edge E1, TopoDS_Edge E2)
 Return continuity of two edges.
static bool IsContinuous (const TopoDS_Edge &E1, const TopoDS_Edge &E2)
 Return true if an edge can be considered as a continuation of another.
static const SMDS_MeshNodeVertexNode (const TopoDS_Vertex &V, const SMESHDS_Mesh *meshDS)
 Return the node built on a vertex.
static std::vector< const
SMDS_MeshNode * > 
GetCommonNodes (const SMDS_MeshElement *e1, const SMDS_MeshElement *e2)
 Return nodes common to two elements.

Protected Types

enum  HypothesisType {
  LOCAL_LENGTH, MAX_LENGTH, NB_SEGMENTS, BEG_END_LENGTH,
  DEFLECTION, ARITHMETIC_1D, FIXED_POINTS_1D, NONE
}
enum  ValueIndex {
  SCALE_FACTOR_IND = 0, BEG_LENGTH_IND = 0, END_LENGTH_IND = 1, DEFLECTION_IND = 0,
  PRECISION_IND = 1
}
enum  IValueIndex { NB_SEGMENTS_IND = 0, DISTR_TYPE_IND = 1, CONV_MODE_IND = 2 }
enum  VValueIndex { TAB_FUNC_IND = 0 }
enum  SValueIndex { EXPR_FUNC_IND = 0 }

Protected Member Functions

virtual bool computeInternalParameters (SMESH_Mesh &theMesh, Adaptor3d_Curve &theC3d, double theLength, double theFirstU, double theLastU, std::list< double > &theParameters, const bool theReverse, bool theConsiderPropagation=false)
virtual void redistributeNearVertices (SMESH_Mesh &theMesh, Adaptor3d_Curve &theC3d, double theLength, std::list< double > &theParameters, const TopoDS_Vertex &theVf, const TopoDS_Vertex &theVl)
 Tune parameters to fit "SegmentLengthAroundVertex" hypothesis.
bool error (int error, const SMESH_Comment &comment="")
 store error and comment and then return ( error == COMPERR_OK )
bool error (const SMESH_Comment &comment="")
 store COMPERR_ALGO_FAILED error and comment and then return false
bool error (SMESH_ComputeErrorPtr error)
 store error and return error->IsOK()
void addBadInputElement (const SMDS_MeshElement *elem)
 store a bad input element preventing computation, which may be a temporary one i.e.

Static Protected Member Functions

static const
StdMeshers_SegmentLengthAroundVertex
getVertexHyp (SMESH_Mesh &theMesh, const TopoDS_Vertex &theV)
 Return StdMeshers_SegmentLengthAroundVertex assigned to vertex.

Protected Attributes

SMESH_subMeshEventListener_EventListener
HypothesisType _hypType
const StdMeshers_FixedPoints1D_fpHyp
double _value [2]
int _ivalue [3]
std::vector< double > _vvalue [1]
std::string _svalue [1]
std::vector< int_revEdgesIDs
TopoDS_Shape _mainEdge
std::vector< std::string > _compatibleHypothesis
std::list< const
SMESHDS_Hypothesis * > 
_appliedHypList
std::list< const
SMESHDS_Hypothesis * > 
_usedHypList
bool _onlyUnaryInput
bool _requireDescretBoundary
bool _requireShape
bool _supportSubmeshes
bool _quadraticMesh
int _error
 SMESH_ComputeErrorName or anything algo specific.
std::string _comment
 any text explaining what is wrong in Compute()
std::list< const
SMDS_MeshElement * > 
_badInputElements
 to explain COMPERR_BAD_INPUT_MESH

Detailed Description

Definition at line 39 of file StdMeshers_CompositeSegment_1D.hxx.


Member Enumeration Documentation

enum StdMeshers_Regular_1D::HypothesisType [protected, inherited]
Enumerator:
LOCAL_LENGTH 
MAX_LENGTH 
NB_SEGMENTS 
BEG_END_LENGTH 
DEFLECTION 
ARITHMETIC_1D 
FIXED_POINTS_1D 
NONE 

Definition at line 103 of file StdMeshers_Regular_1D.hxx.

enum StdMeshers_Regular_1D::IValueIndex [protected, inherited]
Enumerator:
NB_SEGMENTS_IND 
DISTR_TYPE_IND 
CONV_MODE_IND 

Definition at line 113 of file StdMeshers_Regular_1D.hxx.

enum StdMeshers_Regular_1D::SValueIndex [protected, inherited]
Enumerator:
EXPR_FUNC_IND 

Definition at line 123 of file StdMeshers_Regular_1D.hxx.

                   {
    EXPR_FUNC_IND  = 0
  };
enum StdMeshers_Regular_1D::ValueIndex [protected, inherited]
Enumerator:
SCALE_FACTOR_IND 
BEG_LENGTH_IND 
END_LENGTH_IND 
DEFLECTION_IND 
PRECISION_IND 

Definition at line 105 of file StdMeshers_Regular_1D.hxx.

enum StdMeshers_Regular_1D::VValueIndex [protected, inherited]
Enumerator:
TAB_FUNC_IND 

Definition at line 119 of file StdMeshers_Regular_1D.hxx.

                   {
    TAB_FUNC_IND  = 0
  };

Constructor & Destructor Documentation

StdMeshers_CompositeSegment_1D::StdMeshers_CompositeSegment_1D ( int  hypId,
int  studyId,
SMESH_Gen gen 
)

Definition at line 220 of file StdMeshers_CompositeSegment_1D.cxx.

References _EventListener, and MESSAGE.

  :StdMeshers_Regular_1D(hypId, studyId, gen)
{
  MESSAGE("StdMeshers_CompositeSegment_1D::StdMeshers_CompositeSegment_1D");
  _name = "CompositeSegment_1D";
  _EventListener = new VertexNodesRestoringListener();
}
StdMeshers_CompositeSegment_1D::~StdMeshers_CompositeSegment_1D ( ) [virtual]

Definition at line 236 of file StdMeshers_CompositeSegment_1D.cxx.

{
  delete _EventListener;
}

Member Function Documentation

void SMESH_Algo::addBadInputElement ( const SMDS_MeshElement elem) [protected, inherited]

store a bad input element preventing computation, which may be a temporary one i.e.

not residing the mesh, then it will be deleted by InitComputeError()

Definition at line 674 of file SMESH_Algo.cxx.

{
  if ( elem )
    _badInputElements.push_back( elem );
}
virtual bool StdMeshers_Regular_1D.CheckHypothesis ( SMESH_Mesh aMesh,
const TopoDS_Shape &  aShape,
SMESH_Hypothesis::Hypothesis_Status aStatus 
) [virtual, inherited]

Check hypothesis definition to mesh a shape.

Parameters:
aMesh- the mesh
aShape- the shape
aStatus- check result
Return values:
bool- true if hypothesis is well defined

Implements SMESH_Algo.

Referenced by TNodeDistributor.Compute().

virtual bool StdMeshers_CompositeSegment_1D.Compute ( SMESH_Mesh aMesh,
const TopoDS_Shape &  aShape 
) [virtual]

Computes mesh on a shape.

Parameters:
aMesh- the mesh
aShape- the shape
Return values:
bool- is a success

Algorithms that !NeedDescretBoundary() || !OnlyUnaryInput() are to set SMESH_ComputeError returned by SMESH_submesh.GetComputeError() to report problematic subshapes

Reimplemented from StdMeshers_Regular_1D.

virtual bool SMESH_Algo.Compute ( SMESH_Mesh aMesh,
SMESH_MesherHelper aHelper 
) [virtual, inherited]

Computes mesh without geometry.

Parameters:
aMesh- the mesh
aHelper- helper that must be used for adding elements to
Return values:
bool- is a success

The method is called if ( !aMesh->HasShapeToMesh() )

Reimplemented in StdMeshers_Hexa_3D, and StdMeshers_HexaFromSkin_3D.

bool StdMeshers_Regular_1D::computeInternalParameters ( SMESH_Mesh theMesh,
Adaptor3d_Curve theC3d,
double  theLength,
double  theFirstU,
double  theLastU,
std::list< double > &  theParameters,
const bool  theReverse,
bool  theConsiderPropagation = false 
) [protected, virtual, inherited]

Definition at line 591 of file StdMeshers_Regular_1D.cxx.

References compensateError(), computeParamByFunc(), StdMeshers_NumberOfSegments.DT_ExprFunc, StdMeshers_NumberOfSegments.DT_Regular, StdMeshers_NumberOfSegments.DT_Scale, StdMeshers_NumberOfSegments.DT_TabFunc, SMESHDS_SubMesh.NbElements(), and SMESH_subMesh.READY_TO_COMPUTE.

Referenced by TNodeDistributor.Compute().

{
  theParams.clear();

  double f = theFirstU, l = theLastU;

  switch( _hypType )
  {
  case LOCAL_LENGTH:
  case MAX_LENGTH:
  case NB_SEGMENTS: {

    double eltSize = 1;
    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

      // NPAL17873:
      bool isFound = false;
      if (theConsiderPropagation && !_mainEdge.IsNull()) // propagated from some other edge
      {
        // Advanced processing to assure equal number of segments in case of Propagation
        SMESH_subMesh* sm = theMesh.GetSubMeshContaining(_mainEdge);
        if (sm) {
          bool computed = sm->IsMeshComputed();
          if (!computed) {
            if (sm->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE) {
              _gen->Compute( theMesh, _mainEdge, /*anUpward=*/true);
              computed = sm->IsMeshComputed();
            }
          }
          if (computed) {
            SMESHDS_SubMesh* smds = sm->GetSubMeshDS();
            int nb_segments = smds->NbElements();
            if (nbseg - 1 <= nb_segments && nb_segments <= nbseg + 1) {
              isFound = true;
              nbseg = nb_segments;
            }
          }
        }
      }
      if (!isFound) // not found by meshed edge in the propagation chain, use precision
      {
        double aPrecision = _value[ PRECISION_IND ];
        double nbseg_prec = ceil((theLength / _value[ BEG_LENGTH_IND ]) - aPrecision);
        if (nbseg_prec == (nbseg - 1)) nbseg--;
      }

      if (nbseg <= 0)
        nbseg = 1;                        // degenerated edge
      eltSize = theLength / nbseg;
    }
    else
    {
      // Number Of Segments hypothesis
      int NbSegm = _ivalue[ NB_SEGMENTS_IND ];
      if ( NbSegm < 1 )  return false;
      if ( NbSegm == 1 ) return true;

      switch (_ivalue[ DISTR_TYPE_IND ])
      {
      case StdMeshers_NumberOfSegments::DT_Scale:
        {
          double scale = _value[ SCALE_FACTOR_IND ];

          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;
              theParams.push_back( param );
            }
          } else {
            // general case of scale distribution
            if ( theReverse )
              scale = 1.0 / scale;

            double alpha = pow(scale, 1.0 / (NbSegm - 1));
            double factor = (l - f) / (1.0 - pow(alpha, NbSegm));

            for (int i = 1; i < NbSegm; i++) {
              double param = f + factor * (1.0 - pow(alpha, i));
              theParams.push_back( param );
            }
          }
          return true;
        }
        break;
      case StdMeshers_NumberOfSegments::DT_TabFunc:
        {
          FunctionTable func(_vvalue[ TAB_FUNC_IND ], _ivalue[ CONV_MODE_IND ]);
          return computeParamByFunc(theC3d, f, l, theLength, theReverse,
                                    _ivalue[ NB_SEGMENTS_IND ], func,
                                    theParams);
        }
        break;
      case StdMeshers_NumberOfSegments::DT_ExprFunc:
        {
          FunctionExpr func(_svalue[ EXPR_FUNC_IND ].c_str(), _ivalue[ CONV_MODE_IND ]);
          return computeParamByFunc(theC3d, f, l, theLength, theReverse,
                                    _ivalue[ NB_SEGMENTS_IND ], func,
                                    theParams);
        }
        break;
      case StdMeshers_NumberOfSegments::DT_Regular:
        eltSize = theLength / _ivalue[ NB_SEGMENTS_IND ];
        break;
      default:
        return false;
      }
    }
    GCPnts_UniformAbscissa Discret(theC3d, eltSize, f, l);
    if ( !Discret.IsDone() )
      return error( "GCPnts_UniformAbscissa failed");

    int NbPoints = Discret.NbPoints();
    for ( int i = 2; i < NbPoints; i++ )
    {
      double param = Discret.Parameter(i);
      theParams.push_back( param );
    }
    compensateError( eltSize, eltSize, f, l, theLength, theC3d, theParams ); // for PAL9899
    return true;
  }

  case BEG_END_LENGTH: {

    // geometric progression: SUM(n) = ( a1 - an * q ) / ( 1 - q ) = theLength

    double a1 = _value[ BEG_LENGTH_IND ];
    double an = _value[ END_LENGTH_IND ];
    double q  = ( theLength - a1 ) / ( theLength - an );
    if ( q < theLength/1e6 || 1.01*theLength < a1 + an)
      return error ( SMESH_Comment("Invalid segment lengths (")<<a1<<" and "<<an<<") "<<
                     "for an edge of length "<<theLength);

    double U1 = theReverse ? l : f;
    double Un = theReverse ? f : l;
    double param = U1;
    double eltSize = theReverse ? -a1 : a1;
    while ( 1 ) {
      // computes a point on a curve <theC3d> at the distance <eltSize>
      // from the point of parameter <param>.
      GCPnts_AbscissaPoint Discret( theC3d, eltSize, param );
      if ( !Discret.IsDone() ) break;
      param = Discret.Parameter();
      if ( f < param && param < l )
        theParams.push_back( param );
      else
        break;
      eltSize *= q;
    }
    compensateError( a1, an, U1, Un, theLength, theC3d, theParams );
    if (theReverse) theParams.reverse(); // NPAL18025
    return true;
  }

  case ARITHMETIC_1D: {

    // arithmetic progression: SUM(n) = ( an - a1 + q ) * ( a1 + an ) / ( 2 * q ) = theLength

    double a1 = _value[ BEG_LENGTH_IND ];
    double an = _value[ END_LENGTH_IND ];
    if ( 1.01*theLength < a1 + an)
      return error ( SMESH_Comment("Invalid segment lengths (")<<a1<<" and "<<an<<") "<<
                     "for an edge of length "<<theLength);

    double  q = ( an - a1 ) / ( 2 *theLength/( a1 + an ) - 1 );
    int n = int(fabs(q) > numeric_limits<double>::min() ? ( 1+( an-a1 )/q ) : ( 1+theLength/a1 ));

    double U1 = theReverse ? l : f;
    double Un = theReverse ? f : l;
    double param = U1;
    double eltSize = a1;
    if ( theReverse ) {
      eltSize = -eltSize;
      q = -q;
    }
    while ( n-- > 0 && eltSize * ( Un - U1 ) > 0 ) {
      // computes a point on a curve <theC3d> at the distance <eltSize>
      // from the point of parameter <param>.
      GCPnts_AbscissaPoint Discret( theC3d, eltSize, param );
      if ( !Discret.IsDone() ) break;
      param = Discret.Parameter();
      if ( param > f && param < l )
        theParams.push_back( param );
      else
        break;
      eltSize += q;
    }
    compensateError( a1, an, U1, Un, theLength, theC3d, theParams );
    if (theReverse) theParams.reverse(); // NPAL18025

    return true;
  }

  case FIXED_POINTS_1D: {
    const std::vector<double>& aPnts = _fpHyp->GetPoints();
    const std::vector<int>& nbsegs = _fpHyp->GetNbSegments();
    int i = 0;
    TColStd_SequenceOfReal Params;
    for(; i<aPnts.size(); i++) {
      if( aPnts[i]<0.0001 || aPnts[i]>0.9999 ) continue;
      int j=1;
      bool IsExist = false;
      for(; j<=Params.Length(); j++) {
        if( fabs(aPnts[i]-Params.Value(j)) < 1e-4 ) {
          IsExist = true;
          break;
        }
        if( aPnts[i]<Params.Value(j) ) break;
      }
      if(!IsExist) Params.InsertBefore(j,aPnts[i]);
    }
    double par2, par1, lp;
    par1 = f;
    lp = l;
    double sign = 1.0;
    if(theReverse) {
      par1 = l;
      lp = f;
      sign = -1.0;
    }
    double eltSize, segmentSize = 0.;
    double currAbscissa = 0;
    for(i=0; i<Params.Length(); i++) {
      int nbseg = ( i > nbsegs.size()-1 ) ? nbsegs[0] : nbsegs[i];
      segmentSize = Params.Value(i+1)*theLength - currAbscissa;
      currAbscissa += segmentSize;
      GCPnts_AbscissaPoint APnt(theC3d, sign*segmentSize, par1);
      if( !APnt.IsDone() )
        return error( "GCPnts_AbscissaPoint failed");
      par2 = APnt.Parameter();
      eltSize = segmentSize/nbseg;
      GCPnts_UniformAbscissa Discret(theC3d, eltSize, par1, par2);
      if(theReverse)
        Discret.Initialize(theC3d, eltSize, par2, par1);
      else
        Discret.Initialize(theC3d, eltSize, par1, par2);
      if ( !Discret.IsDone() )
        return error( "GCPnts_UniformAbscissa failed");
      int NbPoints = Discret.NbPoints();
      list<double> tmpParams;
      for(int i=2; i<NbPoints; i++) {
        double param = Discret.Parameter(i);
        tmpParams.push_back( param );
      }
      if (theReverse) {
        compensateError( eltSize, eltSize, par2, par1, segmentSize, theC3d, tmpParams );
        tmpParams.reverse();
      }
      else {
        compensateError( eltSize, eltSize, par1, par2, segmentSize, theC3d, tmpParams );
      }
      list<double>::iterator itP = tmpParams.begin();
      for(; itP != tmpParams.end(); itP++) {
        theParams.push_back( *(itP) );
      }
      theParams.push_back( par2 );

      par1 = par2;
    }
    // add for last
    int nbseg = ( nbsegs.size() > Params.Length() ) ? nbsegs[Params.Length()] : nbsegs[0];
    segmentSize = theLength - currAbscissa;
    eltSize = segmentSize/nbseg;
    GCPnts_UniformAbscissa Discret;
    if(theReverse)
      Discret.Initialize(theC3d, eltSize, par1, lp);
    else
      Discret.Initialize(theC3d, eltSize, lp, par1);
    if ( !Discret.IsDone() )
      return error( "GCPnts_UniformAbscissa failed");
    int NbPoints = Discret.NbPoints();
    list<double> tmpParams;
    for(int i=2; i<NbPoints; i++) {
      double param = Discret.Parameter(i);
      tmpParams.push_back( param );
    }
    if (theReverse) {
      compensateError( eltSize, eltSize, lp, par1, segmentSize, theC3d, tmpParams );
      tmpParams.reverse();
    }
    else {
      compensateError( eltSize, eltSize, par1, lp, segmentSize, theC3d, tmpParams );
    }
    list<double>::iterator itP = tmpParams.begin();
    for(; itP != tmpParams.end(); itP++) {
      theParams.push_back( *(itP) );
    }

    if (theReverse) {
      theParams.reverse(); // NPAL18025
    }
    return true;
  }

  case DEFLECTION: {

    GCPnts_UniformDeflection Discret(theC3d, _value[ DEFLECTION_IND ], f, l, true);
    if ( !Discret.IsDone() )
      return false;

    int NbPoints = Discret.NbPoints();
    for ( int i = 2; i < NbPoints; i++ )
    {
      double param = Discret.Parameter(i);
      theParams.push_back( param );
    }
    return true;
  }

  default:;
  }

  return false;
}
GeomAbs_Shape SMESH_Algo::Continuity ( TopoDS_Edge  E1,
TopoDS_Edge  E2 
) [static, inherited]

Return continuity of two edges.

Parameters:
E1- the 1st edge
E2- the 2nd edge
Return values:
GeomAbs_Shape- regularity at the junction between E1 and E2

Definition at line 494 of file SMESH_Algo.cxx.

References SMESH_AdvancedEditor.tol.

{
  //E1.Orientation(TopAbs_FORWARD), E2.Orientation(TopAbs_FORWARD); // avoid pb with internal edges
  if (E1.Orientation() > TopAbs_REVERSED) // INTERNAL
      E1.Orientation( TopAbs_FORWARD );
  if (E2.Orientation() > TopAbs_REVERSED) // INTERNAL
      E2.Orientation( TopAbs_FORWARD );
  TopoDS_Vertex V = TopExp::LastVertex (E1, true);
  if ( !V.IsSame( TopExp::FirstVertex(E2, true )))
    if ( !TopExp::CommonVertex( E1, E2, V ))
      return GeomAbs_C0;
  Standard_Real u1 = BRep_Tool::Parameter( V, E1 );
  Standard_Real u2 = BRep_Tool::Parameter( V, E2 );
  BRepAdaptor_Curve C1( E1 ), C2( E2 );
  Standard_Real tol = BRep_Tool::Tolerance( V );
  Standard_Real angTol = 2e-3;
  try {
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
    OCC_CATCH_SIGNALS;
#endif
    return BRepLProp::Continuity(C1, C2, u1, u2, tol, angTol);
  }
  catch (Standard_Failure) {
  }
  return GeomAbs_C0;
}
double SMESH_Algo::EdgeLength ( const TopoDS_Edge &  E) [static, inherited]

Compute length of an edge.

Parameters:
E- the edge
Return values:
double- the length

Definition at line 167 of file SMESH_Algo.cxx.

References Handle().

Referenced by StdMeshers_PrismAsBlock.Init().

{
  double UMin = 0, UMax = 0;
  if (BRep_Tool::Degenerated(E))
    return 0;
  TopLoc_Location L;
  Handle(Geom_Curve) C = BRep_Tool::Curve(E, L, UMin, UMax);
  GeomAdaptor_Curve AdaptCurve(C, UMin, UMax); //range is important for periodic curves
  double length = GCPnts_AbscissaPoint::Length(AdaptCurve, UMin, UMax);
  return length;
}
bool SMESH_Algo.error ( int  error,
const SMESH_Comment comment = "" 
) [protected, inherited]
bool SMESH_Algo.error ( const SMESH_Comment comment = "") [protected, inherited]

store COMPERR_ALGO_FAILED error and comment and then return false

Definition at line 340 of file SMESH_Algo.hxx.

References COMPERR_ALGO_FAILED, and SMESH_Algo.error().

Referenced by SMESH_Algo.error().

  { return error(COMPERR_ALGO_FAILED, comment); }
bool SMESH_Algo::error ( SMESH_ComputeErrorPtr  error) [protected, inherited]

store error and return error->IsOK()

store error and return ( error == COMPERR_OK )

Definition at line 623 of file SMESH_Algo.cxx.

{
  if ( error ) {
    _error   = error->myName;
    _comment = error->myComment;
    _badInputElements = error->myBadElements;
    return error->IsOK();
  }
  return true;
}
virtual bool StdMeshers_Regular_1D.Evaluate ( SMESH_Mesh aMesh,
const TopoDS_Shape &  aShape,
MapShapeNbElems aResMap 
) [virtual, inherited]

evaluates size of prospective mesh on a shape

Parameters:
aMesh- the mesh
aShape- the shape
aNbElems- prospective number of elements by types
Return values:
bool- is a success

Implements SMESH_Algo.

bool SMESH_Algo::FaceNormal ( const SMDS_MeshElement F,
gp_XYZ &  normal,
bool  normalized = true 
) [static, inherited]

Calculate normal of a mesh face.

Definition at line 185 of file SMESH_Algo.cxx.

References SMDS_MeshElement.GetNode(), SMDS_MeshElement.GetType(), SMDS_MeshElement.IsQuadratic(), SMDS_MeshElement.NbNodes(), ex29_refine.node(), SMDSAbs_Face, SMDS_MeshNode.X(), SMDS_MeshNode.Y(), and SMDS_MeshNode.Z().

Referenced by SMESH_ElementSearcherImpl.findOuterBoundary(), and SMESH_ElementSearcherImpl.GetPointState().

{
  if ( !F || F->GetType() != SMDSAbs_Face )
    return false;

  normal.SetCoord(0,0,0);
  int nbNodes = F->IsQuadratic() ? F->NbNodes()/2 : F->NbNodes();
  for ( int i = 0; i < nbNodes-2; ++i )
  {
    gp_XYZ p[3];
    for ( int n = 0; n < 3; ++n )
    {
      const SMDS_MeshNode* node = F->GetNode( i + n );
      p[n].SetCoord( node->X(), node->Y(), node->Z() );
    }
    normal += ( p[2] - p[1] ) ^ ( p[0] - p[1] );
  }
  double size2 = normal.SquareModulus();
  bool ok = ( size2 > numeric_limits<double>::min() * numeric_limits<double>::min());
  if ( normalized && ok )
    normal /= sqrt( size2 );

  return ok;
}
const list< const SMESHDS_Hypothesis * > & SMESH_Algo::GetAppliedHypothesis ( SMESH_Mesh aMesh,
const TopoDS_Shape &  aShape,
const bool  ignoreAuxiliary = true 
) [inherited]

Returns a list of compatible hypotheses assigned to a shape in a mesh.

List the relevant hypothesis associated to the shape.

Parameters:
aMesh- the mesh
aShape- the shape
ignoreAuxiliary- do not include auxiliary hypotheses in the list
Return values:
conststd.list <const SMESHDS_Hypothesis*> - hypotheses list

List the relevant hypothesis associated to the shape. Relevant hypothesis have a name (type) listed in the algorithm. Hypothesis associated to father shape -are not- taken into account (see GetUsedHypothesis)

Relevant hypothesis have a name (type) listed in the algorithm. Hypothesis associated to father shape -are not- taken into account (see GetUsedHypothesis)

Definition at line 149 of file SMESH_Algo.cxx.

{
  _appliedHypList.clear();
  SMESH_HypoFilter filter;
  if ( InitCompatibleHypoFilter( filter, ignoreAuxiliary ))
    aMesh.GetHypotheses( aShape, filter, _appliedHypList, false );

  return _appliedHypList;
}
vector< const SMDS_MeshNode * > SMESH_Algo::GetCommonNodes ( const SMDS_MeshElement e1,
const SMDS_MeshElement e2 
) [static, inherited]

Return nodes common to two elements.

Definition at line 547 of file SMESH_Algo.cxx.

References SMDS_MeshElement.GetNode(), SMDS_MeshElement.GetNodeIndex(), and SMDS_MeshElement.NbNodes().

Referenced by StdMeshers_QuadToTriaAdaptor.Compute2ndPart(), SMESH_MeshEditor.ConvertFromQuadratic(), and SMESH_ElementSearcherImpl.GetPointState().

{
  vector< const SMDS_MeshNode*> common;
  for ( int i = 0 ; i < e1->NbNodes(); ++i )
    if ( e2->GetNodeIndex( e1->GetNode( i )) >= 0 )
      common.push_back( e1->GetNode( i ));
  return common;
}
const std::vector< std::string >& SMESH_Algo.GetCompatibleHypothesis ( ) [inherited]

Returns all types of compatible hypotheses.

SMESH_ComputeErrorPtr SMESH_Algo.GetComputeError ( ) const [inherited]

return compute error

Referenced by StdMeshers_Hexa_3D.Compute().

StdMeshers_FaceSide * StdMeshers_CompositeSegment_1D::GetFaceSide ( SMESH_Mesh aMesh,
const TopoDS_Edge &  anEdge,
const TopoDS_Face &  aFace,
const bool  ignoreMeshed 
) [static]

Return a face side the edge belongs to.

Definition at line 293 of file StdMeshers_CompositeSegment_1D.cxx.

References ex01_cube2build.algo.

{
  list< TopoDS_Edge > edges;
  if ( anEdge.Orientation() <= TopAbs_REVERSED )
    edges.push_back( anEdge );
  else
    edges.push_back( TopoDS::Edge( anEdge.Oriented( TopAbs_FORWARD ))); // PAL21718

  list <const SMESHDS_Hypothesis *> hypList;
  SMESH_Algo* theAlgo = aMesh.GetGen()->GetAlgo( aMesh, anEdge );
  if ( theAlgo ) hypList = theAlgo->GetUsedHypothesis(aMesh, anEdge, false);
  for ( int forward = 0; forward < 2; ++forward )
  {
    TopoDS_Edge eNext = nextC1Edge( edges.back(), aMesh, forward );
    while ( !eNext.IsNull() ) {
      if ( ignoreMeshed ) {
        // eNext must not have computed mesh
        if ( SMESHDS_SubMesh* sm = aMesh.GetMeshDS()->MeshElements(eNext) )
          if ( sm->NbNodes() || sm->NbElements() )
            break;
      }
      // eNext must have same hypotheses
      SMESH_Algo* algo = aMesh.GetGen()->GetAlgo( aMesh, eNext );
      if ( !algo ||
           string(theAlgo->GetName()) != algo->GetName() ||
           hypList != algo->GetUsedHypothesis(aMesh, eNext, false))
        break;
      if ( std::find( edges.begin(), edges.end(), eNext ) != edges.end() )
        break;
      if ( forward )
        edges.push_back( eNext );
      else
        edges.push_front( eNext );
      eNext = nextC1Edge( eNext, aMesh, forward );
    }
  }
  return new StdMeshers_FaceSide( aFace, edges, &aMesh, true, false );
}
bool SMESH_Algo::GetNodeParamOnEdge ( const SMESHDS_Mesh theMesh,
const TopoDS_Edge &  theEdge,
std::vector< double > &  theParams 
) [static, inherited]

Fill vector of node parameters on geometrical edge, including vertex nodes.

Parameters:
theMesh- The mesh containing nodes
theEdge- The geometrical edge of interest
theParams- The resulting vector of sorted node parameters
Return values:
bool- false if not all parameters are OK

Definition at line 343 of file SMESH_Algo.cxx.

References SMESHDS_SubMesh.GetElements(), SMESHDS_SubMesh.GetNodes(), SMDS_MeshNode.GetPosition(), SMDS_Position.GetTypeOfPosition(), SMDS_EdgePosition.GetUParameter(), SMESHDS_Mesh.MeshElements(), ex29_refine.node(), and SMDS_TOP_EDGE.

Referenced by StdMeshers_Arithmetic1D.SetParametersByMesh().

{
  theParams.clear();

  if ( !theMesh || theEdge.IsNull() )
    return false;

  SMESHDS_SubMesh * eSubMesh = theMesh->MeshElements( theEdge );
  if ( !eSubMesh || !eSubMesh->GetElements()->more() )
    return false; // edge is not meshed

  //int nbEdgeNodes = 0;
  set < double > paramSet;
  if ( eSubMesh )
  {
    // loop on nodes of an edge: sort them by param on edge
    SMDS_NodeIteratorPtr nIt = eSubMesh->GetNodes();
    while ( nIt->more() )
    {
      const SMDS_MeshNode* node = nIt->next();
      const SMDS_PositionPtr& pos = node->GetPosition();
      if ( pos->GetTypeOfPosition() != SMDS_TOP_EDGE )
        return false;
      const SMDS_EdgePosition* epos =
        static_cast<const SMDS_EdgePosition*>(node->GetPosition());
      if ( !paramSet.insert( epos->GetUParameter() ).second )
        return false; // equal parameters
    }
  }
  // add vertex nodes params
  TopoDS_Vertex V1,V2;
  TopExp::Vertices( theEdge, V1, V2);
  if ( VertexNode( V1, theMesh ) &&
       !paramSet.insert( BRep_Tool::Parameter(V1,theEdge) ).second )
    return false; // there are equal parameters
  if ( VertexNode( V2, theMesh ) &&
       !paramSet.insert( BRep_Tool::Parameter(V2,theEdge) ).second )
    return false; // there are equal parameters

  // fill the vector
  theParams.resize( paramSet.size() );
  set < double >::iterator   par    = paramSet.begin();
  vector< double >::iterator vecPar = theParams.begin();
  for ( ; par != paramSet.end(); ++par, ++vecPar )
    *vecPar = *par;

  return theParams.size() > 1;
}
bool SMESH_Algo::GetSortedNodesOnEdge ( const SMESHDS_Mesh theMesh,
const TopoDS_Edge &  theEdge,
const bool  ignoreMediumNodes,
std::map< double, const SMDS_MeshNode * > &  theNodes 
) [static, inherited]

Fill map of node parameter on geometrical edge to node it-self.

Fill vector of node parameters on geometrical edge, including vertex nodes.

Parameters:
theMesh- The mesh containing nodes
theEdge- The geometrical edge of interest
theNodes- The resulting map
ignoreMediumNodes- to store medium nodes of quadratic elements or not
Return values:
bool- false if not all parameters are OK
Parameters:
theMesh- The mesh containing nodes
theEdge- The geometrical edge of interest
theParams- The resulting vector of sorted node parameters
Return values:
bool- false if not all parameters are OK

Definition at line 404 of file SMESH_Algo.cxx.

References SMESHDS_SubMesh.GetElements(), SMDS_MeshNode.GetInverseElementIterator(), SMESHDS_SubMesh.GetNodes(), SMDS_MeshNode.GetPosition(), SMDS_Position.GetTypeOfPosition(), SMDS_EdgePosition.GetUParameter(), SMESHDS_Mesh.MeshElements(), SMESH_AdvancedEditor.n1, SMESH_AdvancedEditor.n2, ex29_refine.node(), and SMDS_TOP_EDGE.

Referenced by VISCOUS._ViscousBuilder.addBoundaryElements(), SMESH_MesherHelper.LoadNodeColumns(), and _FaceSide.StoreNodes().

{
  theNodes.clear();

  if ( !theMesh || theEdge.IsNull() )
    return false;

  SMESHDS_SubMesh * eSubMesh = theMesh->MeshElements( theEdge );
  if ( !eSubMesh || !eSubMesh->GetElements()->more() )
    return false; // edge is not meshed

  int nbNodes = 0;
  set < double > paramSet;
  if ( eSubMesh )
  {
    // loop on nodes of an edge: sort them by param on edge
    SMDS_NodeIteratorPtr nIt = eSubMesh->GetNodes();
    while ( nIt->more() )
    {
      const SMDS_MeshNode* node = nIt->next();
      if ( ignoreMediumNodes ) {
        SMDS_ElemIteratorPtr elemIt = node->GetInverseElementIterator();
        if ( elemIt->more() && elemIt->next()->IsMediumNode( node ))
          continue;
      }
      const SMDS_PositionPtr& pos = node->GetPosition();
      if ( pos->GetTypeOfPosition() != SMDS_TOP_EDGE )
        return false;
      const SMDS_EdgePosition* epos =
        static_cast<const SMDS_EdgePosition*>(node->GetPosition());
      theNodes.insert( make_pair( epos->GetUParameter(), node ));
      //MESSAGE("U " << epos->GetUParameter() << " ID " << node->GetID());
      ++nbNodes;
    }
  }
  // add vertex nodes
  TopoDS_Vertex v1, v2;
  TopExp::Vertices(theEdge, v1, v2);
  const SMDS_MeshNode* n1 = VertexNode( v1, (SMESHDS_Mesh*) theMesh );
  const SMDS_MeshNode* n2 = VertexNode( v2, (SMESHDS_Mesh*) theMesh );
  //MESSAGE("Vertices ID " << n1->GetID() << " " << n2->GetID());
  Standard_Real f, l;
  BRep_Tool::Range(theEdge, f, l);
  if ( v1.Orientation() != TopAbs_FORWARD )
    std::swap( f, l );
  if ( n1 && ++nbNodes )
    theNodes.insert( make_pair( f, n1 ));
  if ( n2 && ++nbNodes )
    theNodes.insert( make_pair( l, n2 ));

  return theNodes.size() == nbNodes;
}
const list< const SMESHDS_Hypothesis * > & StdMeshers_Regular_1D::GetUsedHypothesis ( SMESH_Mesh aMesh,
const TopoDS_Shape &  aShape,
const bool  ignoreAuxiliary = true 
) [virtual, inherited]

List the hypothesis used by the algorithm associated to the shape.

See comments in SMESH_Algo.cxx.

Hypothesis associated to father shape -are- taken into account (see GetAppliedHypothesis). Relevant hypothesis have a name (type) listed in the algorithm. This method could be surcharged by specific algorithms, in case of several hypothesis simultaneously applicable.

Reimplemented from SMESH_Algo.

Definition at line 125 of file SMESH_Algo.cxx.

{
  _usedHypList.clear();
  SMESH_HypoFilter filter;
  if ( InitCompatibleHypoFilter( filter, ignoreAuxiliary ))
  {
    aMesh.GetHypotheses( aShape, filter, _usedHypList, true );
    if ( ignoreAuxiliary && _usedHypList.size() > 1 )
      _usedHypList.clear(); //only one compatible hypothesis allowed
  }
  return _usedHypList;
}
const StdMeshers_SegmentLengthAroundVertex * StdMeshers_Regular_1D::getVertexHyp ( SMESH_Mesh theMesh,
const TopoDS_Vertex &  theV 
) [static, protected, inherited]

Return StdMeshers_SegmentLengthAroundVertex assigned to vertex.

Definition at line 481 of file StdMeshers_Regular_1D.cxx.

References ex01_cube2build.algo, and SMESH_HypoFilter.HasName().

{
  static SMESH_HypoFilter filter( SMESH_HypoFilter::HasName("SegmentAroundVertex_0D"));
  if ( const SMESH_Hypothesis * h = theMesh.GetHypothesis( theV, filter, true ))
  {
    SMESH_Algo* algo = const_cast< SMESH_Algo* >( static_cast< const SMESH_Algo* > ( h ));
    const list <const SMESHDS_Hypothesis *> & hypList = algo->GetUsedHypothesis( theMesh, theV, 0 );
    if ( !hypList.empty() && string("SegmentLengthAroundVertex") == hypList.front()->GetName() )
      return static_cast<const StdMeshers_SegmentLengthAroundVertex*>( hypList.front() );
  }
  return 0;
}
bool SMESH_Algo::InitCompatibleHypoFilter ( SMESH_HypoFilter theFilter,
const bool  ignoreAuxiliary 
) const [inherited]

Make the filter recognize only compatible hypotheses.

Make filter recognize only compatible hypotheses.

Parameters:
theFilter- the filter to initialize
ignoreAuxiliary- make filter ignore compatible auxiliary hypotheses
Return values:
bool- true if the algo has compatible hypotheses
Parameters:
theFilter- the filter to initialize
ignoreAuxiliary- make filter ignore compatible auxiliary hypotheses

Definition at line 468 of file SMESH_Algo.cxx.

References SMESH_HypoFilter.AndNot(), SMESH_HypoFilter.HasName(), SMESH_HypoFilter.Init(), SMESH_HypoFilter.IsAuxiliary(), and SMESH_HypoFilter.Or().

{
  if ( !_compatibleHypothesis.empty() )
  {
    theFilter.Init( theFilter.HasName( _compatibleHypothesis[0] ));
    for ( int i = 1; i < _compatibleHypothesis.size(); ++i )
      theFilter.Or( theFilter.HasName( _compatibleHypothesis[ i ] ));

    if ( ignoreAuxiliary )
      theFilter.AndNot( theFilter.IsAuxiliary() );

    return true;
  }
  return false;
}
void SMESH_Algo::InitComputeError ( ) [inherited]

initialize compute error

Definition at line 655 of file SMESH_Algo.cxx.

References COMPERR_OK.

Referenced by StdMeshers_Hexa_3D.Compute().

{
  _error = COMPERR_OK;
  _comment.clear();
  list<const SMDS_MeshElement*>::iterator elem = _badInputElements.begin();
  for ( ; elem != _badInputElements.end(); ++elem )
    if ( (*elem)->GetID() < 1 )
      delete *elem;
  _badInputElements.clear();
}
static bool SMESH_Algo.IsContinuous ( const TopoDS_Edge &  E1,
const TopoDS_Edge &  E2 
) [static, inherited]

Return true if an edge can be considered as a continuation of another.

Definition at line 313 of file SMESH_Algo.hxx.

Referenced by StdMeshers_Quadrangle_2D.CheckNbEdges(), StdMeshers_Quadrangle_2D.CheckNbEdgesForEvaluate(), and _QuadFaceGrid.Init().

                                                                           {
    return ( Continuity( E1, E2 ) >= GeomAbs_G1 );
  }
bool SMESH_Algo::IsReversedSubMesh ( const TopoDS_Face &  theFace,
SMESHDS_Mesh theMeshDS 
) [static, inherited]

Find out elements orientation on a geometrical face.

Parameters:
theFace- The face correctly oriented in the shape being meshed
theMeshDS- The mesh data structure
Return values:
bool- true if the face normal and the normal of first element in the correspoding submesh point in different directions

Definition at line 220 of file SMESH_Algo.cxx.

References SMESHDS_SubMesh.GetElements(), SMDS_MeshNode.GetPosition(), SMDS_MeshElement.getshapeId(), SMDS_Position.GetTypeOfPosition(), SMDS_FacePosition.GetUParameter(), SMDS_FacePosition.GetVParameter(), Handle(), SMESHDS_Mesh.IndexToShape(), SMESHDS_Mesh.MeshElements(), SMDS_MeshElement.NbNodes(), ex29_refine.node(), SMDS_MeshElement.nodesIterator(), SMESHDS_Mesh.ShapeToIndex(), SMDS_TOP_FACE, SMDS_TOP_VERTEX, SMDS_MeshNode.X(), SMDS_MeshNode.Y(), and SMDS_MeshNode.Z().

Referenced by StdMeshers_QuadToTriaAdaptor.Compute(), and VISCOUS._ViscousBuilder.findFacesWithLayers().

{
  if ( theFace.IsNull() || !theMeshDS )
    return false;

  // find out orientation of a meshed face
  int faceID = theMeshDS->ShapeToIndex( theFace );
  TopoDS_Shape aMeshedFace = theMeshDS->IndexToShape( faceID );
  bool isReversed = ( theFace.Orientation() != aMeshedFace.Orientation() );

  const SMESHDS_SubMesh * aSubMeshDSFace = theMeshDS->MeshElements( faceID );
  if ( !aSubMeshDSFace )
    return isReversed;

  // find element with node located on face and get its normal
  const SMDS_FacePosition* facePos = 0;
  int vertexID = 0;
  gp_Pnt nPnt[3];
  gp_Vec Ne;
  bool normalOK = false;
  SMDS_ElemIteratorPtr iteratorElem = aSubMeshDSFace->GetElements();
  while ( iteratorElem->more() ) // loop on elements on theFace
  {
    const SMDS_MeshElement* elem = iteratorElem->next();
    if ( elem && elem->NbNodes() > 2 ) {
      SMDS_ElemIteratorPtr nodesIt = elem->nodesIterator();
      const SMDS_FacePosition* fPos = 0;
      int i = 0, vID = 0;
      while ( nodesIt->more() ) { // loop on nodes
        const SMDS_MeshNode* node
          = static_cast<const SMDS_MeshNode *>(nodesIt->next());
        if ( i == 3 ) i = 2;
        nPnt[ i++ ].SetCoord( node->X(), node->Y(), node->Z() );
        // check position
        const SMDS_PositionPtr& pos = node->GetPosition();
        if ( !pos ) continue;
        if ( pos->GetTypeOfPosition() == SMDS_TOP_FACE ) {
          fPos = dynamic_cast< const SMDS_FacePosition* >( pos );
        }
        else if ( pos->GetTypeOfPosition() == SMDS_TOP_VERTEX ) {
          vID = node->getshapeId();
        }
      }
      if ( fPos || ( !normalOK && vID )) {
        // compute normal
        gp_Vec v01( nPnt[0], nPnt[1] ), v02( nPnt[0], nPnt[2] );
        if ( v01.SquareMagnitude() > RealSmall() &&
             v02.SquareMagnitude() > RealSmall() )
        {
          Ne = v01 ^ v02;
          normalOK = ( Ne.SquareMagnitude() > RealSmall() );
        }
        // we need position on theFace or at least on vertex
        if ( normalOK ) {
          vertexID = vID;
          if ((facePos = fPos))
            break;
        }
      }
    }
  }
  if ( !normalOK )
    return isReversed;

  // node position on face
  double u,v;
  if ( facePos ) {
    u = facePos->GetUParameter();
    v = facePos->GetVParameter();
  }
  else if ( vertexID ) {
    TopoDS_Shape V = theMeshDS->IndexToShape( vertexID );
    if ( V.IsNull() || V.ShapeType() != TopAbs_VERTEX )
      return isReversed;
    gp_Pnt2d uv = BRep_Tool::Parameters( TopoDS::Vertex( V ), theFace );
    u = uv.X();
    v = uv.Y();
  }
  else
  {
    return isReversed;
  }

  // face normal at node position
  TopLoc_Location loc;
  Handle(Geom_Surface) surf = BRep_Tool::Surface( theFace, loc );
  if ( surf.IsNull() || surf->Continuity() < GeomAbs_C1 ) return isReversed;
  gp_Vec d1u, d1v;
  surf->D1( u, v, nPnt[0], d1u, d1v );
  gp_Vec Nf = (d1u ^ d1v).Transformed( loc );

  if ( theFace.Orientation() == TopAbs_REVERSED )
    Nf.Reverse();

  return Ne * Nf < 0.;
}
virtual std::istream& SMESH_Algo.LoadFrom ( std::istream &  load) [virtual, inherited]

Loads nothing from a stream.

Parameters:
load- the stream
Return values:
std.ostream& - the stream
bool SMESH_Algo.NeedDescretBoundary ( ) const [inherited]

Definition at line 222 of file SMESH_Algo.hxx.

bool SMESH_Algo.NeedShape ( ) const [inherited]

Definition at line 225 of file SMESH_Algo.hxx.

{ return _requireShape; }
bool SMESH_Algo.OnlyUnaryInput ( ) const [inherited]

Definition at line 214 of file SMESH_Algo.hxx.

{ return _onlyUnaryInput; }
void StdMeshers_Regular_1D::redistributeNearVertices ( SMESH_Mesh theMesh,
Adaptor3d_Curve theC3d,
double  theLength,
std::list< double > &  theParameters,
const TopoDS_Vertex &  theVf,
const TopoDS_Vertex &  theVl 
) [protected, virtual, inherited]

Tune parameters to fit "SegmentLengthAroundVertex" hypothesis.

Parameters:
theC3d- wire curve
theLength- curve length
theParameters- internal nodes parameters to modify
theVf- 1st vertex
theVl- 2nd vertex

Definition at line 506 of file StdMeshers_Regular_1D.cxx.

References ex01_cube2build.algo, and compensateError().

{
  double f = theC3d.FirstParameter(), l = theC3d.LastParameter();
  int nPar = theParameters.size();
  for ( int isEnd1 = 0; isEnd1 < 2; ++isEnd1 )
  {
    const TopoDS_Vertex & V = isEnd1 ? theVf : theVl;
    const StdMeshers_SegmentLengthAroundVertex* hyp = getVertexHyp (theMesh, V );
    if ( hyp ) {
      double vertexLength = hyp->GetLength();
      if ( vertexLength > theLength / 2.0 )
        continue;
      if ( isEnd1 ) { // to have a segment of interest at end of theParameters
        theParameters.reverse();
        std::swap( f, l );
      }
      if ( _hypType == NB_SEGMENTS )
      {
        compensateError(0, vertexLength, f, l, theLength, theC3d, theParameters, true );
      }
      else if ( nPar <= 3 )
      {
        if ( !isEnd1 )
          vertexLength = -vertexLength;
        GCPnts_AbscissaPoint Discret(theC3d, vertexLength, l);
        if ( Discret.IsDone() ) {
          if ( nPar == 0 )
            theParameters.push_back( Discret.Parameter());
          else {
            double L = GCPnts_AbscissaPoint::Length( theC3d, theParameters.back(), l);
            if ( vertexLength < L / 2.0 )
              theParameters.push_back( Discret.Parameter());
            else
              compensateError(0, vertexLength, f, l, theLength, theC3d, theParameters, true );
          }
        }
      }
      else
      {
        // recompute params between the last segment and a middle one.
        // find size of a middle segment
        int nHalf = ( nPar-1 ) / 2;
        list< double >::reverse_iterator itU = theParameters.rbegin();
        std::advance( itU, nHalf );
        double Um = *itU++;
        double Lm = GCPnts_AbscissaPoint::Length( theC3d, Um, *itU);
        double L = GCPnts_AbscissaPoint::Length( theC3d, *itU, l);
        StdMeshers_Regular_1D algo( *this );
        algo._hypType = BEG_END_LENGTH;
        algo._value[ BEG_LENGTH_IND ] = Lm;
        algo._value[ END_LENGTH_IND ] = vertexLength;
        double from = *itU, to = l;
        if ( isEnd1 ) {
          std::swap( from, to );
          std::swap( algo._value[ BEG_LENGTH_IND ], algo._value[ END_LENGTH_IND ]);
        }
        list<double> params;
        if ( algo.computeInternalParameters( theMesh, theC3d, L, from, to, params, false ))
        {
          if ( isEnd1 ) params.reverse();
          while ( 1 + nHalf-- )
            theParameters.pop_back();
          theParameters.splice( theParameters.end(), params );
        }
        else
        {
          compensateError(0, vertexLength, f, l, theLength, theC3d, theParameters, true );
        }
      }
      if ( isEnd1 )
        theParameters.reverse();
    }
  }
}
virtual std::ostream& SMESH_Algo.SaveTo ( std::ostream &  save) [virtual, inherited]

Saves nothing in a stream.

Parameters:
save- the stream
Return values:
std.ostream& - the stream
virtual void StdMeshers_CompositeSegment_1D.SetEventListener ( SMESH_subMesh subMesh) [virtual]

Sets event listener to submeshes if necessary.

Parameters:
subMesh- submesh where algo is set

This method is called when a submesh gets HYP_OK algo_state. After being set, event listener is notified on each event of a submesh.

Reimplemented from StdMeshers_Regular_1D.

virtual bool SMESH_Algo.SetParametersByDefaults ( const TDefaults &  dflts,
const SMESH_Mesh theMesh = 0 
) [virtual, inherited]
virtual bool SMESH_Algo.SetParametersByMesh ( const SMESH_Mesh theMesh,
const TopoDS_Shape &  theShape 
) [virtual, inherited]

Just return false as the algorithm does not hold parameters values.

void StdMeshers_Regular_1D::SubmeshRestored ( SMESH_subMesh subMesh) [virtual, inherited]

Allow algo to do something after persistent restoration.

Do nothing.

Parameters:
subMesh- restored submesh

This method is called only if a submesh has HYP_OK algo_state.

Parameters:
subMesh- restored submesh

call markEdgeAsComputedByMe()

Reimplemented from SMESH_Algo.

Definition at line 580 of file SMESH_Algo.cxx.

{
}
bool SMESH_Algo.SupportSubmeshes ( ) const [inherited]

Definition at line 228 of file SMESH_Algo.hxx.

{ return _supportSubmeshes; }
const SMDS_MeshNode * SMESH_Algo::VertexNode ( const TopoDS_Vertex &  V,
const SMESHDS_Mesh meshDS 
) [static, inherited]

Return the node built on a vertex.

Parameters:
V- the vertex
meshDS- mesh
Return values:
constSMDS_MeshNode* - found node or NULL

Definition at line 531 of file SMESH_Algo.cxx.

References SMESHDS_Mesh.MeshElements().

Referenced by SMESH.SMESH_Gen.Compute(), StdMeshers_ProjectionUtils.FindMatchingNodesOnFaces(), StdMeshers_FaceSide.GetFaceWires(), and StdMeshers_FaceSide.GetUVPtStruct().

{
  if ( SMESHDS_SubMesh* sm = meshDS->MeshElements(V) ) {
    SMDS_NodeIteratorPtr nIt= sm->GetNodes();
    if (nIt->more())
      return nIt->next();
  }
  return 0;
}

Field Documentation

std::list<const SMESHDS_Hypothesis *> SMESH_Algo._appliedHypList [protected, inherited]

Definition at line 356 of file SMESH_Algo.hxx.

std::list<const SMDS_MeshElement*> SMESH_Algo._badInputElements [protected, inherited]

to explain COMPERR_BAD_INPUT_MESH

Definition at line 373 of file SMESH_Algo.hxx.

std::string SMESH_Algo._comment [protected, inherited]

any text explaining what is wrong in Compute()

Definition at line 372 of file SMESH_Algo.hxx.

std::vector<std::string> SMESH_Algo._compatibleHypothesis [protected, inherited]
int SMESH_Algo._error [protected, inherited]

SMESH_ComputeErrorName or anything algo specific.

Definition at line 371 of file SMESH_Algo.hxx.

Referenced by SMESH_Algo.SMESH_Algo().

Definition at line 65 of file StdMeshers_CompositeSegment_1D.hxx.

Referenced by StdMeshers_CompositeSegment_1D().

Definition at line 127 of file StdMeshers_Regular_1D.hxx.

int StdMeshers_Regular_1D._ivalue[3] [protected, inherited]

Definition at line 132 of file StdMeshers_Regular_1D.hxx.

TopoDS_Shape StdMeshers_Regular_1D._mainEdge [protected, inherited]

Definition at line 139 of file StdMeshers_Regular_1D.hxx.

bool SMESH_Algo._onlyUnaryInput [protected, inherited]

Definition at line 362 of file SMESH_Algo.hxx.

Referenced by SMESH_Algo.SMESH_Algo().

bool SMESH_Algo._quadraticMesh [protected, inherited]
bool SMESH_Algo._requireDescretBoundary [protected, inherited]
bool SMESH_Algo._requireShape [protected, inherited]

Definition at line 364 of file SMESH_Algo.hxx.

Referenced by SMESH_Algo.SMESH_Algo(), and StdMeshers_Hexa_3D.StdMeshers_Hexa_3D().

std::vector<int> StdMeshers_Regular_1D._revEdgesIDs [protected, inherited]

Definition at line 135 of file StdMeshers_Regular_1D.hxx.

bool SMESH_Algo._supportSubmeshes [protected, inherited]
std::string StdMeshers_Regular_1D._svalue[1] [protected, inherited]

Definition at line 134 of file StdMeshers_Regular_1D.hxx.

std::list<const SMESHDS_Hypothesis *> SMESH_Algo._usedHypList [protected, inherited]

Definition at line 357 of file SMESH_Algo.hxx.

double StdMeshers_Regular_1D._value[2] [protected, inherited]

Definition at line 131 of file StdMeshers_Regular_1D.hxx.

std::vector<double> StdMeshers_Regular_1D._vvalue[1] [protected, inherited]

Definition at line 133 of file StdMeshers_Regular_1D.hxx.

Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS