Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
Visualization
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Modules
Visualization
Commits
d6d313be
Commit
d6d313be
authored
15 years ago
by
Mark Olesen
Browse files
Options
Downloads
Patches
Plain Diff
ENH: use simpler API for vtkPolyhedron
parent
32c03c7c
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/paraview-plugins/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshVolume.C
+21
-30
21 additions, 30 deletions
...V3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshVolume.C
with
21 additions
and
30 deletions
src/paraview-plugins/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshVolume.C
+
21
−
30
View file @
d6d313be
...
@@ -164,17 +164,10 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
...
@@ -164,17 +164,10 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
// data types - max 'order' = hex = 8 points
// data types - max 'order' = hex = 8 points
vtkIdType
nodeIds
[
8
];
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
// face-stream for a polyhedral cell
// [numFace0Pts, id1, id2, id3, numFace1Pts, id1, id2, id3, ...]
// [numFace0Pts, id1, id2, id3, numFace1Pts, id1, id2, id3, ...]
DynamicList
<
vtkIdType
>
faceStream
(
256
);
DynamicList
<
vtkIdType
>
faceStream
(
256
);
forAll
(
cellShapes
,
cellI
)
forAll
(
cellShapes
,
cellI
)
{
{
const
cellShape
&
cellShape
=
cellShapes
[
cellI
];
const
cellShape
&
cellShape
=
cellShapes
[
cellI
];
...
@@ -282,6 +275,7 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
...
@@ -282,6 +275,7 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
// Polyhedral cell - use VTK_POLYHEDRON
// Polyhedral cell - use VTK_POLYHEDRON
const
labelList
&
cFaces
=
mesh
.
cells
()[
cellI
];
const
labelList
&
cFaces
=
mesh
.
cells
()[
cellI
];
#ifdef HAS_VTK_POLYHEDRON
vtkIdType
nFaces
=
cFaces
.
size
();
vtkIdType
nFaces
=
cFaces
.
size
();
vtkIdType
nLabels
=
nFaces
;
vtkIdType
nLabels
=
nFaces
;
...
@@ -292,13 +286,6 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
...
@@ -292,13 +286,6 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
nLabels
+=
f
.
size
();
nLabels
+=
f
.
size
();
}
}
// hash to establish unique node ids for a polyhedral cell
hashUniqId
.
clear
();
// unique node ids - approximately equal to the number of point ids
uniqueNodeIds
.
clear
();
uniqueNodeIds
.
reserve
(
nLabels
-
nFaces
);
// build face-stream
// build face-stream
// [numFace0Pts, id1, id2, id3, numFace1Pts, id1, id2, id3, ...]
// [numFace0Pts, id1, id2, id3, numFace1Pts, id1, id2, id3, ...]
// point Ids are global
// point Ids are global
...
@@ -318,7 +305,6 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
...
@@ -318,7 +305,6 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
{
{
forAll
(
f
,
fp
)
forAll
(
f
,
fp
)
{
{
hashUniqId
.
insert
(
f
[
fp
]);
faceStream
.
append
(
f
[
fp
]);
faceStream
.
append
(
f
[
fp
]);
}
}
}
}
...
@@ -328,32 +314,37 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
...
@@ -328,32 +314,37 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
// or use face::reverseFace()
// or use face::reverseFace()
forAllReverse
(
f
,
fp
)
forAllReverse
(
f
,
fp
)
{
{
hashUniqId
.
insert
(
f
[
fp
]);
faceStream
.
append
(
f
[
fp
]);
faceStream
.
append
(
f
[
fp
]);
}
}
}
}
}
}
uniqueNodeIds
.
append
(
hashUniqId
.
sortedToc
());
vtkmesh
->
InsertNextCell
(
VTK_POLYHEDRON
,
nFaces
,
faceStream
.
data
());
vtkIdType
nodeCount
=
uniqueNodeIds
.
size
();
#ifdef HAS_VTK_POLYHEDRON
vtkmesh
->
InsertNextCell
(
VTK_POLYHEDRON
,
nodeCount
,
uniqueNodeIds
.
data
(),
nFaces
,
faceStream
.
data
()
);
#else
#else
// this is a horrible substitute
// this is a horrible substitute
// but avoids crashes when there is no vtkPolyhedron support
// 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
vtkmesh
->
InsertNextCell
(
(
VTK_CONVEX_POINT_SET
,
VTK_CONVEX_POINT_SET
,
nodeCount
,
vtkIdType
(
faceStream
.
size
())
,
uniqueNodeIds
.
data
()
faceStream
.
data
()
);
);
#endif
#endif
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment