X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESH_I%2FSMESH_Measurements_i.cxx;h=f81c0573b65f65c2c9acd0841956b550ef89b23d;hb=705ff2e64ca884a8b62d28974fd63a9f15772cb2;hp=4d573980aae364244c42ad3147a8e4e9722dc5ae;hpb=09bc0414c91ebabb67c7fe200549044a1854e199;p=modules%2Fsmesh.git diff --git a/src/SMESH_I/SMESH_Measurements_i.cxx b/src/SMESH_I/SMESH_Measurements_i.cxx index 4d573980a..f81c0573b 100644 --- a/src/SMESH_I/SMESH_Measurements_i.cxx +++ b/src/SMESH_I/SMESH_Measurements_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -151,7 +151,8 @@ static SMESHDS_Mesh* getMesh(SMESH::SMESH_IDSource_ptr theSource) { if (!CORBA::is_nil( theSource )) { - SMESH_Mesh_i* anImplPtr = DownCast(theSource->GetMesh()); + SMESH::SMESH_Mesh_var mesh = theSource->GetMesh(); + SMESH_Mesh_i* anImplPtr = DownCast( mesh ); if (anImplPtr) return anImplPtr->GetImpl().GetMeshDS(); } @@ -173,7 +174,7 @@ static double getNumericalValue(SMESH::SMESH_IDSource_ptr theSource, if ( aMesh ) { theFunctor->SetMesh( aMesh ); - SMESH::long_array_var anElementsId = theSource->GetIDs(); + SMESH::smIdType_array_var anElementsId = theSource->GetIDs(); for ( CORBA::ULong i = 0; i < anElementsId->length(); i++) { value += theFunctor->GetValue( anElementsId[i] ); } @@ -208,8 +209,8 @@ SMESH::Measure Measurements_i::MinDistance bool isNode1 = isNodeType(types1); bool isNode2 = isOrigin || isNodeType(types2); - SMESH::long_array_var aElementsId1 = theSource1->GetIDs(); - SMESH::long_array_var aElementsId2; + SMESH::smIdType_array_var aElementsId1 = theSource1->GetIDs(); + SMESH::smIdType_array_var aElementsId2; // compute distance between two entities /* NOTE: currently only node-to-node case is implemented @@ -287,19 +288,28 @@ static void enlargeBoundingBox(const SMESH::SMESH_IDSource_ptr theObject, 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 ( DownCast( theObject )) // theObject is mesh { - if (isNode) - enlargeBoundingBox( aMesh->FindNode( aElementsId[i] ), theMeasure); - else + for (SMDS_NodeIteratorPtr aNodeIter = aMesh->nodesIterator(); aNodeIter->more(); ) + enlargeBoundingBox( aNodeIter->next(), theMeasure); + } + else + { + SMESH::array_of_ElementType_var types = theObject->GetTypes(); + SMESH::smIdType_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 ( const SMDS_MeshElement* elem = aMesh->FindElement( aElementsId[i] )) - for (SMDS_NodeIteratorPtr aNodeIter = elem->nodeIterator(); aNodeIter->more(); ) - enlargeBoundingBox( aNodeIter->next(), theMeasure); + if (isNode) + enlargeBoundingBox( aMesh->FindNode( aElementsId[i] ), theMeasure); + else + { + if ( const SMDS_MeshElement* elem = aMesh->FindElement( aElementsId[i] )) + for (SMDS_NodeIteratorPtr aNodeIter = elem->nodeIterator(); aNodeIter->more(); ) + enlargeBoundingBox( aNodeIter->next(), theMeasure); + } } } }