Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenFOAM-plus
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
339
Issues
339
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Development
OpenFOAM-plus
Commits
6cdb80b2
Commit
6cdb80b2
authored
Feb 01, 2019
by
Mark Olesen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ENH: add vtk::Tools::Patch faceCentres() method
parent
60513758
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
2 deletions
+39
-2
src/conversion/vtk/adaptor/foamVtkTools.H
src/conversion/vtk/adaptor/foamVtkTools.H
+5
-1
src/conversion/vtk/adaptor/foamVtkToolsTemplates.C
src/conversion/vtk/adaptor/foamVtkToolsTemplates.C
+34
-1
No files found.
src/conversion/vtk/adaptor/foamVtkTools.H
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
);
};
...
...
src/conversion/vtk/adaptor/foamVtkToolsTemplates.C
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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