From 3c1d19eebfa38b5cb48ddf6c955186fd6c840f34 Mon Sep 17 00:00:00 2001 From: prascle Date: Mon, 15 Feb 2010 16:58:17 +0000 Subject: [PATCH] PR: debug triangles --- clean_configure | 3 ++ src/SMDS/SMDS_Mesh.cxx | 71 +++++++++++++++++++++++++++++++++++--- src/SMDS/SMDS_Mesh.hxx | 1 + src/SMDS/SMDS_MeshNode.cxx | 17 +++++++-- src/SMESH/SMESH_Gen.cxx | 1 + 5 files changed, 86 insertions(+), 7 deletions(-) diff --git a/clean_configure b/clean_configure index f57f7b3bf..423451e2b 100755 --- a/clean_configure +++ b/clean_configure @@ -31,5 +31,8 @@ find doc -name Makefile.in | xargs rm -f find idl -name Makefile.in | xargs rm -f find resources -name Makefile.in | xargs rm -f find salome_adm -name Makefile.in | xargs rm -f +find adm_local -name Makefile.in | xargs rm -f find src -name Makefile.in | xargs rm -f rm -f Makefile.in +cd adm_local/unix/config_files +rm -f config.* depcomp install-sh l*.m4 ltmain.sh missing py-compile diff --git a/src/SMDS/SMDS_Mesh.cxx b/src/SMDS/SMDS_Mesh.cxx index 1fbe8d324..723915535 100644 --- a/src/SMDS/SMDS_Mesh.cxx +++ b/src/SMDS/SMDS_Mesh.cxx @@ -39,10 +39,16 @@ #include "SMDS_SpacePosition.hxx" #include +#include #include +#include +#include +#include #include #include +#include +#include using namespace std; #ifndef WIN32 @@ -358,7 +364,7 @@ SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1, int ID) { //MESSAGE("AddFaceWithID " << ID) - SMDS_MeshFace * face=createTriangle(n1, n2, n3, myElementIDFactory->GetFreeID()); + SMDS_MeshFace * face=createTriangle(n1, n2, n3, ID); if (face && !registerElement(ID, face)) { RemoveElement(face, false); @@ -1208,7 +1214,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddPolyhedralVolume /////////////////////////////////////////////////////////////////////////////// bool SMDS_Mesh::registerElement(int ID, SMDS_MeshElement* element) { - //MESSAGE("registerElement " << ID) + //MESSAGE("registerElement " << ID); if ((ID < myIDElements.size()) && myIDElements[ID] >= 0) // --- already bound { MESSAGE(" --------------------------------- already bound "<< ID << " " << myIDElements[ID]); @@ -1231,7 +1237,7 @@ bool SMDS_Mesh::registerElement(int ID, SMDS_MeshElement* element) } myIDElements[ID] = vtkId; - //MESSAGE("smds:" << ID << " vtk:" << cellId ); + //MESSAGE("smds:" << ID << " vtk:" << vtkId ); if (vtkId >= myVtkIndex.size()) // --- resize local vector { @@ -1297,6 +1303,7 @@ SMDS_MeshFace * SMDS_Mesh::createTriangle(const SMDS_MeshNode * node1, face = facevtk; adjustmyCellsCapacity(ID); myCells[ID] = face; + //MESSAGE("createTriangle " << ID << " " << face); myInfo.myNbTriangles++; return face; } @@ -2129,7 +2136,10 @@ void SMDS_Mesh::DebugStats() const /////////////////////////////////////////////////////////////////////////////// int SMDS_Mesh::NbNodes() const { - return myNodes.size(); + //MESSAGE(myGrid->GetNumberOfPoints()); + //MESSAGE(myInfo.NbNodes()); + //MESSAGE(myNodeMax); + return myInfo.NbNodes(); } /////////////////////////////////////////////////////////////////////////////// @@ -3562,6 +3572,11 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1, void SMDS_Mesh::updateNodeMinMax() { myNodeMin = 0; + if (myNodes.size() == 0) + { + myNodeMax=0; + return; + } while (!myNodes[myNodeMin] && (myNodeMinGetPoints()->GetData()->SetNumberOfTuples(myNodeIDFactory->GetMaxID()+1); } +void SMDS_Mesh::dumpGrid(string ficdump) +{ + MESSAGE("SMDS_Mesh::dumpGrid " << ficdump); + vtkUnstructuredGridWriter* aWriter = vtkUnstructuredGridWriter::New(); + aWriter->SetFileName(ficdump.c_str()); + aWriter->SetInput(myGrid); + if(myGrid->GetNumberOfCells()) + { + aWriter->Write(); + } + aWriter->Delete(); + ficdump = ficdump + "_connectivity"; + ofstream ficcon(ficdump.c_str(), ios::out); + int nbPoints = myGrid->GetNumberOfPoints(); + ficcon << "-------------------------------- points " << nbPoints << endl; + for (int i=0; iGetPoint(i)) << " " << *(myGrid->GetPoint(i)+1) << " " << " " << *(myGrid->GetPoint(i)+2) << endl; + } + int nbCells = myGrid->GetNumberOfCells(); + ficcon << "-------------------------------- cells " << nbCells << endl; + for (int i=0; iGetCell(i)->GetCellType() << " -"; + int nbptcell = myGrid->GetCell(i)->GetNumberOfPoints(); + vtkIdList *listid = myGrid->GetCell(i)->GetPointIds(); + for (int j=0; jGetId(j); + } + ficcon << endl; + } + ficcon << "-------------------------------- connectivity " << nbPoints << endl; + vtkCellLinks *links = myGrid->GetCellLinks(); + for (int i=0; iGetNcells(i); + vtkIdType *cells = links->GetCells(i); + ficcon << i << " - " << ncells << " -"; + for (int j=0; j using namespace std; @@ -191,6 +193,12 @@ private: int vtkId = myCells[iter]; int smdsId = myMesh->fromVtkToSmds(vtkId); const SMDS_MeshElement* elem = myMesh->FindElement(smdsId); + if (!elem) + { + assert(0); + throw SALOME_Exception("SMDS_MeshNode_MyInvIterator problem Null element"); + } + //MESSAGE("vtkId " << vtkId << " smdsId " << smdsId << " " << (elem!=0)); iter++; return elem; } @@ -200,7 +208,7 @@ SMDS_ElemIteratorPtr SMDS_MeshNode:: GetInverseElementIterator(SMDSAbs_ElementType type) const { vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks()->GetLink(myID); - //MESSAGE("ncells " << l.ncells); + //MESSAGE("myID " << myID << " ncells " << l.ncells); return SMDS_ElemIteratorPtr(new SMDS_MeshNode_MyInvIterator(SMDS_Mesh::_meshList[myMeshId], l.cells, l.ncells, type)); } @@ -223,16 +231,19 @@ private: SMDSAbs_ElementType type): myMesh(mesh), myCells(cells), myNcells(ncells), myType(type), iter(0) { - for (; iterfromVtkToSmds(vtkId); + //MESSAGE("vtkId " << vtkId << " smdsId " << smdsId); const SMDS_MeshElement* elem = myMesh->FindElement(smdsId); if (elem->GetType() == type) myFiltCells.push_back((SMDS_MeshElement*)elem); } myNcells = myFiltCells.size(); - iter = 0; + //MESSAGE("myNcells " << myNcells); + iter = 0; //MESSAGE("SMDS_MeshNode_MyIterator (filter) " << ncells << " " << myNcells); } diff --git a/src/SMESH/SMESH_Gen.cxx b/src/SMESH/SMESH_Gen.cxx index 8fb0ec276..0cbac04e8 100644 --- a/src/SMESH/SMESH_Gen.cxx +++ b/src/SMESH/SMESH_Gen.cxx @@ -307,6 +307,7 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, cerr << "total elements and nodes in submesh sets:" << total << endl; cerr << "Number of node objects " << SMDS_MeshNode::nbNodes << endl; cerr << "Number of cell objects " << SMDS_MeshCell::nbCells << endl; + //myMesh->dumpGrid(); return ret; } -- 2.39.2