Back to index

salome-smesh  6.5.0
Classes | Public Types | Public Member Functions
SMESH::Length2D Interface Reference

import "SMESH_Filter.idl";

Inheritance diagram for SMESH::Length2D:
Inheritance graph
[legend]
Collaboration diagram for SMESH::Length2D:
Collaboration graph
[legend]

List of all members.

Classes

struct  Value

Public Types

typedef sequence< ValueValues

Public Member Functions

Values GetValues ()
double GetValue (in long theElementId)
Histogram GetHistogram (in short nbIntervals)
 Return histogram of functor values.
void SetPrecision (in long thePrecision)
 Set precision for calculation.
long GetPrecision ()
void SetMesh (in SMESH_Mesh theMesh)
FunctorType GetFunctorType ()
ElementType GetElementType ()

Detailed Description

Definition at line 137 of file SMESH_Filter.idl.


Class Documentation

struct SMESH::Length2D::Value

Definition at line 139 of file SMESH_Filter.idl.

Class Members
double myLength
long myPnt1
long myPnt2

Member Typedef Documentation

typedef sequence<Value> SMESH::Length2D::Values

Definition at line 144 of file SMESH_Filter.idl.


Member Function Documentation

Here is the caller graph for this function:

void NumericalFunctor::GetHistogram ( in short  nbIntervals) [inherited]

Return histogram of functor values.

Parameters:
nbIntervals- number of intervals
nbEvents- number of mesh elements having values within i-th interval
funValues- boundaries of intervals
elements- elements to check vulue of; empty list means "of all"
minmax- boundaries of diapason of values to divide into intervals

Definition at line 323 of file SMESH_Controls.cxx.

{
  if ( nbIntervals < 1 ||
       !myMesh ||
       !myMesh->GetMeshInfo().NbElements( GetType() ))
    return;
  nbEvents.resize( nbIntervals, 0 );
  funValues.resize( nbIntervals+1 );

  // get all values sorted
  std::multiset< double > values;
  if ( elements.empty() )
  {
    SMDS_ElemIteratorPtr elemIt = myMesh->elementsIterator(GetType());
    while ( elemIt->more() )
      values.insert( GetValue( elemIt->next()->GetID() ));
  }
  else
  {
    vector<int>::const_iterator id = elements.begin();
    for ( ; id != elements.end(); ++id )
      values.insert( GetValue( *id ));
  }

  if ( minmax )
  {
    funValues[0] = minmax[0];
    funValues[nbIntervals] = minmax[1];
  }
  else
  {
    funValues[0] = *values.begin();
    funValues[nbIntervals] = *values.rbegin();
  }
  // case nbIntervals == 1
  if ( nbIntervals == 1 )
  {
    nbEvents[0] = values.size();
    return;
  }
  // case of 1 value
  if (funValues.front() == funValues.back())
  {
    nbEvents.resize( 1 );
    nbEvents[0] = values.size();
    funValues[1] = funValues.back();
    funValues.resize( 2 );
  }
  // generic case
  std::multiset< double >::iterator min = values.begin(), max;
  for ( int i = 0; i < nbIntervals; ++i )
  {
    // find end value of i-th interval
    double r = (i+1) / double( nbIntervals );
    funValues[i+1] = funValues.front() * (1-r) + funValues.back() * r;

    // count values in the i-th interval if there are any
    if ( min != values.end() && *min <= funValues[i+1] )
    {
      // find the first value out of the interval
      max = values.upper_bound( funValues[i+1] ); // max is greater than funValues[i+1], or end()
      nbEvents[i] = std::distance( min, max );
      min = max;
    }
  }
  // add values larger than minmax[1]
  nbEvents.back() += std::distance( min, values.end() );
}

Here is the call graph for this function:

long NumericalFunctor::GetPrecision ( ) [inherited]

Definition at line 283 of file SMESH_Controls.cxx.

{
  return myPrecision;
}
double NumericalFunctor::GetValue ( in long  theElementId) [inherited]

Definition at line 294 of file SMESH_Controls.cxx.

{
  double aVal = 0;

  myCurrElement = myMesh->FindElement( theId );

  TSequenceOfXYZ P;
  if ( GetPoints( theId, P ))
    aVal = Round( GetValue( P ));

  return aVal;
}

Here is the caller graph for this function:

Definition at line 1695 of file SMESH_Controls.cxx.

                                          {
  TValues aValues;
  SMDS_FaceIteratorPtr anIter = myMesh->facesIterator();
  for(; anIter->more(); ){
    const SMDS_MeshFace* anElem = anIter->next();

    if(anElem->IsQuadratic()) {
      const SMDS_VtkFace* F =
        dynamic_cast<const SMDS_VtkFace*>(anElem);
      // use special nodes iterator
      SMDS_ElemIteratorPtr anIter = F->interlacedNodesElemIterator();
      long aNodeId[4];
      gp_Pnt P[4];

      double aLength;
      const SMDS_MeshElement* aNode;
      if(anIter->more()){
        aNode = anIter->next();
        const SMDS_MeshNode* aNodes = (SMDS_MeshNode*) aNode;
        P[0] = P[1] = gp_Pnt(aNodes->X(),aNodes->Y(),aNodes->Z());
        aNodeId[0] = aNodeId[1] = aNode->GetID();
        aLength = 0;
      }
      for(; anIter->more(); ){
        const SMDS_MeshNode* N1 = static_cast<const SMDS_MeshNode*> (anIter->next());
        P[2] = gp_Pnt(N1->X(),N1->Y(),N1->Z());
        aNodeId[2] = N1->GetID();
        aLength = P[1].Distance(P[2]);
        if(!anIter->more()) break;
        const SMDS_MeshNode* N2 = static_cast<const SMDS_MeshNode*> (anIter->next());
        P[3] = gp_Pnt(N2->X(),N2->Y(),N2->Z());
        aNodeId[3] = N2->GetID();
        aLength += P[2].Distance(P[3]);
        Value aValue1(aLength,aNodeId[1],aNodeId[2]);
        Value aValue2(aLength,aNodeId[2],aNodeId[3]);
        P[1] = P[3];
        aNodeId[1] = aNodeId[3];
        theValues.insert(aValue1);
        theValues.insert(aValue2);
      }
      aLength += P[2].Distance(P[0]);
      Value aValue1(aLength,aNodeId[1],aNodeId[2]);
      Value aValue2(aLength,aNodeId[2],aNodeId[0]);
      theValues.insert(aValue1);
      theValues.insert(aValue2);
    }
    else {
      SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
      long aNodeId[2];
      gp_Pnt P[3];

      double aLength;
      const SMDS_MeshElement* aNode;
      if(aNodesIter->more()){
        aNode = aNodesIter->next();
        const SMDS_MeshNode* aNodes = (SMDS_MeshNode*) aNode;
        P[0] = P[1] = gp_Pnt(aNodes->X(),aNodes->Y(),aNodes->Z());
        aNodeId[0] = aNodeId[1] = aNode->GetID();
        aLength = 0;
      }
      for(; aNodesIter->more(); ){
        aNode = aNodesIter->next();
        const SMDS_MeshNode* aNodes = (SMDS_MeshNode*) aNode;
        long anId = aNode->GetID();
        
        P[2] = gp_Pnt(aNodes->X(),aNodes->Y(),aNodes->Z());
        
        aLength = P[1].Distance(P[2]);
        
        Value aValue(aLength,aNodeId[1],anId);
        aNodeId[1] = anId;
        P[1] = P[2];
        theValues.insert(aValue);
      }

      aLength = P[0].Distance(P[1]);

      Value aValue(aLength,aNodeId[0],aNodeId[1]);
      theValues.insert(aValue);
    }
  }
}
void SMESH::Functor::SetMesh ( in SMESH_Mesh  theMesh) [inherited]
void NumericalFunctor::SetPrecision ( in long  thePrecision) [inherited]

Set precision for calculation.

It is a position after point which is used to functor value after calculation.

Definition at line 288 of file SMESH_Controls.cxx.

{
  myPrecision = thePrecision;
  myPrecisionValue = pow( 10., (double)( myPrecision ) );
}

The documentation for this interface was generated from the following files: