Salome HOME
projects
/
modules
/
smesh.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
23315: [CEA 1929] Too much memory used to display a mesh in shading and wireframe
[modules/smesh.git]
/
src
/
OBJECT
/
SMESH_SVTKActor.cxx
diff --git
a/src/OBJECT/SMESH_SVTKActor.cxx
b/src/OBJECT/SMESH_SVTKActor.cxx
index 48ad8691026d940a2383031b614ba60cd0d10943..a9a549f035d101e5e799b69db94c79db3e6dd090 100644
(file)
--- a/
src/OBJECT/SMESH_SVTKActor.cxx
+++ b/
src/OBJECT/SMESH_SVTKActor.cxx
@@
-1,4
+1,4
@@
-// Copyright (C) 2007-201
2
CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-201
6
CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@
-6,7
+6,7
@@
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License
, or (at your option) any later version
.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
@@
-31,7
+31,6
@@
#include <SVTK_Utils.h>
#include <SALOME_Actor.h>
#include <SVTK_Utils.h>
#include <SALOME_Actor.h>
-
#include <SVTK_DeviceActor.h>
#include <vtkPoints.h>
#include <vtkRenderer.h>
#include <SVTK_DeviceActor.h>
#include <vtkPoints.h>
#include <vtkRenderer.h>
@@
-39,6
+38,10
@@
#include <vtkUnstructuredGrid.h>
#include <vtkCell.h>
#include <vtkDataSetMapper.h>
#include <vtkUnstructuredGrid.h>
#include <vtkCell.h>
#include <vtkDataSetMapper.h>
+#include <vtkPolyhedron.h>
+#include <vtkCellData.h>
+
+#include <Utils_SALOME_Exception.hxx>
vtkStandardNewMacro(SMESH_SVTKActor);
vtkStandardNewMacro(SMESH_SVTKActor);
@@
-51,6
+54,7
@@
SMESH_SVTKActor::SMESH_SVTKActor():
{
my0DActor = SVTK_DeviceActor::New();
myBallActor = SVTK_DeviceActor::New();
{
my0DActor = SVTK_DeviceActor::New();
myBallActor = SVTK_DeviceActor::New();
+ myBallActor->SetBallEnabled(true);
myBallActor->SetResolveCoincidentTopology(false);
myBallActor->SetCoincident3DAllowed(true);
myBallActor->SetResolveCoincidentTopology(false);
myBallActor->SetCoincident3DAllowed(true);
@@
-115,29
+119,40
@@
SMESH_SVTKActor
myBallGrid->Initialize();
myBallGrid->Allocate();
myBallGrid->Initialize();
myBallGrid->Allocate();
- vtk
DataSet *aSourceDataSet =
theMapActor->GetInput();
-
SVTK::CopyPoints( GetSource(), aSourceDataSet
);
-
SVTK::CopyPoints( myBallGrid, aSourceDataSet
);
-
SVTK::CopyPoints( my0DGrid, aSourceDataSet
);
+ vtk
UnstructuredGrid * aSourceGrid = (vtkUnstructuredGrid *)
theMapActor->GetInput();
+
GetSource()->SetPoints( aSourceGrid->GetPoints()
);
+
myBallGrid->SetPoints( aSourceGrid->GetPoints()
);
+
my0DGrid->SetPoints( aSourceGrid->GetPoints()
);
int aNbOfParts = theMapIndex.Extent();
int aNbOfParts = theMapIndex.Extent();
+
+ vtkCellData* cd = 0;
+ vtkCellData* outputCD = 0;
+ //Copy deamaters of the balls
+ if(myVisualObj) {
+ outputCD = myBallGrid->GetCellData();
+ cd = aSourceGrid->GetCellData();
+ }
+ outputCD->CopyAllocate(cd,aNbOfParts,aNbOfParts/2);
for(int ind = 1; ind <= aNbOfParts; ind++){
int aPartId = theMapIndex( ind );
if(vtkCell* aCell = theMapActor->GetElemCell(aPartId))
{
for(int ind = 1; ind <= aNbOfParts; ind++){
int aPartId = theMapIndex( ind );
if(vtkCell* aCell = theMapActor->GetElemCell(aPartId))
{
-#if VTK_XVERSION > 50700
if (aCell->GetCellType() != VTK_POLYHEDRON)
if (aCell->GetCellType() != VTK_POLYHEDRON)
-#endif
{
if(aCell->GetCellType() == VTK_VERTEX ) {
my0DGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
{
if(aCell->GetCellType() == VTK_VERTEX ) {
my0DGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
- } else if(aCell->GetCellType() == VTK_POLY_VERTEX ) {
- myBallGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
- } else {
+ }
+ else if(aCell->GetCellType() == VTK_POLY_VERTEX ) {
+ vtkIdType newCellId = myBallGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
+ if(myVisualObj) {
+ outputCD->CopyData(cd, myVisualObj->GetElemVTKId(aPartId), newCellId);
+ }
+ }
+ else {
myUnstructuredGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
}
}
myUnstructuredGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
}
}
-#if VTK_XVERSION > 50700
else
{
vtkPolyhedron *polyhedron = dynamic_cast<vtkPolyhedron*>(aCell);
else
{
vtkPolyhedron *polyhedron = dynamic_cast<vtkPolyhedron*>(aCell);
@@
-146,7
+161,6
@@
SMESH_SVTKActor
vtkIdType *pts = polyhedron->GetFaces();
myUnstructuredGrid->InsertNextCell(aCell->GetCellType(),pts[0], pts+1);
}
vtkIdType *pts = polyhedron->GetFaces();
myUnstructuredGrid->InsertNextCell(aCell->GetCellType(),pts[0], pts+1);
}
-#endif
}
}
}
}
@@
-164,8
+178,8
@@
SMESH_SVTKActor
::Initialize()
{
Superclass::Initialize();
::Initialize()
{
Superclass::Initialize();
- my0DActor->SetInput(my0DGrid);
- myBallActor->SetInput(myBallGrid);
+ my0DActor->SetInput
Data
(my0DGrid);
+ myBallActor->SetInput
Data
(myBallGrid);
}
}
@@
-184,3
+198,11
@@
void SMESH_SVTKActor::SetBallSize(float theSize) {
myBallActor->GetProperty()->SetPointSize(theSize);
}
myBallActor->GetProperty()->SetPointSize(theSize);
}
+void SMESH_SVTKActor::SetBallScale(double theScale) {
+ myBallActor->SetBallScale(theScale);
+}
+
+void SMESH_SVTKActor::SetVisualObject(TVisualObjPtr theVisualObj) {
+ myVisualObj = theVisualObj;
+}
+