]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix for Bug NPAL19763
authorapo <apo@opencascade.com>
Thu, 22 May 2008 15:43:38 +0000 (15:43 +0000)
committerapo <apo@opencascade.com>
Thu, 22 May 2008 15:43:38 +0000 (15:43 +0000)
 - EDF 714 VISU : Can't read a med file

src/CONVERTOR/VISU_AppendFilter.cxx
src/CONVERTOR/VISU_AppendFilterUtilities.cxx
src/CONVERTOR/VISU_MeshValue.cxx
src/PIPELINE/VISU_ColoredPL.cxx
src/PIPELINE/VISU_Extractor.cxx

index 604e38c161ddf702fedc321647b4642103afdc0e..c605d563f6357717514c2037295530963375162f 100644 (file)
@@ -56,14 +56,14 @@ VISU_AppendFilter
              vtkInformationVector *theOutputVector)
 {
   bool anIsExecuted = false;
-  if(GetNumberOfInputConnections(0) > 1 || IsMergingInputs() || IsMappingInputs())
+  if( IsMergingInputs() || IsMappingInputs() )
     anIsExecuted = VISU::UnstructuredGridRequestData(theInputVector,
-                                                    this->GetNumberOfInputConnections(0),
+                                                    GetNumberOfInputConnections( 0 ),
                                                     theOutputVector,
                                                     GetSharedPointSet(),
                                                     IsMergingInputs(),
                                                     IsMappingInputs());
-  if(!anIsExecuted)
+  if( !anIsExecuted )
     anIsExecuted = Superclass::RequestData(theRequest,
                                           theInputVector,
                                           theOutputVector);
index 3294684d233aeda763976d472402944b807608ff..8d46b280bba9f7b970894ddaa65355302a56a5bf 100644 (file)
@@ -191,14 +191,30 @@ namespace
              bool theIsMergingInputs,
              bool theIsMappingInputs)
   {
-    if(theSharedPointSet){
+    if ( theNumberOfInputConnections == 1 ) {
+      // get the input and ouptut
+      vtkDataSet *anInput = VISU::GetInput( theInputVector, 0 );
+      vtkDataSet* anOutput = VISU::GetOutput( theOutputVector );
+
+      // This has to be here because it initialized all field datas.
+      anOutput->CopyStructure( anInput );
+  
+      // Pass all. (data object's field data is passed by the
+      // superclass after this method)
+      anOutput->GetPointData()->PassData( anInput->GetPointData() );
+      anOutput->GetCellData()->PassData( anInput->GetCellData() );
+      
+      return 1;
+    }
+
+    if ( theSharedPointSet ) {
       vtkPoints* aPoints = theSharedPointSet->GetPoints();
       if(aPoints->GetNumberOfPoints() < 1)
        return true;
   
       TDataSet* anOutput = TDataSet::SafeDownCast(VISU::GetOutput(theOutputVector));
       vtkIdType anNbInputs = theNumberOfInputConnections;
-      if(theIsMergingInputs){
+      if ( theIsMergingInputs ) {
        TCellIdMerger aFunctor(anNbInputs);
        ForEachInput<TCellIdMerger>(theInputVector, anNbInputs, aFunctor);
 
index 51b4a72d78d4f6bc779ce577c1856006dac07d5e..b4b265ed640f429cbbf4d4554f9d8870fb97e06a 100644 (file)
@@ -280,7 +280,7 @@ namespace VISU
     std::string aFieldName = VISU::GenerateFieldName(theField, theValForTime);
     
     vtkDataSetAttributes* aDataSetAttributes;
-    switch(theEntity){
+    switch ( theEntity ) {
     case VISU::NODE_ENTITY : 
       aDataSetAttributes = theSource->GetPointData();
       break;
@@ -291,10 +291,18 @@ namespace VISU
     typedef typename TL::TEnum2VTKArrayType<EDataType>::TResult TVTKDataArray;
     TVTKDataArray *aSelectedDataArray = TVTKDataArray::New();
     vtkIdType aNbComp = theField->myNbComp;
-    aSelectedDataArray->SetNumberOfComponents( 3 );
+
+    switch ( aNbComp ) {
+    case 1:
+      aSelectedDataArray->SetNumberOfComponents( 1 );
+      aDataSetAttributes->SetScalars( aSelectedDataArray );
+      break;
+    default:
+      aSelectedDataArray->SetNumberOfComponents( 3 );
+      aDataSetAttributes->SetVectors( aSelectedDataArray );
+    }
     aSelectedDataArray->SetNumberOfTuples( aNbTuples );
     aSelectedDataArray->SetName( aFieldName.c_str() );
-    aDataSetAttributes->SetVectors( aSelectedDataArray );
 
     TVTKDataArray *aFullDataArray = TVTKDataArray::New();
     aFullDataArray->SetNumberOfComponents( aNbComp );
@@ -325,9 +333,9 @@ namespace VISU
                                   true);
       INITMSG(MYDEBUG,"InitTimeStampOnProfile - aFullDataArray->SetVoidArray()"<<std::endl);
       if ( aNbComp == 1 ) {
-       aSelectedDataArray->SetVoidArray(aMeshValue->GetPointer(),
-                                        aMeshValue->size(),
-                                        true);
+       aSelectedDataArray->SetVoidArray( aMeshValue->GetPointer(),
+                                         aMeshValue->size(),
+                                         true );
        INITMSG(MYDEBUG,"InitTimeStampOnProfile - aSelectedDataArray->SetVoidArray()"<<std::endl);
       }else{
        PDataArrayHolder aDataArrayHolder(new TTDataArrayHolder(aSelectedDataArray));
index 25e055ad7426a1b4bf4f4cc72fa2583ed5c97b0c..820bfd0bc84e1e1ff0ca72c2561af3f6b1ce63e2 100644 (file)
@@ -239,7 +239,7 @@ VISU_ColoredPL
 
   GetMapperHolder()->SetLookupTable(GetMapperTable());
   GetMapper()->InterpolateScalarsBeforeMappingOn();
-  GetMapper()->SetUseLookupTableScalarRange(true);
+  GetMapper()->SetUseLookupTableScalarRange( true );
   GetMapper()->SetColorModeToMapScalars();
   GetMapper()->ScalarVisibilityOn();
 }
index e44145e30dccbdaaa385401558b0beab5ad32c2a..eb078e3a5705a8580994fca872f9880c15e4985a 100644 (file)
@@ -168,27 +168,27 @@ VISU_Extractor
              vtkInformationVector **theInputVector,
              vtkInformationVector *theOutputVector)
 {
-  vtkDataSet *anInput = VISU::GetInput(theInputVector, 0);
-  vtkDataSet *anOutput = VISU::GetOutput(theOutputVector);
+  vtkDataSet *anInput = VISU::GetInput( theInputVector, 0 );
+  vtkDataSet *anOutput = VISU::GetOutput( theOutputVector );
 
-  anOutput->CopyStructure(anInput);
+  anOutput->CopyStructure( anInput );
 
   vtkPointData *anInputPointData = anInput->GetPointData();
   vtkPointData *anOutputPointData = anOutput->GetPointData();
-  anOutputPointData->PassData(anInputPointData); 
-  if(VISU::IsDataOnPoints(anInput)){
+  anOutputPointData->PassData( anInputPointData ); 
+  if ( VISU::IsDataOnPoints( anInput ) ) {
     int aNbElems = anInput->GetNumberOfPoints();
-    if(anInputPointData->GetAttribute(vtkDataSetAttributes::VECTORS))
-      ExecuteScalars(aNbElems, myScalarMode, anInputPointData, anOutputPointData);
+    if ( anInputPointData->GetAttribute( vtkDataSetAttributes::VECTORS ) )
+      ExecuteScalars( aNbElems, myScalarMode, anInputPointData, anOutputPointData );
   }
   
   vtkCellData *anInputCellData = anInput->GetCellData();
   vtkCellData *anOutputCellData = anOutput->GetCellData();
-  anOutputCellData->PassData(anInputCellData); 
-  if(VISU::IsDataOnCells(anInput)){
+  anOutputCellData->PassData( anInputCellData ); 
+  if ( VISU::IsDataOnCells( anInput ) ) {
     int aNbElems = anInput->GetNumberOfCells();
-    if(anInputCellData->GetAttribute(vtkDataSetAttributes::VECTORS))
-      ExecuteScalars(aNbElems, myScalarMode, anInputCellData, anOutputCellData);
+    if ( anInputCellData->GetAttribute( vtkDataSetAttributes::VECTORS ) )
+      ExecuteScalars( aNbElems, myScalarMode, anInputCellData, anOutputCellData );
   }
 
   return 1;