PR: debug gui display

This commit is contained in:
prascle 2010-05-19 16:07:15 +00:00
parent 8c1dfe2d90
commit 64be032249
9 changed files with 140 additions and 83 deletions

View File

@ -264,9 +264,9 @@ void SMESH_VisualObjDef::buildPrs(bool buildGrid)
myLocalGrid = false;
vtkUnstructuredGrid *theGrid = GetMesh()->getGrid();
myGrid->ShallowCopy(theGrid);
MESSAGE(myGrid->GetReferenceCount());
MESSAGE( "Update - myGrid->GetNumberOfCells() = "<<myGrid->GetNumberOfCells() );
MESSAGE( "Update - myGrid->GetNumberOfPoints() = "<<myGrid->GetNumberOfPoints() );
//MESSAGE(myGrid->GetReferenceCount());
//MESSAGE( "Update - myGrid->GetNumberOfCells() = "<<myGrid->GetNumberOfCells() );
//MESSAGE( "Update - myGrid->GetNumberOfPoints() = "<<myGrid->GetNumberOfPoints() );
if( MYDEBUGWITHFILES ) SMESH::WriteUnstructuredGrid( myGrid,"/tmp/buildPrs" );
}
}
@ -558,7 +558,7 @@ bool SMESH_VisualObjDef::GetEdgeNodes( const int theElemId,
vtkUnstructuredGrid* SMESH_VisualObjDef::GetUnstructuredGrid()
{
MESSAGE("SMESH_VisualObjDef::GetUnstructuredGrid " << myGrid);
//MESSAGE("SMESH_VisualObjDef::GetUnstructuredGrid " << myGrid);
return myGrid;
}
@ -569,7 +569,7 @@ vtkUnstructuredGrid* SMESH_VisualObjDef::GetUnstructuredGrid()
//=================================================================================
bool SMESH_VisualObjDef::IsValid() const
{
MESSAGE("SMESH_VisualObjDef::IsValid");
//MESSAGE("SMESH_VisualObjDef::IsValid");
return GetNbEntities(SMDSAbs_Node) > 0 ||
GetNbEntities(SMDSAbs_0DElement) > 0 ||
GetNbEntities(SMDSAbs_Edge) > 0 ||
@ -611,7 +611,7 @@ SMESH_MeshObj::~SMESH_MeshObj()
bool SMESH_MeshObj::Update( int theIsClear )
{
// Update SMDS_Mesh on client part
MESSAGE("SMESH_MeshObj::Update " << this);
//MESSAGE("SMESH_MeshObj::Update " << this);
if ( myClient.Update(theIsClear) || GetUnstructuredGrid()->GetNumberOfPoints()==0) {
buildPrs(); // Fill unstructured grid
return true;

View File

@ -8,7 +8,13 @@ Problemes en cours
creation d'une structure vtkUnstructuredGrid locale : iteration un peu lourde, et pas de partage avec la structure du maillage (pas evident)
- inversion d'un volume (tetra): exception
- script de creation de noeuds et d'elements: OK, mais pas compatible avec version precedente (numerotation noeuds differente)
- affichage numeros noeuds: numeros en trop sur (O,0,0) pas systematique, trouver la condition (enlever dans vtkUnstructuredGrid ?)
+ affichage numeros noeuds: numeros en trop sur (O,0,0) pas systematique, trouver la condition (enlever dans vtkUnstructuredGrid ?)
==> purge systematique noeuds et cellules en trop dans compactage grid.
+ gestion du mode embedded mal faite lors d'un script python : journal commandes intempestif
- affichage des noeuds apres changement lineaire <--> quadratique à l'IHM : pas pris en compte, alors que maillage OK,
mais script OK
==> cassé apres mode embedded ou elimination noeuds en trop ?
- extrusion elements 2D along a path : affichage apres calcul pas toujours OK (filaire)
A tester, non pris en compte
============================

View File

@ -56,6 +56,7 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int n
int startBloc = 0;
int endBloc = 0;
int alreadyCopied = 0;
int holes = 0;
typedef enum {lookHoleStart, lookHoleEnd, lookBlocEnd} enumState;
enumState compactState = lookHoleStart;
@ -71,7 +72,7 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int n
vtkPoints *newPoints = 0;
if (newNodeSize)
{
MESSAGE("-------------- compactGrid, newNodeSize");
MESSAGE("-------------- compactGrid, newNodeSize " << newNodeSize);
newPoints = vtkPoints::New();
newPoints->Initialize();
newPoints->Allocate(newNodeSize);
@ -87,6 +88,11 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int n
{
MESSAGE("-------------- newNodeSize, startHole " << i << " " << oldNodeSize);
startHole = i;
if (!alreadyCopied) // copy the first bloc
{
MESSAGE("--------- copy first nodes before hole " << i << " " << oldNodeSize);
copyNodes(newPoints, idNodesOldToNew, alreadyCopied, 0, startHole);
}
compactState = lookHoleEnd;
}
break;
@ -105,12 +111,7 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int n
if (endBloc)
{
MESSAGE("-------------- newNodeSize, endbloc " << endBloc << " " << oldNodeSize);
void *target = newPoints->GetVoidPointer(3*alreadyCopied);
void *source = this->Points->GetVoidPointer(3*startBloc);
int nbPoints = endBloc - startBloc;
memcpy(target, source, 3*sizeof(float)*nbPoints);
for (int j=startBloc; j<endBloc; j++)
idNodesOldToNew[j] = alreadyCopied++;
copyNodes(newPoints, idNodesOldToNew, alreadyCopied, startBloc, endBloc);
compactState = lookHoleStart;
startHole = i;
endHole = 0;
@ -122,12 +123,10 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int n
}
if (!alreadyCopied) // no hole, but shorter, no need to modify idNodesOldToNew
{
MESSAGE("------------- newNodeSize, shorter " << oldNodeSize)
void *target = newPoints->GetVoidPointer(0);
void *source = this->Points->GetVoidPointer(0);
int nbPoints = newNodeSize;
memcpy(target, source, 3*sizeof(float)*nbPoints);
MESSAGE("------------- newNodeSize, shorter " << oldNodeSize);
copyNodes(newPoints, idNodesOldToNew, alreadyCopied, 0, newNodeSize);
}
newPoints->Squeeze();
}
// --- create new compacted Connectivity, Locations and Types
@ -155,6 +154,7 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int n
startBloc = 0;
endBloc = 0;
alreadyCopied = 0;
holes = 0;
compactState = lookHoleStart;
vtkIdType tmpid[50];
@ -167,45 +167,36 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int n
case lookHoleStart:
if (this->Types->GetValue(i) == VTK_EMPTY_CELL)
{
MESSAGE(" -------- newCellSize, startHole " << i << " " << oldCellSize);
MESSAGE(" -------- newCellSize, startHole " << i << " " << oldCellSize);
startHole = i;
compactState = lookHoleEnd;
if (!alreadyCopied) // copy the first bloc
{
MESSAGE("--------- copy first bloc before hole " << i << " " << oldCellSize);
copyBloc(newTypes, idCellsOldToNew, idNodesOldToNew, newConnectivity, newLocations, pointsCell, alreadyCopied, 0, startHole);
}
}
break;
case lookHoleEnd:
if (this->Types->GetValue(i) != VTK_EMPTY_CELL)
{
MESSAGE(" -------- newCellSize, EndHole " << i << " " << oldCellSize);
MESSAGE(" -------- newCellSize, EndHole " << i << " " << oldCellSize);
endHole = i;
startBloc = i;
compactState = lookBlocEnd;
holes += endHole - startHole;
//alreadyCopied = startBloc -holes;
}
break;
case lookBlocEnd:
endBloc =0;
if (this->Types->GetValue(i) == VTK_EMPTY_CELL) endBloc =i;
else if (i == (oldCellSize-1)) endBloc = i+1;
if (endBloc)
{
MESSAGE(" -------- newCellSize, endBloc " << endBloc << " " << oldCellSize);
for (int j=startBloc; j<endBloc; j++)
{
newTypes->SetValue(alreadyCopied, this->Types->GetValue(j));
idCellsOldToNew[j] = alreadyCopied;
vtkIdType oldLoc = this->Locations->GetValue(j);
vtkIdType nbpts;
vtkIdType *oldPtsCell = 0;
this->Connectivity->GetCell(oldLoc, nbpts, oldPtsCell);
for (int l=0; l<nbpts; l++)
{
int oldval = oldPtsCell[l];
pointsCell[l] = idNodesOldToNew[oldval];
}
int newcnt = newConnectivity->InsertNextCell(nbpts, pointsCell);
int newLoc = newConnectivity->GetInsertLocation(nbpts);
newLocations->SetValue(alreadyCopied, newLoc);
alreadyCopied++;
}
compactState = lookHoleStart;
MESSAGE(" -------- newCellSize, endBloc " << endBloc << " " << oldCellSize);
copyBloc(newTypes, idCellsOldToNew, idNodesOldToNew, newConnectivity, newLocations, pointsCell, alreadyCopied, startBloc, endBloc);
compactState = lookHoleStart;
}
break;
}
@ -213,27 +204,7 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int n
if (!alreadyCopied) // no hole, but shorter
{
MESSAGE(" -------- newCellSize, shorter " << oldCellSize);
for (int j=0; j<oldCellSize; j++)
{
newTypes->SetValue(alreadyCopied, this->Types->GetValue(j));
idCellsOldToNew[j] = alreadyCopied;
vtkIdType oldLoc = this->Locations->GetValue(j);
vtkIdType nbpts;
vtkIdType *oldPtsCell = 0;
this->Connectivity->GetCell(oldLoc, nbpts, oldPtsCell);
//MESSAGE(j << " " << alreadyCopied << " " << (int)this->Types->GetValue(j) << " " << oldLoc << " " << nbpts );
for (int l=0; l<nbpts; l++)
{
int oldval = oldPtsCell[l];
pointsCell[l] = idNodesOldToNew[oldval];
//MESSAGE(" " << oldval << " " << pointsCell[l]);
}
int newcnt = newConnectivity->InsertNextCell(nbpts, pointsCell);
int newLoc = newConnectivity->GetInsertLocation(nbpts);
//MESSAGE(newcnt << " " << newLoc);
newLocations->SetValue(alreadyCopied, newLoc);
alreadyCopied++;
}
copyBloc(newTypes, idCellsOldToNew, idNodesOldToNew, newConnectivity, newLocations, pointsCell, alreadyCopied, 0, oldCellSize);
}
newConnectivity->Squeeze();
@ -244,7 +215,60 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int n
{
MESSAGE("------- newNodeSize, setPoints");
this->SetPoints(newPoints);
MESSAGE("NumberOfPoints: " << this->GetNumberOfPoints());
}
this->SetCells(newTypes, newLocations, newConnectivity);
this->BuildLinks();
}
void SMDS_UnstructuredGrid::copyNodes(vtkPoints *newPoints,
std::vector<int>& idNodesOldToNew,
int& alreadyCopied,
int start,
int end)
{
MESSAGE("copyNodes " << alreadyCopied << " " << start << " " << end << " size: " << end - start << " total: " << alreadyCopied + end - start);
void *target = newPoints->GetVoidPointer(3*alreadyCopied);
void *source = this->Points->GetVoidPointer(3*start);
int nbPoints = end - start;
if (nbPoints >0)
{
memcpy(target, source, 3*sizeof(float)*nbPoints);
for (int j=start; j<end; j++)
idNodesOldToNew[j] = alreadyCopied++;
}
}
void SMDS_UnstructuredGrid::copyBloc(vtkUnsignedCharArray *newTypes,
std::vector<int>& idCellsOldToNew,
std::vector<int>& idNodesOldToNew,
vtkCellArray* newConnectivity,
vtkIdTypeArray* newLocations,
vtkIdType* pointsCell,
int& alreadyCopied,
int start,
int end)
{
MESSAGE("copyBloc " << alreadyCopied << " " << start << " " << end << " size: " << end - start << " total: " << alreadyCopied + end - start);
for (int j=start; j<end; j++)
{
newTypes->SetValue(alreadyCopied, this->Types->GetValue(j));
idCellsOldToNew[j] = alreadyCopied;
vtkIdType oldLoc = this->Locations->GetValue(j);
vtkIdType nbpts;
vtkIdType *oldPtsCell = 0;
this->Connectivity->GetCell(oldLoc, nbpts, oldPtsCell);
//MESSAGE(j << " " << alreadyCopied << " " << (int)this->Types->GetValue(j) << " " << oldLoc << " " << nbpts );
for (int l=0; l<nbpts; l++)
{
int oldval = oldPtsCell[l];
pointsCell[l] = idNodesOldToNew[oldval];
//MESSAGE(" " << oldval << " " << pointsCell[l]);
}
int newcnt = newConnectivity->InsertNextCell(nbpts, pointsCell);
int newLoc = newConnectivity->GetInsertLocation(nbpts);
//MESSAGE(newcnt << " " << newLoc);
newLocations->SetValue(alreadyCopied, newLoc);
alreadyCopied++;
}
}

View File

@ -26,6 +26,21 @@ public:
protected:
SMDS_UnstructuredGrid();
~SMDS_UnstructuredGrid();
void copyNodes(vtkPoints *newPoints,
std::vector<int>& idNodesOldToNew,
int& alreadyCopied,
int start,
int end);
void copyBloc(vtkUnsignedCharArray *newTypes,
std::vector<int>& idCellsOldToNew,
std::vector<int>& idNodesOldToNew,
vtkCellArray* newConnectivity,
vtkIdTypeArray* newLocations,
vtkIdType* pointsCell,
int& alreadyCopied,
int start,
int end);
};
#endif /* _SMDS_UNSTRUCTUREDGRID_HXX */

View File

@ -54,7 +54,7 @@
#endif
#ifdef _DEBUG_
static int MYDEBUG = 0;
static int MYDEBUG = 1;
#else
static int MYDEBUG = 0;
#endif
@ -634,6 +634,7 @@ SMESH_Client::SMESH_Client(CORBA::ORB_ptr theORB,
mySMESHDSMesh(NULL),
mySMDSMesh(NULL)
{
MESSAGE("SMESH_Client::SMESH_Client");
myMeshServer->Register();
CORBA::Boolean anIsEmbeddedMode;
@ -649,7 +650,8 @@ SMESH_Client::SMESH_Client(CORBA::ORB_ptr theORB,
SMESH_Mesh* aMesh = reinterpret_cast<SMESH_Mesh*> (pointeur);
if ( MYDEBUG )
MESSAGE("SMESH_Client::SMESH_Client aMesh "<<aMesh);
if(aMesh->GetMeshDS()->IsEmbeddedMode()){
//if(aMesh->GetMeshDS()->IsEmbeddedMode()){
if(anIsEmbeddedMode){
mySMESHDSMesh = aMesh->GetMeshDS();
mySMDSMesh = mySMESHDSMesh;
}
@ -704,10 +706,12 @@ SMESH_Client::Update(bool theIsClear)
{
bool anIsModified = true;
if(mySMESHDSMesh){
MESSAGE("Update mySMESHDSMesh");
SMESHDS_Script* aScript = mySMESHDSMesh->GetScript();
anIsModified = aScript->IsModified();
aScript->SetModified(false);
}else{
MESSAGE("Update CORBA");
SMESH::log_array_var aSeq = myMeshServer->GetLog( theIsClear );
CORBA::Long aLength = aSeq->length();
anIsModified = aLength > 0;

View File

@ -1782,10 +1782,11 @@ void SMESHDS_Mesh::compactMesh()
int nbNodes = myNodes.size();
int nbVtkNodes = myGrid->GetNumberOfPoints();
MESSAGE("nbNodes=" << nbNodes << " nbVtkNodes=" << nbVtkNodes);
if (nbNodes > nbVtkNodes) nbVtkNodes = nbNodes;
int nbNodeTemp = nbVtkNodes;
if (nbNodes > nbVtkNodes) nbNodeTemp = nbNodes;
vector<int> idNodesOldToNew;
idNodesOldToNew.clear();
idNodesOldToNew.resize(nbVtkNodes, -1); // all unused id will be -1
idNodesOldToNew.resize(nbNodeTemp, -1); // all unused id will be -1
bool areNodesModified = ! myNodeIDFactory->isPoolIdEmpty();
MESSAGE("------------------------------------------------- SMESHDS_Mesh::compactMesh " << areNodesModified);
@ -1804,16 +1805,19 @@ void SMESHDS_Mesh::compactMesh()
{
for (int i=0; i<nbNodes; i++)
idNodesOldToNew[i] = i;
if (nbNodes > nbVtkNodes)
newNodeSize = nbVtkNodes; // else 0 means nothing to change (no need to compact vtkPoints)
}
int newCellSize = 0;
int nbCells = myCells.size();
int nbVtkCells = myGrid->GetNumberOfCells();
MESSAGE("nbCells=" << nbCells << " nbVtkCells=" << nbVtkCells);
if (nbCells > nbVtkCells) nbVtkCells = nbCells;
int nbCellTemp = nbVtkCells;
if (nbCells > nbVtkCells) nbCellTemp = nbCells;
vector<int> idCellsOldToNew;
idCellsOldToNew.clear();
idCellsOldToNew.resize(nbVtkCells, -1); // all unused id will be -1
idCellsOldToNew.resize(nbCellTemp, -1); // all unused id will be -1
for (int i=0; i<nbCells; i++)
{
@ -1830,20 +1834,20 @@ void SMESHDS_Mesh::compactMesh()
if (areNodesModified)
{
MESSAGE("-------------- modify myNodes");
SetOfNodes newNodes;
newNodes.resize(newNodeSize);
for (int i=0; i<nbNodes; i++)
{
if (myNodes[i])
{
int newid = idNodesOldToNew[i];
if (newid != i)
{
MESSAGE(i << " --> " << newid);
myNodes[i]->setId(newid);
ASSERT(!myNodes[newid]);
myNodes[newid] = myNodes[i];
}
//MESSAGE(i << " --> " << newid);;
myNodes[i]->setId(newid);
newNodes[newid] = myNodes[i];
}
}
myNodes.swap(newNodes);
this->myNodeIDFactory->emptyPool(newNodeSize);
}
@ -1882,6 +1886,7 @@ void SMESHDS_Mesh::compactMesh()
{
if (myCells[i])
{
//MESSAGE(newSmdsId << " " << i);
newCells[newSmdsId] = myCells[i];
int idvtk = myCells[i]->getVtkId();
newSmdsToVtk[newSmdsId] = idvtk;

View File

@ -1093,6 +1093,7 @@ LightApp_Module( "SMESH" )
{
CORBA::Boolean anIsEmbeddedMode;
myComponentSMESH = SMESH_Client::GetSMESHGen(getApp()->orb(),anIsEmbeddedMode);
MESSAGE("-------------------------------> anIsEmbeddedMode=" << anIsEmbeddedMode);
// 0019923: EDF 765 SMESH : default values of hypothesis
SUIT_ResourceMgr* aResourceMgr = SMESH::GetResourceMgr(this);

View File

@ -326,7 +326,7 @@ namespace SMESH
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
OCC_CATCH_SIGNALS;
#endif
MESSAGE("GetVisualObj");
//MESSAGE("GetVisualObj");
if (nulData)
objModified = aVisualObj->NulData();
else
@ -669,7 +669,7 @@ namespace SMESH
bool UpdateView(SUIT_ViewWindow *theWnd, EDisplaing theAction, const char* theEntry)
{
MESSAGE("UpdateView");
//MESSAGE("UpdateView");
bool OK = false;
SVTK_ViewWindow* aViewWnd = GetVtkViewWindow(theWnd);
if (!aViewWnd)
@ -694,10 +694,10 @@ namespace SMESH
}
case eDisplayOnly:
case eEraseAll: {
MESSAGE("---case eDisplayOnly");
//MESSAGE("---case eDisplayOnly");
while (vtkActor *anAct = aCollection->GetNextActor()) {
if (SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)) {
MESSAGE("--- erase " << anActor);
//MESSAGE("--- erase " << anActor);
anActor->SetVisibility(false);
}
}
@ -707,12 +707,12 @@ namespace SMESH
switch (theAction) {
case eDisplay:
case eDisplayOnly:
MESSAGE("--- display " << anActor);
//MESSAGE("--- display " << anActor);
anActor->SetVisibility(true);
if (theAction == eDisplayOnly) aRenderer->ResetCameraClippingRange();
break;
case eErase:
MESSAGE("--- erase " << anActor);
//MESSAGE("--- erase " << anActor);
anActor->SetVisibility(false);
break;
}
@ -721,7 +721,7 @@ namespace SMESH
case eDisplay:
case eDisplayOnly:
{
MESSAGE("---");
//MESSAGE("---");
SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(theWnd->getViewManager()->study());
_PTR(Study) aDocument = aStudy->studyDS();
// Pass non-visual objects (hypotheses, etc.), return true in this case
@ -750,7 +750,7 @@ namespace SMESH
bool UpdateView(EDisplaing theAction, const char* theEntry){
MESSAGE("UpdateView");
//MESSAGE("UpdateView");
SalomeApp_Study* aStudy = dynamic_cast< SalomeApp_Study* >( GetActiveStudy() );
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( aStudy->application() );
SUIT_ViewWindow *aWnd = app->activeViewManager()->getActiveView();

View File

@ -459,6 +459,7 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::createMesh()
// create a new mesh object servant, store it in a map in study context
SMESH_Mesh_i* meshServant = new SMESH_Mesh_i( GetPOA(), this, GetCurrentStudyID() );
// create a new mesh object
MESSAGE("myIsEmbeddedMode " << myIsEmbeddedMode);
meshServant->SetImpl( myGen.CreateMesh( GetCurrentStudyID(), myIsEmbeddedMode ));
// activate the CORBA servant of Mesh
@ -516,6 +517,7 @@ void SMESH_Gen_i::SetGeomEngine( GEOM::GEOM_Gen_ptr geomcompo )
void SMESH_Gen_i::SetEmbeddedMode( CORBA::Boolean theMode )
{
myIsEmbeddedMode = theMode;
MESSAGE("myIsEmbeddedMode " << myIsEmbeddedMode);
if ( !myIsEmbeddedMode ) {
//PAL10867: disable signals catching with "noexcepthandler" option