PR: display submeshes and groups

This commit is contained in:
prascle 2010-05-14 12:30:48 +00:00
parent e3214b68d2
commit 8c1dfe2d90
5 changed files with 335 additions and 286 deletions

View File

@ -134,6 +134,7 @@ SMESH_VisualObjDef::SMESH_VisualObjDef()
{ {
MESSAGE("---------------------------------------------SMESH_VisualObjDef::SMESH_VisualObjDef"); MESSAGE("---------------------------------------------SMESH_VisualObjDef::SMESH_VisualObjDef");
myGrid = vtkUnstructuredGrid::New(); myGrid = vtkUnstructuredGrid::New();
myLocalGrid = false;
} }
SMESH_VisualObjDef::~SMESH_VisualObjDef() SMESH_VisualObjDef::~SMESH_VisualObjDef()
{ {
@ -149,29 +150,41 @@ SMESH_VisualObjDef::~SMESH_VisualObjDef()
//================================================================================= //=================================================================================
vtkIdType SMESH_VisualObjDef::GetNodeObjId( int theVTKID ) vtkIdType SMESH_VisualObjDef::GetNodeObjId( int theVTKID )
{ {
// TMapOfIds::const_iterator i = myVTK2SMDSNodes.find(theVTKID); if (myLocalGrid)
// return i == myVTK2SMDSNodes.end() ? -1 : i->second; {
TMapOfIds::const_iterator i = myVTK2SMDSNodes.find(theVTKID);
return i == myVTK2SMDSNodes.end() ? -1 : i->second;
}
return theVTKID; return theVTKID;
} }
vtkIdType SMESH_VisualObjDef::GetNodeVTKId( int theObjID ) vtkIdType SMESH_VisualObjDef::GetNodeVTKId( int theObjID )
{ {
// TMapOfIds::const_iterator i = mySMDS2VTKNodes.find(theObjID); if (myLocalGrid)
// return i == mySMDS2VTKNodes.end() ? -1 : i->second; {
TMapOfIds::const_iterator i = mySMDS2VTKNodes.find(theObjID);
return i == mySMDS2VTKNodes.end() ? -1 : i->second;
}
return theObjID; return theObjID;
} }
vtkIdType SMESH_VisualObjDef::GetElemObjId( int theVTKID ) vtkIdType SMESH_VisualObjDef::GetElemObjId( int theVTKID )
{ {
// TMapOfIds::const_iterator i = myVTK2SMDSElems.find(theVTKID); if (myLocalGrid)
// return i == myVTK2SMDSElems.end() ? -1 : i->second; {
TMapOfIds::const_iterator i = myVTK2SMDSElems.find(theVTKID);
return i == myVTK2SMDSElems.end() ? -1 : i->second;
}
return this->GetMesh()->fromVtkToSmds(theVTKID); return this->GetMesh()->fromVtkToSmds(theVTKID);
} }
vtkIdType SMESH_VisualObjDef::GetElemVTKId( int theObjID ) vtkIdType SMESH_VisualObjDef::GetElemVTKId( int theObjID )
{ {
// TMapOfIds::const_iterator i = mySMDS2VTKElems.find(theObjID); if (myLocalGrid)
// return i == mySMDS2VTKElems.end() ? -1 : i->second; {
TMapOfIds::const_iterator i = mySMDS2VTKElems.find(theObjID);
return i == mySMDS2VTKElems.end() ? -1 : i->second;
}
return this->GetMesh()->fromSmdsToVtk(theObjID); return this->GetMesh()->fromSmdsToVtk(theObjID);
} }
@ -179,72 +192,83 @@ vtkIdType SMESH_VisualObjDef::GetElemVTKId( int theObjID )
// function : SMESH_VisualObjDef::createPoints // function : SMESH_VisualObjDef::createPoints
// purpose : Create points from nodes // purpose : Create points from nodes
//================================================================================= //=================================================================================
/*! fills a vtkPoints structure for a submesh.
* fills a std::list of SMDS_MeshElements*, then extract the points.
* fills also conversion id maps between SMDS and VTK.
*/
void SMESH_VisualObjDef::createPoints( vtkPoints* thePoints )
{
if ( thePoints == 0 )
return;
//void SMESH_VisualObjDef::createPoints( vtkPoints* thePoints ) TEntityList aNodes;
//{ vtkIdType nbNodes = GetEntities( SMDSAbs_Node, aNodes );
// if ( thePoints == 0 ) thePoints->SetNumberOfPoints( nbNodes );
// return;
// int nbPoints = 0;
// TEntityList aNodes;
// vtkIdType nbNodes = GetEntities( SMDSAbs_Node, aNodes ); TEntityList::const_iterator anIter;
// thePoints->SetNumberOfPoints( nbNodes ); for ( anIter = aNodes.begin(); anIter != aNodes.end(); ++anIter )
// {
// int nbPoints = 0; const SMDS_MeshNode* aNode = ( const SMDS_MeshNode* )(*anIter);
// if ( aNode != 0 )
// TEntityList::const_iterator anIter; {
// for ( anIter = aNodes.begin(); anIter != aNodes.end(); ++anIter ) thePoints->SetPoint( nbPoints, aNode->X(), aNode->Y(), aNode->Z() );
// { int anId = aNode->GetID();
// const SMDS_MeshNode* aNode = ( const SMDS_MeshNode* )(*anIter); mySMDS2VTKNodes.insert( TMapOfIds::value_type( anId, nbPoints ) );
// if ( aNode != 0 ) myVTK2SMDSNodes.insert( TMapOfIds::value_type( nbPoints, anId ) );
// { nbPoints++;
// thePoints->SetPoint( nbPoints, aNode->X(), aNode->Y(), aNode->Z() ); }
// int anId = aNode->GetID(); }
// mySMDS2VTKNodes.insert( TMapOfIds::value_type( anId, nbPoints ) );
// myVTK2SMDSNodes.insert( TMapOfIds::value_type( nbPoints, anId ) ); if ( nbPoints != nbNodes )
// nbPoints++; thePoints->SetNumberOfPoints( nbPoints );
// } }
// }
//
// if ( nbPoints != nbNodes )
// thePoints->SetNumberOfPoints( nbPoints );
//}
//================================================================================= //=================================================================================
// function : buildPrs // function : buildPrs
// purpose : create VTK cells( fill unstructured grid ) // purpose : create VTK cells( fill unstructured grid )
//================================================================================= //=================================================================================
void SMESH_VisualObjDef::buildPrs() void SMESH_VisualObjDef::buildPrs(bool buildGrid)
{ {
// try MESSAGE("----------------------------------------------------------SMESH_VisualObjDef::buildPrs " << buildGrid);
// { if (buildGrid)
// mySMDS2VTKNodes.clear(); {
// myVTK2SMDSNodes.clear(); myLocalGrid = true;
// mySMDS2VTKElems.clear(); try
// myVTK2SMDSElems.clear(); {
// mySMDS2VTKNodes.clear();
// if ( IsNodePrs() ) myVTK2SMDSNodes.clear();
// buildNodePrs(); mySMDS2VTKElems.clear();
// else myVTK2SMDSElems.clear();
// buildElemPrs();
// } if ( IsNodePrs() )
// catch(...) buildNodePrs();
// { else
// mySMDS2VTKNodes.clear(); buildElemPrs();
// myVTK2SMDSNodes.clear(); }
// mySMDS2VTKElems.clear(); catch(...)
// myVTK2SMDSElems.clear(); {
// mySMDS2VTKNodes.clear();
// myGrid->SetPoints( 0 ); myVTK2SMDSNodes.clear();
// myGrid->SetCells( 0, 0, 0 ); mySMDS2VTKElems.clear();
// throw; myVTK2SMDSElems.clear();
// }
MESSAGE("----------------------------------------------------------SMESH_VisualObjDef::buildPrs"); myGrid->SetPoints( 0 );
myGrid->SetCells( 0, 0, 0 );
throw;
}
}
else
{
myLocalGrid = false;
vtkUnstructuredGrid *theGrid = GetMesh()->getGrid(); vtkUnstructuredGrid *theGrid = GetMesh()->getGrid();
myGrid->ShallowCopy(theGrid); myGrid->ShallowCopy(theGrid);
MESSAGE(myGrid->GetReferenceCount()); MESSAGE(myGrid->GetReferenceCount());
MESSAGE( "Update - myGrid->GetNumberOfCells() = "<<myGrid->GetNumberOfCells() ); MESSAGE( "Update - myGrid->GetNumberOfCells() = "<<myGrid->GetNumberOfCells() );
MESSAGE( "Update - myGrid->GetNumberOfPoints() = "<<myGrid->GetNumberOfPoints() ); MESSAGE( "Update - myGrid->GetNumberOfPoints() = "<<myGrid->GetNumberOfPoints() );
if( MYDEBUGWITHFILES ) SMESH::WriteUnstructuredGrid( myGrid,"/tmp/buildPrs" ); if( MYDEBUGWITHFILES ) SMESH::WriteUnstructuredGrid( myGrid,"/tmp/buildPrs" );
}
} }
//================================================================================= //=================================================================================
@ -252,19 +276,19 @@ void SMESH_VisualObjDef::buildPrs()
// purpose : create VTK cells for nodes // purpose : create VTK cells for nodes
//================================================================================= //=================================================================================
//void SMESH_VisualObjDef::buildNodePrs() void SMESH_VisualObjDef::buildNodePrs()
//{ {
// // PAL16631: without swap, bad_alloc is not thrown but hung up and crash instead, // PAL16631: without swap, bad_alloc is not thrown but hung up and crash instead,
// // so check remaining memory size for safety // so check remaining memory size for safety
// SMDS_Mesh::CheckMemory(); // PAL16631 // SMDS_Mesh::CheckMemory(); // PAL16631
// vtkPoints* aPoints = vtkPoints::New(); vtkPoints* aPoints = vtkPoints::New();
// createPoints( aPoints ); createPoints( aPoints );
// SMDS_Mesh::CheckMemory(); // SMDS_Mesh::CheckMemory();
// myGrid->SetPoints( aPoints ); myGrid->SetPoints( aPoints );
// aPoints->Delete(); aPoints->Delete();
//
// myGrid->SetCells( 0, 0, 0 ); myGrid->SetCells( 0, 0, 0 );
//} }
//================================================================================= //=================================================================================
// function : buildElemPrs // function : buildElemPrs
@ -296,199 +320,199 @@ namespace{
} }
//void SMESH_VisualObjDef::buildElemPrs() void SMESH_VisualObjDef::buildElemPrs()
//{ {
// // Create points // Create points
//
// vtkPoints* aPoints = vtkPoints::New(); vtkPoints* aPoints = vtkPoints::New();
// createPoints( aPoints ); createPoints( aPoints );
// myGrid->SetPoints( aPoints ); myGrid->SetPoints( aPoints );
// aPoints->Delete(); aPoints->Delete();
//
// if ( MYDEBUG ) if ( MYDEBUG )
// MESSAGE("Update - myGrid->GetNumberOfPoints() = "<<myGrid->GetNumberOfPoints()); MESSAGE("Update - myGrid->GetNumberOfPoints() = "<<myGrid->GetNumberOfPoints());
//
// // Calculate cells size // Calculate cells size
//
// static SMDSAbs_ElementType aTypes[ 4 ] = static SMDSAbs_ElementType aTypes[ 4 ] =
// { SMDSAbs_0DElement, SMDSAbs_Edge, SMDSAbs_Face, SMDSAbs_Volume }; { SMDSAbs_0DElement, SMDSAbs_Edge, SMDSAbs_Face, SMDSAbs_Volume };
//
// // get entity data // get entity data
// map<SMDSAbs_ElementType,int> nbEnts; map<SMDSAbs_ElementType,int> nbEnts;
// map<SMDSAbs_ElementType,TEntityList> anEnts; map<SMDSAbs_ElementType,TEntityList> anEnts;
//
// for ( int i = 0; i <= 3; i++ ) for ( int i = 0; i <= 3; i++ )
// nbEnts[ aTypes[ i ] ] = GetEntities( aTypes[ i ], anEnts[ aTypes[ i ] ] ); nbEnts[ aTypes[ i ] ] = GetEntities( aTypes[ i ], anEnts[ aTypes[ i ] ] );
//
// // PAL16631: without swap, bad_alloc is not thrown but hung up and crash instead, // PAL16631: without swap, bad_alloc is not thrown but hung up and crash instead,
// // so check remaining memory size for safety // so check remaining memory size for safety
// SMDS_Mesh::CheckMemory(); // PAL16631 // SMDS_Mesh::CheckMemory(); // PAL16631
//
// vtkIdType aCellsSize = 2 * nbEnts[ SMDSAbs_0DElement ] + 3 * nbEnts[ SMDSAbs_Edge ]; vtkIdType aCellsSize = 2 * nbEnts[ SMDSAbs_0DElement ] + 3 * nbEnts[ SMDSAbs_Edge ];
//
// for ( int i = 2; i <= 3; i++ ) // iterate through faces and volumes for ( int i = 2; i <= 3; i++ ) // iterate through faces and volumes
// { {
// if ( nbEnts[ aTypes[ i ] ] ) if ( nbEnts[ aTypes[ i ] ] )
// { {
// const TEntityList& aList = anEnts[ aTypes[ i ] ]; const TEntityList& aList = anEnts[ aTypes[ i ] ];
// TEntityList::const_iterator anIter; TEntityList::const_iterator anIter;
// for ( anIter = aList.begin(); anIter != aList.end(); ++anIter ) for ( anIter = aList.begin(); anIter != aList.end(); ++anIter )
// aCellsSize += (*anIter)->NbNodes() + 1; aCellsSize += (*anIter)->NbNodes() + 1;
// } }
// } }
//
// vtkIdType aNbCells = nbEnts[ SMDSAbs_0DElement ] + nbEnts[ SMDSAbs_Edge ] + vtkIdType aNbCells = nbEnts[ SMDSAbs_0DElement ] + nbEnts[ SMDSAbs_Edge ] +
// nbEnts[ SMDSAbs_Face ] + nbEnts[ SMDSAbs_Volume ]; nbEnts[ SMDSAbs_Face ] + nbEnts[ SMDSAbs_Volume ];
//
// if ( MYDEBUG ) if ( MYDEBUG )
// MESSAGE( "Update - aNbCells = "<<aNbCells<<"; aCellsSize = "<<aCellsSize ); MESSAGE( "Update - aNbCells = "<<aNbCells<<"; aCellsSize = "<<aCellsSize );
//
// // Create cells // Create cells
//
// vtkCellArray* aConnectivity = vtkCellArray::New(); vtkCellArray* aConnectivity = vtkCellArray::New();
// aConnectivity->Allocate( aCellsSize, 0 ); aConnectivity->Allocate( aCellsSize, 0 );
//
// SMDS_Mesh::CheckMemory(); // PAL16631 // SMDS_Mesh::CheckMemory(); // PAL16631
//
// vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New(); vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
// aCellTypesArray->SetNumberOfComponents( 1 ); aCellTypesArray->SetNumberOfComponents( 1 );
// aCellTypesArray->Allocate( aNbCells * aCellTypesArray->GetNumberOfComponents() ); aCellTypesArray->Allocate( aNbCells * aCellTypesArray->GetNumberOfComponents() );
//
// SMDS_Mesh::CheckMemory(); // PAL16631 // SMDS_Mesh::CheckMemory(); // PAL16631
//
// vtkIdList *anIdList = vtkIdList::New(); vtkIdList *anIdList = vtkIdList::New();
// vtkIdType iElem = 0; vtkIdType iElem = 0;
//
// TConnect aConnect; TConnect aConnect;
// aConnect.reserve(VTK_CELL_SIZE); aConnect.reserve(VTK_CELL_SIZE);
//
// SMDS_Mesh::CheckMemory(); // PAL16631 // SMDS_Mesh::CheckMemory(); // PAL16631
//
// for ( int i = 0; i <= 3; i++ ) // iterate through 0d elements, edges, faces and volumes for ( int i = 0; i <= 3; i++ ) // iterate through 0d elements, edges, faces and volumes
// { {
// if ( nbEnts[ aTypes[ i ] ] > 0 ) if ( nbEnts[ aTypes[ i ] ] > 0 )
// { {
// const SMDSAbs_ElementType& aType = aTypes[ i ]; const SMDSAbs_ElementType& aType = aTypes[ i ];
// const TEntityList& aList = anEnts[ aType ]; const TEntityList& aList = anEnts[ aType ];
// TEntityList::const_iterator anIter; TEntityList::const_iterator anIter;
// for ( anIter = aList.begin(); anIter != aList.end(); ++anIter ) for ( anIter = aList.begin(); anIter != aList.end(); ++anIter )
// { {
// const SMDS_MeshElement* anElem = *anIter; const SMDS_MeshElement* anElem = *anIter;
//
// vtkIdType aNbNodes = anElem->NbNodes(); vtkIdType aNbNodes = anElem->NbNodes();
// anIdList->SetNumberOfIds( aNbNodes ); anIdList->SetNumberOfIds( aNbNodes );
//
// int anId = anElem->GetID(); int anId = anElem->GetID();
//
// mySMDS2VTKElems.insert( TMapOfIds::value_type( anId, iElem ) ); mySMDS2VTKElems.insert( TMapOfIds::value_type( anId, iElem ) );
// myVTK2SMDSElems.insert( TMapOfIds::value_type( iElem, anId ) ); myVTK2SMDSElems.insert( TMapOfIds::value_type( iElem, anId ) );
//
// SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator(); SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
// switch (aType) { switch (aType) {
// case SMDSAbs_Volume:{ case SMDSAbs_Volume:{
// aConnect.clear(); aConnect.clear();
// std::vector<int> aConnectivities; std::vector<int> aConnectivities;
// // Convertions connectivities from SMDS to VTK // Convertions connectivities from SMDS to VTK
// if (anElem->IsPoly() && aNbNodes > 3) { // POLYEDRE if (anElem->IsPoly() && aNbNodes > 3) { // POLYEDRE
//
// if ( const SMDS_PolyhedralVolumeOfNodes* ph = if ( const SMDS_PolyhedralVolumeOfNodes* ph =
// dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*> (anElem)) dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*> (anElem))
// { {
// aNbNodes = GetConnect(ph->uniqueNodesIterator(),aConnect); aNbNodes = GetConnect(ph->uniqueNodesIterator(),aConnect);
// anIdList->SetNumberOfIds( aNbNodes ); anIdList->SetNumberOfIds( aNbNodes );
// } }
// for (int k = 0; k < aNbNodes; k++) for (int k = 0; k < aNbNodes; k++)
// aConnectivities.push_back(k); aConnectivities.push_back(k);
//
// } else if (aNbNodes == 4) { } else if (aNbNodes == 4) {
// static int anIds[] = {0,2,1,3}; static int anIds[] = {0,2,1,3};
// for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]); for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
//
// } else if (aNbNodes == 5) { } else if (aNbNodes == 5) {
// static int anIds[] = {0,3,2,1,4}; static int anIds[] = {0,3,2,1,4};
// for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]); for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
//
// } else if (aNbNodes == 6) { } else if (aNbNodes == 6) {
// static int anIds[] = {0,1,2,3,4,5}; static int anIds[] = {0,1,2,3,4,5};
// for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]); for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
//
// } }
// else if (aNbNodes == 8) { else if (aNbNodes == 8) {
// static int anIds[] = {0,3,2,1,4,7,6,5}; static int anIds[] = {0,3,2,1,4,7,6,5};
// for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]); for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
//
// } }
// else if (aNbNodes == 10) { else if (aNbNodes == 10) {
// static int anIds[] = {0,2,1,3,6,5,4,7,9,8}; static int anIds[] = {0,2,1,3,6,5,4,7,9,8};
// for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]); for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
// } }
// else if (aNbNodes == 13) { else if (aNbNodes == 13) {
// static int anIds[] = {0,3,2,1,4,8,7,6,5,9,12,11,10}; static int anIds[] = {0,3,2,1,4,8,7,6,5,9,12,11,10};
// for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]); for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
// } }
// else if (aNbNodes == 15) { else if (aNbNodes == 15) {
// //static int anIds[] = {0,2,1,3,5,4,8,7,6,11,10,9,12,14,13}; //static int anIds[] = {0,2,1,3,5,4,8,7,6,11,10,9,12,14,13};
// static int anIds[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14}; static int anIds[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14};
// for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]); for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
// //for (int k = 0; k < aNbNodes; k++) { //for (int k = 0; k < aNbNodes; k++) {
// // int nn = aConnectivities[k]; // int nn = aConnectivities[k];
// // const SMDS_MeshNode* N = static_cast<const SMDS_MeshNode*> (aConnect[nn]); // const SMDS_MeshNode* N = static_cast<const SMDS_MeshNode*> (aConnect[nn]);
// // cout<<"k="<<k<<" N("<<N->X()<<","<<N->Y()<<","<<N->Z()<<")"<<endl; // cout<<"k="<<k<<" N("<<N->X()<<","<<N->Y()<<","<<N->Z()<<")"<<endl;
// //} //}
// } }
// else if (aNbNodes == 20) { else if (aNbNodes == 20) {
// static int anIds[] = {0,3,2,1,4,7,6,5,11,10,9,8,15,14,13,12,16,19,18,17}; static int anIds[] = {0,3,2,1,4,7,6,5,11,10,9,8,15,14,13,12,16,19,18,17};
// for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]); for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
// } }
// else { else {
// } }
//
// if ( aConnect.empty() ) if ( aConnect.empty() )
// GetConnect(aNodesIter,aConnect); GetConnect(aNodesIter,aConnect);
//
// if (aConnectivities.size() > 0) { if (aConnectivities.size() > 0) {
// for (vtkIdType aNodeId = 0; aNodeId < aNbNodes; aNodeId++) for (vtkIdType aNodeId = 0; aNodeId < aNbNodes; aNodeId++)
// SetId(anIdList,mySMDS2VTKNodes,aConnect,aNodeId,aConnectivities[aNodeId]); SetId(anIdList,mySMDS2VTKNodes,aConnect,aNodeId,aConnectivities[aNodeId]);
// } }
// break; break;
// } }
// default: default:
// for( vtkIdType aNodeId = 0; aNodesIter->more(); aNodeId++ ){ for( vtkIdType aNodeId = 0; aNodesIter->more(); aNodeId++ ){
// const SMDS_MeshElement* aNode = aNodesIter->next(); const SMDS_MeshElement* aNode = aNodesIter->next();
// anIdList->SetId( aNodeId, mySMDS2VTKNodes[aNode->GetID()] ); anIdList->SetId( aNodeId, mySMDS2VTKNodes[aNode->GetID()] );
// } }
// } }
//
// aConnectivity->InsertNextCell( anIdList ); aConnectivity->InsertNextCell( anIdList );
// aCellTypesArray->InsertNextValue( getCellType( aType, anElem->IsPoly(), aNbNodes ) ); aCellTypesArray->InsertNextValue( getCellType( aType, anElem->IsPoly(), aNbNodes ) );
//
// iElem++; iElem++;
// } }
// } }
// SMDS_Mesh::CheckMemory(); // PAL16631 // SMDS_Mesh::CheckMemory(); // PAL16631
// } }
//
// // Insert cells in grid // Insert cells in grid
//
// VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New(); VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
// aCellLocationsArray->SetNumberOfComponents( 1 ); aCellLocationsArray->SetNumberOfComponents( 1 );
// aCellLocationsArray->SetNumberOfTuples( aNbCells ); aCellLocationsArray->SetNumberOfTuples( aNbCells );
//
// SMDS_Mesh::CheckMemory(); // PAL16631 // SMDS_Mesh::CheckMemory(); // PAL16631
//
// aConnectivity->InitTraversal(); aConnectivity->InitTraversal();
// for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ ) for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ )
// aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) ); aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
//
// myGrid->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity ); myGrid->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity );
//
// aCellLocationsArray->Delete(); aCellLocationsArray->Delete();
// aCellTypesArray->Delete(); aCellTypesArray->Delete();
// aConnectivity->Delete(); aConnectivity->Delete();
// anIdList->Delete(); anIdList->Delete();
//
// SMDS_Mesh::CheckMemory(); // PAL16631 // SMDS_Mesh::CheckMemory(); // PAL16631
//} }
//================================================================================= //=================================================================================
// function : GetEdgeNodes // function : GetEdgeNodes
@ -587,7 +611,7 @@ SMESH_MeshObj::~SMESH_MeshObj()
bool SMESH_MeshObj::Update( int theIsClear ) bool SMESH_MeshObj::Update( int theIsClear )
{ {
// Update SMDS_Mesh on client part // Update SMDS_Mesh on client part
MESSAGE("SMESH_MeshObj::Update"); MESSAGE("SMESH_MeshObj::Update " << this);
if ( myClient.Update(theIsClear) || GetUnstructuredGrid()->GetNumberOfPoints()==0) { if ( myClient.Update(theIsClear) || GetUnstructuredGrid()->GetNumberOfPoints()==0) {
buildPrs(); // Fill unstructured grid buildPrs(); // Fill unstructured grid
return true; return true;
@ -777,8 +801,9 @@ void SMESH_SubMeshObj::UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunc
//================================================================================= //=================================================================================
bool SMESH_SubMeshObj::Update( int theIsClear ) bool SMESH_SubMeshObj::Update( int theIsClear )
{ {
MESSAGE("SMESH_SubMeshObj::Update " << this)
bool changed = myMeshObj->Update( theIsClear ); bool changed = myMeshObj->Update( theIsClear );
buildPrs(); buildPrs(true);
return changed; return changed;
} }

View File

@ -77,7 +77,7 @@ public:
int& theNodeId1, int& theNodeId1,
int& theNodeId2 ) const; int& theNodeId2 ) const;
virtual vtkUnstructuredGrid* GetUnstructuredGrid(); // { return myGrid; } virtual vtkUnstructuredGrid* GetUnstructuredGrid();
virtual vtkIdType GetNodeObjId( int theVTKID ); virtual vtkIdType GetNodeObjId( int theVTKID );
virtual vtkIdType GetNodeVTKId( int theObjID ); virtual vtkIdType GetNodeVTKId( int theObjID );
@ -86,17 +86,18 @@ public:
protected: protected:
// void createPoints( vtkPoints* ); void createPoints( vtkPoints* );
void buildPrs(); void buildPrs(bool buildGrid = false);
// void buildNodePrs(); void buildNodePrs();
// void buildElemPrs(); void buildElemPrs();
//private: //private:
// TMapOfIds mySMDS2VTKNodes; TMapOfIds mySMDS2VTKNodes;
// TMapOfIds myVTK2SMDSNodes; TMapOfIds myVTK2SMDSNodes;
// TMapOfIds mySMDS2VTKElems; TMapOfIds mySMDS2VTKElems;
// TMapOfIds myVTK2SMDSElems; TMapOfIds myVTK2SMDSElems;
bool myLocalGrid;
vtkUnstructuredGrid* myGrid; vtkUnstructuredGrid* myGrid;
}; };

View File

@ -1,10 +1,14 @@
Problemes en cours Problemes en cours
================== ==================
- a faire
+ en cours, OK mais perfectible
* OK
- visualisation de groupe (type d'element): on voit tout le maillage, mais le groupe est OK + visualisation de groupe (type d'element): on voit tout le maillage, mais le groupe est OK
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 - inversion d'un volume (tetra): exception
- script de creation de noeuds et d'elements: OK, mais pas compatible avec version precedente (numerotation noeuds differente) - 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 (enlever dans vtkUnstructuredGrid) - affichage numeros noeuds: numeros en trop sur (O,0,0) pas systematique, trouver la condition (enlever dans vtkUnstructuredGrid ?)
A tester, non pris en compte A tester, non pris en compte
============================ ============================

View File

@ -1538,7 +1538,10 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
aSel->selectedObjects( sel_objects ); aSel->selectedObjects( sel_objects );
if( theCommandID==302 ) if( theCommandID==302 )
{
MESSAGE("anAction = SMESH::eDisplayOnly");
startOperation( myEraseAll ); startOperation( myEraseAll );
}
extractContainers( sel_objects, to_process ); extractContainers( sel_objects, to_process );
@ -1549,20 +1552,26 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
if (vtkwnd) { if (vtkwnd) {
SALOME_ListIteratorOfListIO It( to_process ); SALOME_ListIteratorOfListIO It( to_process );
for ( ; It.More(); It.Next()) { for ( ; It.More(); It.Next()) {
MESSAGE("---");
Handle(SALOME_InteractiveObject) IOS = It.Value(); Handle(SALOME_InteractiveObject) IOS = It.Value();
if (IOS->hasEntry()) { if (IOS->hasEntry()) {
MESSAGE("---");
if (!SMESH::UpdateView(anAction, IOS->getEntry())) { if (!SMESH::UpdateView(anAction, IOS->getEntry())) {
SMESHGUI::GetSMESHGUI()->EmitSignalVisibilityChanged(); SMESHGUI::GetSMESHGUI()->EmitSignalVisibilityChanged();
break; // PAL16774 (Crash after display of many groups) break; // PAL16774 (Crash after display of many groups)
} }
if (anAction == SMESH::eDisplayOnly) if (anAction == SMESH::eDisplayOnly)
{
MESSAGE("anAction = SMESH::eDisplayOnly");
anAction = SMESH::eDisplay; anAction = SMESH::eDisplay;
} }
} }
} }
}
// PAL13338 + PAL15161 --> // PAL13338 + PAL15161 -->
if ( ( theCommandID==301 || theCommandID==302 ) && !checkLock(aStudy)) { if ( ( theCommandID==301 || theCommandID==302 ) && !checkLock(aStudy)) {
MESSAGE("anAction = SMESH::eDisplayOnly");
SMESH::UpdateView(); SMESH::UpdateView();
SMESHGUI::GetSMESHGUI()->EmitSignalVisibilityChanged(); SMESHGUI::GetSMESHGUI()->EmitSignalVisibilityChanged();
} }
@ -1573,6 +1582,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
} }
if (anAction == SMESH::eErase) { if (anAction == SMESH::eErase) {
MESSAGE("anAction == SMESH::eErase");
SALOME_ListIO l1; SALOME_ListIO l1;
aSel->setSelectedObjects( l1 ); aSel->setSelectedObjects( l1 );
} }

View File

@ -603,6 +603,7 @@ namespace SMESH
} }
} }
} }
MESSAGE("CreateActor " << anActor);
return anActor; return anActor;
} }
@ -613,6 +614,7 @@ namespace SMESH
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
OCC_CATCH_SIGNALS; OCC_CATCH_SIGNALS;
#endif #endif
MESSAGE("DisplayActor " << theActor);
vtkWnd->AddActor(theActor); vtkWnd->AddActor(theActor);
vtkWnd->Repaint(); vtkWnd->Repaint();
} }
@ -628,6 +630,7 @@ namespace SMESH
void RemoveActor( SUIT_ViewWindow *theWnd, SMESH_Actor* theActor){ void RemoveActor( SUIT_ViewWindow *theWnd, SMESH_Actor* theActor){
if(SVTK_ViewWindow* vtkWnd = GetVtkViewWindow(theWnd)){ if(SVTK_ViewWindow* vtkWnd = GetVtkViewWindow(theWnd)){
MESSAGE("RemoveActor " << theActor);
vtkWnd->RemoveActor(theActor); vtkWnd->RemoveActor(theActor);
if(theActor->hasIO()){ if(theActor->hasIO()){
Handle(SALOME_InteractiveObject) anIO = theActor->getIO(); Handle(SALOME_InteractiveObject) anIO = theActor->getIO();
@ -683,6 +686,7 @@ namespace SMESH
case eDisplayAll: { case eDisplayAll: {
while (vtkActor *anAct = aCollection->GetNextActor()) { while (vtkActor *anAct = aCollection->GetNextActor()) {
if (SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)) { if (SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)) {
MESSAGE("--- display " << anActor);
anActor->SetVisibility(true); anActor->SetVisibility(true);
} }
} }
@ -690,8 +694,10 @@ namespace SMESH
} }
case eDisplayOnly: case eDisplayOnly:
case eEraseAll: { case eEraseAll: {
MESSAGE("---case eDisplayOnly");
while (vtkActor *anAct = aCollection->GetNextActor()) { while (vtkActor *anAct = aCollection->GetNextActor()) {
if (SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)) { if (SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)) {
MESSAGE("--- erase " << anActor);
anActor->SetVisibility(false); anActor->SetVisibility(false);
} }
} }
@ -701,10 +707,12 @@ namespace SMESH
switch (theAction) { switch (theAction) {
case eDisplay: case eDisplay:
case eDisplayOnly: case eDisplayOnly:
MESSAGE("--- display " << anActor);
anActor->SetVisibility(true); anActor->SetVisibility(true);
if (theAction == eDisplayOnly) aRenderer->ResetCameraClippingRange(); if (theAction == eDisplayOnly) aRenderer->ResetCameraClippingRange();
break; break;
case eErase: case eErase:
MESSAGE("--- erase " << anActor);
anActor->SetVisibility(false); anActor->SetVisibility(false);
break; break;
} }
@ -713,6 +721,7 @@ namespace SMESH
case eDisplay: case eDisplay:
case eDisplayOnly: case eDisplayOnly:
{ {
MESSAGE("---");
SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(theWnd->getViewManager()->study()); SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(theWnd->getViewManager()->study());
_PTR(Study) aDocument = aStudy->studyDS(); _PTR(Study) aDocument = aStudy->studyDS();
// Pass non-visual objects (hypotheses, etc.), return true in this case // Pass non-visual objects (hypotheses, etc.), return true in this case