#endif
#ifdef _DEBUG_
-static int MYDEBUG = 0;
+static int MYDEBUG = 1;
static int MYDEBUGWITHFILES = 0;
#else
static int MYDEBUG = 0;
//=================================================================================
SMESH_VisualObjDef::SMESH_VisualObjDef()
{
+ MESSAGE("---------------------------------------------SMESH_VisualObjDef::SMESH_VisualObjDef");
myGrid = vtkUnstructuredGrid::New();
}
SMESH_VisualObjDef::~SMESH_VisualObjDef()
{
- if ( MYDEBUG )
+ MESSAGE("---------------------------------------------SMESH_VisualObjDef::~SMESH_VisualObjDef");
+ //if ( MYDEBUG )
MESSAGE( "~SMESH_MeshObj - myGrid->GetReferenceCount() = " << myGrid->GetReferenceCount() );
myGrid->Delete();
}
// myGrid->SetCells( 0, 0, 0 );
// throw;
// }
- myGrid = GetMesh()->getGrid();
-
- if( MYDEBUG ) MESSAGE( "Update - myGrid->GetNumberOfCells() = "<<myGrid->GetNumberOfCells() );
+ MESSAGE("----------------------------------------------------------SMESH_VisualObjDef::buildPrs");
+ vtkUnstructuredGrid *theGrid = GetMesh()->getGrid();
+ myGrid->ShallowCopy(theGrid);
+ MESSAGE(myGrid->GetReferenceCount());
+ MESSAGE( "Update - myGrid->GetNumberOfCells() = "<<myGrid->GetNumberOfCells() );
+ MESSAGE( "Update - myGrid->GetNumberOfPoints() = "<<myGrid->GetNumberOfPoints() );
if( MYDEBUGWITHFILES ) SMESH::WriteUnstructuredGrid( myGrid,"/tmp/buildPrs" );
}
#include "SMDS_SpacePosition.hxx"
#include <vtkUnstructuredGrid.h>
+#include <vtkUnsignedCharArray.h>
#include <algorithm>
#include <map>
void SMDS_Mesh::RemoveFreeElement(const SMDS_MeshElement * elem)
{
int elemId = elem->GetID();
- //MESSAGE("SMDS_Mesh::RemoveFreeElement " << elemId);
+ MESSAGE("SMDS_Mesh::RemoveFreeElement " << elemId);
SMDSAbs_ElementType aType = elem->GetType();
SMDS_MeshElement* todest = (SMDS_MeshElement*)(elem);
if (aType == SMDSAbs_Node) {
// this methods is only for meshes without descendants
return;
+ int vtkid = this->fromSmdsToVtk(elemId);
+
// Remove element from <InverseElements> of its nodes
SMDS_ElemIteratorPtr itn = elem->nodesIterator();
while (itn->more()) {
break;
}
myElementIDFactory->ReleaseID(elemId);
+
+ this->myGrid->GetCellTypesArray()->SetValue(vtkid, VTK_EMPTY_CELL);
+ // --- to do: keep vtkid in a list of reusable cells
}
}
MESSAGE(" ------------------- resize myCells " << val << " --> " << val + nbCells);
myNodes.resize(val +nbCells, 0);
}
+
+void SMDS_Mesh::adjustStructure()
+{
+ myGrid->GetPoints()->GetData()->SetNumberOfTuples(myNodeIDFactory->GetMaxID()+1);
+}
+
void incrementNodesCapacity(int nbNodes);
void incrementCellsCapacity(int nbCells);
+ void adjustStructure();
int myCellLinksSize;
void BuildLinks(); // initialise un SMDS_CellLinks;
SMDS_CellLinks* GetCellLinks();
+ vtkIdType GetCellArraySize() { return (this->Connectivity ? this->Connectivity->GetSize() : 0); };
+
//virtual void Delete();
static SMDS_UnstructuredGrid* New();
protected:
MEMOSTAT;
SMESHDS_Mesh *myMesh = aMesh.GetMeshDS();
+ myMesh->adjustStructure();
list<int> listind = myMesh->SubMeshIndices();
list<int>::iterator it = listind.begin();
int total = 0;