23315: [CEA 1929] Too much memory used to display a mesh in shading and wireframe

This commit is contained in:
eap 2016-10-24 18:07:46 +03:00
parent 0bd9fcdbe7
commit eef0bf5cc7
20 changed files with 348 additions and 222 deletions

View File

@ -26,23 +26,23 @@
// Module : SMESH // Module : SMESH
#include "SMESH_ActorDef.h" #include "SMESH_ActorDef.h"
#include "SMDS_UnstructuredGrid.hxx"
#include "SMESH_ActorUtils.h" #include "SMESH_ActorUtils.h"
#include "SMESH_CellLabelActor.h"
#include "SMESH_ControlsDef.hxx"
#include "SMESH_DeviceActor.h" #include "SMESH_DeviceActor.h"
#include "SMESH_NodeLabelActor.h" #include "SMESH_NodeLabelActor.h"
#include "SMESH_CellLabelActor.h"
#include "SMESH_ObjectDef.h" #include "SMESH_ObjectDef.h"
#include "SMESH_ControlsDef.hxx"
#include "SMDS_UnstructuredGrid.hxx"
#include "SMESH_ScalarBarActor.h"
#include "VTKViewer_ExtractUnstructuredGrid.h"
#include "VTKViewer_FramedTextActor.h"
#include "SALOME_InteractiveObject.hxx"
#include "SMESH_SVTKActor.h" #include "SMESH_SVTKActor.h"
#include "SMESH_ScalarBarActor.h"
#include "SUIT_Session.h"
#include "SUIT_ResourceMgr.h"
#include <Qtx.h> #include <Qtx.h>
#include <SALOME_InteractiveObject.hxx>
#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
#include <VTKViewer_ExtractUnstructuredGrid.h>
#include <VTKViewer_FramedTextActor.h>
#ifndef DISABLE_PLOT2DVIEWER #ifndef DISABLE_PLOT2DVIEWER
#include <SPlot2d_Histogram.h> #include <SPlot2d_Histogram.h>
@ -117,6 +117,9 @@ SMESH_Actor* SMESH_Actor::New(TVisualObjPtr theVisualObj,
SMESH_ActorDef::SMESH_ActorDef() SMESH_ActorDef::SMESH_ActorDef()
{ {
if(MYDEBUG) MESSAGE("SMESH_ActorDef - "<<this); if(MYDEBUG) MESSAGE("SMESH_ActorDef - "<<this);
SALOME_Actor::SetVisibility(false); // avoid update of pipelines
myBaseActor = SMESH_DeviceActor::New(); myBaseActor = SMESH_DeviceActor::New();
myTimeStamp = vtkTimeStamp::New(); myTimeStamp = vtkTimeStamp::New();
@ -1134,6 +1137,13 @@ int SMESH_ActorDef::GetNumberControlEntities()
void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer) void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer)
{ {
if ( !mySelector || !mySelector->IsSelectionEnabled() )
{
myBaseActor->SetUnstructuredGrid( NULL );
myHighlitableActor->SetUnstructuredGrid( NULL );
// theRenderer->AddActor(this);
// cout << "SMESH_ActorDef " << this << endl;
}
theRenderer->AddActor(myBaseActor); theRenderer->AddActor(myBaseActor);
theRenderer->AddActor(myNodeExtActor); theRenderer->AddActor(myNodeExtActor);
theRenderer->AddActor(my1DExtActor); theRenderer->AddActor(my1DExtActor);
@ -1274,7 +1284,9 @@ bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
double* SMESH_ActorDef::GetBounds() double* SMESH_ActorDef::GetBounds()
{ {
if ( GetNumberOfClippingPlanes() + myPlaneCollection->GetNumberOfItems() > 0 )
return myNodeActor->GetBounds(); return myNodeActor->GetBounds();
return myVisualObj->GetUnstructuredGrid()->GetPoints()->GetBounds();
} }
@ -1603,17 +1615,29 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode)
myBaseActor->myGeomFilter->SetInside(myEntityMode != myEntityState); myBaseActor->myGeomFilter->SetInside(myEntityMode != myEntityState);
myEntityMode = theMode; myEntityMode = theMode;
VTKViewer_ExtractUnstructuredGrid* aFilter = NULL;
aFilter = myBaseActor->GetExtractUnstructuredGrid();
aFilter->ClearRegisteredCellsWithType();
aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
VTKViewer_ExtractUnstructuredGrid* aFilter = myBaseActor->GetExtractUnstructuredGrid();
aFilter->ClearRegisteredCellsWithType();
VTKViewer_ExtractUnstructuredGrid* aHightFilter = myHighlitableActor->GetExtractUnstructuredGrid(); VTKViewer_ExtractUnstructuredGrid* aHightFilter = myHighlitableActor->GetExtractUnstructuredGrid();
aHightFilter->ClearRegisteredCellsWithType(); aHightFilter->ClearRegisteredCellsWithType();
bool isPassAll =
(( myEntityMode & e0DElements || myVisualObj->GetNbEntities(SMDSAbs_0DElement) == 0 ) &&
( myEntityMode & eBallElem || myVisualObj->GetNbEntities(SMDSAbs_Ball) == 0 ) &&
( myEntityMode & eEdges || myVisualObj->GetNbEntities(SMDSAbs_Edge) == 0 ) &&
( myEntityMode & eFaces || myVisualObj->GetNbEntities(SMDSAbs_Face) == 0 ) &&
( myEntityMode & eVolumes || myVisualObj->GetNbEntities(SMDSAbs_Volume) == 0 ));
if ( isPassAll && myEntityMode )
{
aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::ePassAll);
aHightFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::ePassAll);
}
else
{
aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
aHightFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding); aHightFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
if (myEntityMode & e0DElements) { if (myEntityMode & e0DElements) {
if (MYDEBUG) MESSAGE("0D ELEMENTS");
aFilter->RegisterCellsWithType(VTK_VERTEX); aFilter->RegisterCellsWithType(VTK_VERTEX);
aHightFilter->RegisterCellsWithType(VTK_VERTEX); aHightFilter->RegisterCellsWithType(VTK_VERTEX);
} }
@ -1623,7 +1647,6 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode)
} }
if (myEntityMode & eEdges) { if (myEntityMode & eEdges) {
if (MYDEBUG) MESSAGE("EDGES");
aFilter->RegisterCellsWithType(VTK_LINE); aFilter->RegisterCellsWithType(VTK_LINE);
aFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE); aFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE);
@ -1632,7 +1655,6 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode)
} }
if (myEntityMode & eFaces) { if (myEntityMode & eFaces) {
if (MYDEBUG) MESSAGE("FACES");
aFilter->RegisterCellsWithType(VTK_TRIANGLE); aFilter->RegisterCellsWithType(VTK_TRIANGLE);
aFilter->RegisterCellsWithType(VTK_QUAD); aFilter->RegisterCellsWithType(VTK_QUAD);
aFilter->RegisterCellsWithType(VTK_POLYGON); aFilter->RegisterCellsWithType(VTK_POLYGON);
@ -1653,7 +1675,6 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode)
} }
if (myEntityMode & eVolumes) { if (myEntityMode & eVolumes) {
if (MYDEBUG) MESSAGE("VOLUMES");
aFilter->RegisterCellsWithType(VTK_TETRA); aFilter->RegisterCellsWithType(VTK_TETRA);
aFilter->RegisterCellsWithType(VTK_VOXEL); aFilter->RegisterCellsWithType(VTK_VOXEL);
aFilter->RegisterCellsWithType(VTK_HEXAHEDRON); aFilter->RegisterCellsWithType(VTK_HEXAHEDRON);
@ -1682,6 +1703,8 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode)
aHightFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET); aHightFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET);
aHightFilter->RegisterCellsWithType(VTK_POLYHEDRON); aHightFilter->RegisterCellsWithType(VTK_POLYHEDRON);
} }
}
if ( GetVisibility() )
aFilter->Update(); aFilter->Update();
if (MYDEBUG) MESSAGE(aFilter->GetOutput()->GetNumberOfCells()); if (MYDEBUG) MESSAGE(aFilter->GetOutput()->GetNumberOfCells());
SetVisibility(GetVisibility(),false); SetVisibility(GetVisibility(),false);
@ -1835,6 +1858,11 @@ void SMESH_ActorDef::UpdateHighlight()
case SMESH_DeviceActor::eSurface: case SMESH_DeviceActor::eSurface:
case SMESH_DeviceActor::eWireframe: case SMESH_DeviceActor::eWireframe:
{ {
// if ( !mySelector || !mySelector->IsSelectionEnabled() )
// myHighlitableActor->SetUnstructuredGrid( NULL );
// else if ( !myHighlitableActor->myExtractUnstructuredGrid->GetInput() )
// myHighlitableActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
if(myIsHighlighted) { if(myIsHighlighted) {
myHighlitableActor->SetProperty(myHighlightProp); myHighlitableActor->SetProperty(myHighlightProp);
}else if(myIsPreselected){ }else if(myIsPreselected){
@ -1868,6 +1896,24 @@ void SMESH_ActorDef::UpdateHighlight()
} }
} }
void SMESH_ActorDef::EnableSelection( bool enable )
{
// selection in the Viewer enabled/disabled
if ( enable && ! myBaseActor->myExtractUnstructuredGrid->GetInput() )
{
myBaseActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
myHighlitableActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
myBaseActor->myExtractUnstructuredGrid->Update();
myHighlitableActor->myExtractUnstructuredGrid->Update();
}
if ( !enable && myBaseActor->myExtractUnstructuredGrid->GetInput() )
{
myBaseActor->SetUnstructuredGrid( NULL );
myHighlitableActor->SetUnstructuredGrid( NULL );
myBaseActor->myExtractUnstructuredGrid->Update();
myHighlitableActor->myExtractUnstructuredGrid->Update();
}
}
void SMESH_ActorDef::highlight(bool theHighlight) void SMESH_ActorDef::highlight(bool theHighlight)
{ {
@ -2297,6 +2343,11 @@ void SMESH_ActorDef::SetOpenGLClippingPlane()
myHighlitableActor->SetPlaneCollection( myPlaneCollection ); myHighlitableActor->SetPlaneCollection( myPlaneCollection );
myHighlitableActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid()); myHighlitableActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
if ( !mySelector || !mySelector->IsSelectionEnabled() )
{
myBaseActor->SetUnstructuredGrid( NULL );
myHighlitableActor->SetUnstructuredGrid( NULL );
}
my1DActor->SetPlaneCollection( myPlaneCollection ); my1DActor->SetPlaneCollection( myPlaneCollection );
my1DActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid()); my1DActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());

View File

@ -95,6 +95,7 @@ class SMESH_ActorDef : public SMESH_Actor
virtual void AddToRender(vtkRenderer* theRenderer); virtual void AddToRender(vtkRenderer* theRenderer);
virtual void RemoveFromRender(vtkRenderer* theRenderer); virtual void RemoveFromRender(vtkRenderer* theRenderer);
virtual void EnableSelection( bool enable );
virtual bool hasHighlight() { return true; } virtual bool hasHighlight() { return true; }
virtual void highlight(bool theHighlight); virtual void highlight(bool theHighlight);
virtual void SetPreSelected(bool thePreselect = false); virtual void SetPreSelected(bool thePreselect = false);

View File

@ -204,7 +204,6 @@ SMESH_DeviceActor
SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid()); SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
} }
void void
SMESH_DeviceActor SMESH_DeviceActor
::SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed) ::SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed)
@ -224,12 +223,12 @@ void
SMESH_DeviceActor SMESH_DeviceActor
::SetUnstructuredGrid(vtkUnstructuredGrid* theGrid) ::SetUnstructuredGrid(vtkUnstructuredGrid* theGrid)
{ {
if(theGrid){
//myIsShrinkable = theGrid->GetNumberOfCells() > 10;
myIsShrinkable = true;
myExtractUnstructuredGrid->SetInputData(theGrid); myExtractUnstructuredGrid->SetInputData(theGrid);
if ( theGrid )
{
myIsShrinkable = true;
myMergeFilter->SetGeometryConnection(myExtractUnstructuredGrid->GetOutputPort()); myMergeFilter->SetGeometryConnection(myExtractUnstructuredGrid->GetOutputPort());
//Pass diameters of the balls //Pass diameters of the balls
@ -263,8 +262,8 @@ SMESH_DeviceActor
myMapper->SetClippingPlanes( myPlaneCollection ); myMapper->SetClippingPlanes( myPlaneCollection );
vtkLODActor::SetMapper( myMapper ); vtkLODActor::SetMapper( myMapper );
Modified();
} }
Modified();
} }
void void
@ -281,6 +280,7 @@ SMESH_DeviceActor
return myExtractUnstructuredGrid; return myExtractUnstructuredGrid;
} }
#include "SMDS_Mesh.hxx"
vtkUnstructuredGrid* vtkUnstructuredGrid*
SMESH_DeviceActor SMESH_DeviceActor
@ -611,6 +611,15 @@ unsigned long int
SMESH_DeviceActor SMESH_DeviceActor
::GetMTime() ::GetMTime()
{ {
// cout << this->myExtractUnstructuredGrid
// << " " << this->Superclass::GetMTime()
// << " " << myExtractGeometry->GetMTime()
// << " " << myExtractUnstructuredGrid->GetMTime()
// << " " << myMergeFilter->GetMTime()
// << " " << myGeomFilter->GetMTime()
// << " " << myTransformFilter->GetMTime()
// << " " << myFaceOrientationFilter->GetMTime() << endl;
unsigned long mTime = this->Superclass::GetMTime(); unsigned long mTime = this->Superclass::GetMTime();
mTime = max(mTime,myExtractGeometry->GetMTime()); mTime = max(mTime,myExtractGeometry->GetMTime());
mTime = max(mTime,myExtractUnstructuredGrid->GetMTime()); mTime = max(mTime,myExtractUnstructuredGrid->GetMTime());
@ -718,7 +727,7 @@ SMESH_DeviceActor
::UpdateFaceOrientation() ::UpdateFaceOrientation()
{ {
bool aShowFaceOrientation = myIsFacesOriented; bool aShowFaceOrientation = myIsFacesOriented;
aShowFaceOrientation &= GetVisibility(); aShowFaceOrientation &= vtkLODActor::GetVisibility(); //GetVisibility(); -- avoid calling GetUnstructuredGrid()
aShowFaceOrientation &= myRepresentation == eSurface; aShowFaceOrientation &= myRepresentation == eSurface;
myFaceOrientation->SetVisibility(aShowFaceOrientation); myFaceOrientation->SetVisibility(aShowFaceOrientation);
} }
@ -762,8 +771,9 @@ void
SMESH_DeviceActor SMESH_DeviceActor
::SetVisibility(int theMode) ::SetVisibility(int theMode)
{ {
if(!myExtractUnstructuredGrid->GetInput() || if(( theMode ) &&
GetUnstructuredGrid()->GetNumberOfCells()) ( !myExtractUnstructuredGrid->GetInput() ||
GetUnstructuredGrid()->GetNumberOfCells()))
{ {
vtkLODActor::SetVisibility(theMode); vtkLODActor::SetVisibility(theMode);
}else{ }else{
@ -777,10 +787,12 @@ int
SMESH_DeviceActor SMESH_DeviceActor
::GetVisibility() ::GetVisibility()
{ {
if(!GetUnstructuredGrid()->GetNumberOfCells()){ int visibi = vtkLODActor::GetVisibility();
if(visibi && !GetUnstructuredGrid()->GetNumberOfCells()){
vtkLODActor::SetVisibility(false); vtkLODActor::SetVisibility(false);
visibi = 0;
} }
return vtkLODActor::GetVisibility(); return visibi;
} }
@ -821,7 +833,7 @@ SMESH_DeviceActor
{ {
vtkDataSet* aDataSet = myMergeFilter->GetOutput(); vtkDataSet* aDataSet = myMergeFilter->GetOutput();
vtkIdType anID = myVisualObj->GetNodeVTKId(theObjID); vtkIdType anID = myVisualObj->GetNodeVTKId(theObjID);
double* aCoord = (anID >=0) ? aDataSet->GetPoint(anID) : NULL; double* aCoord = (anID >=0 && anID < aDataSet->GetNumberOfPoints()) ? aDataSet->GetPoint(anID) : NULL;
if(MYDEBUG) MESSAGE("GetNodeCoord - theObjID = "<<theObjID<<"; anID = "<<anID); if(MYDEBUG) MESSAGE("GetNodeCoord - theObjID = "<<theObjID<<"; anID = "<<anID);
return aCoord; return aCoord;
} }

View File

@ -719,7 +719,7 @@ bool SMESH_MeshObj::NulData()
points->SetNumberOfPoints(0); points->SetNumberOfPoints(0);
myEmptyGrid->SetPoints( points ); myEmptyGrid->SetPoints( points );
points->Delete(); points->Delete();
myEmptyGrid->BuildLinks(); //myEmptyGrid->BuildLinks();
} }
myGrid->ShallowCopy(myEmptyGrid); myGrid->ShallowCopy(myEmptyGrid);
return true; return true;

View File

@ -119,11 +119,10 @@ SMESH_SVTKActor
myBallGrid->Initialize(); myBallGrid->Initialize();
myBallGrid->Allocate(); myBallGrid->Allocate();
vtkDataSet *aSourceDataSet = theMapActor->GetInput(); vtkUnstructuredGrid * aSourceGrid = (vtkUnstructuredGrid *)theMapActor->GetInput();
SVTK::CopyPoints( GetSource(), aSourceDataSet ); GetSource()->SetPoints( aSourceGrid->GetPoints() );
SVTK::CopyPoints( myBallGrid, aSourceDataSet ); myBallGrid->SetPoints( aSourceGrid->GetPoints() );
SVTK::CopyPoints( my0DGrid, aSourceDataSet ); my0DGrid->SetPoints( aSourceGrid->GetPoints() );
int aNbOfParts = theMapIndex.Extent(); int aNbOfParts = theMapIndex.Extent();
@ -132,7 +131,7 @@ SMESH_SVTKActor
//Copy deamaters of the balls //Copy deamaters of the balls
if(myVisualObj) { if(myVisualObj) {
outputCD = myBallGrid->GetCellData(); outputCD = myBallGrid->GetCellData();
cd = aSourceDataSet->GetCellData(); cd = aSourceGrid->GetCellData();
} }
outputCD->CopyAllocate(cd,aNbOfParts,aNbOfParts/2); outputCD->CopyAllocate(cd,aNbOfParts,aNbOfParts/2);
for(int ind = 1; ind <= aNbOfParts; ind++){ for(int ind = 1; ind <= aNbOfParts; ind++){

View File

@ -160,7 +160,7 @@ SMDS_Mesh::SMDS_Mesh():
points->SetNumberOfPoints(0 /*SMDS_Mesh::chunkSize*/); points->SetNumberOfPoints(0 /*SMDS_Mesh::chunkSize*/);
myGrid->SetPoints( points ); myGrid->SetPoints( points );
points->Delete(); points->Delete();
myGrid->BuildLinks(); //myGrid->BuildLinks();
this->Modified(); this->Modified();
// initialize static maps in SMDS_MeshCell, to be thread-safe // initialize static maps in SMDS_MeshCell, to be thread-safe
@ -2757,7 +2757,7 @@ void SMDS_Mesh::Clear()
points->SetNumberOfPoints(0 /*SMDS_Mesh::chunkSize*/); points->SetNumberOfPoints(0 /*SMDS_Mesh::chunkSize*/);
myGrid->SetPoints( points ); myGrid->SetPoints( points );
points->Delete(); points->Delete();
myGrid->BuildLinks(); myGrid->DeleteLinks();
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -4702,7 +4702,7 @@ void SMDS_Mesh::dumpGrid(string ficdump)
ficcon << endl; ficcon << endl;
} }
ficcon << "-------------------------------- connectivity " << nbPoints << endl; ficcon << "-------------------------------- connectivity " << nbPoints << endl;
vtkCellLinks *links = myGrid->GetCellLinks(); vtkCellLinks *links = myGrid->GetLinks();
for (int i=0; i<nbPoints; i++) for (int i=0; i<nbPoints; i++)
{ {
int ncells = links->GetNcells(i); int ncells = links->GetNcells(i);
@ -4720,7 +4720,7 @@ void SMDS_Mesh::dumpGrid(string ficdump)
void SMDS_Mesh::compactMesh() void SMDS_Mesh::compactMesh()
{ {
MESSAGE("SMDS_Mesh::compactMesh do nothing!"); this->myCompactTime = this->myModifTime;
} }
int SMDS_Mesh::fromVtkToSmds(int vtkid) int SMDS_Mesh::fromVtkToSmds(int vtkid)
@ -4780,10 +4780,5 @@ unsigned long SMDS_Mesh::GetMTime() const
bool SMDS_Mesh::isCompacted() bool SMDS_Mesh::isCompacted()
{ {
if (this->myModifTime > this->myCompactTime) return this->myCompactTime == this->myModifTime;
{
this->myCompactTime = this->myModifTime;
return false;
}
return true;
} }

View File

@ -62,16 +62,12 @@ SMDS_MeshNode::SMDS_MeshNode(int id, int meshId, int shapeId, double x, double y
void SMDS_MeshNode::init(int id, int meshId, int shapeId, double x, double y, double z) void SMDS_MeshNode::init(int id, int meshId, int shapeId, double x, double y, double z)
{ {
SMDS_MeshElement::init(id, meshId, shapeId); SMDS_MeshElement::init(id, meshId, shapeId);
myVtkID = id -1; myVtkID = id - 1;
assert(myVtkID >= 0); assert(myVtkID >= 0);
//MESSAGE("Node " << myID << " " << myVtkID << " (" << x << ", " << y << ", " << z << ")"); SMDS_UnstructuredGrid * grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
SMDS_Mesh* mesh = SMDS_Mesh::_meshList[myMeshId];
SMDS_UnstructuredGrid * grid = mesh->getGrid();
vtkPoints *points = grid->GetPoints(); vtkPoints *points = grid->GetPoints();
points->InsertPoint(myVtkID, x, y, z); points->InsertPoint(myVtkID, x, y, z);
SMDS_CellLinks *cellLinks = dynamic_cast<SMDS_CellLinks*>(grid->GetCellLinks()); grid->GetLinks()->ResizeForPoint( myVtkID );
assert(cellLinks);
cellLinks->ResizeForPoint( myVtkID );
} }
SMDS_MeshNode::~SMDS_MeshNode() SMDS_MeshNode::~SMDS_MeshNode()
@ -91,6 +87,7 @@ void SMDS_MeshNode::RemoveInverseElement(const SMDS_MeshElement * parent)
//MESSAGE("RemoveInverseElement " << myID << " " << parent->GetID()); //MESSAGE("RemoveInverseElement " << myID << " " << parent->GetID());
const SMDS_MeshCell* cell = dynamic_cast<const SMDS_MeshCell*>(parent); const SMDS_MeshCell* cell = dynamic_cast<const SMDS_MeshCell*>(parent);
MYASSERT(cell); MYASSERT(cell);
if ( SMDS_Mesh::_meshList[myMeshId]->getGrid()->HasLinks() )
SMDS_Mesh::_meshList[myMeshId]->getGrid()->RemoveReferenceToCell(myVtkID, cell->getVtkId()); SMDS_Mesh::_meshList[myMeshId]->getGrid()->RemoveReferenceToCell(myVtkID, cell->getVtkId());
} }
@ -189,7 +186,7 @@ public:
SMDS_ElemIteratorPtr SMDS_MeshNode::GetInverseElementIterator(SMDSAbs_ElementType type) const SMDS_ElemIteratorPtr SMDS_MeshNode::GetInverseElementIterator(SMDSAbs_ElementType type) const
{ {
vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks()->GetLink(myVtkID); vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetLinks()->GetLink(myVtkID);
return SMDS_ElemIteratorPtr(new SMDS_MeshNode_MyInvIterator(SMDS_Mesh::_meshList[myMeshId], l.cells, l.ncells, type)); return SMDS_ElemIteratorPtr(new SMDS_MeshNode_MyInvIterator(SMDS_Mesh::_meshList[myMeshId], l.cells, l.ncells, type));
} }
@ -248,7 +245,7 @@ elementsIterator(SMDSAbs_ElementType type) const
return SMDS_MeshElement::elementsIterator(SMDSAbs_Node); return SMDS_MeshElement::elementsIterator(SMDSAbs_Node);
else else
{ {
vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks()->GetLink(myVtkID); vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetLinks()->GetLink(myVtkID);
return SMDS_ElemIteratorPtr(new SMDS_MeshNode_MyIterator(SMDS_Mesh::_meshList[myMeshId], l.cells, l.ncells, type)); return SMDS_ElemIteratorPtr(new SMDS_MeshNode_MyIterator(SMDS_Mesh::_meshList[myMeshId], l.cells, l.ncells, type));
} }
} }
@ -319,7 +316,7 @@ void SMDS_MeshNode::AddInverseElement(const SMDS_MeshElement* ME)
const SMDS_MeshCell *cell = dynamic_cast<const SMDS_MeshCell*> (ME); const SMDS_MeshCell *cell = dynamic_cast<const SMDS_MeshCell*> (ME);
assert(cell); assert(cell);
SMDS_UnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid(); SMDS_UnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
vtkCellLinks *Links = grid->GetCellLinks(); vtkCellLinks *Links = grid->GetLinks();
Links->ResizeCellList(myVtkID, 1); Links->ResizeCellList(myVtkID, 1);
Links->AddCellReference(cell->getVtkId(), myVtkID); Links->AddCellReference(cell->getVtkId(), myVtkID);
} }
@ -335,7 +332,7 @@ void SMDS_MeshNode::ClearInverseElements()
bool SMDS_MeshNode::emptyInverseElements() bool SMDS_MeshNode::emptyInverseElements()
{ {
vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks()->GetLink(myVtkID); vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetLinks()->GetLink(myVtkID);
return (l.ncells == 0); return (l.ncells == 0);
} }
@ -347,7 +344,7 @@ bool SMDS_MeshNode::emptyInverseElements()
int SMDS_MeshNode::NbInverseElements(SMDSAbs_ElementType type) const int SMDS_MeshNode::NbInverseElements(SMDSAbs_ElementType type) const
{ {
vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks()->GetLink(myVtkID); vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetLinks()->GetLink(myVtkID);
if ( type == SMDSAbs_All ) if ( type == SMDSAbs_All )
return l.ncells; return l.ncells;

View File

@ -53,6 +53,51 @@ void SMDS_CellLinks::ResizeForPoint(vtkIdType vtkID)
} }
} }
void SMDS_CellLinks::BuildLinks(vtkDataSet *data, vtkCellArray *Connectivity, vtkUnsignedCharArray* types)
{
// build links taking into account removed cells
vtkIdType numPts = data->GetNumberOfPoints();
vtkIdType j, cellId = 0;
unsigned short *linkLoc;
vtkIdType npts=0;
vtkIdType *pts=0;
vtkIdType loc = Connectivity->GetTraversalLocation();
// traverse data to determine number of uses of each point
cellId = 0;
for (Connectivity->InitTraversal();
Connectivity->GetNextCell(npts,pts); cellId++)
{
if ( types->GetValue( cellId ) != VTK_EMPTY_CELL )
for (j=0; j < npts; j++)
{
this->IncrementLinkCount(pts[j]);
}
}
// now allocate storage for the links
this->AllocateLinks(numPts);
this->MaxId = numPts - 1;
// fill out lists with references to cells
linkLoc = new unsigned short[numPts];
memset(linkLoc, 0, numPts*sizeof(unsigned short));
cellId = 0;
for (Connectivity->InitTraversal();
Connectivity->GetNextCell(npts,pts); cellId++)
{
if ( types->GetValue( cellId ) != VTK_EMPTY_CELL )
for (j=0; j < npts; j++)
{
this->InsertCellReference(pts[j], (linkLoc[pts[j]])++, cellId);
}
}
delete [] linkLoc;
Connectivity->SetTraversalLocation(loc);
}
SMDS_CellLinks::SMDS_CellLinks() : SMDS_CellLinks::SMDS_CellLinks() :
vtkCellLinks() vtkCellLinks()
{ {
@ -149,6 +194,8 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int n
//MESSAGE("------------------------- compactGrid " << newNodeSize << " " << newCellSize);//CHRONO(1); //MESSAGE("------------------------- compactGrid " << newNodeSize << " " << newCellSize);//CHRONO(1);
int alreadyCopied = 0; int alreadyCopied = 0;
this->DeleteLinks();
// --- if newNodeSize, create a new compacted vtkPoints // --- if newNodeSize, create a new compacted vtkPoints
vtkPoints *newPoints = vtkPoints::New(); vtkPoints *newPoints = vtkPoints::New();
@ -187,6 +234,12 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int n
int oldCellSize = this->Types->GetNumberOfTuples(); int oldCellSize = this->Types->GetNumberOfTuples();
if ( oldCellSize == newCellSize )
{
for ( int i = 0; i < oldCellSize; ++i )
idCellsOldToNew[i] = i;
return;
}
vtkCellArray *newConnectivity = vtkCellArray::New(); vtkCellArray *newConnectivity = vtkCellArray::New();
newConnectivity->Initialize(); newConnectivity->Initialize();
int oldCellDataSize = this->Connectivity->GetData()->GetSize(); int oldCellDataSize = this->Connectivity->GetData()->GetSize();
@ -287,7 +340,6 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int n
newTypes->Delete(); newTypes->Delete();
newLocations->Delete(); newLocations->Delete();
newConnectivity->Delete(); newConnectivity->Delete();
this->BuildLinks();
} }
void SMDS_UnstructuredGrid::copyNodes(vtkPoints * newPoints, void SMDS_UnstructuredGrid::copyNodes(vtkPoints * newPoints,
@ -979,13 +1031,30 @@ void SMDS_UnstructuredGrid::BuildLinks()
this->Links->UnRegister(this); this->Links->UnRegister(this);
} }
this->Links = SMDS_CellLinks::New(); SMDS_CellLinks* links;
this->Links = links = SMDS_CellLinks::New();
this->Links->Allocate(this->GetNumberOfPoints()); this->Links->Allocate(this->GetNumberOfPoints());
this->Links->Register(this); this->Links->Register(this);
this->Links->BuildLinks(this, this->Connectivity); links->BuildLinks(this, this->Connectivity,this->GetCellTypesArray() );
this->Links->Delete(); this->Links->Delete();
} }
void SMDS_UnstructuredGrid::DeleteLinks()
{
// Remove the old links if they are already built
if (this->Links)
{
this->Links->UnRegister(this);
this->Links = NULL;
}
}
SMDS_CellLinks* SMDS_UnstructuredGrid::GetLinks()
{
if ( !this->Links )
BuildLinks();
return static_cast< SMDS_CellLinks* >( this->Links );
}
/*! Create a volume (prism or hexahedron) by duplication of a face. /*! Create a volume (prism or hexahedron) by duplication of a face.
* Designed for use in creation of flat elements separating volume domains. * Designed for use in creation of flat elements separating volume domains.
* A face separating two domains is shared by two volume cells. * A face separating two domains is shared by two volume cells.

View File

@ -54,6 +54,7 @@ class SMDS_EXPORT SMDS_CellLinks: public vtkCellLinks
{ {
public: public:
void ResizeForPoint(vtkIdType vtkID); void ResizeForPoint(vtkIdType vtkID);
void BuildLinks(vtkDataSet *data, vtkCellArray *Connectivity, vtkUnsignedCharArray* types);
static SMDS_CellLinks* New(); static SMDS_CellLinks* New();
protected: protected:
SMDS_CellLinks(); SMDS_CellLinks();
@ -88,15 +89,15 @@ public:
void GetNodeIds(std::set<int>& nodeSet, int downId, unsigned char downType); void GetNodeIds(std::set<int>& nodeSet, int downId, unsigned char downType);
void ModifyCellNodes(int vtkVolId, std::map<int, int> localClonedNodeIds); void ModifyCellNodes(int vtkVolId, std::map<int, int> localClonedNodeIds);
int getOrderedNodesOfFace(int vtkVolId, int& dim, std::vector<vtkIdType>& orderedNodes); int getOrderedNodesOfFace(int vtkVolId, int& dim, std::vector<vtkIdType>& orderedNodes);
void BuildLinks();
SMDS_MeshCell* extrudeVolumeFromFace(int vtkVolId, int domain1, int domain2, SMDS_MeshCell* extrudeVolumeFromFace(int vtkVolId, int domain1, int domain2,
std::set<int>& originalNodes, std::set<int>& originalNodes,
std::map<int, std::map<int, int> >& nodeDomains, std::map<int, std::map<int, int> >& nodeDomains,
std::map<int, std::map<long,int> >& nodeQuadDomains); std::map<int, std::map<long,int> >& nodeQuadDomains);
vtkCellLinks* GetLinks() void BuildLinks();
{ void DeleteLinks();
return Links; SMDS_CellLinks* GetLinks();
} bool HasLinks() const { return this->Links; }
SMDS_Downward* getDownArray(unsigned char vtkType) SMDS_Downward* getDownArray(unsigned char vtkType)
{ {
return _downArray[vtkType]; return _downArray[vtkType];

View File

@ -123,13 +123,16 @@ SMESH_Mesh* SMESH_Gen::CreateMesh(int theStudyId, bool theIsEmbeddedMode)
bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
const TopoDS_Shape & aShape, const TopoDS_Shape & aShape,
const bool aShapeOnly /*=false*/, const int aFlags /*= COMPACT_MESH*/,
const bool anUpward /*=false*/,
const ::MeshDimension aDim /*=::MeshDim_3D*/, const ::MeshDimension aDim /*=::MeshDim_3D*/,
TSetOfInt* aShapesId /*=0*/) TSetOfInt* aShapesId /*=0*/)
{ {
MEMOSTAT; MEMOSTAT;
const bool aShapeOnly = aFlags & SHAPE_ONLY;
const bool anUpward = aFlags & UPWARD;
const bool aCompactMesh = aFlags & COMPACT_MESH;
bool ret = true; bool ret = true;
SMESH_subMesh *sm = aMesh.GetSubMesh(aShape); SMESH_subMesh *sm = aMesh.GetSubMesh(aShape);
@ -141,7 +144,7 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
SMESH_subMeshIteratorPtr smIt; SMESH_subMeshIteratorPtr smIt;
// Fix of Issue 22150. Due to !BLSURF->OnlyUnaryInput(), BLSURF computes edges // Fix of Issue 22150. Due to !BLSURF->OnlyUnaryInput(), BLSURF computes edges
// that must be computed by Projection 1D-2D when Projection asks to compute // that must be computed by Projection 1D-2D while the Projection asks to compute
// one face only. // one face only.
SMESH_subMesh::compute_event computeEvent = SMESH_subMesh::compute_event computeEvent =
aShapeOnly ? SMESH_subMesh::COMPUTE_SUBMESH : SMESH_subMesh::COMPUTE; aShapeOnly ? SMESH_subMesh::COMPUTE_SUBMESH : SMESH_subMesh::COMPUTE;
@ -331,7 +334,7 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
SMESH_Hypothesis::Hypothesis_Status status; SMESH_Hypothesis::Hypothesis_Status status;
if ( subAlgo->CheckHypothesis( aMesh, aSubShape, status )) if ( subAlgo->CheckHypothesis( aMesh, aSubShape, status ))
// mesh a lower smToCompute starting from vertices // mesh a lower smToCompute starting from vertices
Compute( aMesh, aSubShape, true, /*anUpward=*/true, aDim, aShapesId ); Compute( aMesh, aSubShape, aFlags | SHAPE_ONLY_UPWARD, aDim, aShapesId );
// Compute( aMesh, aSubShape, aShapeOnly, /*anUpward=*/true, aDim, aShapesId ); // Compute( aMesh, aSubShape, aShapeOnly, /*anUpward=*/true, aDim, aShapesId );
} }
} }
@ -363,17 +366,17 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
// ----------------------------------------------- // -----------------------------------------------
// mesh the rest sub-shapes starting from vertices // mesh the rest sub-shapes starting from vertices
// ----------------------------------------------- // -----------------------------------------------
ret = Compute( aMesh, aShape, aShapeOnly, /*anUpward=*/true, aDim, aShapesId ); ret = Compute( aMesh, aShape, aFlags | UPWARD, aDim, aShapesId );
} }
MEMOSTAT; MEMOSTAT;
SMESHDS_Mesh *myMesh = aMesh.GetMeshDS(); if ( aCompactMesh )
//MESSAGE("*** compactMesh after compute"); aMesh.GetMeshDS()->compactMesh();
myMesh->compactMesh();
// fix quadratic mesh by bending iternal links near concave boundary // fix quadratic mesh by bending iternal links near concave boundary
if ( aShape.IsSame( aMesh.GetShapeToMesh() ) && if ( aCompactMesh && // a final compute
aShape.IsSame( aMesh.GetShapeToMesh() ) &&
!aShapesId && // not preview !aShapesId && // not preview
ret ) // everything is OK ret ) // everything is OK
{ {

View File

@ -69,19 +69,25 @@ public:
SMESH_Mesh* CreateMesh(int theStudyId, bool theIsEmbeddedMode) SMESH_Mesh* CreateMesh(int theStudyId, bool theIsEmbeddedMode)
throw(SALOME_Exception); throw(SALOME_Exception);
enum ComputeFlags
{
SHAPE_ONLY = 1, // to ignore algo->OnlyUnaryInput() feature and to compute a given shape only.
UPWARD = 2, // to compute from vertices up to more complex shape (internal usage)
COMPACT_MESH = 4, // to compact the mesh at the end
SHAPE_ONLY_UPWARD = 3 // SHAPE_ONLY | UPWARD
};
/*! /*!
* \brief Computes aMesh on aShape * \brief Computes aMesh on aShape
* \param aShapeOnly - if true, algo->OnlyUnaryInput() feature is ignored and * \param aMesh - the mesh.
* only \a aShape is computed. * \param aShape - the shape.
* \param anUpward - compute from vertices up to more complex shape (internal usage) * \param aFlags - ComputeFlags. By default compute the whole mesh and compact at the end.
* \param aDim - upper level dimension of the mesh computation * \param aDim - upper level dimension of the mesh computation (for preview)
* \param aShapesId - list of shapes with computed mesh entities (elements or nodes) * \param aShapesId - list of shapes with computed mesh entities (elements or nodes)
* \retval bool - true if none submesh failed to compute * \retval bool - true if none sub-mesh failed to compute
*/ */
bool Compute(::SMESH_Mesh & aMesh, bool Compute(::SMESH_Mesh & aMesh,
const TopoDS_Shape & aShape, const TopoDS_Shape & aShape,
const bool aShapeOnly=false, const int aFlags = COMPACT_MESH,
const bool anUpward=false,
const ::MeshDimension aDim=::MeshDim_3D, const ::MeshDimension aDim=::MeshDim_3D,
TSetOfInt* aShapesId=0); TSetOfInt* aShapesId=0);

View File

@ -11650,7 +11650,7 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vector<TIDSorted
} }
meshDS->CleanDownWardConnectivity(); // Mesh has been modified, downward connectivity is no more usable, free memory meshDS->CleanDownWardConnectivity(); // Mesh has been modified, downward connectivity is no more usable, free memory
grid->BuildLinks(); grid->DeleteLinks();
CHRONOSTOP(50); CHRONOSTOP(50);
counters::stats(); counters::stats();

View File

@ -2145,10 +2145,13 @@ SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
void SMESHDS_Mesh::compactMesh() void SMESHDS_Mesh::compactMesh()
{ {
if ( isCompacted() )
return;
SMDS_Mesh::compactMesh();
int newNodeSize = 0; int newNodeSize = 0;
int nbNodes = myNodes.size(); int nbNodes = myNodes.size();
int nbVtkNodes = myGrid->GetNumberOfPoints(); int nbVtkNodes = myGrid->GetNumberOfPoints();
//MESSAGE("nbNodes=" << nbNodes << " nbVtkNodes=" << nbVtkNodes);
int nbNodeTemp = nbVtkNodes; int nbNodeTemp = nbVtkNodes;
if (nbNodes > nbVtkNodes) if (nbNodes > nbVtkNodes)
nbNodeTemp = nbNodes; nbNodeTemp = nbNodes;
@ -2166,13 +2169,11 @@ void SMESHDS_Mesh::compactMesh()
} }
} }
bool areNodesModified = (newNodeSize < nbVtkNodes); bool areNodesModified = (newNodeSize < nbVtkNodes);
//MESSAGE("------------------------- compactMesh Nodes Modified: " << areNodesModified);
areNodesModified = true; areNodesModified = true;
int newCellSize = 0; int newCellSize = 0;
int nbCells = myCells.size(); int nbCells = myCells.size();
int nbVtkCells = myGrid->GetNumberOfCells(); int nbVtkCells = myGrid->GetNumberOfCells();
//MESSAGE("nbCells=" << nbCells << " nbVtkCells=" << nbVtkCells);
int nbCellTemp = nbVtkCells; int nbCellTemp = nbVtkCells;
if (nbCells > nbVtkCells) if (nbCells > nbVtkCells)
nbCellTemp = nbCells; nbCellTemp = nbCells;
@ -2184,9 +2185,6 @@ void SMESHDS_Mesh::compactMesh()
{ {
if (myCells[i]) if (myCells[i])
{ {
// //idCellsOldToNew[i] = myCellIdVtkToSmds[i]; // valid vtk indexes are > = 0
// int vtkid = myCells[i]->getVtkId();
// idCellsOldToNew[vtkid] = i; // old vtkId --> old smdsId (not used in input)
newCellSize++; newCellSize++;
} }
} }
@ -2212,7 +2210,6 @@ void SMESHDS_Mesh::compactMesh()
if (areNodesModified) if (areNodesModified)
{ {
//MESSAGE("-------------- modify myNodes");
SetOfNodes newNodes; SetOfNodes newNodes;
newNodes.resize(newNodeSize+1,0); // 0 not used, SMDS numbers 1..n newNodes.resize(newNodeSize+1,0); // 0 not used, SMDS numbers 1..n
int newSmdsId = 0; int newSmdsId = 0;
@ -2223,16 +2220,13 @@ void SMESHDS_Mesh::compactMesh()
newSmdsId++; // SMDS id start to 1 newSmdsId++; // SMDS id start to 1
int oldVtkId = myNodes[i]->getVtkId(); int oldVtkId = myNodes[i]->getVtkId();
int newVtkId = idNodesOldToNew[oldVtkId]; int newVtkId = idNodesOldToNew[oldVtkId];
//MESSAGE("myNodes["<< i << "] vtkId " << oldVtkId << " --> " << newVtkId);
myNodes[i]->setVtkId(newVtkId); myNodes[i]->setVtkId(newVtkId);
myNodes[i]->setId(newSmdsId); myNodes[i]->setId(newSmdsId);
newNodes[newSmdsId] = myNodes[i]; newNodes[newSmdsId] = myNodes[i];
//MESSAGE("myNodes["<< i << "] --> newNodes[" << newSmdsId << "]");
} }
} }
myNodes.swap(newNodes); myNodes.swap(newNodes);
this->myNodeIDFactory->emptyPool(newSmdsId); // newSmdsId = number of nodes this->myNodeIDFactory->emptyPool(newSmdsId); // newSmdsId = number of nodes
//MESSAGE("myNodes.size " << myNodes.size());
} }
// --- SMDS_MeshCell, myCellIdVtkToSmds, myCellIdSmdsToVtk, myCells // --- SMDS_MeshCell, myCellIdVtkToSmds, myCellIdSmdsToVtk, myCells
@ -2247,21 +2241,15 @@ void SMESHDS_Mesh::compactMesh()
int newVtkId = idCellsOldToNew[oldVtkId]; int newVtkId = idCellsOldToNew[oldVtkId];
if (newVtkId > maxVtkId) if (newVtkId > maxVtkId)
maxVtkId = newVtkId; maxVtkId = newVtkId;
//MESSAGE("myCells["<< oldSmdsId << "] vtkId " << oldVtkId << " --> " << newVtkId);
myCells[oldSmdsId]->setVtkId(newVtkId); myCells[oldSmdsId]->setVtkId(newVtkId);
} }
} }
// MESSAGE("myCells.size()=" << myCells.size()
// << " myCellIdSmdsToVtk.size()=" << myCellIdSmdsToVtk.size()
// << " myCellIdVtkToSmds.size()=" << myCellIdVtkToSmds.size() );
SetOfCells newCells; SetOfCells newCells;
//vector<int> newSmdsToVtk;
vector<int> newVtkToSmds; vector<int> newVtkToSmds;
assert(maxVtkId < newCellSize); assert(maxVtkId < newCellSize);
newCells.resize(newCellSize+1, 0); // 0 not used, SMDS numbers 1..n newCells.resize(newCellSize+1, 0); // 0 not used, SMDS numbers 1..n
//newSmdsToVtk.resize(newCellSize+1, -1);
newVtkToSmds.resize(newCellSize+1, -1); newVtkToSmds.resize(newCellSize+1, -1);
int myCellsSize = myCells.size(); int myCellsSize = myCells.size();
@ -2274,18 +2262,14 @@ void SMESHDS_Mesh::compactMesh()
assert(newSmdsId <= newCellSize); assert(newSmdsId <= newCellSize);
newCells[newSmdsId] = myCells[i]; newCells[newSmdsId] = myCells[i];
newCells[newSmdsId]->setId(newSmdsId); newCells[newSmdsId]->setId(newSmdsId);
//MESSAGE("myCells["<< i << "] --> newCells[" << newSmdsId << "]");
int idvtk = myCells[i]->getVtkId(); int idvtk = myCells[i]->getVtkId();
//newSmdsToVtk[newSmdsId] = idvtk;
assert(idvtk < newCellSize); assert(idvtk < newCellSize);
newVtkToSmds[idvtk] = newSmdsId; newVtkToSmds[idvtk] = newSmdsId;
} }
} }
myCells.swap(newCells); myCells.swap(newCells);
//myCellIdSmdsToVtk.swap(newSmdsToVtk);
myCellIdVtkToSmds.swap(newVtkToSmds); myCellIdVtkToSmds.swap(newVtkToSmds);
//MESSAGE("myCells.size()="<< myCells.size()<<" myCellIdVtkToSmds.size()="<<myCellIdVtkToSmds.size() );
this->myElementIDFactory->emptyPool(newSmdsId); this->myElementIDFactory->emptyPool(newSmdsId);
this->myScript->SetModified(true); // notify GUI client for buildPrs when update this->myScript->SetModified(true); // notify GUI client for buildPrs when update

View File

@ -2919,12 +2919,18 @@ SMESHGUI_MeshInfoDlg::~SMESHGUI_MeshInfoDlg()
*/ */
void SMESHGUI_MeshInfoDlg::showInfo( const Handle(SALOME_InteractiveObject)& IO ) void SMESHGUI_MeshInfoDlg::showInfo( const Handle(SALOME_InteractiveObject)& IO )
{ {
if ( !IO.IsNull() )
myIO = IO;
SMESH::SMESH_IDSource_var obj = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO ); SMESH::SMESH_IDSource_var obj = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO );
if ( !CORBA::is_nil( obj ) ) { if ( !CORBA::is_nil( obj ) )
{
myAddInfo->showInfo( obj ); // nb of nodes in a group can be computed by myAddInfo, myAddInfo->showInfo( obj ); // nb of nodes in a group can be computed by myAddInfo,
myBaseInfo->showInfo( obj ); // and it will be used by myBaseInfo (IPAL52871) myBaseInfo->showInfo( obj ); // and it will be used by myBaseInfo (IPAL52871)
if ( myTabWidget->currentIndex() == CtrlInfo )
myCtrlInfo->showInfo( obj ); myCtrlInfo->showInfo( obj );
{
myActor = SMESH::FindActorByEntry( IO->getEntry() ); myActor = SMESH::FindActorByEntry( IO->getEntry() );
SVTK_Selector* selector = SMESH::GetSelector(); SVTK_Selector* selector = SMESH::GetSelector();
QString ID; QString ID;
@ -2948,6 +2954,7 @@ void SMESHGUI_MeshInfoDlg::showInfo( const Handle(SALOME_InteractiveObject)& IO
myElemInfo->clear(); myElemInfo->clear();
} }
} }
}
} }
/*! /*!
@ -3049,11 +3056,9 @@ void SMESHGUI_MeshInfoDlg::updateInfo()
Handle(SALOME_InteractiveObject) IO = selected.First(); Handle(SALOME_InteractiveObject) IO = selected.First();
showInfo( IO ); showInfo( IO );
} }
// else { else {
// myBaseInfo->clear(); showInfo( myIO );
// myElemInfo->clear(); }
// myAddInfo->clear();
// }
} }
/*! /*!

View File

@ -395,6 +395,7 @@ private:
SMESHGUI_AddInfo* myAddInfo; SMESHGUI_AddInfo* myAddInfo;
SMESHGUI_CtrlInfo* myCtrlInfo; SMESHGUI_CtrlInfo* myCtrlInfo;
SMESH_Actor* myActor; SMESH_Actor* myActor;
Handle(SALOME_InteractiveObject) myIO;
}; };
class SMESHGUI_EXPORT SMESHGUI_CtrlInfoDlg : public QDialog class SMESHGUI_EXPORT SMESHGUI_CtrlInfoDlg : public QDialog

View File

@ -2001,7 +2001,7 @@ SMESH::MeshPreviewStruct* SMESH_Gen_i::Precompute( SMESH::SMESH_Mesh_ptr theMesh
::SMESH_Mesh& myLocMesh = meshServant->GetImpl(); ::SMESH_Mesh& myLocMesh = meshServant->GetImpl();
TSetOfInt shapeIds; TSetOfInt shapeIds;
::MeshDimension aDim = (MeshDimension)theDimension; ::MeshDimension aDim = (MeshDimension)theDimension;
if ( myGen.Compute( myLocMesh, myLocShape, false, false, aDim, &shapeIds ) ) if ( myGen.Compute( myLocMesh, myLocShape, ::SMESH_Gen::COMPACT_MESH, aDim, &shapeIds ) )
{ {
int nbShapeId = shapeIds.size(); int nbShapeId = shapeIds.size();
theShapesId.length( nbShapeId ); theShapesId.length( nbShapeId );

View File

@ -2952,8 +2952,9 @@ SMESH_MeshEditor_i::ExtrusionAlongPathObjects(const SMESH::ListOfIDSources & the
} }
if ( !myIsPreviewMode ) { if ( !myIsPreviewMode ) {
aPythonDump << "(" << aGroups << ", error) = " if ( aGroups->length() > 0 ) aPythonDump << "(" << aGroups << ", error) = ";
<< this << ".ExtrusionAlongPathObjects( " else aPythonDump << "(_noGroups, error) = ";
aPythonDump << this << ".ExtrusionAlongPathObjects( "
<< theNodes << ", " << theNodes << ", "
<< theEdges << ", " << theEdges << ", "
<< theFaces << ", " << theFaces << ", "

View File

@ -383,7 +383,7 @@ namespace
tmpMesh.ShapeToMesh( theEdges[i] ); tmpMesh.ShapeToMesh( theEdges[i] );
try { try {
if ( !mesh->GetGen() ) continue; // tmp mesh if ( !mesh->GetGen() ) continue; // tmp mesh
mesh->GetGen()->Compute( tmpMesh, theEdges[i], true, true ); // make nodes on VERTEXes mesh->GetGen()->Compute( tmpMesh, theEdges[i], SMESH_Gen::SHAPE_ONLY_UPWARD ); // make nodes on VERTEXes
if ( !algo->Compute( tmpMesh, theEdges[i] )) if ( !algo->Compute( tmpMesh, theEdges[i] ))
continue; continue;
} }
@ -868,7 +868,7 @@ namespace
TmpMesh tmpMesh; TmpMesh tmpMesh;
tmpMesh.ShapeToMesh( branchEdge ); tmpMesh.ShapeToMesh( branchEdge );
try { try {
mesh->GetGen()->Compute( tmpMesh, branchEdge, true, true ); // make nodes on VERTEXes mesh->GetGen()->Compute( tmpMesh, branchEdge, SMESH_Gen::SHAPE_ONLY_UPWARD ); // make nodes on VERTEXes
if ( !algo->Compute( tmpMesh, branchEdge )) if ( !algo->Compute( tmpMesh, branchEdge ))
return false; return false;
} }
@ -1930,7 +1930,8 @@ namespace
{ {
if ( !theHasRadialHyp ) if ( !theHasRadialHyp )
// use global hyps // use global hyps
theHelper.GetGen()->Compute( *theHelper.GetMesh(), theShortEdges[i], true, true ); theHelper.GetGen()->Compute( *theHelper.GetMesh(), theShortEdges[i],
SMESH_Gen::SHAPE_ONLY_UPWARD );
SMESH_subMesh* sm = theHelper.GetMesh()->GetSubMesh(theShortEdges[i] ); SMESH_subMesh* sm = theHelper.GetMesh()->GetSubMesh(theShortEdges[i] );
if ( sm->IsEmpty() ) if ( sm->IsEmpty() )

View File

@ -675,7 +675,7 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
if ( !_mainEdge.IsNull() && _isPropagOfDistribution ) if ( !_mainEdge.IsNull() && _isPropagOfDistribution )
{ {
TopoDS_Edge mainEdge = TopoDS::Edge( _mainEdge ); // should not be a reference! TopoDS_Edge mainEdge = TopoDS::Edge( _mainEdge ); // should not be a reference!
_gen->Compute( theMesh, mainEdge, /*aShapeOnly=*/true, /*anUpward=*/true); _gen->Compute( theMesh, mainEdge, SMESH_Gen::SHAPE_ONLY_UPWARD );
SMESHDS_SubMesh* smDS = theMesh.GetMeshDS()->MeshElements( mainEdge ); SMESHDS_SubMesh* smDS = theMesh.GetMeshDS()->MeshElements( mainEdge );
if ( !smDS ) if ( !smDS )