From 232eb75e7692561fe712a4f6fd52c8930cac0e37 Mon Sep 17 00:00:00 2001 From: eap Date: Thu, 19 Jul 2012 13:18:27 +0000 Subject: [PATCH] 0021459: EDF 1495 SMESH: Manipulation of discrete elements with attributes + inline void AddBallsWithID(SMDS_Mesh* theMesh, --- src/SMESHClient/SMESH_Client.cxx | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) 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 = "<