]> SALOME platform Git repositories - modules/paravis.git/commitdiff
Salome HOME
Merge V9_dev branch into master
authorrnv <rnv@opencascade.com>
Thu, 14 Jun 2018 11:52:57 +0000 (14:52 +0300)
committerrnv <rnv@opencascade.com>
Thu, 14 Jun 2018 11:52:57 +0000 (14:52 +0300)
14 files changed:
CMakeLists.txt
src/PVGUI/CMakeLists.txt
src/PVGUI/PVGUI_Module_actions.cxx
src/Plugins/MEDReader/CMakeLists.txt
src/Plugins/MEDWriter/CMakeLists.txt
src/Plugins/MEDWriter/IO/VTKToMEDMem.cxx
src/Plugins/MEDWriter/IO/vtkMEDWriter.cxx
src/Plugins/ParaMEDCorba/CMakeLists.txt
src/Plugins/SimpleMode/IO/CMakeLists.txt [deleted file]
src/Plugins/SimpleMode/IO/vtkSimpleMode.cxx
src/Plugins/SimpleMode/IO/vtkSimpleMode.h
src/Plugins/SimpleMode/ParaViewPlugin/Resources/SimpleModeServer.xml
test/standalone/gui/CMakeLists.txt
test/standalone/simple/CMakeLists.txt

index 8a316b74f26c39f208d5a859a6aae07e2f82edd7..ca0969776a11125caf5885edf4e8dfed51117d83 100644 (file)
@@ -37,7 +37,7 @@ ENDIF(WIN32)
 STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
 
 SET(${PROJECT_NAME_UC}_MAJOR_VERSION 8)
-SET(${PROJECT_NAME_UC}_MINOR_VERSION 4)
+SET(${PROJECT_NAME_UC}_MINOR_VERSION 5)
 SET(${PROJECT_NAME_UC}_PATCH_VERSION 0)
 SET(${PROJECT_NAME_UC}_VERSION
   ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION})
index 7e74e068696019f3c81badd7187064c190eed03a..63a01e229e093464ee0f74af889995e981241959 100644 (file)
@@ -25,7 +25,6 @@ INCLUDE_DIRECTORIES(
     ${KERNEL_INCLUDE_DIRS}
     ${GUI_INCLUDE_DIRS}  
     ${PROJECT_BINARY_DIR} 
-    ${CAS_INCLUDE_DIRS} 
     ${Boost_INCLUDE_DIRS}
     ${QT_INCLUDES}
     ${CMAKE_CURRENT_SOURCE_DIR}
@@ -33,7 +32,6 @@ INCLUDE_DIRECTORIES(
     )
 
 # additional preprocessor / compiler flags
-ADD_DEFINITIONS(${CAS_DEFINITIONS})
 ADD_DEFINITIONS(${KERNEL_DEFINITIONS})
 
 # libraries to link to
index 463ce6cf01bf73949c7b26ab68321b025dbf96d5..a07f9719a3cc1ba8841d1fb9caba6a3d57b615bf 100644 (file)
@@ -512,7 +512,8 @@ void PVGUI_Module::pvCreateMenus()
   // --- Menu "Help"
 
   int aHelpMnu = createMenu( tr( "MEN_DESK_HELP" ), -1, -1 );
-  int aPVHelpMnu = createMenu( tr( "ParaViS module" ), aHelpMnu, -1, 0 );
+  int aUsersGuide = createMenu( tr( "User's Guide" ), aHelpMnu, -1 );
+  int aPVHelpMnu = createMenu( tr( "ParaViS module" ), aUsersGuide, -1, 5 );
 #ifdef HAS_PV_DOC
   createMenu( ParaViewHelpId,  aPVHelpMnu );
   createMenu( separator(),     aPVHelpMnu );
index 39420aa16bfa1f53153beca00748ff3547a9c2d8..dd004c5c7a56de32e3ff85ff67dfcb3789b4de14 100644 (file)
@@ -93,7 +93,6 @@ IF(MEDReader_BUILD_ParaView_Plugin)
     ENDIF(NOT ParaView_FOUND)
     INCLUDE(${PARAVIEW_USE_FILE})
     # Load information about VTK/ParaView modules loaded/available.
-    PV_SETUP_MODULE_ENVIRONMENT("vtkMEDReader")
 ELSE(MEDReader_BUILD_ParaView_Plugin)
     FIND_PACKAGE(VTK REQUIRED)
     if(NOT VTK_FOUND)
index 653e5cac29300c9bf468ebf0a457fc55d527af9a..edcbf67ac80a74837760e2cbdf45ed4b6eab461c 100644 (file)
@@ -34,7 +34,6 @@ IF(NOT ParaView_FOUND)
   MESSAGE(FATAL_ERROR "Please locate ParaView." )
 ENDIF(NOT ParaView_FOUND)
 INCLUDE(${PARAVIEW_USE_FILE})
-PV_SETUP_MODULE_ENVIRONMENT("vtkMEDWriter")
 
 OPTION(BUILD_SHARED_LIBS "Build with shared libraries." ${VTK_BUILD_SHARED_LIBS})
 
index b63989583774f6374859aed57833d2f62c8f9025..10a5b04ad2fa4abb70ecdf2f3395ca2f53235836 100644 (file)
@@ -664,7 +664,16 @@ void ConvertFromPolyData(MEDFileData *ret, vtkPolyData *ds, const std::vector<in
   vtkCellArray *cc(ds->GetLines());
   if(cc)
     {
-      MCAuto<MEDCouplingUMesh> subMesh(BuildMeshFromCellArray(cc,coords,1,INTERP_KERNEL::NORM_SEG2));
+      MCAuto<MEDCouplingUMesh> subMesh;
+      try
+        {
+          subMesh=BuildMeshFromCellArray(cc,coords,1,INTERP_KERNEL::NORM_SEG2);
+        }
+      catch(INTERP_KERNEL::Exception& e)
+        {
+          std::ostringstream oss; oss << "MEDWriter does not manage polyline cell type because MED file format does not support it ! Maybe it is the source of the problem ? The cause of this exception was " << e.what() << std::endl;
+          throw INTERP_KERNEL::Exception(oss.str());
+        }
       if((const MEDCouplingUMesh *)subMesh)
         {
           std::vector<MCAuto<DataArray> > cellFs(AddPartFields2(offset,offset+subMesh->getNumberOfCells(),ds->GetCellData()));
@@ -741,8 +750,16 @@ void ConvertFromUnstructuredGrid(MEDFileData *ret, vtkUnstructuredGrid *ds, cons
         }
       else
         {
-          std::ostringstream oss; oss << "ConvertFromUnstructuredGrid : at pos #" << i << " unrecognized VTK cell with type =" << ctPtr[i];
-          throw MZCException(oss.str());
+          if(ctPtr[i]==VTK_POLY_VERTEX)
+            {
+              const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(INTERP_KERNEL::NORM_POINT1));
+              levPtr[i]=cm.getDimension();
+            }
+          else
+            {
+              std::ostringstream oss; oss << "ConvertFromUnstructuredGrid : at pos #" << i << " unrecognized VTK cell with type =" << ctPtr[i];
+              throw MZCException(oss.str());
+            }
         }
     }
   int dummy(0);
@@ -756,18 +773,19 @@ void ConvertFromUnstructuredGrid(MEDFileData *ret, vtkUnstructuredGrid *ds, cons
       MCAuto<DataArrayInt> cellIdsCurLev(lev->findIdsEqual(*curLev));
       for(const int *cellId=cellIdsCurLev->begin();cellId!=cellIdsCurLev->end();cellId++)
         {
-          std::map<int,int>::iterator it(m.find(ctPtr[*cellId]));
+          int vtkType(ctPtr[*cellId]);
+          std::map<int,int>::iterator it(m.find(vtkType));
           vtkIdType offset(claPtr[*cellId]);
           vtkIdType sz(caPtr[offset]);
-          INTERP_KERNEL::NormalizedCellType ct((INTERP_KERNEL::NormalizedCellType)(*it).second);
-          if(ct!=INTERP_KERNEL::NORM_POLYHED)
+          INTERP_KERNEL::NormalizedCellType ct=it!=m.end()?(INTERP_KERNEL::NormalizedCellType)((*it).second):INTERP_KERNEL::NORM_POINT1;
+          if(ct!=INTERP_KERNEL::NORM_POLYHED && vtkType!=VTK_POLY_VERTEX)
             {
               std::vector<int> conn2(sz);
               for(int kk=0;kk<sz;kk++)
                 conn2[kk]=caPtr[offset+1+kk];
               m0->insertNextCell(ct,sz,&conn2[0]);
             }
-          else
+          else if(ct==INTERP_KERNEL::NORM_POLYHED)
             {
               if(!faces || !faceLoc)
                 throw MZCException("ConvertFromUnstructuredGrid : faces are expected when there are polyhedra !");
@@ -785,6 +803,12 @@ void ConvertFromUnstructuredGrid(MEDFileData *ret, vtkUnstructuredGrid *ds, cons
                 }
               m0->insertNextCell(ct,conn.size(),&conn[0]);
             }
+          else
+            {
+              if(sz!=1)
+                throw MZCException("ConvertFromUnstructuredGrid : non single poly vertex not managed by MED !");
+              m0->insertNextCell(ct,1,caPtr+offset+1);
+            }
         }
       std::vector<MCAuto<DataArray> > cellFs(AddPartFields(cellIdsCurLev,ds->GetCellData()));
       ms.push_back(MicroField(m0,cellFs));
index 65537b3e262a7ffa2ec74392815b16cc8a617cdd..3abe4dee9e40c38a04b9121a646f5229f834991d 100644 (file)
@@ -212,6 +212,17 @@ int vtkMEDWriter::RequestUpdateExtent(vtkInformation* vtkNotUsed(request), vtkIn
   return 1;
 }
 
+void ExceptionDisplayer(vtkMEDWriter *self, const std::string& fileName, std::exception& e)
+{
+  std::ostringstream oss;
+  oss << "Exception has been thrown in vtkMEDWriter::RequestData : During writing of \"" << fileName << "\", the following exception has been thrown : "<< e.what() << std::endl;
+  if(self->HasObserver("ErrorEvent") )
+    self->InvokeEvent("ErrorEvent",const_cast<char *>(oss.str().c_str()));
+  else
+    vtkOutputWindowDisplayErrorText(const_cast<char *>(oss.str().c_str()));
+  vtkObject::BreakOnError();
+}
+
 int vtkMEDWriter::RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
 {
   //std::cerr << "########################################## vtkMEDWriter::RequestData        ########################################## " << (const char *) this->FileName << std::endl;
@@ -269,15 +280,14 @@ int vtkMEDWriter::RequestData(vtkInformation *request, vtkInformationVector **in
             }
         }
     }
+  catch(INTERP_KERNEL::Exception& e)
+    {
+      ExceptionDisplayer(this,(const char *) this->FileName,e);
+      return 0;
+    }
   catch(MZCException& e)
     {
-      std::ostringstream oss;
-      oss << "Exception has been thrown in vtkMEDWriter::RequestData : During writing of \"" << (const char *) this->FileName << "\", the following exception has been thrown : "<< e.what() << std::endl;
-      if(this->HasObserver("ErrorEvent") )
-        this->InvokeEvent("ErrorEvent",const_cast<char *>(oss.str().c_str()));
-      else
-        vtkOutputWindowDisplayErrorText(const_cast<char *>(oss.str().c_str()));
-      vtkObject::BreakOnError();
+      ExceptionDisplayer(this,(const char *) this->FileName,e);
       return 0;
     }
   return 1;
index 11ca52fa7011a9be3d705b9c65c7bd50d953aa3f..7728d30ff82e25be323dd83ed801b8ade1d1c651 100644 (file)
@@ -89,9 +89,11 @@ PROJECT( ParaMEDCorba )
       ${ParaMEDCorba_SOURCE_DIR}/testParaMEDCorba.cxx
       )
     # SET_TARGET_PROPERTIES(testCorbaPlugin PROPERTIES COMPILE_FLAGS "${OMNIORB_DEFINITIONS}")
-    
+
+    # RNV: ${vtkgl2ps_LIBRARIES} was added for Fedora 26 OS    
     TARGET_LINK_LIBRARIES( testParaMEDCorba
       ParaMEDCorbaPlugin
+      ${vtkgl2ps_LIBRARIES}
       )
     
     INSTALL(FILES ParaMEDCorbaServerManager.xml DESTINATION share)
diff --git a/src/Plugins/SimpleMode/IO/CMakeLists.txt b/src/Plugins/SimpleMode/IO/CMakeLists.txt
deleted file mode 100644 (file)
index f683609..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright (C) 2017  CEA/DEN, EDF R&D
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-# Author : Anthony Geay (EDF R&D)
-
-VTK_MODULE_LIBRARY(vtkSimpleMode vtkSimpleMode.cxx)
-IF(${SALOME_GUI_USE_OPENGL2})
-  TARGET_LINK_LIBRARIES(vtkSimpleMode vtkPVVTKExtensionsRendering vtkFiltersGeneral vtkFiltersCore vtkRenderingOpenGL2 ${PARAVIEW_LIBRARIES})
-ELSE()
-  TARGET_LINK_LIBRARIES(vtkSimpleMode vtkPVVTKExtensionsRendering vtkFiltersGeneral vtkFiltersCore vtkRenderingOpenGL ${PARAVIEW_LIBRARIES})
-ENDIF()
-INSTALL(TARGETS vtkSimpleMode RUNTIME DESTINATION lib/salome LIBRARY DESTINATION lib/salome ARCHIVE DESTINATION lib/salome)
index 0affd5c177b3c2a3d9a538a82c906afdbf5c7d73..d6bd567f134ad703eb005892abf141972dc6f81d 100644 (file)
@@ -28,7 +28,7 @@
 
 #include "vtkStreamingDemandDrivenPipeline.h"
 #include "vtkUnstructuredGrid.h"
-#include "vtkPolyData.h"
+#include "vtkDataSet.h"
 #include  "vtkMultiBlockDataSet.h"
 
 #include "vtkInformationStringKey.h"
@@ -96,7 +96,6 @@ vtkSmartPointer<vtkDoubleArray> ForceTo3Compo(vtkDoubleArray *arr)
   if(nbCompo==3)
     {
       vtkSmartPointer<vtkDoubleArray> ret(arr);
-      arr->Register(0);
       return ret;
     }
   if(nbCompo==6)
@@ -298,7 +297,7 @@ void vtkSimpleMode::SetInputArrayToProcess(int idx, int port, int connection, in
 {
   if(idx==0)
     this->Internal->setFieldForReal(name);
-  vtkPolyDataAlgorithm::SetInputArrayToProcess(idx,port,connection,ff,name);
+  vtkDataSetAlgorithm::SetInputArrayToProcess(idx,port,connection,ff,name);
 }
 
 double GetOptimalRatioFrom(vtkUnstructuredGrid *dataset, vtkDoubleArray *array)
@@ -334,6 +333,12 @@ double GetOptimalRatioFrom(vtkUnstructuredGrid *dataset, vtkDoubleArray *array)
   return maxGeoDelta/maxDispDelta;
 }
 
+int vtkSimpleMode::FillOutputPortInformation( int vtkNotUsed(port), vtkInformation* info)
+{
+  info->Set(vtkDataObject::DATA_TYPE_NAME(), "vtkPolyData");
+  return 1;
+}
+
 int vtkSimpleMode::RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
 { 
   //std::cerr << "########################################## vtkSimpleMode::RequestInformation ##########################################" << std::endl;
@@ -385,7 +390,7 @@ int vtkSimpleMode::RequestData(vtkInformation *request, vtkInformationVector **i
       arr1->SetNumberOfTuples(nbPts);
       double *ptToFeed1(arr1->Begin());
       const double *srcPt1(arrReal->Begin());
-      double cst1(Factor*sin(AnimationTime*2*M_PI));
+      double cst1(Factor*cos(AnimationTime*2*M_PI));
       std::transform(srcPt1,srcPt1+3*nbPts,ptToFeed1,std::bind2nd(std::multiplies<double>(),cst1));
       int idx1(outSurface->GetPointData()->AddArray(arr1));
       outSurface->GetPointData()->SetActiveAttribute(idx1,vtkDataSetAttributes::VECTORS);
@@ -404,12 +409,30 @@ int vtkSimpleMode::RequestData(vtkInformation *request, vtkInformationVector **i
         vtkDataArray *dummy(0);
         ExtractInfo3(ds,this->Internal->getFieldForReal(),dummy,idx2);
       }
-      ds->GetPointData()->SetActiveAttribute(idx2,vtkDataSetAttributes::SCALARS);
       //
       vtkInformation *outInfo(outputVector->GetInformationObject(0));
       vtkPolyData *output(vtkPolyData::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT())));
       output->ShallowCopy(ds);
-      
+      output->GetPointData()->DeepCopy(ds->GetPointData());
+      //
+      for(int i=0;i<output->GetPointData()->GetNumberOfArrays();i++)
+        {
+          vtkDataArray *arr(output->GetPointData()->GetArray(i));
+          vtkDoubleArray *arr2(vtkDoubleArray::SafeDownCast(arr));
+          if(!arr2)
+            continue;
+          int nbCompo(arr2->GetNumberOfComponents()),nbTuples(arr2->GetNumberOfTuples());
+          if(nbCompo!=3 && nbCompo!=2)
+            continue;
+          double *arrPtr(arr2->GetPointer(0));
+          std::transform(arrPtr,arrPtr+nbCompo*nbTuples,arrPtr,std::bind2nd(std::multiplies<double>(),cos(AnimationTime*2*M_PI)));
+        }
+      //
+      vtkDataArray* array = output->GetPointData()->GetArray(idx2);
+      vtkSmartPointer<vtkDataArray> result = vtkSmartPointer<vtkDataArray>::Take(vtkDataArray::CreateDataArray(array->GetDataType()));
+      result->ShallowCopy(array);
+      result->SetName("Result");
+      output->GetPointData()->SetScalars(result);            
     }
   catch(MZCException& e)
     {
index db110c2bf767e1697ae9317d0bead3dca2d42150..160bb9d06147c457f76644cfdd44abd2fd18855f 100644 (file)
 #ifndef vtkSimpleMode_h__
 #define vtkSimpleMode_h__
 
-#include "vtkPolyDataAlgorithm.h"
+#include "vtkDataSetAlgorithm.h"
 
 class vtkMutableDirectedGraph;
 
-class VTK_EXPORT vtkSimpleMode : public vtkPolyDataAlgorithm
+class VTK_EXPORT vtkSimpleMode : public vtkDataSetAlgorithm
 {
 public:
   static vtkSimpleMode* New();
-  vtkTypeMacro(vtkSimpleMode, vtkPolyDataAlgorithm)
+  vtkTypeMacro(vtkSimpleMode, vtkDataSetAlgorithm)
   void PrintSelf(ostream& os, vtkIndent indent);
   void SetInputArrayToProcess(int idx, int port, int connection, int fieldAssociation, const char *name);
   vtkGetMacro(Factor,double);
@@ -39,7 +39,7 @@ public:
 protected:
   vtkSimpleMode();
   ~vtkSimpleMode();
-
+  int FillOutputPortInformation( int vtkNotUsed(port), vtkInformation* info);
   int RequestInformation(vtkInformation *request,
       vtkInformationVector **inputVector, vtkInformationVector *outputVector);
 
index 45b9c0a313f1675e17e075630b53860ea62d3b37..68a0714aa14d07605311f6dea32ff214b7fbb6c7 100644 (file)
@@ -61,7 +61,6 @@ Select the array that represents the requested mode.
                             command="SetAnimationTime"
                             default_values="0"
                             name="AnimationTime"
-                           panel_visibility="advanced"
                             number_of_elements="1">
         <DoubleRangeDomain max="1" min="0" name="range" />
         <Documentation>The value of this property sets the scale factor applied for all nodes displacement.</Documentation>
index a0be32385b977791ad977c0592b390d5c2f64cfe..56190768ff251f33682e90c6b6763cb94f6ef5df 100644 (file)
@@ -71,7 +71,8 @@ ADD_EXECUTABLE(paraLight
     ${pl_HEADERS_MOC} 
     ${pl_FORMS_HEADERS}
     ${rcs_sources})
-    
-TARGET_LINK_LIBRARIES(paraLight ${QT_LIBRARIES} pqApplicationComponents vtkRenderingFreeType vtkInteractionStyle)
+
+# RNV: ${vtkgl2ps_LIBRARIES} was added for Fedora 26 OS    
+TARGET_LINK_LIBRARIES(paraLight ${QT_LIBRARIES} pqApplicationComponents vtkRenderingFreeType vtkInteractionStyle ${vtkgl2ps_LIBRARIES})
 #INSTALL(TARGET paraLight bin)
 
index 61c0fb8b05d93d08a8879d57ffe42dab8f6c7676..d74d98adf340f35885f13c0cf6fa1846414b2c4a 100644 (file)
@@ -32,5 +32,6 @@ INCLUDE_DIRECTORIES(
   )
 
 ADD_EXECUTABLE(paraCmdLine ${pl_SOURCES})
-TARGET_LINK_LIBRARIES(paraCmdLine ${PYTHON_LIBRARIES} ${QT_LIBRARIES} pqApplicationComponents vtkRenderingFreeType vtkInteractionStyle)
+# RNV: ${vtkgl2ps_LIBRARIES} was added for Fedora 26 OS
+TARGET_LINK_LIBRARIES(paraCmdLine ${PYTHON_LIBRARIES} ${QT_LIBRARIES} pqApplicationComponents vtkRenderingFreeType vtkInteractionStyle ${vtkgl2ps_LIBRARIES})