]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Now ElnoDisassembleFilter can generate corresponding vectorial data
authorapo <apo@opencascade.com>
Fri, 2 May 2008 11:36:44 +0000 (11:36 +0000)
committerapo <apo@opencascade.com>
Fri, 2 May 2008 11:36:44 +0000 (11:36 +0000)
src/PIPELINE/VISUPipeLine.cxx
src/PIPELINE/VISU_ElnoDisassembleFilter.cxx

index 8ab6e28be9e94b1a3257852ee11bd89680489cd5..96d7f9bb303a1274d80945d74a0d8f35cecb60a5 100644 (file)
@@ -287,8 +287,10 @@ main(int argc, char** argv)
              VISU::WriteToFile( aCutter->GetOutput(), "/data/apo/elno_from_cutter.vtk" );
 
              VISU_ElnoAssembleFilter* anAssembleFilter = VISU_ElnoAssembleFilter::New();
-             anAssembleFilter->SetInput( aCutter->GetOutput() );
-             VISU::WriteToFile( anAssembleFilter->GetPolyDataOutput(), "/data/apo/elno_from_assemble.vtk" );
+             //anAssembleFilter->SetInput( aCutter->GetOutput() );
+             //VISU::WriteToFile( anAssembleFilter->GetPolyDataOutput(), "/data/apo/elno_from_assemble.vtk" );
+             anAssembleFilter->SetInput( anExtractScalars->GetOutput() );
+             VISU::WriteToFile( anAssembleFilter->GetUnstructuredGridOutput(), "/data/apo/elno_from_assemble.vtk" );
 
              //VISU_ElnoWarpVector* anElnoWarpVector = VISU_ElnoWarpVector::New();
               //anElnoWarpVector->SetInput( anUnstructuredGridIDMapper->GetUnstructuredGridOutput() );
@@ -303,7 +305,7 @@ main(int argc, char** argv)
              vtkFloatingPointType aScalarRange[ 2 ];
              aGeometryFilter->GetRange( aScalarRange );
              anExtractScalars->GetOutput()->GetScalarRange( aScalarRange );
-             aCutter->GetOutput()->GetScalarRange( aScalarRange );
+             //aCutter->GetOutput()->GetScalarRange( aScalarRange );
              // To calculate and apply default scale factor
              //{
              //        vtkFloatingPointType aScale = VISU_DeformedShapePL::GetScaleFactor( anElnoWarpVector->GetOutput() );
index b73b5214f5df4a457d762937d385e8598765b805..45e5c075aaa435bd59b5485dfa902da827a52981 100644 (file)
@@ -89,11 +89,16 @@ namespace
                      TPointsDataArray *theOutputPointsArray, 
                      VISU::TGetElnoNodeData< elno_type >& theGetElnoNodeData,
                      TElnoDataArray* theElnoPointDataArray,
+                     TElnoDataArray* theElnoPointVectors,
                      TPointsDataArray *theElnoPointCoords )
   {
     typedef typename VISU::TL::TEnum2VTKBasicType< points_type >::TResult TPointsDataType;
     typedef typename VISU::TL::TEnum2VTKBasicType< elno_type >::TResult TElnoDataType;
 
+    // To reserve a temproary value holder
+    vtkIdType aNbComp = std::max( 3, theGetElnoNodeData.getNbComp() );
+    std::vector< TElnoDataType > anElnoDataValues( aNbComp ); 
     theConnectivity->InitTraversal();
     vtkIdType aNbPts = 0, *aPts = 0;
     for ( vtkIdType aCellId = 0; theConnectivity->GetNextCell( aNbPts, aPts ); aCellId++ ) {
@@ -111,6 +116,9 @@ namespace
 
        TElnoDataType* anElnoData = theGetElnoNodeData( aCellId, aPntId );
        theElnoPointDataArray->SetTupleValue( aNewPntId,  anElnoData );
+
+       theElnoPointDataArray->GetTupleValue( aNewPntId, &anElnoDataValues[ 0 ] );
+       theElnoPointVectors->SetTupleValue( aNewPntId, &anElnoDataValues[ 0 ] );
       }
     }
   }
@@ -125,12 +133,17 @@ namespace
                      TPointsDataArray *theOutputPointsArray, 
                      VISU::TGetElnoNodeData< elno_type >& theGetElnoNodeData,
                      TElnoDataArray* theElnoPointDataArray,
+                     TElnoDataArray* theElnoPointVectors,
                      TPointsDataArray *theElnoPointCoords, 
                      vtkFloatingPointType theShrinkFactor )
   {
     typedef typename VISU::TL::TEnum2VTKBasicType< points_type >::TResult TPointsDataType;
     typedef typename VISU::TL::TEnum2VTKBasicType< elno_type >::TResult TElnoDataType;
 
+    // To reserve a temproary value holder
+    vtkIdType aNbComp = std::max( 3, theGetElnoNodeData.getNbComp() );
+    std::vector< TElnoDataType > anElnoDataValues( aNbComp ); 
+
     theConnectivity->InitTraversal();
     vtkIdType aNbPts = 0, *aPts = 0;
     for ( vtkIdType aCellId = 0; theConnectivity->GetNextCell( aNbPts, aPts ); aCellId++ ) {
@@ -172,7 +185,10 @@ namespace
        theOutputPointData->CopyData( theInputPointData, aCurrentPntId, aNewPntId );
 
        TElnoDataType* anElnoData = theGetElnoNodeData( aCellId, aPntId );
-       theElnoPointDataArray->SetTupleValue( aNewPntId,  anElnoData );
+       theElnoPointDataArray->SetTupleValue( aNewPntId, anElnoData );
+
+       theElnoPointDataArray->GetTupleValue( aNewPntId, &anElnoDataValues[ 0 ] );
+       theElnoPointVectors->SetTupleValue( aNewPntId, &anElnoDataValues[ 0 ] );
       }
     }
   }
@@ -211,6 +227,11 @@ namespace
     anElnoPointDataArray->SetNumberOfTuples( aNbPoints );
     anElnoPointDataArray->SetName( "ELNO_POINT_DATA" );
 
+    TElnoDataArray* anElnoPointVectors = TElnoDataArray::New();
+    anElnoPointVectors->SetNumberOfComponents( 3 );
+    anElnoPointVectors->SetNumberOfTuples( aNbPoints );
+    anElnoPointVectors->SetName( "ELNO_POINT_VECTORS" );
+
     TPointsDataArray* anElnoPointCoords = TPointsDataArray::New();
     anElnoPointCoords->SetNumberOfComponents( 3 );
     anElnoPointCoords->SetNumberOfTuples( aNbPoints );
@@ -225,6 +246,7 @@ namespace
          anOutputPointsArray,
          aGetElnoNodeData,
          anElnoPointDataArray,
+         anElnoPointVectors,
          anElnoPointCoords,
          theShrinkFactor );
     } else {
@@ -236,6 +258,7 @@ namespace
          anOutputPointsArray,
          aGetElnoNodeData,
          anElnoPointDataArray,
+         anElnoPointVectors,
          anElnoPointCoords );
     }
 
@@ -254,6 +277,9 @@ namespace
     anOutputPointData->AddArray( anElnoPointDataArray );
     anElnoPointDataArray->Delete();
     
+    anOutputPointData->AddArray( anElnoPointVectors );
+    anElnoPointVectors->Delete();
+    
     anOutputPointData->AddArray( anElnoPointCoords );
     anElnoPointCoords->Delete();