+ // --- SMDS_MeshNode and myNodes (id in SMDS and in VTK are the same), myNodeIdFactory
+
+ if (areNodesModified)
+ {
+ MESSAGE("-------------- modify myNodes");
+ SetOfNodes newNodes;
+ newNodes.resize(newNodeSize+1,0); // 0 not used, SMDS numbers 1..n
+ int newSmdsId = 0;
+ for (int i = 0; i < nbNodes; i++)
+ {
+ if (myNodes[i])
+ {
+ newSmdsId++; // SMDS id start to 1
+ int oldVtkId = myNodes[i]->getVtkId();
+ int newVtkId = idNodesOldToNew[oldVtkId];
+ //MESSAGE("myNodes["<< i << "] vtkId " << oldVtkId << " --> " << newVtkId);
+ myNodes[i]->setVtkId(newVtkId);
+ myNodes[i]->setId(newSmdsId);
+ newNodes[newSmdsId] = myNodes[i];
+ //MESSAGE("myNodes["<< i << "] --> newNodes[" << newSmdsId << "]");
+ }
+ }
+ myNodes.swap(newNodes);
+ this->myNodeIDFactory->emptyPool(newSmdsId); // newSmdsId = number of nodes
+ MESSAGE("myNodes.size " << myNodes.size());
+ }
+
+ // --- SMDS_MeshCell, myCellIdVtkToSmds, myCellIdSmdsToVtk, myCells
+
+ int vtkIndexSize = myCellIdVtkToSmds.size();
+ int maxVtkId = -1;
+ for (int oldVtkId = 0; oldVtkId < vtkIndexSize; oldVtkId++)
+ {
+ int oldSmdsId = this->myCellIdVtkToSmds[oldVtkId];
+ if (oldSmdsId > 0)
+ {
+ int newVtkId = idCellsOldToNew[oldVtkId];
+ if (newVtkId > maxVtkId)
+ maxVtkId = newVtkId;
+ //MESSAGE("myCells["<< oldSmdsId << "] vtkId " << oldVtkId << " --> " << newVtkId);
+ myCells[oldSmdsId]->setVtkId(newVtkId);
+ }
+ }
+// MESSAGE("myCells.size()=" << myCells.size()
+// << " myCellIdSmdsToVtk.size()=" << myCellIdSmdsToVtk.size()
+// << " myCellIdVtkToSmds.size()=" << myCellIdVtkToSmds.size() );
+
+ SetOfCells newCells;
+ //vector<int> newSmdsToVtk;
+ vector<int> newVtkToSmds;
+
+ assert(maxVtkId < newCellSize);
+ newCells.resize(newCellSize+1, 0); // 0 not used, SMDS numbers 1..n
+ //newSmdsToVtk.resize(newCellSize+1, -1);
+ newVtkToSmds.resize(newCellSize+1, -1);
+
+ int myCellsSize = myCells.size();
+ int newSmdsId = 0;
+ for (int i = 0; i < myCellsSize; i++)
+ {
+ if (myCells[i])
+ {
+ newSmdsId++; // SMDS id start to 1
+ assert(newSmdsId <= newCellSize);
+ newCells[newSmdsId] = myCells[i];
+ newCells[newSmdsId]->setId(newSmdsId);
+ //MESSAGE("myCells["<< i << "] --> newCells[" << newSmdsId << "]");
+ int idvtk = myCells[i]->getVtkId();
+ //newSmdsToVtk[newSmdsId] = idvtk;
+ assert(idvtk < newCellSize);
+ newVtkToSmds[idvtk] = newSmdsId;
+ }
+ }
+
+ myCells.swap(newCells);
+ //myCellIdSmdsToVtk.swap(newSmdsToVtk);
+ myCellIdVtkToSmds.swap(newVtkToSmds);
+ MESSAGE("myCells.size()=" << myCells.size()
+ << " myCellIdVtkToSmds.size()=" << myCellIdVtkToSmds.size() );
+ this->myElementIDFactory->emptyPool(newSmdsId);
+
+ this->myScript->SetModified(true); // notify GUI client for buildPrs when update
+
+ // --- compact list myNodes and myElements in submeshes
+
+ map<int,SMESHDS_SubMesh*>::iterator it = myShapeIndexToSubMesh.begin();
+ for(; it != myShapeIndexToSubMesh.end(); ++it)
+ {
+ (*it).second->compactList();
+ }
+
+}
+
+void SMESHDS_Mesh::CleanDownWardConnectivity()
+{
+ myGrid->CleanDownwardConnectivity();
+}
+
+void SMESHDS_Mesh::BuildDownWardConnectivity(bool withEdges)
+{
+ myGrid->BuildDownwardConnectivity(withEdges);
+}
+
+/*! change some nodes in cell without modifying type or internal connectivity.
+ * Nodes inverse connectivity is maintained up to date.
+ * @param vtkVolId vtk id of the cell.
+ * @param localClonedNodeIds map old node id to new node id.
+ * @return ok if success.
+ */
+bool SMESHDS_Mesh::ModifyCellNodes(int vtkVolId, std::map<int,int> localClonedNodeIds)
+{
+ myGrid->ModifyCellNodes(vtkVolId, localClonedNodeIds);
+ return true;
+}