Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
OpenFOAM-plus
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Development
OpenFOAM-plus
Commits
6cdb80b2
Commit
6cdb80b2
authored
6 years ago
by
Mark OLESEN
Browse files
Options
Downloads
Patches
Plain Diff
ENH: add vtk::Tools::Patch faceCentres() method
parent
60513758
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/conversion/vtk/adaptor/foamVtkTools.H
+5
-1
5 additions, 1 deletion
src/conversion/vtk/adaptor/foamVtkTools.H
src/conversion/vtk/adaptor/foamVtkToolsTemplates.C
+34
-1
34 additions, 1 deletion
src/conversion/vtk/adaptor/foamVtkToolsTemplates.C
with
39 additions
and
2 deletions
src/conversion/vtk/adaptor/foamVtkTools.H
+
5
−
1
View file @
6cdb80b2
...
...
@@ -195,7 +195,7 @@ namespace Tools
//- Convert OpenFOAM patch to vtkPolyData
struct
Patch
{
//-
Convert
local patch points
to
vtkPoints
//-
Return
local patch points
as
vtkPoints
template
<
class
PatchType
>
static
vtkSmartPointer
<
vtkPoints
>
points
(
const
PatchType
&
p
);
...
...
@@ -210,6 +210,10 @@ namespace Tools
//- Convert patch face normals to vtkFloatArray
template
<
class
PatchType
>
static
vtkSmartPointer
<
vtkFloatArray
>
faceNormals
(
const
PatchType
&
p
);
//- Return patch face centres as vtkPoints
template
<
class
PatchType
>
static
vtkSmartPointer
<
vtkPoints
>
faceCentres
(
const
PatchType
&
p
);
};
...
...
This diff is collapsed.
Click to expand it.
src/conversion/vtk/adaptor/foamVtkToolsTemplates.C
+
34
−
1
View file @
6cdb80b2
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017-201
8
OpenCFD Ltd.
\\ / A nd | Copyright (C) 2017-201
9
OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -139,6 +139,39 @@ Foam::vtk::Tools::Patch::faceNormals(const PatchType& p)
}
template
<
class
PatchType
>
vtkSmartPointer
<
vtkPoints
>
Foam
::
vtk
::
Tools
::
Patch
::
faceCentres
(
const
PatchType
&
p
)
{
auto
vtkpoints
=
vtkSmartPointer
<
vtkPoints
>::
New
();
vtkpoints
->
SetNumberOfPoints
(
p
.
size
());
// Use cached values if available or loop over faces
// (avoid triggering cache)
vtkIdType
pointId
=
0
;
if
(
p
.
hasFaceCentres
())
{
for
(
const
point
&
pt
:
p
.
faceCentres
())
{
vtkpoints
->
SetPoint
(
pointId
++
,
pt
.
v_
);
}
}
else
{
for
(
const
auto
&
f
:
p
)
{
const
point
pt
(
f
.
centre
(
p
.
points
()));
vtkpoints
->
SetPoint
(
pointId
++
,
pt
.
v_
);
}
}
return
vtkpoints
;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//
// Low-Level conversions
...
...
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