]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To fix regression in selection of GaussPoints
authorapo <apo@opencascade.com>
Wed, 16 May 2007 14:57:05 +0000 (14:57 +0000)
committerapo <apo@opencascade.com>
Wed, 16 May 2007 14:57:05 +0000 (14:57 +0000)
src/CONVERTOR/VISU_AppendFilter.cxx
src/CONVERTOR/VISU_AppendFilterUtilities.cxx
src/CONVERTOR/VISU_AppendPolyData.cxx
src/CONVERTOR/VISU_ConvertorUtils.cxx
src/CONVERTOR/VISU_Convertor_impl.cxx
src/CONVERTOR/VISU_MedConvertor.cxx
src/CONVERTOR/VISU_MedConvertor.hxx
src/CONVERTOR/VISU_PointCoords.cxx
src/CONVERTOR/VISU_PointCoords.hxx
src/CONVERTOR/VISU_Structures_impl.cxx
src/CONVERTOR/VISU_Structures_impl.hxx

index 7207f68b6cfae39e6c5fbbb66c3d9277e81b1da2..604e38c161ddf702fedc321647b4642103afdc0e 100644 (file)
@@ -56,7 +56,7 @@ VISU_AppendFilter
              vtkInformationVector *theOutputVector)
 {
   bool anIsExecuted = false;
-  if(GetNumberOfInputConnections(0) > 1)
+  if(GetNumberOfInputConnections(0) > 1 || IsMergingInputs() || IsMappingInputs())
     anIsExecuted = VISU::UnstructuredGridRequestData(theInputVector,
                                                     this->GetNumberOfInputConnections(0),
                                                     theOutputVector,
index 18b585713410805b1ebb66fdfca80056d399a5b1..d09b24a5afdd60eccb16046705f6e10962cc286f 100644 (file)
@@ -312,8 +312,8 @@ namespace
            if(vtkDataSet *aDataSet = VISU::GetInput(theInputVector, anInputId)){
              vtkIdType aNbCells = aDataSet->GetNumberOfCells(); 
              for(vtkIdType aCellId = 0; aCellId < aNbCells; aCellId++){
-               aDataArray->SetValue(aTupleId++, anInputId);
                aDataArray->SetValue(aTupleId++, aCellId);
+               aDataArray->SetValue(aTupleId++, anInputId);
              }
            }
          }
index 728bbb948a5d0f595b6bf3e89ac186785c375fce..6a549521100cce454c2364f7513d53b869acfff2 100644 (file)
@@ -55,12 +55,14 @@ VISU_AppendPolyData
              vtkInformationVector **theInputVector,
              vtkInformationVector *theOutputVector)
 {
-  bool anIsExecuted = VISU::PolyDataRequestData(theInputVector,
-                                               this->GetNumberOfInputConnections(0),
-                                               theOutputVector,
-                                               GetSharedPointSet(),
-                                               IsMergingInputs(),
-                                               IsMappingInputs());
+  bool anIsExecuted = false;
+  if(GetNumberOfInputConnections(0) > 1 || IsMergingInputs() || IsMappingInputs())
+    anIsExecuted = VISU::PolyDataRequestData(theInputVector,
+                                            this->GetNumberOfInputConnections(0),
+                                            theOutputVector,
+                                            GetSharedPointSet(),
+                                            IsMergingInputs(),
+                                            IsMappingInputs());
   if(!anIsExecuted)
     anIsExecuted = Superclass::RequestData(theRequest,
                                           theInputVector,
index 35db58b145e883293ccfd3a8234f9e3e2286b048..85f49eecc761a73cf75f0461d1c8644263ee23fd 100644 (file)
@@ -362,8 +362,8 @@ namespace VISU
   GetObjID(vtkDataSet *theDataSet, vtkIdType theID)
   {
     theDataSet->Update();
-    vtkDataSetAttributes *aDataSetAttributes = theDataSet->GetPointData();
-    if(vtkDataArray *aDataArray = aDataSetAttributes->GetArray("VISU_GAUSS_MAPPER")){
+    vtkDataSetAttributes *aDataSetAttributes = theDataSet->GetCellData();
+    if(vtkDataArray *aDataArray = aDataSetAttributes->GetArray("VISU_CELLS_MAPPER")){
       if(vtkIntArray *anIntArray = dynamic_cast<vtkIntArray*>(aDataArray)){
        vtkIdType anID = 2 * theID;
        TCellID aCellID = anIntArray->GetValue(anID);
@@ -380,13 +380,13 @@ namespace VISU
   GetInputCellID(vtkDataSet *theDataSet, vtkIdType theObjID)
   {
     theDataSet->Update();
-    vtkDataSetAttributes *aDataSetAttributes = theDataSet->GetPointData();
+    vtkDataSetAttributes *aDataSetAttributes = theDataSet->GetCellData();
     if(vtkDataArray *aDataArray = aDataSetAttributes->GetArray("VISU_INPUTS_MAPPER")){
       if(vtkIntArray *anIntArray = dynamic_cast<vtkIntArray*>(aDataArray)){
        vtkIdType aVTKID = GetElemVTKID(theDataSet, theObjID);
        vtkIdType aTupleID = 2 * aVTKID;
-       TInputID anInputID = anIntArray->GetValue(aTupleID);
-       TCellID aCellID = anIntArray->GetValue(aTupleID + 1);
+       TCellID aCellID = anIntArray->GetValue(aTupleID);
+       TInputID anInputID = anIntArray->GetValue(aTupleID + 1);
        return TInputCellID(anInputID, aCellID);
       }
     }
index 9f67b8feff86e802a3fedd8d04c539fd959451a6..c2cd889314fd9b8f78a3ba473cc5b5578c4932c5 100644 (file)
@@ -414,9 +414,9 @@ namespace
   
   //---------------------------------------------------------------
   void
-  GetSource(const VISU::PPolyData& theSource,
-           const VISU::PGaussSubMeshImpl& theGaussSubMesh,
-           const VISU::PMeshOnEntityImpl& theMeshOnEntity)
+  GetGaussSubMeshSource(const VISU::PPolyData& theSource,
+                       const VISU::PGaussSubMeshImpl& theGaussSubMesh,
+                       const VISU::PMeshOnEntityImpl& theMeshOnEntity)
   {
     vtkCellArray* aConnectivity = vtkCellArray::New();
     vtkIdType aCellsSize = theGaussSubMesh->myCellsSize;
@@ -438,6 +438,38 @@ namespace
     aSource->SetVerts(aConnectivity);
     
     aConnectivity->Delete();
+
+    {
+      vtkIdType aNbTuples = aNbPoints;
+      vtkIntArray *aDataArray = vtkIntArray::New();
+      aDataArray->SetName("VISU_POINTS_MAPPER");
+      aDataArray->SetNumberOfComponents(2);
+      aDataArray->SetNumberOfTuples(aNbTuples);
+      int *aDataArrayPtr = aDataArray->GetPointer(0);
+      for(vtkIdType aTupleId = 0; aTupleId < aNbTuples; aTupleId++){
+       vtkIdType aGlobalID = theGaussSubMesh->GetGlobalID(aTupleId);
+       *aDataArrayPtr++ = aGlobalID;
+       *aDataArrayPtr++ = 0;
+      }
+      aSource->GetPointData()->AddArray(aDataArray);
+      aDataArray->Delete();
+    }
+
+    {
+      vtkIdType aNbTuples = aNbPoints;
+      vtkIntArray *aDataArray = vtkIntArray::New();
+      aDataArray->SetName("VISU_CELLS_MAPPER");
+      aDataArray->SetNumberOfComponents(2);
+      aDataArray->SetNumberOfTuples(aNbTuples);
+      int *aDataArrayPtr = aDataArray->GetPointer(0);
+      for(vtkIdType aTupleId = 0; aTupleId < aNbTuples; aTupleId++){
+       VISU::TGaussPointID aGaussPointID = theGaussSubMesh->GetObjID(aTupleId);
+       *aDataArrayPtr++ = aGaussPointID.first;
+       *aDataArrayPtr++ = aGaussPointID.second;
+      }
+      aSource->GetCellData()->AddArray(aDataArray);
+      aDataArray->Delete();
+    }
   }
   
   
@@ -460,7 +492,7 @@ namespace
     INITMSG(MYDEBUG,"GetGaussSubMesh - aVGeom = "<<aGauss->myGeom<<endl);
 
     const VISU::PPolyData& aSource = theGaussSubMesh->GetSource();
-    GetSource(aSource, theGaussSubMesh, theMeshOnEntity);
+    GetGaussSubMeshSource(aSource, theGaussSubMesh, theMeshOnEntity);
 
     INITMSGA(MYDEBUG,0,"GetNumberOfPoints - "<<aSource->GetNumberOfPoints()<<endl);
     BEGMSG(MYDEBUG,"GetNumberOfCells - "<<aSource->GetNumberOfCells()<<endl);
@@ -482,18 +514,21 @@ namespace
     const VISU::PAppendPolyData& anAppendFilter = theGaussMesh->GetFilter();
     const VISU::TGeom2GaussSubMesh& aGeom2GaussSubMesh = theGaussMesh->myGeom2GaussSubMesh;
     VISU::TGeom2GaussSubMesh::const_iterator anIter = aGeom2GaussSubMesh.begin();
-    for(; anIter != aGeom2GaussSubMesh.end(); anIter++){
+    for(vtkIdType aStartID = 0; anIter != aGeom2GaussSubMesh.end(); anIter++){
       VISU::PGaussSubMeshImpl aGaussSubMesh = anIter->second;
       if(aGaussSubMesh->myStatus == VISU::eRemoveAll)
        continue;
-      
+
+      aGaussSubMesh->myStartID = aStartID;
+
       GetGaussSubMesh(theMesh,
                      theMeshOnEntity,
                      theGaussMesh,
                      aGaussSubMesh);
       
       const VISU::PPolyData& aSource = aGaussSubMesh->GetSource();
-      
+      aStartID += aSource->GetNumberOfCells();
+
       anAppendFilter->AddInput(aSource.GetPointer());
     }
     anAppendFilter->Update(); // Fix on VTK
@@ -662,7 +697,7 @@ VISU_Convertor_impl
       if(MYDEBUGWITHFILES){
        std::string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
        std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-";
-       aFileName += aMeshName + dtos("-%d-",int(theEntity)) + "-Conv.vtk";
+       aFileName += aMeshName + dtos("-%d-",int(theEntity)) + "-MeshOnEntity.vtk";
        VISU::WriteToFile(anAppendFilter->GetOutput(),aFileName);
       }
 
@@ -730,7 +765,7 @@ VISU_Convertor_impl
        std::string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
        std::string aFamilyName = QString(theFamilyName.c_str()).simplifyWhiteSpace().latin1();
        std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-";
-       aFileName += aMeshName + dtos("-%d-",int(theEntity)) + aFamilyName + "-Conv.vtk";
+       aFileName += aMeshName + dtos("-%d-",int(theEntity)) + aFamilyName + "-FamilyOnEntity.vtk";
        VISU::WriteToFile(aSource.GetPointer(),aFileName);
       }
 
@@ -813,7 +848,7 @@ VISU_Convertor_impl
        std::string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
        std::string aGroupName = QString(theGroupName.c_str()).simplifyWhiteSpace().latin1();
        std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-";
-       aFileName += aMeshName + "-" + aGroupName + "-Conv.vtk";
+       aFileName += aMeshName + "-" + aGroupName + "-MeshOnGroup.vtk";
        VISU::WriteToFile(anAppendFilter->GetOutput(),aFileName);
       }
     }
@@ -919,7 +954,7 @@ VISU_Convertor_impl
        std::string aFieldName = QString(theFieldName.c_str()).simplifyWhiteSpace().latin1();
        std::string aPrefix = std::string(getenv("HOME"))+"/"+getenv("USER")+"-";
        std::string aFileName = aPrefix + aMeshName + dtos("-%d-",int(theEntity)) + 
-         aFieldName + dtos("-%d", theStampsNum) + "-Conv.vtk";
+         aFieldName + dtos("-%d", theStampsNum) + "-TimeStampOnMesh.vtk";
        VISU::WriteToFile(anOutput,aFileName);
       }
       if(MYVTKDEBUG){
@@ -1008,7 +1043,7 @@ VISU_Convertor_impl
        std::string aFieldName = QString(theFieldName.c_str()).simplifyWhiteSpace().latin1();
        std::string aPrefix = std::string(getenv("HOME"))+"/"+getenv("USER")+"-";
        std::string aFileName = aPrefix + aMeshName + dtos("-%d-",int(theEntity)) + 
-         aFieldName + dtos("-%d",theStampsNum) + "-Conv.vtk";
+         aFieldName + dtos("-%d",theStampsNum) + "-TimeStampOnGaussPts.vtk";
        VISU::WriteToFile(anOutput, aFileName);
       }
       if(MYVTKDEBUG){
index a2f0f396e5b4b1dca919cee45186ee37797daf0d..b4d1f74115ea164bae2c8050a63a9bb82abcad5b 100644 (file)
@@ -1218,8 +1218,7 @@ namespace VISU
   //---------------------------------------------------------------
   TGaussPointID
   TMEDGaussSubMesh
-  ::GetObjID(vtkIdType theID,
-            vtkIdType theStartID) const
+  ::GetObjID(vtkIdType theID) const
   {
     TCellID aCellID = theID / myGauss->myNbPoints;
     TLocalPntID aLocalPntID = theID % myGauss->myNbPoints;
@@ -1227,7 +1226,7 @@ namespace VISU
     if(myIsElemNum)
       aCellID = (*myElemNum)[aCellID];
     else
-      aCellID += theStartID;
+      aCellID += myStartID;
 
     return TGaussPointID(aCellID, aLocalPntID);
   }
index 6935b63ff05e8dacf76ed86e86ceb1cbe46de387..4b95024400aec10df7833567149016144e19737f 100644 (file)
@@ -236,8 +236,7 @@ namespace VISU
 
     virtual
     TGaussPointID
-    GetObjID(vtkIdType theID,
-            vtkIdType theStartID) const;
+    GetObjID(vtkIdType theID) const;
     
     //! Gets memory size used by the instance (bytes).
     virtual
index bfdf7aeffd6420b2c43c6fcc6b980f345c0cdb25..ac1e3dbbafe0374afeabe6d434413a789231397f 100644 (file)
@@ -127,6 +127,20 @@ namespace VISU
     return myCoord->GetCoordSlice(theNodeId);
   }
 
+  vtkIdType
+  TPointCoords
+  ::GetObjID(vtkIdType theID) const
+  {
+    return theID;
+  }
+
+  vtkIdType
+  TPointCoords
+  ::GetVTKID(vtkIdType theID) const
+  {
+    return theID;
+  }
+
   void 
   TPointCoords
   ::SetVoidArray() const
@@ -203,20 +217,6 @@ namespace VISU
     return myPointsDim[theDim];
   }
 
-  vtkIdType
-  TNamedPointCoords
-  ::GetObjID(vtkIdType theID) const
-  {
-    return theID;
-  }
-
-  vtkIdType
-  TNamedPointCoords
-  ::GetVTKID(vtkIdType theID) const
-  {
-    return theID;
-  }
-
   std::string 
   TNamedPointCoords
   ::GetNodeName(vtkIdType theObjID) const
index 6a420ec7b088c0724cd05a162b0bd4b0e181f165..dfb30f2af5f8fb8be2f6a6423ebf40c310d04766 100644 (file)
@@ -187,6 +187,16 @@ namespace VISU
     TCoordSlice 
     GetCoordSlice(vtkIdType theNodeId);
 
+    //! Get object number for node by its VTK one
+    virtual
+    vtkIdType
+    GetObjID(vtkIdType theID) const;
+
+    //! Get VTK number for node by its object one
+    virtual
+    vtkIdType
+    GetVTKID(vtkIdType theID) const;
+
   protected:
     //! An container for coordinates of the nodes
     /*!
@@ -222,16 +232,6 @@ namespace VISU
     const std::string&
     GetName(vtkIdType theDim) const;
 
-    //! Get object number for node by its VTK one
-    virtual
-    vtkIdType
-    GetObjID(vtkIdType theID) const;
-
-    //! Get VTK number for node by its object one
-    virtual
-    vtkIdType
-    GetVTKID(vtkIdType theID) const;
-
     //! Get name of node by its object number
     virtual
     std::string 
index 76b59d96976f2b42cbcc6b32ff0e9dea73123537..34e202e8cbfb8e8844af459a3ad6d14b650b5f92 100644 (file)
@@ -601,18 +601,25 @@ namespace VISU
   TGaussSubMeshImpl
   ::TGaussSubMeshImpl():
     myPointCoords(new TPointCoords()),
-    myStatus(eNone)
+    myStatus(eNone),
+    myStartID(0)
   {}
   
   TGaussPointID
   TGaussSubMeshImpl
-  ::GetObjID(vtkIdType theID,
-            vtkIdType theStartID) const
+  ::GetObjID(vtkIdType theID) const
   {
-    TCellID aCellID = theStartID + theID / myGauss->myNbPoints;
+    TCellID aCellID = myStartID + theID / myGauss->myNbPoints;
     TLocalPntID aLocalPntID = theID % myGauss->myNbPoints;
     
-    return TGaussPointID(aCellID,aLocalPntID);
+    return TGaussPointID(aCellID, aLocalPntID);
+  }
+
+  vtkIdType 
+  TGaussSubMeshImpl
+  ::GetGlobalID(vtkIdType theID) const
+  {
+    return myStartID + theID;
   }
 
   unsigned long int
@@ -720,6 +727,11 @@ namespace VISU
 
 
   //---------------------------------------------------------------
+  TSubMeshImpl
+  ::TSubMeshImpl():
+    myStartID(0)
+  {}
+
   vtkIdType
   TSubMeshImpl
   ::GetElemObjID(vtkIdType theID) const
@@ -747,6 +759,13 @@ namespace VISU
   }
 
   //---------------------------------------------------------------
+  TMeshOnEntityImpl
+  ::TMeshOnEntityImpl()
+  {
+    const PAppendFilter& anAppendFilter = GetFilter();
+    anAppendFilter->SetMappingInputs(true);
+  }
+
   vtkIdType
   TMeshOnEntityImpl
   ::GetNodeVTKID(vtkIdType theID) const
index 351b886cd960addaf5f3a6912a9f65b2085cbc9e..57fc5335662e2c6335ae675c727e637007c9c0e9 100644 (file)
@@ -443,8 +443,11 @@ namespace VISU
     //! To implement the TGaussPtsIDMapper::GetObjID
     virtual
     TGaussPointID
-    GetObjID(vtkIdType theID,
-            vtkIdType theStartID) const;
+    GetObjID(vtkIdType theID) const;
+    
+    virtual
+    vtkIdType
+    GetGlobalID(vtkIdType theID) const;
     
     //! Gets memory size used by the instance (bytes).
     virtual
@@ -460,6 +463,7 @@ namespace VISU
     */
     ESubMeshStatus myStatus;
 
+    vtkIdType myStartID;
     PPointCoords myPointCoords; //!< Keeps coordinates of Gauss Points
   };
 
@@ -536,6 +540,8 @@ namespace VISU
   //! The class is responsible for mapping of cells of defined geometrical type  
   struct TSubMeshImpl: virtual TUnstructuredGridHolder
   {
+    TSubMeshImpl();
+
     //! To implement the TIDMapper::GetElemObjID
     virtual 
     vtkIdType 
@@ -565,6 +571,8 @@ namespace VISU
                            virtual TAppendFilterHolder, 
                            virtual TSizeCounter
   {
+    TMeshOnEntityImpl();
+
     //! Reimplement the TIDMapper::GetNodeVTKID
     virtual 
     vtkIdType