From: eap Date: Thu, 19 Jul 2012 13:18:27 +0000 (+0000) Subject: 0021459: EDF 1495 SMESH: Manipulation of discrete elements with attributes X-Git-Tag: V6_6_0a1~245 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=232eb75e7692561fe712a4f6fd52c8930cac0e37;p=modules%2Fsmesh.git 0021459: EDF 1495 SMESH: Manipulation of discrete elements with attributes + inline void AddBallsWithID(SMDS_Mesh* theMesh, --- diff --git a/src/SMESHClient/SMESH_Client.cxx b/src/SMESHClient/SMESH_Client.cxx index df14738a8..f7195b89e 100644 --- a/src/SMESHClient/SMESH_Client.cxx +++ b/src/SMESHClient/SMESH_Client.cxx @@ -25,6 +25,7 @@ #include "SMESH_Client.hxx" #include "SMESH_Mesh.hxx" +#include "SMESHDS_Script.hxx" #include "SALOME_NamingService.hxx" #include "SALOME_LifeCycleCORBA.hxx" @@ -124,6 +125,32 @@ namespace } + //======================================================================= + //function : AddBallsWithID + //======================================================================= + inline void AddBallsWithID(SMDS_Mesh* theMesh, + SMESH::log_array_var& theSeq, + CORBA::Long theId) + { + const SMESH::double_array& aDiameter = theSeq[theId].coords; + const SMESH::long_array& anIndexes = theSeq[theId].indexes; + CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number; + if (2*aNbElems != anIndexes.length() ) + EXCEPTION(runtime_error,"AddEdgeWithID - 2*aNbElems != anIndexes.length()"); + if (aNbElems != aDiameter.length()) + EXCEPTION(runtime_error,"AddEdgeWithID - aNbElems != aDiameter.length()"); + CORBA::Long anIndexId = 0; + for (; anElemId < aNbElems; anElemId++, anIndexId+=2) + { + SMDS_MeshElement* anElem = theMesh->AddBallWithID(anIndexes[anIndexId+1], + aDiameter[anElemId], + anIndexes[anIndexId]); + if (!anElem) + EXCEPTION(runtime_error,"cannot SMDS_Mesh::AddBallsWithID for ID = "<