#include "SMESH_Measurements_i.hxx"#include "SMESH_Gen_i.hxx"#include "SMESH_PythonDump.hxx"#include "SMDS_Mesh.hxx"#include "SMDS_MeshNode.hxx"#include "SMDS_MeshElement.hxx"#include "SMDS_ElemIterator.hxx"#include "SMESHDS_Mesh.hxx"
Go to the source code of this file.
Functions | |
| static void | initMeasure (SMESH::Measure &theMeasure) |
| this local function to avoid uninitialized fields | |
| static bool | getNodeNodeDistance (SMESH::Measure &theMeasure, const SMDS_MeshNode *theNode1, const SMDS_MeshNode *theNode2=0) |
| static SMESHDS_Mesh * | getMesh (SMESH::SMESH_IDSource_ptr theSource) |
| static bool | isNodeType (SMESH::array_of_ElementType_var theTypes) |
| static void | enlargeBoundingBox (const SMDS_MeshNode *theNode, SMESH::Measure &theMeasure) |
| static void | enlargeBoundingBox (const SMESH::SMESH_IDSource_ptr theObject, SMESH::Measure &theMeasure) |
| static void enlargeBoundingBox | ( | const SMDS_MeshNode * | theNode, |
| SMESH::Measure & | theMeasure | ||
| ) | [static] |
Definition at line 191 of file SMESH_Measurements_i.cxx.
References SMDS_MeshElement.GetID(), SMESH.Measure.maxX, SMESH.Measure.maxY, SMESH.Measure.maxZ, SMESH.Measure.minX, SMESH.Measure.minY, SMESH.Measure.minZ, SMESH.Measure.node1, SMDS_MeshNode.X(), SMDS_MeshNode.Y(), and SMDS_MeshNode.Z().
Referenced by SMESH.Measurements_i.BoundingBox(), and enlargeBoundingBox().
{
if (!theNode)
return;
if ( theMeasure.node1 == -1 ) {
// we use this attribute as a flag that it is the first node added to the bnd box
theMeasure.minX = theMeasure.maxX = theNode->X();
theMeasure.minY = theMeasure.maxY = theNode->Y();
theMeasure.minZ = theMeasure.maxZ = theNode->Z();
theMeasure.node1 = theNode->GetID();
}
else {
theMeasure.minX = min( theMeasure.minX, theNode->X() );
theMeasure.maxX = max( theMeasure.maxX, theNode->X() );
theMeasure.minY = min( theMeasure.minY, theNode->Y() );
theMeasure.maxY = max( theMeasure.maxY, theNode->Y() );
theMeasure.minZ = min( theMeasure.minZ, theNode->Z() );
theMeasure.maxZ = max( theMeasure.maxZ, theNode->Z() );
}
}
| static void enlargeBoundingBox | ( | const SMESH::SMESH_IDSource_ptr | theObject, |
| SMESH::Measure & | theMeasure | ||
| ) | [static] |
Definition at line 217 of file SMESH_Measurements_i.cxx.
References enlargeBoundingBox(), SMDS_Mesh.FindElement(), SMDS_Mesh.FindNode(), getMesh(), isNodeType(), and SMDS_MeshElement.nodesIterator().
{
if ( CORBA::is_nil( theObject ) )
return;
const SMESHDS_Mesh* aMesh = getMesh( theObject );
if ( !aMesh )
return;
SMESH::array_of_ElementType_var types = theObject->GetTypes();
SMESH::long_array_var aElementsId = theObject->GetIDs();
// here we assume that type of all IDs defined by first type in array
const bool isNode = isNodeType( types );
for(int i = 0, n = aElementsId->length(); i < n; i++)
{
if (isNode)
enlargeBoundingBox( aMesh->FindNode( aElementsId[i] ), theMeasure);
else
{
const SMDS_MeshElement* elem = aMesh->FindElement( aElementsId[i] );
if (!elem)
continue;
SMDS_ElemIteratorPtr aNodeIter = elem->nodesIterator();
while( aNodeIter->more() )
enlargeBoundingBox( dynamic_cast<const SMDS_MeshNode*>( aNodeIter->next() ), theMeasure);
}
}
}
| static SMESHDS_Mesh* getMesh | ( | SMESH::SMESH_IDSource_ptr | theSource | ) | [static] |
Definition at line 118 of file SMESH_Measurements_i.cxx.
References SMESH_Mesh_i.GetImpl().
Referenced by enlargeBoundingBox(), and SMESH.Measurements_i.MinDistance().
{
if (!CORBA::is_nil( theSource ))
{
SMESH_Mesh_i* anImplPtr = DownCast<SMESH_Mesh_i*>(theSource->GetMesh());
if (anImplPtr)
return anImplPtr->GetImpl().GetMeshDS();
}
return 0;
}
| static bool getNodeNodeDistance | ( | SMESH::Measure & | theMeasure, |
| const SMDS_MeshNode * | theNode1, | ||
| const SMDS_MeshNode * | theNode2 = 0 |
||
| ) | [static] |
Definition at line 95 of file SMESH_Measurements_i.cxx.
References SMDS_MeshElement.GetID(), SMESH.Measure.minX, SMESH.Measure.minY, SMESH.Measure.minZ, SMESH.Measure.node1, SMESH.Measure.node2, SMESH.Measure.value, SMDS_MeshNode.X(), SMDS_MeshNode.Y(), and SMDS_MeshNode.Z().
Referenced by SMESH.Measurements_i.MinDistance().
{
double dist = 0., dd = 0.;
if (!theNode1)
return false;
dd = theNode1->X(); if (theNode2) dd -= theNode2->X(); theMeasure.minX = dd; dd *= dd; dist += dd;
dd = theNode1->Y(); if (theNode2) dd -= theNode2->Y(); theMeasure.minY = dd; dd *= dd; dist += dd;
dd = theNode1->Z(); if (theNode2) dd -= theNode2->Z(); theMeasure.minZ = dd; dd *= dd; dist += dd;
if (dist < 0)
return false;
theMeasure.value = sqrt(dist);
theMeasure.node1 = theNode1->GetID();
theMeasure.node2 = theNode2 ? theNode2->GetID() : 0;
return true;
}
| static void initMeasure | ( | SMESH::Measure & | theMeasure | ) | [static] |
this local function to avoid uninitialized fields
Definition at line 43 of file SMESH_Measurements_i.cxx.
References SMESH.Measure.elem1, SMESH.Measure.elem2, SMESH.Measure.maxX, SMESH.Measure.maxY, SMESH.Measure.maxZ, SMESH.Measure.minX, SMESH.Measure.minY, SMESH.Measure.minZ, SMESH.Measure.node1, SMESH.Measure.node2, and SMESH.Measure.value.
Referenced by SMESH.Measurements_i.BoundingBox(), and SMESH.Measurements_i.MinDistance().
| static bool isNodeType | ( | SMESH::array_of_ElementType_var | theTypes | ) | [static] |
Definition at line 129 of file SMESH_Measurements_i.cxx.
References SMESH.NODE.
Referenced by enlargeBoundingBox(), and SMESH.Measurements_i.MinDistance().
{
return theTypes->length() > 0 && theTypes[0] == SMESH::NODE;
}