IPAL22870: Incorrect numbering of volume elements

This commit is contained in:
ouv 2012-03-14 08:59:47 +00:00
parent b4fbb4655f
commit 3f1a249dc8
5 changed files with 18 additions and 18 deletions

View File

@ -38,7 +38,7 @@
#include <vtkPointData.h> #include <vtkPointData.h>
#include <vtkProperty2D.h> #include <vtkProperty2D.h>
#include <vtkRenderer.h> #include <vtkRenderer.h>
#include <vtkPolyData.h> #include <vtkUnstructuredGrid.h>
#include <vtkCellData.h> #include <vtkCellData.h>
vtkStandardNewMacro(SMESH_CellLabelActor); vtkStandardNewMacro(SMESH_CellLabelActor);
@ -49,7 +49,7 @@ vtkStandardNewMacro(SMESH_CellLabelActor);
SMESH_CellLabelActor::SMESH_CellLabelActor() { SMESH_CellLabelActor::SMESH_CellLabelActor() {
//Definition of cells numbering pipeline //Definition of cells numbering pipeline
//--------------------------------------- //---------------------------------------
myCellsNumDataSet = vtkPolyData::New(); myCellsNumDataSet = vtkUnstructuredGrid::New();
myCellCenters = VTKViewer_CellCenters::New(); myCellCenters = VTKViewer_CellCenters::New();
myCellCenters->SetInput(myCellsNumDataSet); myCellCenters->SetInput(myCellsNumDataSet);
@ -125,19 +125,19 @@ SMESH_CellLabelActor::~SMESH_CellLabelActor() {
void SMESH_CellLabelActor::SetCellsLabeled(bool theIsCellsLabeled) { void SMESH_CellLabelActor::SetCellsLabeled(bool theIsCellsLabeled) {
myTransformFilter->Update(); myTransformFilter->Update();
vtkPolyData* aGrid = vtkPolyData::SafeDownCast(myTransformFilter->GetOutput()); vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::SafeDownCast(myTransformFilter->GetOutput());
if(!aGrid) if(!aGrid)
return; return;
myIsCellsLabeled = theIsCellsLabeled && aGrid->GetNumberOfPoints(); myIsCellsLabeled = theIsCellsLabeled && aGrid->GetNumberOfPoints();
if(myIsCellsLabeled){ if(myIsCellsLabeled){
myCellsNumDataSet->ShallowCopy(aGrid); myCellsNumDataSet->ShallowCopy(aGrid);
vtkDataSet *aDataSet = myCellsNumDataSet; vtkUnstructuredGrid *aDataSet = myCellsNumDataSet;
int aNbElem = aDataSet->GetNumberOfCells(); int aNbElem = aDataSet->GetNumberOfCells();
vtkIntArray *anArray = vtkIntArray::New(); vtkIntArray *anArray = vtkIntArray::New();
anArray->SetNumberOfValues(aNbElem); anArray->SetNumberOfValues(aNbElem);
for(int anId = 0; anId < aNbElem; anId++){ for(int anId = 0; anId < aNbElem; anId++){
int aSMDSId = GetElemObjId(anId); int aSMDSId = myVisualObj->GetElemObjId(anId);
anArray->SetValue(anId,aSMDSId); anArray->SetValue(anId,aSMDSId);
} }
aDataSet->GetCellData()->SetScalars(anArray); aDataSet->GetCellData()->SetScalars(anArray);

View File

@ -32,7 +32,7 @@ class vtkSelectVisiblePoints;
class vtkLabeledDataMapper; class vtkLabeledDataMapper;
class vtkActor2D; class vtkActor2D;
class vtkMaskPoints; class vtkMaskPoints;
class vtkPolyData; class vtkUnstructuredGrid;
class VTKViewer_CellCenters; class VTKViewer_CellCenters;
@ -65,7 +65,7 @@ protected:
~SMESH_CellLabelActor(); ~SMESH_CellLabelActor();
bool myIsCellsLabeled; bool myIsCellsLabeled;
vtkPolyData* myCellsNumDataSet; vtkUnstructuredGrid* myCellsNumDataSet;
vtkActor2D *myCellsLabels; vtkActor2D *myCellsLabels;
vtkMaskPoints* myClsMaskPoints; vtkMaskPoints* myClsMaskPoints;
VTKViewer_CellCenters* myCellCenters; VTKViewer_CellCenters* myCellCenters;

View File

@ -240,17 +240,17 @@ SMESH_DeviceActor
myPassFilter[ anId + 1]->SetInput( myPassFilter[ anId ]->GetOutput() ); myPassFilter[ anId + 1]->SetInput( myPassFilter[ anId ]->GetOutput() );
anId++; // 1 anId++; // 1
myGeomFilter->SetInput( myPassFilter[ anId ]->GetOutput() ); myTransformFilter->SetInput( myPassFilter[ anId ]->GetOutput() );
anId++; // 2 anId++; // 2
myPassFilter[ anId ]->SetInput( myGeomFilter->GetOutput() ); myPassFilter[ anId ]->SetInput( myTransformFilter->GetOutput() );
myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() ); myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() );
anId++; // 3 anId++; // 3
myTransformFilter->SetInput( myPassFilter[ anId ]->GetPolyDataOutput() ); myGeomFilter->SetInput( myPassFilter[ anId ]->GetOutput() );
anId++; // 4 anId++; // 4
myPassFilter[ anId ]->SetInput( myTransformFilter->GetOutput() ); myPassFilter[ anId ]->SetInput( myGeomFilter->GetOutput() );
myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() ); myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() );
anId++; // 5 anId++; // 5

View File

@ -37,7 +37,7 @@
#include <vtkPointData.h> #include <vtkPointData.h>
#include <vtkProperty2D.h> #include <vtkProperty2D.h>
#include <vtkRenderer.h> #include <vtkRenderer.h>
#include <vtkPolyData.h> #include <vtkUnstructuredGrid.h>
vtkStandardNewMacro(SMESH_NodeLabelActor); vtkStandardNewMacro(SMESH_NodeLabelActor);
@ -47,7 +47,7 @@ vtkStandardNewMacro(SMESH_NodeLabelActor);
SMESH_NodeLabelActor::SMESH_NodeLabelActor() { SMESH_NodeLabelActor::SMESH_NodeLabelActor() {
//Definition of points numbering pipeline //Definition of points numbering pipeline
//--------------------------------------- //---------------------------------------
myPointsNumDataSet = vtkPolyData::New(); myPointsNumDataSet = vtkUnstructuredGrid::New();
myPtsMaskPoints = vtkMaskPoints::New(); myPtsMaskPoints = vtkMaskPoints::New();
myPtsMaskPoints->SetInput(myPointsNumDataSet); myPtsMaskPoints->SetInput(myPointsNumDataSet);
@ -114,7 +114,7 @@ SMESH_NodeLabelActor::~SMESH_NodeLabelActor() {
void SMESH_NodeLabelActor::SetPointsLabeled(bool theIsPointsLabeled) { void SMESH_NodeLabelActor::SetPointsLabeled(bool theIsPointsLabeled) {
myTransformFilter->Update(); myTransformFilter->Update();
vtkDataSet* aGrid = vtkPolyData::SafeDownCast(myTransformFilter->GetOutput()); vtkDataSet* aGrid = vtkUnstructuredGrid::SafeDownCast(myTransformFilter->GetOutput());
if(!aGrid) if(!aGrid)
return; return;
@ -124,7 +124,7 @@ void SMESH_NodeLabelActor::SetPointsLabeled(bool theIsPointsLabeled) {
if ( myIsPointsLabeled ) if ( myIsPointsLabeled )
{ {
myPointsNumDataSet->ShallowCopy(aGrid); myPointsNumDataSet->ShallowCopy(aGrid);
vtkDataSet *aDataSet = myPointsNumDataSet; vtkUnstructuredGrid *aDataSet = myPointsNumDataSet;
int aNbElem = aDataSet->GetNumberOfPoints(); int aNbElem = aDataSet->GetNumberOfPoints();
@ -133,7 +133,7 @@ void SMESH_NodeLabelActor::SetPointsLabeled(bool theIsPointsLabeled) {
for ( vtkIdType anId = 0; anId < aNbElem; anId++ ) for ( vtkIdType anId = 0; anId < aNbElem; anId++ )
{ {
int aSMDSId = GetNodeObjId( anId ); int aSMDSId = myVisualObj->GetNodeObjId( anId );
anArray->SetValue( anId, aSMDSId ); anArray->SetValue( anId, aSMDSId );
} }

View File

@ -32,7 +32,7 @@ class vtkSelectVisiblePoints;
class vtkLabeledDataMapper; class vtkLabeledDataMapper;
class vtkActor2D; class vtkActor2D;
class vtkMaskPoints; class vtkMaskPoints;
class vtkPolyData; class vtkUnstructuredGrid;
class SMESHOBJECT_EXPORT SMESH_NodeLabelActor : public SMESH_DeviceActor { class SMESHOBJECT_EXPORT SMESH_NodeLabelActor : public SMESH_DeviceActor {
@ -63,7 +63,7 @@ protected:
~SMESH_NodeLabelActor(); ~SMESH_NodeLabelActor();
bool myIsPointsLabeled; bool myIsPointsLabeled;
vtkPolyData* myPointsNumDataSet; vtkUnstructuredGrid* myPointsNumDataSet;
vtkActor2D *myPointLabels; vtkActor2D *myPointLabels;
vtkMaskPoints* myPtsMaskPoints; vtkMaskPoints* myPtsMaskPoints;
vtkLabeledDataMapper* myPtsLabeledDataMapper; vtkLabeledDataMapper* myPtsLabeledDataMapper;