Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Steven Walton
VTK-m
Commits
90cf4684
Commit
90cf4684
authored
Jun 01, 2019
by
Steven Walton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implementation of Taper for Hex and Quad. Untested
parent
7e885fee
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
1 deletion
+32
-1
vtkm/exec/cellmetrics/CellTaperMetric.h
vtkm/exec/cellmetrics/CellTaperMetric.h
+32
-1
No files found.
vtkm/exec/cellmetrics/CellTaperMetric.h
View file @
90cf4684
...
...
@@ -41,20 +41,51 @@ namespace vtkm
{
namespace
exec
{
static
constexpr
FloatType
FLOAT_MAX
=
vtkm
::
Infinity
<
FloatType
>
();
static
constexpr
FloatType
FLOAT_MIN
=
vtkm
::
NegativeInfinity
<
FloatType
>
();
template
<
typename
OutType
,
typename
PointCoordVecType
,
typename
CellShapeType
>
VTKM_EXEC
OutType
CellStretchMetric
(
const
vtkm
::
IdComponent
&
numPts
,
const
PointCoordVecType
&
pts
,
CellShapeType
shape
,
const
vtkm
::
exec
::
FunctorBase
&
worklet
)
{
worklet
.
RaiseError
(
"Shape type template must be specified to compute taper"
)
return
OutType
(
-
1.0
);
}
template
<
typename
OutType
,
typename
PointCoordVecType
>
VTKM_EXEC
OutType
CellTaperMetric
(
const
vtkm
::
IdComponents
&
numPts
,
const
PointCoordVecType
&
pts
,
vtkm
::
CellShapeHex
,
const
vtkm
::
exec
::
FunctorBase
&
worklet
)
{
FloatDefault
X1
=
(
pts
[
1
]
-
pts
[
0
])
+
(
pts
[
2
]
-
pts
[
3
])
+
(
pts
[
5
]
-
pts
[
4
])
+
(
pts
[
6
]
-
pts
[
7
]);
FloatDefault
X2
=
(
pts
[
3
]
-
pts
[
0
])
+
(
pts
[
2
]
-
pts
[
1
])
+
(
pts
[
7
]
-
pts
[
4
])
+
(
pts
[
6
]
-
pts
[
5
]);
FloatDefault
X3
=
(
pts
[
4
]
-
pts
[
0
])
+
(
pts
[
5
]
-
pts
[
1
])
+
(
pts
[
6
]
-
pts
[
2
])
+
(
pts
[
7
]
-
pts
[
3
]);
if
((
X1
<
FLOAT_MIN
)
||
(
X2
<
FLOAT_MIN
)
||
(
X3
<
FLOAT_MIN
))
return
FLOAT_MAX
;
FloatDefault
X12
=
((
pts
[
2
]
-
pts
[
3
])
-
(
pts
[
1
]
-
pts
[
0
]))
+
((
pts
[
6
]
-
pts
[
7
])
-
(
pts
[
5
]
-
pts
[
4
]));
FloatDefault
X13
=
((
pts
[
5
]
-
pts
[
1
])
-
(
pts
[
4
]
-
pts
[
0
]))
+
((
pts
[
6
]
-
pts
[
2
])
-
(
pts
[
7
]
-
pts
[
3
]));
FloatDefault
X23
=
((
pts
[
7
]
-
pts
[
4
])
-
(
pts
[
3
]
-
pts
[
0
]))
+
((
pts
[
6
]
-
pts
[
5
])
-
(
pts
[
2
]
-
pts
[
1
]));
FloatDefault
T12
=
X12
/
vtkm
::
Min
(
X1
,
vtkm
::
Min
(
X2
,
X3
));
FloatDefault
T13
=
X13
/
vtkm
::
Min
(
X1
,
vtkm
::
Min
(
X2
,
X3
));
FloatDefault
T23
=
X23
/
vtkm
::
Min
(
X1
,
vtkm
::
Min
(
X2
,
X3
));
return
vtkm
::
Max
(
T12
,
vtkm
::
Max
(
T13
,
T23
));
}
template
<
typename
OutType
,
typename
PointCoordVecType
>
VTKM_EXEC
OutType
CellTaperMetric
(
const
vtkm
::
IdComponents
&
numPts
,
const
PointCoordVecType
&
pts
,
vtkm
::
CellShape
Hex
,
vtkm
::
CellShape
Quad
,
const
vtkm
::
exec
::
FunctorBase
&
worklet
)
{
FloatDefault
X1
=
(
pts
[
1
]
-
pts
[
0
])
+
(
pts
[
2
]
-
pts
[
3
]);
FloatDefault
X2
=
(
pts
[
0
]
-
pts
[
3
])
+
(
pts
[
2
]
-
pts
[
1
]);
if
((
X1
<
FLOAT_MIN
)
||
(
X2
<
FLOAT_MIN
))
return
FLOAT_MAX
;
FloatDefault
X12
=
vtkm
::
Magnitude
((
pts
[
0
]
-
pts
[
1
])
+
(
pts
[
2
]
-
pts
[
3
]));
return
X12
/
vtkm
::
Min
(
X1
,
X2
);
}
}
// exec
...
...
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