Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Steven Walton
VTK-m
Commits
512cec4f
Commit
512cec4f
authored
Jun 01, 2019
by
Steven Walton
Browse files
Options
Browse Files
Download
Plain Diff
Making sure this takes
Switched to FloatType and not FloatDefault
parents
fa4ec082
e7a0931f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
98 additions
and
24 deletions
+98
-24
vtkm/exec/cellmetrics/CellStretchMetric.h
vtkm/exec/cellmetrics/CellStretchMetric.h
+24
-24
vtkm/exec/cellmetrics/CellWarpageMetric.h
vtkm/exec/cellmetrics/CellWarpageMetric.h
+74
-0
No files found.
vtkm/exec/cellmetrics/CellStretchMetric.h
View file @
512cec4f
...
...
@@ -58,14 +58,14 @@ VTKM_EXEC OutType CellStretchMetric(const vtkm::IdComponent& numPts,
vtlm
::
CellShapeTagQuad
,
const
vtkm
::
exec
::
FunctorBase
&
worklet
)
{
Float
Default
L0
=
vtkm
::
MagnitudeSquared
(
pts
[
1
]
-
pts
[
0
]);
Float
Default
L1
=
vtkm
::
MagnitudeSquared
(
pts
[
2
]
-
pts
[
1
]);
Float
Default
L2
=
vtkm
::
MagnitudeSquared
(
pts
[
3
]
-
pts
[
2
]);
Float
Default
L3
=
vtkm
::
MagnitudeSquared
(
pts
[
0
]
-
pts
[
3
]);
Float
Type
L0
=
vtkm
::
MagnitudeSquared
(
pts
[
1
]
-
pts
[
0
]);
Float
Type
L1
=
vtkm
::
MagnitudeSquared
(
pts
[
2
]
-
pts
[
1
]);
Float
Type
L2
=
vtkm
::
MagnitudeSquared
(
pts
[
3
]
-
pts
[
2
]);
Float
Type
L3
=
vtkm
::
MagnitudeSquared
(
pts
[
0
]
-
pts
[
3
]);
// Find the minimum length (use square of values to speed up)
Float
Default
D0
=
pts
[
2
]
-
pts
[
0
];
Float
Default
D1
=
pts
[
3
]
-
pts
[
1
];
Float
Default
D_max
=
vtkm
::
Max
(
D0
,
D1
);
Float
Type
D0
=
pts
[
2
]
-
pts
[
0
];
Float
Type
D1
=
pts
[
3
]
-
pts
[
1
];
Float
Type
D_max
=
vtkm
::
Max
(
D0
,
D1
);
if
(
D_max
<
FLOAT_MIN
)
return
FLOAT_MAX
;
return
vtkm
::
Sqrt
(
2
)
/
D_max
*
vtkm
::
Sqrt
(
L_min
);
...
...
@@ -77,23 +77,23 @@ VTKM_EXEC OutType CellStretchMetric(const vtkm::IdComponent& numPts,
vtlm
::
CellShapeTagHex
,
const
vtkm
::
exec
::
FunctorBase
&
worklet
)
{
Float
Default
L0
=
vtkm
::
MagnitudeSquared
(
pts
[
1
]
-
pts
[
0
]);
Float
Default
L1
=
vtkm
::
MagnitudeSquared
(
pts
[
2
]
-
pts
[
1
]);
Float
Default
L2
=
vtkm
::
MagnitudeSquared
(
pts
[
3
]
-
pts
[
2
]);
Float
Default
L3
=
vtkm
::
MagnitudeSquared
(
pts
[
3
]
-
pts
[
0
]);
Float
Default
L4
=
vtkm
::
MagnitudeSquared
(
pts
[
4
]
-
pts
[
0
]);
Float
Default
L5
=
vtkm
::
MagnitudeSquared
(
pts
[
5
]
-
pts
[
1
]);
Float
Default
L6
=
vtkm
::
MagnitudeSquared
(
pts
[
6
]
-
pts
[
2
]);
Float
Default
L7
=
vtkm
::
MagnitudeSquared
(
pts
[
3
]
-
pts
[
3
]);
Float
Default
L8
=
vtkm
::
MagnitudeSquared
(
pts
[
5
]
-
pts
[
4
]);
Float
Default
L9
=
vtkm
::
MagnitudeSquared
(
pts
[
6
]
-
pts
[
5
]);
Float
Default
L10
=
vtkm
::
MagnitudeSquared
(
pts
[
7
]
-
pts
[
6
]);
Float
Default
L11
=
vtkm
::
MagnitudeSquared
(
pts
[
7
]
-
pts
[
4
]);
Float
Default
D0
=
pts
[
6
]
-
pts
[
0
];
Float
Default
D1
=
pts
[
7
]
-
pts
[
1
];
Float
Default
D2
=
pts
[
4
]
-
pts
[
2
];
Float
Default
D3
=
pts
[
5
]
-
pts
[
3
];
Float
Default
D_max
=
vtkm
::
Max
(
D0
,
D1
,
D2
,
D3
);
Float
Type
L0
=
vtkm
::
MagnitudeSquared
(
pts
[
1
]
-
pts
[
0
]);
Float
Type
L1
=
vtkm
::
MagnitudeSquared
(
pts
[
2
]
-
pts
[
1
]);
Float
Type
L2
=
vtkm
::
MagnitudeSquared
(
pts
[
3
]
-
pts
[
2
]);
Float
Type
L3
=
vtkm
::
MagnitudeSquared
(
pts
[
3
]
-
pts
[
0
]);
Float
Type
L4
=
vtkm
::
MagnitudeSquared
(
pts
[
4
]
-
pts
[
0
]);
Float
Type
L5
=
vtkm
::
MagnitudeSquared
(
pts
[
5
]
-
pts
[
1
]);
Float
Type
L6
=
vtkm
::
MagnitudeSquared
(
pts
[
6
]
-
pts
[
2
]);
Float
Type
L7
=
vtkm
::
MagnitudeSquared
(
pts
[
3
]
-
pts
[
3
]);
Float
Type
L8
=
vtkm
::
MagnitudeSquared
(
pts
[
5
]
-
pts
[
4
]);
Float
Type
L9
=
vtkm
::
MagnitudeSquared
(
pts
[
6
]
-
pts
[
5
]);
Float
Type
L10
=
vtkm
::
MagnitudeSquared
(
pts
[
7
]
-
pts
[
6
]);
Float
Type
L11
=
vtkm
::
MagnitudeSquared
(
pts
[
7
]
-
pts
[
4
]);
Float
Type
D0
=
pts
[
6
]
-
pts
[
0
];
Float
Type
D1
=
pts
[
7
]
-
pts
[
1
];
Float
Type
D2
=
pts
[
4
]
-
pts
[
2
];
Float
Type
D3
=
pts
[
5
]
-
pts
[
3
];
Float
Type
D_max
=
vtkm
::
Max
(
D0
,
D1
,
D2
,
D3
);
if
(
D_max
<
FLOAT_MIN
)
return
FLOAT_MAX
;
return
vtkm
::
Sqrt
(
3
)
*
vtkm
::
Sqrt
(
vtkm
::
Min
(
L0
,
L1
,
L2
,
L3
,
L4
,
L5
,
L6
,
L7
,
L8
,
L9
,
L10
,
L11
))
/
D_max
;
}
...
...
vtkm/exec/cellmetrics/CellWarpageMetric.h
0 → 100644
View file @
512cec4f
//============================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//
// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
// Copyright 2014 UT-Battelle, LLC.
// Copyright 2014 Los Alamos National Security.
//
// Under the terms of Contract DE-NA0003525 with NTESS,
// the U.S. Government retains certain rights in this software.
//
// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
// Laboratory (LANL), the U.S. Government retains certain rights in
// this software.
//============================================================================
#ifndef vtk_m_exec_CellWarpageMetric_h
#define vtk_m_exec_CellWarpageMetric_h
/*
* Mesh quality metric functions that compute the shape, or weighted Jacobian, of mesh cells.
* The Jacobian of a cell is weighted by the condition metric value of the cell.
*
* These metric computations are adapted from the VTK implementation of the Verdict library,
* which provides a set of cell metrics for evaluating the geometric qualities of regions of mesh spaces.
*
* See: The Verdict Library Reference Manual (for per-cell-type metric formulae)
* See: vtk/ThirdParty/verdict/vtkverdict (for VTK code implementation of this metric)
*/
#include "vtkm/CellShape.h"
#include "vtkm/CellTraits.h"
#include "vtkm/VecTraits.h"
#include "vtkm/VectorAnalysis.h"
#include "vtkm/exec/FunctorBase.h"
#include "vtkm/exec/cellmetrics/CellConditionMetric.h"
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
::
CellShapeQuad
,
const
vtkm
::
exec
::
FunctorBase
&
worklet
)
{
FloatType
N0
=
vtkm
::
Cross
((
pts
[
0
]
-
pts
[
3
]),(
pts
[
1
]
-
pts
[
0
]));
FloatType
N1
=
vtkm
::
Cross
((
pts
[
1
]
-
pts
[
0
]),(
pts
[
2
]
-
pts
[
1
]));
FloatType
N2
=
vtkm
::
Cross
((
pts
[
2
]
-
pts
[
1
]),(
pts
[
3
]
-
pts
[
2
]));
FloatType
N3
=
vtkm
::
Cross
((
pts
[
3
]
-
pts
[
2
]),(
pts
[
0
]
-
pts
[
3
]));
if
(
}
}
// exec
}
// vtkm
#endif vtk_m_exec_CellWarpage_Metric_h
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