From 58d4e7b341059024c462080f8809c9cda7881c2a Mon Sep 17 00:00:00 2001 From: jrt Date: Mon, 1 Mar 2004 14:04:23 +0000 Subject: [PATCH] Add an update all command in the log of mesh DS. It will allow to display the whole mesh with a small number of CORBA call. --- idl/SMESH_Mesh.idl | 3 +- src/SMDS/SMDS_Mesh.cxx | 125 +++++++++++++++++++++++- src/SMDS/SMDS_Mesh.hxx | 6 ++ src/SMESH/SMESH_Gen.cxx | 9 +- src/SMESHDS/SMESHDS_Command.hxx | 1 + src/SMESHDS/SMESHDS_CommandType.hxx | 3 +- src/SMESHDS/SMESHDS_Mesh.cxx | 9 ++ src/SMESHDS/SMESHDS_Mesh.hxx | 3 +- src/SMESHDS/SMESHDS_Script.cxx | 10 +- src/SMESHDS/SMESHDS_Script.hxx | 1 + src/SMESHGUI/SMESHGUI.cxx | 109 +++++++++++---------- src/SMESH_I/SMESH_Gen_i.cxx | 1 + src/SMESH_I/SMESH_Mesh_i.cxx | 144 +++++++++++++++++++++------- src/SMESH_I/SMESH_Mesh_i.hxx | 2 +- 14 files changed, 332 insertions(+), 94 deletions(-) diff --git a/idl/SMESH_Mesh.idl b/idl/SMESH_Mesh.idl index ea65c8d3f..b2c5813b5 100644 --- a/idl/SMESH_Mesh.idl +++ b/idl/SMESH_Mesh.idl @@ -49,7 +49,8 @@ module SMESH ADD_PRISM, ADD_HEXAHEDRON, REMOVE_NODE, - REMOVE_ELEMENT + REMOVE_ELEMENT, + REMOVE_ALL }; struct log_block diff --git a/src/SMDS/SMDS_Mesh.cxx b/src/SMDS/SMDS_Mesh.cxx index a67db9dd4..eda54c971 100644 --- a/src/SMDS/SMDS_Mesh.cxx +++ b/src/SMDS/SMDS_Mesh.cxx @@ -1271,7 +1271,7 @@ SMDS_Iterator * SMDS_Mesh::nodesIterator() const } /////////////////////////////////////////////////////////////////////////////// -///Return an iterator on volumes of the current mesh. Once used this iterator +///Return an iterator on egdes of the current mesh. Once used this iterator ///must be free by the caller /////////////////////////////////////////////////////////////////////////////// SMDS_Iterator * SMDS_Mesh::edgesIterator() const @@ -1574,3 +1574,126 @@ void SMDS_Mesh::RemoveElement(const SMDS_MeshElement * elem, delete s2; delete s1; } + +/** + * Concat the coordinates of all nodes in an array. + * Its used to display the mesh. + * @return A array of size 3*NbNodes() containing the coordinates of nodes. + */ +double * SMDS_Mesh::getNodesCoordinates() +{ + double * toReturn=new double[3*NbNodes()]; + SMDS_Iterator * it=nodesIterator(); + int i=0; + while(it->more()) + { + const SMDS_MeshNode * n=it->next(); + toReturn[i]=n->X(); + i++; + toReturn[i]=n->Y(); + i++; + toReturn[i]=n->Z(); + i++; + } + delete it; + return toReturn; +} + +/** + * Concat the id of all nodes in an array. + * Its used to display the mesh. + * @return A array of size NbNodes() containing the ids of nodes. + */ +long * SMDS_Mesh::getNodesID() +{ + long * toReturn=new long[NbNodes()]; + SMDS_Iterator * it=nodesIterator(); + int i=0; + while(it->more()) + { + const SMDS_MeshNode * n=it->next(); + toReturn[i]=n->GetID(); + i++; + } + delete it; + return toReturn; +} + +/** + * Concat the id of nodes of edges in an array. + * Array format is {edge_id, node1_id, node2_id} + * Its used to display the mesh. + * @return A array of size 3*NbEdges() containing the edges. + */ +long * SMDS_Mesh::getEdgesIndices() +{ + long * toReturn=new long[NbEdges()*3]; + SMDS_Iterator * it=edgesIterator(); + int i=0; + + while(it->more()) + { + const SMDS_MeshEdge * e=it->next(); + toReturn[i]=e->GetID(); + i++; + SMDS_Iterator * itn=e->nodesIterator(); + while(itn->more()) + { + const SMDS_MeshElement * n=itn->next(); + toReturn[i]=n->GetID(); + i++; + } + delete itn; + } + delete it; + return toReturn; +} + +/** + * Concat the id of nodes of triangles in an array. + * Array format is {tria_id, node1_id, node2_id, node3_id} + * Its used to display the mesh. + * @return A array of size 4*NbTriangles() containing the edges. + */ +long * SMDS_Mesh::getTrianglesIndices() +{ + long * toReturn=new long[NbTriangles()*4]; + SMDS_Iterator * it=facesIterator(); + int i=0; + while(it->more()) + { + const SMDS_MeshFace * f=it->next(); + if(f->NbNodes()==3) + { + toReturn[i]=f->GetID(); + i++; + SMDS_Iterator * itn=f->nodesIterator(); + while(itn->more()) + { + const SMDS_MeshElement * n=itn->next(); + toReturn[i]=n->GetID(); + i++; + } + delete itn; + } + } + delete it; + return toReturn; +} + +/** + * Return the number of 3 nodes faces in the mesh. + * This method run in O(n). + * @return The number of face whose number of nodes is 3 + */ +int SMDS_Mesh::NbTriangles() const +{ + SMDS_Iterator * it=facesIterator(); + int toReturn=0; + while(it->more()) + { + const SMDS_MeshFace * f=it->next(); + if(f->NbNodes()==3) toReturn++; + } + return toReturn; +} diff --git a/src/SMDS/SMDS_Mesh.hxx b/src/SMDS/SMDS_Mesh.hxx index f869cd705..47c22b079 100644 --- a/src/SMDS/SMDS_Mesh.hxx +++ b/src/SMDS/SMDS_Mesh.hxx @@ -167,6 +167,7 @@ class SMDS_Mesh:public SMDS_MeshObject int NbNodes() const; int NbEdges() const; int NbFaces() const; + int NbTriangles() const; int NbVolumes() const; int NbSubMesh() const; void DumpNodes() const; @@ -184,6 +185,11 @@ class SMDS_Mesh:public SMDS_MeshObject void setConstructionFaces(bool); void setInverseElements(bool); + double * getNodesCoordinates(); + long * getNodesID(); + long * getEdgesIndices(); + long * getTrianglesIndices(); + private: SMDS_Mesh(SMDS_Mesh * parent); SMDS_MeshFace * createTriangle(SMDS_MeshNode * node1, diff --git a/src/SMESH/SMESH_Gen.cxx b/src/SMESH/SMESH_Gen.cxx index fd5504858..5be63b4a9 100644 --- a/src/SMESH/SMESH_Gen.cxx +++ b/src/SMESH/SMESH_Gen.cxx @@ -127,7 +127,8 @@ throw(SALOME_Exception) //============================================================================= /*! - * + * @TODO Doing a full update after computation is not optimal when doing a local + * remeshing. */ //============================================================================= @@ -139,7 +140,7 @@ throw(SALOME_Exception) /* Algo : s'appuie ou non sur une geometrie Si geometrie: -Vertex : rien à faire (range le point) +Vertex : rien �faire (range le point) Edge, Wire, collection d'edge et wire : 1D Face, Shell, collection de Face et Shells : 2D Solid, Collection de Solid : 3D @@ -184,6 +185,8 @@ Solid, Collection de Solid : 3D smToCompute = sm->GetFirstToCompute(); } + aMesh.GetMeshDS()->logFullUpdate(); + return ret; } @@ -437,6 +440,8 @@ SMESH_Mesh * SMESH_Gen::Import(int studyId, const char * fileName, reader->SetFile(string(fileName)); reader->Read(); + mesh->GetMeshDS()->logFullUpdate(); + return mesh; } diff --git a/src/SMESHDS/SMESHDS_Command.hxx b/src/SMESHDS/SMESHDS_Command.hxx index 7c3014e7d..5de4a710c 100644 --- a/src/SMESHDS/SMESHDS_Command.hxx +++ b/src/SMESHDS/SMESHDS_Command.hxx @@ -29,6 +29,7 @@ #include "SMESHDS_CommandType.hxx" #include +using namespace std; class SMESHDS_Command { diff --git a/src/SMESHDS/SMESHDS_CommandType.hxx b/src/SMESHDS/SMESHDS_CommandType.hxx index fd64ba005..404642e87 100644 --- a/src/SMESHDS/SMESHDS_CommandType.hxx +++ b/src/SMESHDS/SMESHDS_CommandType.hxx @@ -38,7 +38,8 @@ SMESHDS_AddPrism, SMESHDS_AddHexahedron, SMESHDS_RemoveNode, SMESHDS_RemoveElement, -SMESHDS_MoveNode +SMESHDS_MoveNode, +SMESHDS_UpdateAll }; diff --git a/src/SMESHDS/SMESHDS_Mesh.cxx b/src/SMESHDS/SMESHDS_Mesh.cxx index 0396c6ba7..4aafa43ad 100644 --- a/src/SMESHDS/SMESHDS_Mesh.cxx +++ b/src/SMESHDS/SMESHDS_Mesh.cxx @@ -577,3 +577,12 @@ void SMESHDS_Mesh::SetMeshElementOnShape(const SMDS_MeshElement* anElement, SMESHDS_Mesh::~SMESHDS_Mesh() { } + +/** + * Add FULL_UPDATE command to the log of this mesh. Once interpreted by the + * graphical client it will (re)draw the full mesh. + */ +void SMESHDS_Mesh::logFullUpdate() +{ + myScript->UpdateAll(); +} diff --git a/src/SMESHDS/SMESHDS_Mesh.hxx b/src/SMESHDS/SMESHDS_Mesh.hxx index 6159a4fca..2f3766155 100644 --- a/src/SMESHDS/SMESHDS_Mesh.hxx +++ b/src/SMESHDS/SMESHDS_Mesh.hxx @@ -133,7 +133,8 @@ class SMESHDS_Mesh:public SMDS_Mesh void SetNodeOnVertex(SMDS_MeshNode * aNode, int Index); void SetMeshElementOnShape(const SMDS_MeshElement * anElt, int Index); ~SMESHDS_Mesh(); - + void logFullUpdate(); + private: struct HashTopoDS_Shape { diff --git a/src/SMESHDS/SMESHDS_Script.cxx b/src/SMESHDS/SMESHDS_Script.cxx index 57baf301c..cc969b748 100644 --- a/src/SMESHDS/SMESHDS_Script.cxx +++ b/src/SMESHDS/SMESHDS_Script.cxx @@ -26,7 +26,6 @@ // Module : SMESH // $Header: -using namespace std; #include "SMESHDS_Script.hxx" //======================================================================= @@ -321,3 +320,12 @@ const list& SMESHDS_Script::GetCommands() { return myCommands; } + +/** + * Add UpdateAll command to the log of this mesh. Once interpreted by the + * graphical client it will (re)draw the full mesh. + */ +void SMESHDS_Script::UpdateAll() +{ + myCommands.insert(myCommands.end(), new SMESHDS_Command(SMESHDS_UpdateAll)); +} diff --git a/src/SMESHDS/SMESHDS_Script.hxx b/src/SMESHDS/SMESHDS_Script.hxx index 8a67c98fe..70d4d5b30 100644 --- a/src/SMESHDS/SMESHDS_Script.hxx +++ b/src/SMESHDS/SMESHDS_Script.hxx @@ -52,6 +52,7 @@ class SMESHDS_Script void RemoveElement(int ElementID); void Clear(); const list & GetCommands(); + void UpdateAll(); ~SMESHDS_Script(); private: diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index 47bb68559..8cf3381d8 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -3982,13 +3982,13 @@ bool SMESHGUI::CustomPopup(QAD_Desktop * parent, return false; } -//============================================================================= -/*! Method: BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO) - * Purpose: ensures that the actor for the given exists in the active VTK view +/** + * Ensures that the actor for the given exists in the active VTK view + * @TODO Handle multiple selection. */ -//============================================================================= void SMESHGUI::BuildPresentation(const Handle(SALOME_InteractiveObject) & theIO) { + MESSAGE("SMESHGUI::BuildPresentation("<getEntry()<<")"); /* Create or retrieve an object SMESHGUI */ SMESHGUI::GetOrCreateSMESHGUI(QAD_Application::getDesktop()); @@ -3997,7 +3997,8 @@ void SMESHGUI::BuildPresentation(const Handle(SALOME_InteractiveObject) & theIO) if (activeFrame->getTypeView() == VIEW_VTK) { // VTK - SALOMEDS::SObject_var fatherSF = + // Some ideas to handle multiple selection... + /*SALOMEDS::SObject_var fatherSF = smeshGUI->myStudy->FindObjectID(activeFrame->entry()); SALOME_Selection *Sel = @@ -4005,8 +4006,8 @@ void SMESHGUI::BuildPresentation(const Handle(SALOME_InteractiveObject) & theIO) getSelection()); SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); -// for(;It.More();It.Next()) { -// Handle(SALOME_InteractiveObject) IObject = It.Value(); + for(;It.More();It.Next()) { + Handle(SALOME_InteractiveObject) IObject = It.Value();*/ Handle(SALOME_InteractiveObject) IObject = theIO; if (IObject->hasEntry()) { @@ -4014,42 +4015,39 @@ void SMESHGUI::BuildPresentation(const Handle(SALOME_InteractiveObject) & theIO) Standard_Boolean res; SMESH_Actor *ac = smeshGUI->FindActorByEntry(IObject->getEntry(), res, false); - - // Actor not found at all -> mesh is not computed -> do nothing!!! + if (!res) { - /*SMESH::SMESH_Mesh_var aM; - * SALOMEDS::SObject_var aMorSM = smeshGUI->myStudy->FindObjectID( IObject->getEntry() ); - * SALOMEDS::SObject_var father = aMorSM->GetFather(); - * SALOMEDS::SObject_var fatherComp = aMorSM->GetFatherComponent(); - * - * // Non-displayable objects (Hypo, Algo) have tags < 3 or have a father different from component - * if (aMorSM->Tag() < 3 || strcmp(father->GetID(), fatherComp->GetID()) != 0) - * continue; - * - * SALOMEDS::GenericAttribute_var anAttr; - * SALOMEDS::AttributeIOR_var anIOR; - * if ( !aMorSM->_is_nil() ) { - * if (aMorSM->FindAttribute(anAttr, "AttributeIOR") ) { - * anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - * aM = SMESH::SMESH_Mesh::_narrow( _orb->string_to_object(anIOR->Value()) ); - * } - * } - * - * if (!aM->_is_nil()) { - * smeshGUI->InitActor(aM); - * ac = smeshGUI->ReadScript(aM); - * } - * - * if (ac) { - * smeshGUI->DisplayActor( ac, true ); - * smeshGUI->DisplayEdges( ac ); - * smeshGUI->ChangeRepresentation( ac, ac->getDisplayMode() ); - * } */ -// continue; + SALOMEDS::SObject_var aMorSM=smeshGUI->myStudy->FindObjectID( IObject->getEntry()); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeIOR_var anIOR; + if(aMorSM->FindAttribute(anAttr, "AttributeIOR")) + { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + SMESH::SMESH_Mesh_var aM = + SMESH::SMESH_Mesh::_narrow( _orb->string_to_object(anIOR->Value())); + if(!aM->_is_nil()) + { + smeshGUI->InitActor(aM); + ac = smeshGUI->ReadScript(aM); + smeshGUI->DisplayActor( ac, true ); + smeshGUI->DisplayEdges( ac ); + smeshGUI->ChangeRepresentation( ac, ac->getDisplayMode() ); + } + else + { + MESSAGE("Do not know how to display something which is not a SMESH_Mesh"); + } + } + else + { + MESSAGE("The object "<getEntry()<< + " do not have \"AttributeIOR\" attribute"); + } } else - { // The actor exists in some view + { + // The actor exists in some view // Check whether the actor belongs to the active view VTKViewer_RenderWindowInteractor *rwInter = ((VTKViewer_ViewFrame *) activeFrame->getRightFrame()-> @@ -4072,12 +4070,11 @@ void SMESHGUI::BuildPresentation(const Handle(SALOME_InteractiveObject) & theIO) smeshGUI->ChangeRepresentation(ac, ac->getDisplayMode()); } } -// } } else { - MESSAGE - ("BuildPresentation() must not be called while non-VTK view is active")} + MESSAGE("BuildPresentation() must not be called while non-VTK view is active"); + } } //============================================================================= @@ -4100,13 +4097,14 @@ void SMESHGUI::setOrb() ASSERT(!CORBA::is_nil(_orb)); } -//============================================================================= -/*! - * +/** + * Get the history of all commands made in the SMESH server. This list of command + * is used to display the mesh in the VTK view + * @TODO Handle the REMOVE_ALL command. */ -//============================================================================= SMESH_Actor *SMESHGUI::ReadScript(SMESH::SMESH_Mesh_ptr aMesh) { + MESSAGE("SMESHGUI::ReadScript"); SMESH_Actor *MeshActor; if (!aMesh->_is_nil()) { @@ -4115,11 +4113,8 @@ SMESH_Actor *SMESHGUI::ReadScript(SMESH::SMESH_Mesh_ptr aMesh) if (result) { SMESH::log_array_var aSeq = aMesh->GetLog(true); - - if (aSeq->length() == 0) - { - MESSAGE("ReadScript(): log is empty") return MeshActor; - } + MESSAGE("SMESHGUI::ReadScript: The log contains "<length() + <<" commands."); for (unsigned int ind = 0; ind < aSeq->length(); ind++) { @@ -4180,6 +4175,10 @@ SMESH_Actor *SMESHGUI::ReadScript(SMESH::SMESH_Mesh_ptr aMesh) aSeq[ind].coords, aSeq[ind].indexes); break; } + case SMESH::REMOVE_ALL: + MESSAGE("REMOVE_ALL command not yet implemented"); + break; + default: MESSAGE("Warning: Unknown script command."); } } return MeshActor; @@ -4232,6 +4231,7 @@ void SMESHGUI::Dump(SMESH_Actor * Mactor) void SMESHGUI::AddNodes(SMESH_Actor * Mactor, int number, const SMESH::double_array & coords, const SMESH::long_array & indexes) { + MESSAGE("SMESHGUI::AddNodes(number="<GetMapper() == NULL) { @@ -4289,8 +4289,9 @@ void SMESHGUI::AddNode(SMESH_Actor * Mactor, int idnode, float x, float y, float z) { QApplication::setOverrideCursor(Qt::waitCursor); - MESSAGE("SMESHGUI::AddNode " << idnode << " : " << x << ";" << y << ";" << - z) if (Mactor->GetMapper() == NULL) + MESSAGE("SMESHGUI::AddNode " << idnode << " : " << x << ";" << y << ";" << z); + + if (Mactor->GetMapper() == NULL) { vtkPoints *Pts = vtkPoints::New(); int idVTK = Pts->InsertNextPoint(x, y, z); @@ -4951,6 +4952,7 @@ void SMESHGUI::AddEdge(SMESH_Actor * Mactor, int idedge, int idnode1, void SMESHGUI::AddTriangles(SMESH_Actor * Mactor, int number, const SMESH::double_array & coords, const SMESH::long_array & indexes) { + MESSAGE("SMESHGUI::AddTriangles(number="<DataSource ); SMESH_Grid *ugrid = SMESH_Grid::SafeDownCast(Mactor->DataSource); @@ -5895,6 +5897,7 @@ void SMESHGUI::InitActor(SMESH::SMESH_Mesh_ptr aMesh) //============================================================================= void SMESHGUI::Update() { + MESSAGE("SMESHGUI::Update"); if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { //VTK vtkRenderer *theRenderer = diff --git a/src/SMESH_I/SMESH_Gen_i.cxx b/src/SMESH_I/SMESH_Gen_i.cxx index 8706e7a90..a6ed6375f 100644 --- a/src/SMESH_I/SMESH_Gen_i.cxx +++ b/src/SMESH_I/SMESH_Gen_i.cxx @@ -1521,6 +1521,7 @@ void SMESH_Gen_i::loadMesh(char * name, HDFfile * hdf_file, myReader->SetMeshId(myMeshId); myReader->SetFile(datafilename); myReader->Read(); + mySMESHDSMesh->logFullUpdate(); MESSAGE("Loaded a mesh with " << mySMESHDSMesh->NbNodes() <<" nodes"); } } diff --git a/src/SMESH_I/SMESH_Mesh_i.cxx b/src/SMESH_I/SMESH_Mesh_i.cxx index 7a2ffaa99..76b97fbfe 100644 --- a/src/SMESH_I/SMESH_Mesh_i.cxx +++ b/src/SMESH_I/SMESH_Mesh_i.cxx @@ -162,18 +162,15 @@ CORBA::Boolean return ret; }; -//============================================================================= -/*! - * +/** + *@TODO Not implemented */ -//============================================================================= - SMESH::ListOfHypothesis * SMESH_Mesh_i::GetHypothesisList(GEOM::GEOM_Shape_ptr aSubShape) throw(SALOME::SALOME_Exception) { - MESSAGE("GetHypothesisList"); - // **** + MESSAGE("GetHypothesisList: Not implemented"); + return NULL; }; //============================================================================= @@ -230,25 +227,100 @@ SMESH::SMESH_subMesh_ptr SMESH_Mesh_i::GetElementsOnShape(GEOM:: return SMESH::SMESH_subMesh::_duplicate(_mapSubMeshIor[subMeshId]); } -//============================================================================= -/*! - * +/** + * Translate the UpdateAll SMESHDS_Command to a set of SMESH::log_command. + * As the input log need to be resized, it is realocated. + * @param logBlock The log where to insert created commands + * @param index The place where to insert created commands in log + * @return The realocated and resized log. + * @TODO Add support for other type of elements */ -//============================================================================= +SMESH::log_array_var SMESH_Mesh_i:: + createUpdateAllCommand(SMESH::log_array_var log, int * index) +{ + MESSAGE("SMESH_Mesh_i::createUpdateAllCommand"); + SMESH::log_array_var aLog=new SMESH::log_array(log->length()+4); + aLog->length(log->length()+4); + + for(int i=0;i<*index;i++) + { + aLog[i]=log[i]; + } + + log->length(0); + int id=*index; + + //Remove all elements + aLog[id].commandType=SMESH::REMOVE_ALL; + id++; + + //Export nodes + aLog[id].commandType=SMESH::ADD_NODE; + aLog[id].number=_impl->GetMeshDS()->NbNodes(); + + double * nodesCoordinates=_impl->GetMeshDS()->getNodesCoordinates(); + aLog[id].coords=SMESH::double_array( + aLog[id].number*3, + aLog[id].number*3, + nodesCoordinates); + + long * nodesID=_impl->GetMeshDS()->getNodesID(); + aLog[id].indexes=SMESH::long_array( + aLog[id].number, + aLog[id].number, + nodesID); + + id++; + + MESSAGE("Export edges"); + //Export edges + aLog[id].commandType=SMESH::ADD_EDGE; + aLog[id].number=_impl->GetMeshDS()->NbEdges(); + aLog[id].coords.length(0); + + long * edgesIndices=_impl->GetMeshDS()->getEdgesIndices(); + aLog[id].indexes=SMESH::long_array( + aLog[id].number*3, + aLog[id].number*3, + edgesIndices); + + id++; + + MESSAGE("Export triangles"); + //Export triangles + aLog[id].commandType=SMESH::ADD_TRIANGLE; + aLog[id].number=_impl->GetMeshDS()->NbTriangles(); + aLog[id].coords.length(0); + + long * triasIndices=_impl->GetMeshDS()->getTrianglesIndices(); + aLog[id].indexes=SMESH::long_array( + aLog[id].number*4, + aLog[id].number*4, + triasIndices); + + (*index)+=4; + return aLog; +} +/** + * Return the log of the current mesh. CORBA wrap of the SMESH::GetLog method + * with a special treatment for SMESHDS_UpdateAll commands + * @param clearAfterGet Tell if the log must be cleared after being returned + * @return the log + */ SMESH::log_array * SMESH_Mesh_i::GetLog(CORBA::Boolean clearAfterGet) -throw(SALOME::SALOME_Exception) + throw(SALOME::SALOME_Exception) { MESSAGE("SMESH_Mesh_i::GetLog"); SMESH::log_array_var aLog; - try - { + /*try + {*/ list < SMESHDS_Command * >logDS = _impl->GetLog(); aLog = new SMESH::log_array; int indexLog = 0; int lg = logDS.size(); - SCRUTE(lg); + MESSAGE("Number of command in the log: "<length(lg); list < SMESHDS_Command * >::iterator its = logDS.begin(); while (its != logDS.end()) @@ -267,32 +339,38 @@ throw(SALOME::SALOME_Exception) //SCRUTE(rnum); list < double >::const_iterator ir = coordList.begin(); aLog[indexLog].commandType = comType; - aLog[indexLog].number = lgcom; - aLog[indexLog].coords.length(rnum); - aLog[indexLog].indexes.length(inum); - for (int i = 0; i < rnum; i++) + if(comType==SMESHDS_UpdateAll) { - aLog[indexLog].coords[i] = *ir; - //MESSAGE(" "<ClearLog(); - } + if (clearAfterGet) _impl->ClearLog(); + return aLog._retn(); + /*} catch(SALOME_Exception & S_ex) { THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM); - } - return aLog._retn(); + }*/ } // SMESH::string_array* SMESH_Mesh_i::GetLog(CORBA::Boolean clearAfterGet) diff --git a/src/SMESH_I/SMESH_Mesh_i.hxx b/src/SMESH_I/SMESH_Mesh_i.hxx index 74a03a75b..796421478 100644 --- a/src/SMESH_I/SMESH_Mesh_i.hxx +++ b/src/SMESH_I/SMESH_Mesh_i.hxx @@ -138,7 +138,7 @@ public: map _mapSubMesh; //NRI private: - + SMESH::log_array_var createUpdateAllCommand(SMESH::log_array_var log, int * index); ::SMESH_Mesh* _impl; // :: force no namespace here SMESH_Gen_i* _gen_i; // CORBA::ORB_ptr _orb; -- 2.39.2