Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Modules
Visualization
Commits
32c03c7c
Commit
32c03c7c
authored
Apr 30, 2010
by
Mark Olesen
Browse files
ENH: enable vtkPolyhedron support when detected
parent
4e1bc4c8
Changes
23
Hide whitespace changes
Inline
Side-by-side
src/paraview-plugins/PV3Readers/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx
View file @
32c03c7c
...
...
@@ -39,7 +39,7 @@ License
#include
"vtkStreamingDemandDrivenPipeline.h"
#include
"vtkStringArray.h"
//
Foam
includes
//
OpenFOAM
includes
#include
"vtkPV3Foam.H"
#undef EXPERIMENTAL_TIME_CACHING
...
...
@@ -413,7 +413,7 @@ int vtkPV3FoamReader::RequestData
#endif
// Do any cleanup on the
Foam
side
// Do any cleanup on the
OpenFOAM
side
foamData_
->
CleanUp
();
return
1
;
...
...
src/paraview-plugins/PV3Readers/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.h
View file @
32c03c7c
...
...
@@ -47,7 +47,7 @@ SourceFiles
class
vtkDataArraySelection
;
class
vtkCallbackCommand
;
//
Foam
forward declarations
//
OpenFOAM
forward declarations
namespace
Foam
{
class
vtkPV3Foam
;
...
...
@@ -78,16 +78,16 @@ public:
vtkGetStringMacro
(
FileName
);
// Description:
// FOAM mesh caching control
//
Open
FOAM mesh caching control
vtkSetMacro
(
CacheMesh
,
int
);
vtkGetMacro
(
CacheMesh
,
int
);
// Description:
// FOAM refresh times/fields
//
Open
FOAM refresh times/fields
virtual
void
SetRefresh
(
int
);
// Description:
// FOAM
S
kip/include the 0/ time directory
//
Open
FOAM
s
kip/include the 0/ time directory
vtkSetMacro
(
SkipZeroTime
,
int
);
vtkGetMacro
(
SkipZeroTime
,
int
);
...
...
@@ -97,27 +97,27 @@ public:
vtkGetMacro
(
UpdateGUI
,
int
);
// Description:
// FOAM extrapolate internal values onto the patches
//
Open
FOAM extrapolate internal values onto the patches
vtkSetMacro
(
ExtrapolatePatches
,
int
);
vtkGetMacro
(
ExtrapolatePatches
,
int
);
// Description:
// FOAM use vtkPolyhedron instead of decomposing polyhedra
//
Open
FOAM use vtkPolyhedron instead of decomposing polyhedra
vtkSetMacro
(
UseVTKPolyhedron
,
int
);
vtkGetMacro
(
UseVTKPolyhedron
,
int
);
// Description:
// FOAM read sets control
//
Open
FOAM read sets control
virtual
void
SetIncludeSets
(
int
);
vtkGetMacro
(
IncludeSets
,
int
);
// Description:
// FOAM read zones control
//
Open
FOAM read zones control
virtual
void
SetIncludeZones
(
int
);
vtkGetMacro
(
IncludeZones
,
int
);
// Description:
// FOAM display patch names control
//
Open
FOAM display patch names control
virtual
void
SetShowPatchNames
(
int
);
vtkGetMacro
(
ShowPatchNames
,
int
);
...
...
src/paraview-plugins/PV3Readers/PV3FoamReader/vtkPV3Foam/Make/options
View file @
32c03c7c
/* Note: enable vtkPolyhedron when available */
PARAVIEW_INC=$(ParaView_DIR)/include/paraview-$(ParaView_MAJOR)
EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(ParaView_DIR)/include/paraview-$(ParaView_MAJOR) \
-I../../vtkPV3Readers/lnInclude \
-I../PV3FoamReader
-I../PV3FoamReader \
-I$(PARAVIEW_INC) \
$(shell \
test -f $(PARAVIEW_INC)/vtkPolyhedron.h && \
echo "-DHAS_VTK_POLYHEDRON" || echo "-UHAS_VTK_POLYHEDRON" \
)
LIB_LIBS = \
-lvtkPV3Readers \
...
...
src/paraview-plugins/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkOpenFOAMPoints.H
View file @
32c03c7c
...
...
@@ -56,7 +56,7 @@ inline void vtkSetOpenFOAMPoint
}
// Convert
Foam
mesh vertices to VTK
// Convert
OpenFOAM
mesh vertices to VTK
inline vtkPoints* vtkSetOpenFOAMPoints(const Foam::pointField& points)
{
vtkPoints *vtkpoints = vtkPoints::New();
...
...
src/paraview-plugins/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C
View file @
32c03c7c
...
...
@@ -26,7 +26,7 @@ License
#include
"vtkPV3Foam.H"
#include
"vtkPV3FoamReader.h"
//
Foam
includes
//
OpenFOAM
includes
#include
"fvMesh.H"
#include
"Time.H"
#include
"patchZones.H"
...
...
@@ -426,12 +426,12 @@ void Foam::vtkPV3Foam::updateFoamMesh()
meshPtr_
=
NULL
;
}
// Check to see if the FOAM mesh has been created
// Check to see if the
Open
FOAM mesh has been created
if
(
!
meshPtr_
)
{
if
(
debug
)
{
Info
<<
"Creating
Foam
mesh for region "
<<
meshRegion_
Info
<<
"Creating
OpenFOAM
mesh for region "
<<
meshRegion_
<<
" at time="
<<
dbPtr_
().
timeName
()
<<
endl
;
...
...
@@ -454,7 +454,7 @@ void Foam::vtkPV3Foam::updateFoamMesh()
{
if
(
debug
)
{
Info
<<
"Using existing
Foam
mesh"
<<
endl
;
Info
<<
"Using existing
OpenFOAM
mesh"
<<
endl
;
}
}
...
...
@@ -488,7 +488,7 @@ void Foam::vtkPV3Foam::Update
reader_
->
UpdateProgress
(
0
.
15
);
// Update the
Foam
mesh
// Update the
OpenFOAM
mesh
updateFoamMesh
();
reader_
->
UpdateProgress
(
0
.
4
);
...
...
@@ -527,6 +527,10 @@ void Foam::vtkPV3Foam::Update
convertVolFields
(
output
);
convertPointFields
(
output
);
convertLagrangianFields
(
lagrangianOutput
);
if
(
debug
)
{
Info
<<
"done reader part"
<<
endl
;
}
reader_
->
UpdateProgress
(
0
.
95
);
meshChanged_
=
fieldsChanged_
=
false
;
...
...
src/paraview-plugins/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H
View file @
32c03c7c
...
...
@@ -89,7 +89,7 @@ class vtkIndent;
namespace
Foam
{
//
Foam
class forward declarations
//
OpenFOAM
class forward declarations
class
argList
;
class
Time
;
class
fvMesh
;
...
...
@@ -249,10 +249,10 @@ class vtkPV3Foam
//- Access to the controlling vtkPV3FoamReader
vtkPV3FoamReader
*
reader_
;
//-
Foam
time control
//-
OpenFOAM
time control
autoPtr
<
Time
>
dbPtr_
;
//-
Foam
mesh
//-
OpenFOAM
mesh
fvMesh
*
meshPtr_
;
//- The mesh region
...
...
@@ -384,7 +384,7 @@ class vtkPV3Foam
// Update helper functions
//-
Foam
mesh
//-
OpenFOAM
mesh
void
updateFoamMesh
();
//- Reduce memory footprint after conversion
...
...
@@ -496,7 +496,7 @@ class vtkPV3Foam
);
// Convert
Foam
fields
// Convert
OpenFOAM
fields
//- Volume fields - all types
template
<
class
Type
>
...
...
src/paraview-plugins/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamAddToSelection.H
View file @
32c03c7c
...
...
@@ -26,7 +26,7 @@ License
#ifndef vtkPV3FoamAddToSelection_H
#define vtkPV3FoamAddToSelection_H
// FOAM includes
//
Open
FOAM includes
#include
"IOobjectList.H"
#include
"SortableList.H"
...
...
src/paraview-plugins/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamFields.C
View file @
32c03c7c
...
...
@@ -25,7 +25,7 @@ License
#include
"vtkPV3Foam.H"
//
Foam
includes
//
OpenFOAM
includes
#include
"IOobjectList.H"
#include
"vtkPV3FoamReader.h"
...
...
@@ -94,7 +94,7 @@ void Foam::vtkPV3Foam::convertVolFields
if
(
debug
)
{
Info
<<
"<beg> Foam::vtkPV3Foam::convertVolFields"
<<
nl
<<
"converting
Foam
volume fields"
<<
endl
;
<<
"converting
OpenFOAM
volume fields"
<<
endl
;
forAllConstIter
(
IOobjectList
,
objects
,
iter
)
{
Info
<<
" "
<<
iter
()
->
name
()
...
...
@@ -163,6 +163,10 @@ void Foam::vtkPV3Foam::convertPointFields
if
(
selectedFields
.
empty
())
{
if
(
debug
)
{
Info
<<
"no point fields selected"
<<
endl
;
}
return
;
}
...
...
@@ -179,7 +183,7 @@ void Foam::vtkPV3Foam::convertPointFields
if
(
debug
)
{
Info
<<
"<beg> Foam::vtkPV3Foam::convertPointFields"
<<
nl
<<
"converting
Foam volume
fields"
<<
endl
;
<<
"converting
OpenFOAM volume fields -> point
fields"
<<
endl
;
forAllConstIter
(
IOobjectList
,
objects
,
iter
)
{
Info
<<
" "
<<
iter
()
->
name
()
...
...
@@ -274,7 +278,7 @@ void Foam::vtkPV3Foam::convertLagrangianFields
if
(
debug
)
{
Info
<<
"converting
Foam
lagrangian fields"
<<
nl
;
Info
<<
"converting
OpenFOAM
lagrangian fields"
<<
nl
;
forAllConstIter
(
IOobjectList
,
objects
,
iter
)
{
Info
<<
" "
<<
iter
()
->
name
()
...
...
src/paraview-plugins/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMesh.C
View file @
32c03c7c
...
...
@@ -25,7 +25,7 @@ License
#include
"vtkPV3Foam.H"
//
Foam
includes
//
OpenFOAM
includes
#include
"cellSet.H"
#include
"faceSet.H"
#include
"pointSet.H"
...
...
src/paraview-plugins/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.C
View file @
32c03c7c
...
...
@@ -25,7 +25,7 @@ License
#include
"vtkPV3Foam.H"
//
Foam
includes
//
OpenFOAM
includes
#include
"Cloud.H"
#include
"fvMesh.H"
#include
"IOobjectList.H"
...
...
src/paraview-plugins/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshPatch.C
View file @
32c03c7c
...
...
@@ -25,7 +25,7 @@ License
#include
"vtkPV3Foam.H"
//
Foam
includes
//
OpenFOAM
includes
#include
"polyPatch.H"
#include
"primitivePatch.H"
#include
"vtkOpenFOAMPoints.H"
...
...
@@ -47,7 +47,7 @@ vtkPolyData* Foam::vtkPV3Foam::patchVTKMesh(const polyPatch& p)
printMemory
();
}
// Convert
Foam
mesh vertices to VTK
// Convert
OpenFOAM
mesh vertices to VTK
const
Foam
::
pointField
&
points
=
p
.
localPoints
();
vtkPoints
*
vtkpoints
=
vtkPoints
::
New
();
...
...
src/paraview-plugins/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshSet.C
View file @
32c03c7c
...
...
@@ -25,7 +25,7 @@ License
#include
"vtkPV3Foam.H"
//
Foam
includes
//
OpenFOAM
includes
#include
"faceSet.H"
#include
"pointSet.H"
#include
"vtkOpenFOAMPoints.H"
...
...
@@ -65,7 +65,7 @@ vtkPolyData* Foam::vtkPV3Foam::faceSetVTKMesh
// The balance of this routine should be identical to patchVTKMesh
// Convert
Foam
mesh vertices to VTK
// Convert
OpenFOAM
mesh vertices to VTK
const
pointField
&
points
=
p
.
localPoints
();
vtkPoints
*
vtkpoints
=
vtkPoints
::
New
();
...
...
src/paraview-plugins/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshVolume.C
View file @
32c03c7c
...
...
@@ -26,7 +26,7 @@ License
#include
"vtkPV3Foam.H"
#include
"vtkPV3FoamReader.h"
//
Foam
includes
//
OpenFOAM
includes
#include
"fvMesh.H"
#include
"cellModeller.H"
#include
"vtkOpenFOAMPoints.H"
...
...
@@ -74,15 +74,15 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
labelList
&
superCells
=
decompInfo
.
superCells
();
labelList
&
addPointCellLabels
=
decompInfo
.
addPointCellLabels
();
if
(
debug
)
{
Info
<<
"... scanning"
<<
endl
;
}
// Scan for cells which need to be decomposed and count additional points
// and cells
if
(
!
reader_
->
GetUseVTKPolyhedron
())
{
if
(
debug
)
{
Info
<<
"... scanning for polyhedra"
<<
endl
;
}
forAll
(
cellShapes
,
cellI
)
{
const
cellModel
&
model
=
cellShapes
[
cellI
].
model
();
...
...
@@ -138,7 +138,7 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
Info
<<
"... converting points"
<<
endl
;
}
// Convert
Foam
mesh vertices to VTK
// Convert
OpenFOAM
mesh vertices to VTK
vtkPoints
*
vtkpoints
=
vtkPoints
::
New
();
vtkpoints
->
Allocate
(
mesh
.
nPoints
()
+
nAddPoints
);
...
...
@@ -164,6 +164,17 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
// data types - max 'order' = hex = 8 points
vtkIdType
nodeIds
[
8
];
// hash to establish unique node ids for a polyhedral cell
HashSet
<
vtkIdType
,
Hash
<
label
>
>
hashUniqId
(
2
*
256
);
// unique node ids for a polyhedral cell
DynamicList
<
vtkIdType
>
uniqueNodeIds
(
256
);
// face-stream for a polyhedral cell
// [numFace0Pts, id1, id2, id3, numFace1Pts, id1, id2, id3, ...]
DynamicList
<
vtkIdType
>
faceStream
(
256
);
forAll
(
cellShapes
,
cellI
)
{
const
cellShape
&
cellShape
=
cellShapes
[
cellI
];
...
...
@@ -272,7 +283,6 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
const
labelList
&
cFaces
=
mesh
.
cells
()[
cellI
];
vtkIdType
nFaces
=
cFaces
.
size
();
vtkIdType
nodeCount
=
0
;
vtkIdType
nLabels
=
nFaces
;
// count size for face stream
...
...
@@ -282,46 +292,51 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
nLabels
+=
f
.
size
();
}
//
unique node ids - approximately equal to the number of point ids
DynamicList
<
vtkIdType
>
uniqueNodeIds
(
nLabels
-
nFaces
);
//
hash to establish unique node ids for a polyhedral cell
hashUniqId
.
clear
(
);
// zero-based index into uniqueNodeIds
DynamicList
<
vtkIdType
>
faceLabels
(
nLabels
);
// unique node ids - approximately equal to the number of point ids
uniqueNodeIds
.
clear
();
uniqueNodeIds
.
reserve
(
nLabels
-
nFaces
);
// localized point id within the cell
Map
<
label
>
mapLocalId
(
2
*
nLabels
);
// build face-stream
// [numFace0Pts, id1, id2, id3, numFace1Pts, id1, id2, id3, ...]
// point Ids are global
faceStream
.
clear
();
faceStream
.
reserve
(
nLabels
+
nFaces
);
// establish the unique point ids,
// record the local mapping ids,
// create new face list
forAll
(
cFaces
,
cFaceI
)
{
const
face
&
f
=
mesh
.
faces
()[
cFaces
[
cFaceI
]];
const
bool
isOwner
=
(
owner
[
cFaces
[
cFaceI
]]
==
cellI
);
const
label
nFacePoints
=
f
.
size
();
// number of labels for this face
face
Labels
.
append
(
nFacePoints
);
face
Stream
.
append
(
nFacePoints
);
forAll
(
f
,
fp
)
if
(
isOwner
)
{
const
label
nodeId
=
f
[
fp
];
if
(
mapLocalId
.
insert
(
nodeId
,
nodeCount
))
forAll
(
f
,
fp
)
{
// insertion was successful (node Id was unique)
uniqueNodeIds
.
append
(
nodeId
);
// map orig vertex id -> localized point label
faceLabels
.
append
(
nodeCount
);
++
nodeCount
;
hashUniqId
.
insert
(
f
[
fp
]);
faceStream
.
append
(
f
[
fp
]);
}
else
}
else
{
// fairly immaterial if we reverse the list
// or use face::reverseFace()
forAllReverse
(
f
,
fp
)
{
// map orig vertex id -> localized point label
face
Labels
.
append
(
mapLocalId
[
nodeId
]);
hashUniqId
.
insert
(
f
[
fp
]);
face
Stream
.
append
(
f
[
fp
]);
}
}
}
uniqueNodeIds
.
append
(
hashUniqId
.
sortedToc
());
vtkIdType
nodeCount
=
uniqueNodeIds
.
size
();
#ifdef HAS_VTK_POLYHEDRON
vtkmesh
->
InsertNextCell
(
...
...
@@ -329,9 +344,11 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
nodeCount
,
uniqueNodeIds
.
data
(),
nFaces
,
face
Labels
.
data
()
face
Stream
.
data
()
);
#else
// this is a horrible substitute
// but avoids crashes when there is no vtkPolyhedron support
vtkmesh
->
InsertNextCell
(
VTK_CONVEX_POINT_SET
,
...
...
src/paraview-plugins/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshZone.C
View file @
32c03c7c
...
...
@@ -25,7 +25,7 @@ License
#include
"vtkPV3Foam.H"
//
Foam
includes
//
OpenFOAM
includes
#include
"vtkOpenFOAMPoints.H"
// VTK includes
...
...
@@ -62,7 +62,7 @@ vtkPolyData* Foam::vtkPV3Foam::faceZoneVTKMesh
// The balance of this routine should be identical to patchVTKMesh
// Convert
Foam
mesh vertices to VTK
// Convert
OpenFOAM
mesh vertices to VTK
const
pointField
&
points
=
p
.
localPoints
();
vtkPoints
*
vtkpoints
=
vtkPoints
::
New
();
...
...
src/paraview-plugins/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPointFields.H
View file @
32c03c7c
...
...
@@ -29,7 +29,7 @@ InClass
#ifndef vtkPV3FoamPointFields_H
#define vtkPV3FoamPointFields_H
//
Foam
includes
//
OpenFOAM
includes
#include
"interpolatePointToCell.H"
#include
"vtkOpenFOAMTupleRemap.H"
...
...
src/paraview-plugins/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfo.C
View file @
32c03c7c
...
...
@@ -25,7 +25,7 @@ License
#include
"vtkPV3Foam.H"
//
Foam
includes
//
OpenFOAM
includes
#include
"cellSet.H"
#include
"faceSet.H"
#include
"pointSet.H"
...
...
src/paraview-plugins/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUtils.C
View file @
32c03c7c
...
...
@@ -29,7 +29,7 @@ Description
#include
"vtkPV3Foam.H"
#include
"vtkPV3FoamReader.h"
//
Foam
includes
//
OpenFOAM
includes
#include
"fvMesh.H"
#include
"Time.H"
#include
"IFstream.H"
...
...
src/paraview-plugins/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamVolFields.H
View file @
32c03c7c
...
...
@@ -29,7 +29,7 @@ InClass
#ifndef vtkPV3FoamVolFields_H
#define vtkPV3FoamVolFields_H
//
Foam
includes
//
OpenFOAM
includes
#include
"emptyFvPatchField.H"
#include
"wallPolyPatch.H"
#include
"faceSet.H"
...
...
src/paraview-plugins/PV3Readers/PV3blockMeshReader/PV3blockMeshReader/vtkPV3blockMeshReader.cxx
View file @
32c03c7c
...
...
@@ -39,7 +39,7 @@ License
#include
"vtkStreamingDemandDrivenPipeline.h"
#include
"vtkStringArray.h"
//
Foam
includes
//
OpenFOAM
includes
#include
"vtkPV3blockMesh.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
...
...
@@ -226,7 +226,7 @@ int vtkPV3blockMeshReader::RequestData
foamData_
->
Update
(
output
);
updatePointNumbersView
(
ShowPointNumbers
);
// Do any cleanup on the
Foam
side
// Do any cleanup on the
OpenFOAM
side
foamData_
->
CleanUp
();
return
1
;
...
...
src/paraview-plugins/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMesh.C
View file @
32c03c7c
...
...
@@ -26,7 +26,7 @@ License
#include
"vtkPV3blockMesh.H"
#include
"vtkPV3blockMeshReader.h"
//
Foam
includes
//
OpenFOAM
includes
#include
"blockMesh.H"
#include
"Time.H"
#include
"patchZones.H"
...
...
@@ -298,7 +298,7 @@ void Foam::vtkPV3blockMesh::updateFoamMesh()
Info
<<
"<beg> Foam::vtkPV3blockMesh::updateFoamMesh"
<<
endl
;
}
// Check to see if the FOAM mesh has been created
// Check to see if the
Open
FOAM mesh has been created
if
(
!
meshPtr_
)
{
if
(
debug
)
...
...
@@ -347,7 +347,7 @@ void Foam::vtkPV3blockMesh::Update
reader_
->
UpdateProgress
(
0
.
2
);
// Update the
Foam
mesh
// Update the
OpenFOAM
mesh
updateFoamMesh
();
reader_
->
UpdateProgress
(
0
.
5
);
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment