ENH: avoid deprecated resource xml when building paraview plugins (fixes #181)

- remove old VTK_CONVEX_POINT_SET code, since VTK_POLYHEDRON exists
  since several years

ENH: improve robustness of paraFoam script

- only check the relevant plugin types,
  fallback to native reader if needed/possible.
This commit is contained in:
Mark Olesen
2016-07-12 11:17:57 +02:00
parent a9fed233db
commit ecfbdce3da
7 changed files with 65 additions and 82 deletions

View File

@ -47,11 +47,14 @@ QT4_WRAP_CPP(MOC_SRCS pqPVFoamReaderPanel.h)
ADD_PARAVIEW_OBJECT_PANEL(IFACES IFACE_SRCS
CLASS_NAME pqPVFoamReaderPanel
XML_NAME PVFoamReader # name of SourceProxy in *SM.xml
XML_NAME PVFoamReader # name of SourceProxy in *SM.xml
XML_GROUP sources
)
IF("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
# Separate GUI_RESOURCE_FILES deprecated with paraview 4.3
# so check if version < 4.4
IF(("${PARAVIEW_VERSION_MAJOR}" LESS 5) AND ("${PARAVIEW_VERSION_MINOR}" LESS 4))
ADD_PARAVIEW_PLUGIN(
PVFoamReader_SM "1.0"
SERVER_MANAGER_XML PVFoamReader_SM.xml
@ -61,7 +64,7 @@ IF("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS}
GUI_RESOURCE_FILES PVFoamReader.xml
)
ELSE("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
ELSE()
ADD_PARAVIEW_PLUGIN(
PVFoamReader_SM "1.0"
SERVER_MANAGER_XML PVFoamReader_SM.xml
@ -70,7 +73,7 @@ ELSE("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
GUI_SOURCES pqPVFoamReaderPanel.cxx
${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS}
)
ENDIF("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
ENDIF()
TARGET_LINK_LIBRARIES(
PVFoamReader_SM

View File

@ -1,4 +1,5 @@
<ParaViewReaders>
<!-- deprecated with paraview-4.3, use hints in *SM.xml -->
<Reader name="PVFoamReader"
extensions="OpenFOAM"
file_description="OpenFOAM Reader">

View File

@ -1,18 +1,12 @@
/* Note: enable vtkPolyhedron when available */
EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I../../vtkPVReaders/lnInclude \
-I../PVFoamReader \
-I$(ParaView_INCLUDE_DIR) \
-I$(ParaView_INCLUDE_DIR)/vtkkwiml \
$(shell \
test -f $(ParaView_INCLUDE_DIR)/vtkPolyhedron.h && \
echo "-DHAS_VTK_POLYHEDRON" || echo "-UHAS_VTK_POLYHEDRON" \
)
-I../../vtkPVReaders/lnInclude \
-I../PVFoamReader
LIB_LIBS = \
-lmeshTools \

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -275,7 +275,6 @@ vtkUnstructuredGrid* Foam::vtkPVFoam::volumeVTKMesh
// Polyhedral cell - use VTK_POLYHEDRON
const labelList& cFaces = mesh.cells()[cellI];
#ifdef HAS_VTK_POLYHEDRON
vtkIdType nFaces = cFaces.size();
vtkIdType nLabels = nFaces;
@ -320,33 +319,6 @@ vtkUnstructuredGrid* Foam::vtkPVFoam::volumeVTKMesh
}
vtkmesh->InsertNextCell(VTK_POLYHEDRON, nFaces, faceStream.data());
#else
// this is a horrible substitute
// but avoids crashes when there is no vtkPolyhedron support
// establish unique node ids used
HashSet<vtkIdType, Hash<label>> hashUniqId(2*256);
forAll(cFaces, cFaceI)
{
const face& f = mesh.faces()[cFaces[cFaceI]];
forAll(f, fp)
{
hashUniqId.insert(f[fp]);
}
}
// use face stream to store unique node ids:
faceStream = hashUniqId.sortedToc();
vtkmesh->InsertNextCell
(
VTK_CONVEX_POINT_SET,
vtkIdType(faceStream.size()),
faceStream.data()
);
#endif
}
else
{

View File

@ -46,13 +46,16 @@ QT4_WRAP_CPP(MOC_SRCS pqPVblockMeshReaderPanel.h)
ADD_PARAVIEW_OBJECT_PANEL(IFACES IFACE_SRCS
CLASS_NAME pqPVblockMeshReaderPanel
XML_NAME PVblockMeshReader # name of SourceProxy in *SM.xml
XML_NAME PVblockMeshReader # name of SourceProxy in *SM.xml
XML_GROUP sources
)
IF("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
ADD_PARAVIEW_PLUGIN(
PVblockMeshReader_SM "1.0"
# Separate GUI_RESOURCE_FILES deprecated with paraview 4.3
# so check if version < 4.4
IF(("${PARAVIEW_VERSION_MAJOR}" LESS 5) AND ("${PARAVIEW_VERSION_MINOR}" LESS 4))
ADD_PARAVIEW_PLUGIN(
PVblockMeshReader_SM "1.0"
SERVER_MANAGER_XML PVblockMeshReader_SM.xml
SERVER_MANAGER_SOURCES vtkPVblockMeshReader.cxx
GUI_INTERFACES ${IFACES}
@ -60,16 +63,16 @@ IF("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS}
GUI_RESOURCE_FILES PVblockMeshReader.xml
)
ELSE("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
ADD_PARAVIEW_PLUGIN(
PVblockMeshReader_SM "1.0"
ELSE()
ADD_PARAVIEW_PLUGIN(
PVblockMeshReader_SM "1.0"
SERVER_MANAGER_XML PVblockMeshReader_SM.xml
SERVER_MANAGER_SOURCES vtkPVblockMeshReader.cxx
GUI_INTERFACES ${IFACES}
GUI_SOURCES pqPVblockMeshReaderPanel.cxx
${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS}
)
ENDIF("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
ENDIF()
# Build the client-side plugin

View File

@ -1,4 +1,5 @@
<ParaViewReaders>
<!-- deprecated with paraview-4.3, use hints in *SM.xml -->
<Reader name="PVblockMeshReader"
extensions="blockMesh"
file_description="OpenFOAM blockMesh reader">