]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
Add an update all command in the log of mesh DS. It will allow to display the whole...
authorjrt <jrt>
Mon, 1 Mar 2004 14:04:23 +0000 (14:04 +0000)
committerjrt <jrt>
Mon, 1 Mar 2004 14:04:23 +0000 (14:04 +0000)
14 files changed:
idl/SMESH_Mesh.idl
src/SMDS/SMDS_Mesh.cxx
src/SMDS/SMDS_Mesh.hxx
src/SMESH/SMESH_Gen.cxx
src/SMESHDS/SMESHDS_Command.hxx
src/SMESHDS/SMESHDS_CommandType.hxx
src/SMESHDS/SMESHDS_Mesh.cxx
src/SMESHDS/SMESHDS_Mesh.hxx
src/SMESHDS/SMESHDS_Script.cxx
src/SMESHDS/SMESHDS_Script.hxx
src/SMESHGUI/SMESHGUI.cxx
src/SMESH_I/SMESH_Gen_i.cxx
src/SMESH_I/SMESH_Mesh_i.cxx
src/SMESH_I/SMESH_Mesh_i.hxx

index ea65c8d3ffb69c33aa692f96dbae37738a2c1263..b2c5813b59d3f0a58fd1a6242652b4805d20fa41 100644 (file)
@@ -49,7 +49,8 @@ module SMESH
       ADD_PRISM,
       ADD_HEXAHEDRON,
       REMOVE_NODE,
-      REMOVE_ELEMENT
+      REMOVE_ELEMENT,
+         REMOVE_ALL
     };
 
   struct log_block
index a67db9dd41d702e5c9def7884d4551e709591b68..eda54c971fb6e0efc07bce69389442705505648a 100644 (file)
@@ -1271,7 +1271,7 @@ SMDS_Iterator<const SMDS_MeshNode *> * 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<const SMDS_MeshEdge *> * 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<const SMDS_MeshNode*> * 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<const SMDS_MeshNode*> * 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<const SMDS_MeshEdge*> * it=edgesIterator();
+       int i=0;
+       
+       while(it->more())
+       {
+               const SMDS_MeshEdge * e=it->next();
+               toReturn[i]=e->GetID();
+               i++;
+               SMDS_Iterator<const SMDS_MeshElement*> * 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<const SMDS_MeshFace*> * 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<const SMDS_MeshElement*> * 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<const SMDS_MeshFace*> * it=facesIterator();
+       int toReturn=0;
+       while(it->more())
+       {
+               const SMDS_MeshFace * f=it->next();
+               if(f->NbNodes()==3) toReturn++;
+       }
+       return toReturn;
+}
index f869cd705aa4795248af9ae2e83bbaa0fb004748..47c22b07996a1b04920e6d441139ba969ff0e9bc 100644 (file)
@@ -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,
index fd5504858e1066114251f0723bd44c9638c56d4b..5be63b4a9ff765c419be4e622b352a438bb957d2 100644 (file)
@@ -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;
 }
 
index 7c3014e7d2e66a2caf4dc920008f735eb3481e53..5de4a710c9aabed0ee4b8e3016ab11b55f822f1f 100644 (file)
@@ -29,6 +29,7 @@
 
 #include "SMESHDS_CommandType.hxx"
 #include <list>
+using namespace std;
 
 class SMESHDS_Command
 {
index fd64ba00593d0513c17b311c852d079d5349cd59..404642e8793e877258a5ba147bd94205e5bef62f 100644 (file)
@@ -38,7 +38,8 @@ SMESHDS_AddPrism,
 SMESHDS_AddHexahedron,
 SMESHDS_RemoveNode,
 SMESHDS_RemoveElement,
-SMESHDS_MoveNode
+SMESHDS_MoveNode,
+SMESHDS_UpdateAll
 };
 
 
index 0396c6ba75cff834279258f1c7fcc6a7e63c07f0..4aafa43adc2508066cdfb76837a23f7212a1c83d 100644 (file)
@@ -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();
+}
index 6159a4fca69bb143cdc7bd1520d4894cee54436b..2f37661552a6880c875495934e9f94f48f90bf0b 100644 (file)
@@ -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
     {
index 57baf301c149f7d5de451b4a0f09fe805e123a0a..cc969b748471f5b468d522949ea1db61d938cd79 100644 (file)
@@ -26,7 +26,6 @@
 //  Module : SMESH
 //  $Header: 
 
-using namespace std;
 #include "SMESHDS_Script.hxx"
 
 //=======================================================================
@@ -321,3 +320,12 @@ const list<SMESHDS_Command*>& 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));
+}
index 8a67c98fe0ea57610bee5b8e7f949fc42ba3f407..70d4d5b30484daac6906d74b649f3c61847ce695 100644 (file)
@@ -52,6 +52,7 @@ class SMESHDS_Script
        void RemoveElement(int ElementID);
        void Clear();
        const list<SMESHDS_Command*> & GetCommands();
+       void UpdateAll();
        ~SMESHDS_Script();
   
   private:
index 47bb68559b16ea0b067f60210a750b86b16fcbf5..8cf3381d84bc0e9d320ef0cd04a3d1c136a5149f 100644 (file)
@@ -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 <theIO> exists in the active VTK view
+/**
+ * Ensures that the actor for the given <theIO> exists in the active VTK view
+ * @TODO Handle multiple selection.
  */
-//=============================================================================
 void SMESHGUI::BuildPresentation(const Handle(SALOME_InteractiveObject) & theIO)
 {
+       MESSAGE("SMESHGUI::BuildPresentation("<<theIO->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 "<<theIO->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 "<<aSeq->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="<<number<<")");
        QApplication::setOverrideCursor(Qt::waitCursor);
        if (Mactor->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="<<number<<")");
        QApplication::setOverrideCursor(Qt::waitCursor);
        //vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::SafeDownCast( Mactor->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 =
index 8706e7a90f58f82cd48be87b6e9966b0d7712344..a6ed6375f75b4aef0161f46198565e2481750abd 100644 (file)
@@ -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");
                }
        }
index 7a2ffaa995c1757ce5f0b96563cc32243b775d73..76b97fbfe0145b175f314b131e4a4aff9876c773 100644 (file)
@@ -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: "<<lg);
                aLog->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(" "<<i<<" "<<ir.Value());
-                               ir++;
+                               aLog=createUpdateAllCommand(aLog, &indexLog);                   
                        }
-                       for (int i = 0; i < inum; i++)
+                       else
                        {
-                               aLog[indexLog].indexes[i] = *ii;
-                               //MESSAGE(" "<<i<<" "<<ii.Value());
-                               ii++;
-                       }
-                       indexLog++;
+                               aLog[indexLog].number = lgcom;
+                               aLog[indexLog].coords.length(rnum);
+                               aLog[indexLog].indexes.length(inum);
+                               for (int i = 0; i < rnum; i++)
+                               {
+                                       aLog[indexLog].coords[i] = *ir;
+                                       //MESSAGE(" "<<i<<" "<<ir.Value());
+                                       ir++;
+                               }
+                               for (int i = 0; i < inum; i++)
+                               {
+                                       aLog[indexLog].indexes[i] = *ii;
+                                       //MESSAGE(" "<<i<<" "<<ii.Value());
+                                       ii++;
+                               }
+                               indexLog++;
+                       }                       
                        its++;
                }
-               if (clearAfterGet)
-                       _impl->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)
index 74a03a75b9e8e659adf532cdaa9e2d3597ca4667..796421478fe7b5b02f99a041ce2239500307516e 100644 (file)
@@ -138,7 +138,7 @@ public:
   map<int, ::SMESH_subMesh*> _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;