VTK-m  2.0
CellWarpageMetric.h
Go to the documentation of this file.
1 //============================================================================
2 // Copyright (c) Kitware, Inc.
3 // All rights reserved.
4 // See LICENSE.txt for details.
5 // This software is distributed WITHOUT ANY WARRANTY; without even
6 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
7 // PURPOSE. See the above copyright notice for more information.
8 //
9 // Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
10 // Copyright 2014 UT-Battelle, LLC.
11 // Copyright 2014 Los Alamos National Security.
12 //
13 // Under the terms of Contract DE-NA0003525 with NTESS,
14 // the U.S. Government retains certain rights in this software.
15 //
16 // Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
17 // Laboratory (LANL), the U.S. Government retains certain rights in
18 // this software.
19 //============================================================================
20 #ifndef vtk_m_worklet_CellWarpageMetric_h
21 #define vtk_m_worklet_CellWarpageMetric_h
22 
24 #include <vtkm/CellShape.h>
25 #include <vtkm/CellTraits.h>
26 #include <vtkm/ErrorCode.h>
27 #include <vtkm/VecTraits.h>
28 #include <vtkm/VectorAnalysis.h>
29 
30 namespace vtkm
31 {
32 namespace worklet
33 {
34 namespace cellmetrics
35 {
36 
37 template <typename OutType, typename PointCoordVecType, typename CellShapeType>
39  const PointCoordVecType& vtkmNotUsed(pts),
40  CellShapeType vtkmNotUsed(shape),
42 {
43  //ec = vtkm::ErrorCode::InvalidCellMetric;
44  return OutType(-1.0);
45 }
46 
47 template <typename OutType, typename PointCoordVecType>
49  const PointCoordVecType& pts,
50  vtkm::CellShapeTagQuad,
52 {
53  using Scalar = OutType;
54  using CollectionOfPoints = PointCoordVecType;
55  using Vector = typename PointCoordVecType::ComponentType;
56 
57  const Vector N0Mag = GetQuadN0Normalized<Scalar, Vector, CollectionOfPoints>(pts);
58  const Vector N1Mag = GetQuadN1Normalized<Scalar, Vector, CollectionOfPoints>(pts);
59  const Vector N2Mag = GetQuadN2Normalized<Scalar, Vector, CollectionOfPoints>(pts);
60  const Vector N3Mag = GetQuadN3Normalized<Scalar, Vector, CollectionOfPoints>(pts);
61 
62  if (N0Mag < Scalar(0.0) || N1Mag < Scalar(0.0) || N2Mag < Scalar(0.0) || N3Mag < Scalar(0.0))
63  return vtkm::Infinity<Scalar>();
64  const Scalar n0dotn2 = static_cast<Scalar>(vtkm::Dot(N0Mag, N2Mag));
65  const Scalar n1dotn3 = static_cast<Scalar>(vtkm::Dot(N1Mag, N3Mag));
66  const Scalar min = vtkm::Min(n0dotn2, n1dotn3);
67 
68  const Scalar minCubed = vtkm::Pow(min, 3);
69  //return Scalar(1.0) - minCubed; // AS DEFINED IN THE MANUAL
70  return minCubed; // AS DEFINED IN VISIT SOURCE CODE
71 }
72 }
73 } // worklet
74 } // vtkm
75 #endif // vtk_m_worklet_CellWarpageMetric_h
vtkm::ErrorCode
ErrorCode
Definition: ErrorCode.h:19
VTKM_EXEC
#define VTKM_EXEC
Definition: ExportMacros.h:51
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::IdComponent
vtkm::Int32 IdComponent
Represents a component ID (index of component in a vector).
Definition: Types.h:168
vtkm::worklet::cellmetrics::CellWarpageMetric
VTKM_EXEC OutType CellWarpageMetric(const vtkm::IdComponent &vtkmNotUsed(numPts), const PointCoordVecType &vtkmNotUsed(pts), CellShapeType vtkmNotUsed(shape), vtkm::ErrorCode &vtkmNotUsed(ec))
Definition: CellWarpageMetric.h:38
CellShape.h
ErrorCode.h
VectorAnalysis.h
vtkmNotUsed
#define vtkmNotUsed(parameter_name)
Simple macro to identify a parameter as unused.
Definition: ExportMacros.h:128
TypeOfCellQuadrilateral.h
CellTraits.h
VecTraits.h