]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix for Bug IPAL13723:
authorenk <enk@opencascade.com>
Thu, 2 Nov 2006 14:21:36 +0000 (14:21 +0000)
committerenk <enk@opencascade.com>
Thu, 2 Nov 2006 14:21:36 +0000 (14:21 +0000)
enk/PRSMERGER: white scalar map on groups.

Fix for carre_en_quad4_seg2.med.

src/VISU_I/VISU_PrsMerger_i.cc

index 8450d072a4390f50bd8bc6bdb8d8a002efcc855a..3c40a3f2e928ed45fc8f4cb793ca7f8b8111ddb7 100644 (file)
@@ -36,6 +36,7 @@
 #include "SUIT_ResourceMgr.h"
 
 #include <vtkUnstructuredGrid.h>
+#include <vtkCellType.h>
 #include <vtkProperty.h>
 #include <vtkMapper.h>
 
@@ -266,7 +267,8 @@ AddMeshOnGroup(const char* theMeshName,
   CORBA::Long aRetVal = -1;
   VISU::PIDMapper anIDMapper;
   anIDMapper = myResult->GetInput()->GetMeshOnGroup(theMeshName,theGroupName);
-
+  if(!anIDMapper)
+    MESSAGE("Warning: There are no mesh with group=|"<<theGroupName<<"|");
   VISU_MeshPL* aTmpMesh = VISU_MeshPL::New();
   aTmpMesh->SetIDMapper(anIDMapper);
 
@@ -336,6 +338,11 @@ SetScalarMap(const char* theMeshName,
   if (MYDEBUG) MESSAGE("VISU::PrsMerger_i::SetScalarMap");
   VISU::PIDMapper anIDMapper;
   anIDMapper = myResult->GetInput()->GetTimeStampOnMesh(theMeshName,(VISU::TEntity)theEntity,theFieldName,int(theStampsNum));
+
+  myEntity    = (VISU::TEntity)theEntity;
+  myFieldName = theFieldName;
+  myIteration = theStampsNum;
+
   myScalarsPL->SetIDMapper(anIDMapper);
   myPrsMergerPL->SetScalars(myScalarsPL);
 }
@@ -444,11 +451,33 @@ VISU::PrsMerger_i
   if(!anIDMapper) return false;
   
   bool aAllPoints = true;
-  for(int i=0;i<anIDMapper->GetVTKOutput()->GetNumberOfCells();i++)
-    if(anIDMapper->GetVTKOutput()->GetCellType(i) != 1){
-      aAllPoints = false;
+  if(anIDMapper->GetVTKOutput()->GetNumberOfCells()>0){
+    int aVtkCellType = anIDMapper->GetVTKOutput()->GetCellType(0);
+    if (MYDEBUG) MESSAGE("CellType="<<aVtkCellType);
+    switch(myEntity){
+    case NODE_ENTITY:
+    case CELL_ENTITY:
+      if(aVtkCellType != VTK_LINE &&
+        aVtkCellType != VTK_POLY_LINE && 
+        aVtkCellType != VTK_VERTEX &&
+        aVtkCellType != VTK_PIXEL)
+       aAllPoints = false;
+      break;
+    case EDGE_ENTITY:
+      if(aVtkCellType == VTK_LINE ||
+        aVtkCellType == VTK_POLY_LINE)
+       aAllPoints = false;
+      break;
+    case FACE_ENTITY:
+      if(aVtkCellType == VTK_TRIANGLE ||
+        aVtkCellType == VTK_TRIANGLE_STRIP ||
+        aVtkCellType == VTK_POLYGON ||
+        aVtkCellType == VTK_QUAD)
+       aAllPoints = false;
       break;
     }
+  }
 
+  if (MYDEBUG) MESSAGE("return="<<!aAllPoints);
   return (!aAllPoints);
 }