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

SMESH.Controls.MultiConnection2D Class Reference

#include <SMESH_ControlsDef.hxx>

Inheritance diagram for SMESH.Controls.MultiConnection2D:
Inheritance graph
[legend]

Data Structures

struct  Value

Public Types

typedef std::map< Value, intMValues

Public Member Functions

virtual double GetValue (long theElementId)
virtual double GetValue (const TSequenceOfXYZ &thePoints)
virtual double GetBadRate (double Value, int nbNodes) const
virtual SMDSAbs_ElementType GetType () const
void GetValues (MValues &theValues)
virtual void SetMesh (const SMDS_Mesh *theMesh)
void GetHistogram (int nbIntervals, std::vector< int > &nbEvents, std::vector< double > &funValues, const std::vector< int > &elements, const double *minmax=0)
long GetPrecision () const
void SetPrecision (const long thePrecision)
double Round (const double &value)
bool GetPoints (const int theId, TSequenceOfXYZ &theRes) const

Static Public Member Functions

static bool GetPoints (const SMDS_MeshElement *theElem, TSequenceOfXYZ &theRes)

Protected Attributes

const SMDS_MeshmyMesh
const SMDS_MeshElementmyCurrElement
long myPrecision
double myPrecisionValue

Detailed Description

Definition at line 325 of file SMESH_ControlsDef.hxx.


Member Typedef Documentation

Definition at line 336 of file SMESH_ControlsDef.hxx.


Member Function Documentation

double MultiConnection2D::GetBadRate ( double  Value,
int  nbNodes 
) const [virtual]

Implements SMESH.Controls.NumericalFunctor.

Definition at line 1842 of file SMESH_Controls.cxx.

{
  // meaningless as it is not quality control functor
  return Value;
}
void SMESH.Controls.NumericalFunctor.GetHistogram ( int  nbIntervals,
std::vector< int > &  nbEvents,
std::vector< double > &  funValues,
const std::vector< int > &  elements,
const double *  minmax = 0 
) [inherited]

Referenced by SaveDistribution().

bool NumericalFunctor::GetPoints ( const int  theId,
TSequenceOfXYZ theRes 
) const [inherited]
bool NumericalFunctor::GetPoints ( const SMDS_MeshElement theElem,
TSequenceOfXYZ theRes 
) [static, inherited]

Definition at line 239 of file SMESH_Controls.cxx.

References SMESH.Controls.TSequenceOfXYZ.clear(), SMDS_MeshElement.GetType(), SMDS_MeshElement.IsQuadratic(), SMDS_MeshElement.NbNodes(), SMDS_MeshElement.nodesIterator(), SMESH.Controls.TSequenceOfXYZ.push_back(), SMESH.Controls.TSequenceOfXYZ.reserve(), SMDSAbs_Edge, SMDSAbs_Face, SMDS_MeshNode.X(), SMDS_MeshNode.Y(), and SMDS_MeshNode.Z().

{
  theRes.clear();

  if ( anElem == 0)
    return false;

  theRes.reserve( anElem->NbNodes() );

  // Get nodes of the element
  SMDS_ElemIteratorPtr anIter;

  if ( anElem->IsQuadratic() ) {
    switch ( anElem->GetType() ) {
    case SMDSAbs_Edge:
      anIter = dynamic_cast<const SMDS_VtkEdge*>
        (anElem)->interlacedNodesElemIterator();
      break;
    case SMDSAbs_Face:
      anIter = dynamic_cast<const SMDS_VtkFace*>
        (anElem)->interlacedNodesElemIterator();
      break;
    default:
      anIter = anElem->nodesIterator();
      //return false;
    }
  }
  else {
    anIter = anElem->nodesIterator();
  }

  if ( anIter ) {
    while( anIter->more() ) {
      if ( const SMDS_MeshNode* aNode = static_cast<const SMDS_MeshNode*>( anIter->next() ))
        theRes.push_back( gp_XYZ( aNode->X(), aNode->Y(), aNode->Z() ) );
    }
  }

  return true;
}
long NumericalFunctor::GetPrecision ( ) const [inherited]

Definition at line 281 of file SMESH_Controls.cxx.

References SMESH.Controls.NumericalFunctor.myPrecision.

{
  return myPrecision;
}
SMDSAbs_ElementType MultiConnection2D::GetType ( ) const [virtual]

Implements SMESH.Controls.NumericalFunctor.

Definition at line 1848 of file SMESH_Controls.cxx.

References SMDSAbs_Face.

{
  return SMDSAbs_Face;
}
double MultiConnection2D::GetValue ( const TSequenceOfXYZ thePoints) [virtual]

Reimplemented from SMESH.Controls.NumericalFunctor.

Definition at line 1781 of file SMESH_Controls.cxx.

{
  return 0;
}
double MultiConnection2D::GetValue ( long  theElementId) [virtual]

Reimplemented from SMESH.Controls.NumericalFunctor.

Definition at line 1786 of file SMESH_Controls.cxx.

References SMDS_Mesh.FindElement(), SMDS_MeshElement.GetID(), SMDS_MeshNode.GetInverseElementIterator(), SMDS_MeshElement.GetType(), Max(), SMESH.Controls.NumericalFunctor.myMesh, SMDS_MeshElement.NbNodes(), SMDS_MeshElement.nodesIterator(), and SMDSAbs_Face.

{
  int aResult = 0;

  const SMDS_MeshElement* aFaceElem = myMesh->FindElement(theElementId);
  SMDSAbs_ElementType aType = aFaceElem->GetType();

  switch (aType) {
  case SMDSAbs_Face:
    {
      int i = 0, len = aFaceElem->NbNodes();
      SMDS_ElemIteratorPtr anIter = aFaceElem->nodesIterator();
      if (!anIter) break;

      const SMDS_MeshNode *aNode, *aNode0;
      TColStd_MapOfInteger aMap, aMapPrev;

      for (i = 0; i <= len; i++) {
        aMapPrev = aMap;
        aMap.Clear();

        int aNb = 0;
        if (anIter->more()) {
          aNode = (SMDS_MeshNode*)anIter->next();
        } else {
          if (i == len)
            aNode = aNode0;
          else
            break;
        }
        if (!aNode) break;
        if (i == 0) aNode0 = aNode;

        SMDS_ElemIteratorPtr anElemIter = aNode->GetInverseElementIterator();
        while (anElemIter->more()) {
          const SMDS_MeshElement* anElem = anElemIter->next();
          if (anElem != 0 && anElem->GetType() == SMDSAbs_Face) {
            int anId = anElem->GetID();

            aMap.Add(anId);
            if (aMapPrev.Contains(anId)) {
              aNb++;
            }
          }
        }
        aResult = Max(aResult, aNb);
      }
    }
    break;
  default:
    aResult = 0;
  }

  return aResult;
}
void MultiConnection2D::GetValues ( MValues theValues)

Definition at line 1868 of file SMESH_Controls.cxx.

References SMDS_Mesh.facesIterator(), SMDS_MeshElement.GetID(), SMDS_MeshElement.interlacedNodesElemIterator(), SMDS_MeshElement.IsQuadratic(), SMESH.Controls.NumericalFunctor.myMesh, and SMDS_MeshElement.nodesIterator().

                                                   {
  SMDS_FaceIteratorPtr anIter = myMesh->facesIterator();
  for(; anIter->more(); ){
    const SMDS_MeshFace* anElem = anIter->next();
    SMDS_ElemIteratorPtr aNodesIter;
    if ( anElem->IsQuadratic() )
      aNodesIter = dynamic_cast<const SMDS_VtkFace*>
        (anElem)->interlacedNodesElemIterator();
    else
      aNodesIter = anElem->nodesIterator();
    long aNodeId[3];

    //int aNbConnects=0;
    const SMDS_MeshNode* aNode0;
    const SMDS_MeshNode* aNode1;
    const SMDS_MeshNode* aNode2;
    if(aNodesIter->more()){
      aNode0 = (SMDS_MeshNode*) aNodesIter->next();
      aNode1 = aNode0;
      const SMDS_MeshNode* aNodes = (SMDS_MeshNode*) aNode1;
      aNodeId[0] = aNodeId[1] = aNodes->GetID();
    }
    for(; aNodesIter->more(); ) {
      aNode2 = (SMDS_MeshNode*) aNodesIter->next();
      long anId = aNode2->GetID();
      aNodeId[2] = anId;

      Value aValue(aNodeId[1],aNodeId[2]);
      MValues::iterator aItr = theValues.find(aValue);
      if (aItr != theValues.end()){
        aItr->second += 1;
        //aNbConnects = nb;
      }
      else {
        theValues[aValue] = 1;
        //aNbConnects = 1;
      }
      //cout << "NodeIds: "<<aNodeId[1]<<","<<aNodeId[2]<<" nbconn="<<aNbConnects<<endl;
      aNodeId[1] = aNodeId[2];
      aNode1 = aNode2;
    }
    Value aValue(aNodeId[0],aNodeId[2]);
    MValues::iterator aItr = theValues.find(aValue);
    if (aItr != theValues.end()) {
      aItr->second += 1;
      //aNbConnects = nb;
    }
    else {
      theValues[aValue] = 1;
      //aNbConnects = 1;
    }
    //cout << "NodeIds: "<<aNodeId[0]<<","<<aNodeId[2]<<" nbconn="<<aNbConnects<<endl;
  }

}
double NumericalFunctor::Round ( const double &  value) [inherited]
void NumericalFunctor::SetMesh ( const SMDS_Mesh theMesh) [virtual, inherited]

Implements SMESH.Controls.Functor.

Definition at line 223 of file SMESH_Controls.cxx.

References SMESH.Controls.NumericalFunctor.myMesh.

{
  myMesh = theMesh;
}
void NumericalFunctor::SetPrecision ( const long  thePrecision) [inherited]

Field Documentation

const SMDS_Mesh* SMESH.Controls.NumericalFunctor.myMesh [protected, inherited]
long SMESH.Controls.NumericalFunctor.myPrecision [protected, inherited]
double SMESH.Controls.NumericalFunctor.myPrecisionValue [protected, inherited]
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