Version: 6.3.1
Public Member Functions

SMESH.Measurements_i Class Reference

#include <SMESH_Measurements_i.hxx>

Inheritance diagram for SMESH.Measurements_i:
Inheritance graph
[legend]

Public Member Functions

 Measurements_i ()
 ~Measurements_i ()
SMESH::Measure MinDistance (SMESH::SMESH_IDSource_ptr theSource1, SMESH::SMESH_IDSource_ptr theSource2)
 minimal distance between two given entities
SMESH::Measure BoundingBox (const SMESH::ListOfIDSources &theSources)
 common bounding box of entities

Detailed Description

Definition at line 43 of file SMESH_Measurements_i.hxx.


Constructor & Destructor Documentation

Measurements_i::Measurements_i ( )

Definition at line 78 of file SMESH_Measurements_i.cxx.

: SALOME::GenericObj_i( SMESH_Gen_i::GetPOA() )
{
  //Base class Salome_GenericObject do it inmplicitly by overriding PortableServer::POA_ptr _default_POA() method
  //PortableServer::ObjectId_var anObjectId =
  //  SMESH_Gen_i::GetPOA()->activate_object( this );
}
Measurements_i::~Measurements_i ( )

Definition at line 90 of file SMESH_Measurements_i.cxx.

{
  //TPythonDump()<<this<<".UnRegister()";
}

Member Function Documentation

SMESH::Measure Measurements_i::BoundingBox ( const SMESH::ListOfIDSources theSources)

common bounding box of entities

Definition at line 249 of file SMESH_Measurements_i.cxx.

References enlargeBoundingBox(), and initMeasure().

{
  SMESH::Measure aMeasure;
  initMeasure(aMeasure);

  // calculate bounding box on sources
  for ( int i = 0, n = theSources.length(); i < n ; ++i )
    enlargeBoundingBox( theSources[i], aMeasure );

  return aMeasure;
}
SMESH::Measure Measurements_i::MinDistance ( SMESH::SMESH_IDSource_ptr  theSource1,
SMESH::SMESH_IDSource_ptr  theSource2 
)

minimal distance between two given entities

Definition at line 139 of file SMESH_Measurements_i.cxx.

References SMDS_Mesh.FindNode(), getMesh(), getNodeNodeDistance(), initMeasure(), and isNodeType().

{
  SMESH::Measure aMeasure;
  initMeasure(aMeasure);

  if (CORBA::is_nil( theSource1 ))
    return aMeasure;
  
  // if second source is null, min distance from theSource1 to the origin is calculated
  bool isOrigin =  CORBA::is_nil( theSource2 );

  // calculate minimal distance between two mesh entities
  SMESH::array_of_ElementType_var types1 = theSource1->GetTypes();
  SMESH::array_of_ElementType_var types2;
  if ( !isOrigin ) types2 = theSource2->GetTypes();

  // here we assume that type of all IDs defined by first type in array
  bool isNode1 = isNodeType(types1);
  bool isNode2 = isOrigin || isNodeType(types2);

  SMESH::long_array_var aElementsId1 = theSource1->GetIDs();
  SMESH::long_array_var aElementsId2;
  if ( !isOrigin ) aElementsId2 = theSource2->GetIDs();

  // compute distance between two entities
  /* NOTE: currently only node-to-node case is implemented
   * all other cases will be implemented later
   * below IF should be replaced by complete switch
   * on mesh entities types
   */
  if (isNode1 && isNode2)
  {
    // node - node
    const SMESHDS_Mesh* aMesh1 = getMesh( theSource1 );
    const SMESHDS_Mesh* aMesh2 = isOrigin ? 0 : getMesh( theSource2 );
    const SMDS_MeshNode* theNode1 = aMesh1 ? aMesh1->FindNode( aElementsId1[0] ) : 0;
    const SMDS_MeshNode* theNode2 = aMesh2 ? aMesh2->FindNode( aElementsId2[0] ) : 0;
    getNodeNodeDistance( aMeasure, theNode1, theNode2 );
  }
  else
  {
    // NOT_IMPLEMENTED
  }

  return aMeasure;
}
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