mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-16 17:22:55 +00:00
parent
1141215d42
commit
fb2d36be1e
@ -48,9 +48,9 @@ set(headers
|
||||
TypeListTag.h
|
||||
Types.h
|
||||
TypeTraits.h
|
||||
VecAxisAlignedPointCoordinates.h
|
||||
VecFromPortal.h
|
||||
VecFromPortalPermute.h
|
||||
VecRectilinearPointCoordinates.h
|
||||
VectorAnalysis.h
|
||||
VecTraits.h
|
||||
VecVariable.h
|
||||
|
@ -17,8 +17,9 @@
|
||||
// Laboratory (LANL), the U.S. Government retains certain rights in
|
||||
// this software.
|
||||
//============================================================================
|
||||
#ifndef vtk_m_exec_VecRectilinearPointCoordinates_h
|
||||
#define vtk_m_exec_VecRectilinearPointCoordinates_h
|
||||
|
||||
#ifndef vtk_m_VecAxisAlignedPointCoordinates_h
|
||||
#define vtk_m_VecAxisAlignedPointCoordinates_h
|
||||
|
||||
#include <vtkm/Math.h>
|
||||
#include <vtkm/TypeTraits.h>
|
||||
@ -31,56 +32,62 @@ namespace vtkm
|
||||
namespace detail
|
||||
{
|
||||
|
||||
/// Specifies the size of VecRectilinearPointCoordinates for the given
|
||||
/// Specifies the size of VecAxisAlignedPointCoordinates for the given
|
||||
/// dimension.
|
||||
///
|
||||
template <vtkm::IdComponent NumDimensions>
|
||||
struct VecRectilinearPointCoordinatesNumComponents;
|
||||
struct VecAxisAlignedPointCoordinatesNumComponents;
|
||||
|
||||
template <>
|
||||
struct VecRectilinearPointCoordinatesNumComponents<1>
|
||||
struct VecAxisAlignedPointCoordinatesNumComponents<1>
|
||||
{
|
||||
static const vtkm::IdComponent NUM_COMPONENTS = 2;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct VecRectilinearPointCoordinatesNumComponents<2>
|
||||
struct VecAxisAlignedPointCoordinatesNumComponents<2>
|
||||
{
|
||||
static const vtkm::IdComponent NUM_COMPONENTS = 4;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct VecRectilinearPointCoordinatesNumComponents<3>
|
||||
struct VecAxisAlignedPointCoordinatesNumComponents<3>
|
||||
{
|
||||
static const vtkm::IdComponent NUM_COMPONENTS = 8;
|
||||
};
|
||||
|
||||
VTKM_EXEC_CONSTANT
|
||||
const vtkm::FloatDefault VecRectilinearPointCoordinatesOffsetTable[8][3] = {
|
||||
const vtkm::FloatDefault VecAxisAlignedPointCoordinatesOffsetTable[8][3] = {
|
||||
{ 0.0f, 0.0f, 0.0f }, { 1.0f, 0.0f, 0.0f }, { 1.0f, 1.0f, 0.0f }, { 0.0f, 1.0f, 0.0f },
|
||||
{ 0.0f, 0.0f, 1.0f }, { 1.0f, 0.0f, 1.0f }, { 1.0f, 1.0f, 1.0f }, { 0.0f, 1.0f, 1.0f }
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/// \brief An implicit vector for point coordinates in rectilinear cells.
|
||||
/// \brief An implicit vector for point coordinates in axis aligned cells. For
|
||||
/// internal use only.
|
||||
///
|
||||
/// The \C VecRectilinearPointCoordinates class is a Vec-like class that holds
|
||||
/// the point coordinates for a rectilinear cell. The class is templated on the
|
||||
/// dimensions of the cell, which can be 1 (for a line), 2 (for a pixel), or 3
|
||||
/// (for a voxel).
|
||||
/// The \C VecAxisAlignedPointCoordinates class is a Vec-like class that holds
|
||||
/// the point coordinates for a axis aligned cell. The class is templated on the
|
||||
/// dimensions of the cell, which can be 1 (for a line).
|
||||
///
|
||||
/// This is an internal class used to represent coordinates for uniform datasets
|
||||
/// in an execution environment when executing a WorkletMapPointToCell. Users
|
||||
/// should not directly construct this class under any circumstances. Use the
|
||||
/// related ArrayPortalUniformPointCoordinates and
|
||||
/// ArrayHandleUniformPointCoordinates classes instead.
|
||||
///
|
||||
template <vtkm::IdComponent NumDimensions>
|
||||
class VecRectilinearPointCoordinates
|
||||
class VecAxisAlignedPointCoordinates
|
||||
{
|
||||
public:
|
||||
typedef vtkm::Vec<vtkm::FloatDefault, 3> ComponentType;
|
||||
|
||||
static const vtkm::IdComponent NUM_COMPONENTS =
|
||||
detail::VecRectilinearPointCoordinatesNumComponents<NumDimensions>::NUM_COMPONENTS;
|
||||
detail::VecAxisAlignedPointCoordinatesNumComponents<NumDimensions>::NUM_COMPONENTS;
|
||||
|
||||
VTKM_EXEC_CONT
|
||||
VecRectilinearPointCoordinates(ComponentType origin = ComponentType(0, 0, 0),
|
||||
VecAxisAlignedPointCoordinates(ComponentType origin = ComponentType(0, 0, 0),
|
||||
ComponentType spacing = ComponentType(1, 1, 1))
|
||||
: Origin(origin)
|
||||
, Spacing(spacing)
|
||||
@ -103,7 +110,7 @@ public:
|
||||
VTKM_EXEC_CONT
|
||||
ComponentType operator[](vtkm::IdComponent index) const
|
||||
{
|
||||
const vtkm::FloatDefault* offset = detail::VecRectilinearPointCoordinatesOffsetTable[index];
|
||||
const vtkm::FloatDefault* offset = detail::VecAxisAlignedPointCoordinatesOffsetTable[index];
|
||||
return ComponentType(this->Origin[0] + offset[0] * this->Spacing[0],
|
||||
this->Origin[1] + offset[1] * this->Spacing[1],
|
||||
this->Origin[2] + offset[2] * this->Spacing[2]);
|
||||
@ -124,23 +131,23 @@ private:
|
||||
};
|
||||
|
||||
template <vtkm::IdComponent NumDimensions>
|
||||
struct TypeTraits<vtkm::VecRectilinearPointCoordinates<NumDimensions>>
|
||||
struct TypeTraits<vtkm::VecAxisAlignedPointCoordinates<NumDimensions>>
|
||||
{
|
||||
typedef vtkm::TypeTraitsRealTag NumericTag;
|
||||
typedef TypeTraitsVectorTag DimensionalityTag;
|
||||
|
||||
VTKM_EXEC_CONT
|
||||
static vtkm::VecRectilinearPointCoordinates<NumDimensions> ZeroInitialization()
|
||||
static vtkm::VecAxisAlignedPointCoordinates<NumDimensions> ZeroInitialization()
|
||||
{
|
||||
return vtkm::VecRectilinearPointCoordinates<NumDimensions>(
|
||||
return vtkm::VecAxisAlignedPointCoordinates<NumDimensions>(
|
||||
vtkm::Vec<vtkm::FloatDefault, 3>(0, 0, 0), vtkm::Vec<vtkm::FloatDefault, 3>(0, 0, 0));
|
||||
}
|
||||
};
|
||||
|
||||
template <vtkm::IdComponent NumDimensions>
|
||||
struct VecTraits<vtkm::VecRectilinearPointCoordinates<NumDimensions>>
|
||||
struct VecTraits<vtkm::VecAxisAlignedPointCoordinates<NumDimensions>>
|
||||
{
|
||||
typedef vtkm::VecRectilinearPointCoordinates<NumDimensions> VecType;
|
||||
typedef vtkm::VecAxisAlignedPointCoordinates<NumDimensions> VecType;
|
||||
|
||||
typedef vtkm::Vec<vtkm::FloatDefault, 3> ComponentType;
|
||||
typedef vtkm::VecTraitsTagMultipleComponents HasMultipleComponents;
|
||||
@ -166,4 +173,4 @@ struct VecTraits<vtkm::VecRectilinearPointCoordinates<NumDimensions>>
|
||||
|
||||
} // namespace vtkm
|
||||
|
||||
#endif //vtk_m_exec_VecRectilinearPointCoordinates_h
|
||||
#endif //vtk_m_VecAxisAlignedPointCoordinates_h
|
@ -25,7 +25,7 @@
|
||||
#include <vtkm/CellShape.h>
|
||||
#include <vtkm/Math.h>
|
||||
#include <vtkm/Matrix.h>
|
||||
#include <vtkm/VecRectilinearPointCoordinates.h>
|
||||
#include <vtkm/VecAxisAlignedPointCoordinates.h>
|
||||
#include <vtkm/VectorAnalysis.h>
|
||||
|
||||
#include <vtkm/exec/CellInterpolate.h>
|
||||
@ -531,7 +531,7 @@ VTKM_EXEC vtkm::Vec<typename FieldVecType::ComponentType, 3> CellDerivative(
|
||||
template <typename FieldVecType, typename ParametricCoordType>
|
||||
VTKM_EXEC vtkm::Vec<typename FieldVecType::ComponentType, 3> CellDerivative(
|
||||
const FieldVecType& field,
|
||||
const vtkm::VecRectilinearPointCoordinates<1>& wCoords,
|
||||
const vtkm::VecAxisAlignedPointCoordinates<1>& wCoords,
|
||||
const vtkm::Vec<ParametricCoordType, 3>& vtkmNotUsed(pcoords),
|
||||
vtkm::CellShapeTagLine,
|
||||
const vtkm::exec::FunctorBase& vtkmNotUsed(worklet))
|
||||
@ -823,7 +823,7 @@ VTKM_EXEC vtkm::Vec<typename FieldVecType::ComponentType, 3> CellDerivative(
|
||||
template <typename FieldVecType, typename ParametricCoordType>
|
||||
VTKM_EXEC vtkm::Vec<typename FieldVecType::ComponentType, 3> CellDerivative(
|
||||
const FieldVecType& field,
|
||||
const vtkm::VecRectilinearPointCoordinates<2>& wCoords,
|
||||
const vtkm::VecAxisAlignedPointCoordinates<2>& wCoords,
|
||||
const vtkm::Vec<ParametricCoordType, 3>& pcoords,
|
||||
vtkm::CellShapeTagQuad,
|
||||
const vtkm::exec::FunctorBase& vtkmNotUsed(worklet))
|
||||
@ -1014,7 +1014,7 @@ VTKM_EXEC vtkm::Vec<typename FieldVecType::ComponentType, 3> CellDerivative(
|
||||
template <typename FieldVecType, typename ParametricCoordType>
|
||||
VTKM_EXEC vtkm::Vec<typename FieldVecType::ComponentType, 3> CellDerivative(
|
||||
const FieldVecType& field,
|
||||
const vtkm::VecRectilinearPointCoordinates<3>& wCoords,
|
||||
const vtkm::VecAxisAlignedPointCoordinates<3>& wCoords,
|
||||
const vtkm::Vec<ParametricCoordType, 3>& pcoords,
|
||||
vtkm::CellShapeTagHexahedron,
|
||||
const vtkm::exec::FunctorBase& vtkmNotUsed(worklet))
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <vtkm/Assert.h>
|
||||
#include <vtkm/CellShape.h>
|
||||
#include <vtkm/Math.h>
|
||||
#include <vtkm/VecRectilinearPointCoordinates.h>
|
||||
#include <vtkm/VecAxisAlignedPointCoordinates.h>
|
||||
#include <vtkm/VectorAnalysis.h>
|
||||
#include <vtkm/exec/FunctorBase.h>
|
||||
|
||||
@ -188,7 +188,7 @@ VTKM_EXEC typename FieldVecType::ComponentType CellInterpolate(
|
||||
|
||||
template <typename ParametricCoordType>
|
||||
VTKM_EXEC vtkm::Vec<vtkm::FloatDefault, 3> CellInterpolate(
|
||||
const vtkm::VecRectilinearPointCoordinates<1>& field,
|
||||
const vtkm::VecAxisAlignedPointCoordinates<1>& field,
|
||||
const vtkm::Vec<ParametricCoordType, 3>& pcoords,
|
||||
vtkm::CellShapeTagLine,
|
||||
const vtkm::exec::FunctorBase&)
|
||||
@ -331,7 +331,7 @@ VTKM_EXEC typename FieldVecType::ComponentType CellInterpolate(
|
||||
|
||||
template <typename ParametricCoordType>
|
||||
VTKM_EXEC vtkm::Vec<vtkm::FloatDefault, 3> CellInterpolate(
|
||||
const vtkm::VecRectilinearPointCoordinates<2>& field,
|
||||
const vtkm::VecAxisAlignedPointCoordinates<2>& field,
|
||||
const vtkm::Vec<ParametricCoordType, 3>& pcoords,
|
||||
vtkm::CellShapeTagQuad,
|
||||
const vtkm::exec::FunctorBase&)
|
||||
@ -386,7 +386,7 @@ VTKM_EXEC typename FieldVecType::ComponentType CellInterpolate(
|
||||
|
||||
template <typename ParametricCoordType>
|
||||
VTKM_EXEC vtkm::Vec<vtkm::FloatDefault, 3> CellInterpolate(
|
||||
const vtkm::VecRectilinearPointCoordinates<3>& field,
|
||||
const vtkm::VecAxisAlignedPointCoordinates<3>& field,
|
||||
const vtkm::Vec<ParametricCoordType, 3>& pcoords,
|
||||
vtkm::CellShapeTagHexahedron,
|
||||
const vtkm::exec::FunctorBase&)
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include <vtkm/CellShape.h>
|
||||
#include <vtkm/Math.h>
|
||||
#include <vtkm/NewtonsMethod.h>
|
||||
#include <vtkm/VecRectilinearPointCoordinates.h>
|
||||
#include <vtkm/VecAxisAlignedPointCoordinates.h>
|
||||
#include <vtkm/exec/CellInterpolate.h>
|
||||
#include <vtkm/exec/FunctorBase.h>
|
||||
#include <vtkm/exec/Jacobian.h>
|
||||
@ -795,7 +795,7 @@ WorldCoordinatesToParametricCoordinates(const WorldCoordVector& pointWCoords,
|
||||
}
|
||||
|
||||
static inline VTKM_EXEC vtkm::Vec<vtkm::FloatDefault, 3> WorldCoordinatesToParametricCoordinates(
|
||||
const vtkm::VecRectilinearPointCoordinates<1>& pointWCoords,
|
||||
const vtkm::VecAxisAlignedPointCoordinates<1>& pointWCoords,
|
||||
const vtkm::Vec<vtkm::FloatDefault, 3>& wcoords,
|
||||
vtkm::CellShapeTagLine,
|
||||
const FunctorBase&)
|
||||
@ -963,7 +963,7 @@ WorldCoordinatesToParametricCoordinates(const WorldCoordVector& pointWCoords,
|
||||
}
|
||||
|
||||
static inline VTKM_EXEC vtkm::Vec<vtkm::FloatDefault, 3> WorldCoordinatesToParametricCoordinates(
|
||||
const vtkm::VecRectilinearPointCoordinates<2>& pointWCoords,
|
||||
const vtkm::VecAxisAlignedPointCoordinates<2>& pointWCoords,
|
||||
const vtkm::Vec<vtkm::FloatDefault, 3>& wcoords,
|
||||
vtkm::CellShapeTagQuad,
|
||||
const FunctorBase&)
|
||||
@ -1038,7 +1038,7 @@ WorldCoordinatesToParametricCoordinates(const WorldCoordVector& pointWCoords,
|
||||
}
|
||||
|
||||
static inline VTKM_EXEC vtkm::Vec<vtkm::FloatDefault, 3> WorldCoordinatesToParametricCoordinates(
|
||||
const vtkm::VecRectilinearPointCoordinates<3>& pointWCoords,
|
||||
const vtkm::VecAxisAlignedPointCoordinates<3>& pointWCoords,
|
||||
const vtkm::Vec<vtkm::FloatDefault, 3>& wcoords,
|
||||
vtkm::CellShapeTagHexahedron,
|
||||
const FunctorBase&)
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#include <vtkm/internal/ArrayPortalUniformPointCoordinates.h>
|
||||
|
||||
#include <vtkm/VecRectilinearPointCoordinates.h>
|
||||
#include <vtkm/VecAxisAlignedPointCoordinates.h>
|
||||
#include <vtkm/exec/ConnectivityStructured.h>
|
||||
|
||||
#include <vtkm/VecFromPortalPermute.h>
|
||||
@ -87,25 +87,25 @@ struct FetchArrayTopologyMapInImplementation
|
||||
}
|
||||
};
|
||||
|
||||
static inline VTKM_EXEC vtkm::VecRectilinearPointCoordinates<1> make_VecRectilinearPointCoordinates(
|
||||
static inline VTKM_EXEC vtkm::VecAxisAlignedPointCoordinates<1> make_VecAxisAlignedPointCoordinates(
|
||||
const vtkm::Vec<vtkm::FloatDefault, 3>& origin,
|
||||
const vtkm::Vec<vtkm::FloatDefault, 3>& spacing,
|
||||
const vtkm::Vec<vtkm::Id, 1>& logicalId)
|
||||
{
|
||||
vtkm::Vec<vtkm::FloatDefault, 3> offsetOrigin(
|
||||
origin[0] + spacing[0] * static_cast<vtkm::FloatDefault>(logicalId[0]), origin[1], origin[2]);
|
||||
return vtkm::VecRectilinearPointCoordinates<1>(offsetOrigin, spacing);
|
||||
return vtkm::VecAxisAlignedPointCoordinates<1>(offsetOrigin, spacing);
|
||||
}
|
||||
|
||||
static inline VTKM_EXEC vtkm::VecRectilinearPointCoordinates<1> make_VecRectilinearPointCoordinates(
|
||||
static inline VTKM_EXEC vtkm::VecAxisAlignedPointCoordinates<1> make_VecAxisAlignedPointCoordinates(
|
||||
const vtkm::Vec<vtkm::FloatDefault, 3>& origin,
|
||||
const vtkm::Vec<vtkm::FloatDefault, 3>& spacing,
|
||||
vtkm::Id logicalId)
|
||||
{
|
||||
return make_VecRectilinearPointCoordinates(origin, spacing, vtkm::Vec<vtkm::Id, 1>(logicalId));
|
||||
return make_VecAxisAlignedPointCoordinates(origin, spacing, vtkm::Vec<vtkm::Id, 1>(logicalId));
|
||||
}
|
||||
|
||||
static inline VTKM_EXEC vtkm::VecRectilinearPointCoordinates<2> make_VecRectilinearPointCoordinates(
|
||||
static inline VTKM_EXEC vtkm::VecAxisAlignedPointCoordinates<2> make_VecAxisAlignedPointCoordinates(
|
||||
const vtkm::Vec<vtkm::FloatDefault, 3>& origin,
|
||||
const vtkm::Vec<vtkm::FloatDefault, 3>& spacing,
|
||||
const vtkm::Vec<vtkm::Id, 2>& logicalId)
|
||||
@ -114,10 +114,10 @@ static inline VTKM_EXEC vtkm::VecRectilinearPointCoordinates<2> make_VecRectilin
|
||||
origin[0] + spacing[0] * static_cast<vtkm::FloatDefault>(logicalId[0]),
|
||||
origin[1] + spacing[1] * static_cast<vtkm::FloatDefault>(logicalId[1]),
|
||||
origin[2]);
|
||||
return vtkm::VecRectilinearPointCoordinates<2>(offsetOrigin, spacing);
|
||||
return vtkm::VecAxisAlignedPointCoordinates<2>(offsetOrigin, spacing);
|
||||
}
|
||||
|
||||
static inline VTKM_EXEC vtkm::VecRectilinearPointCoordinates<3> make_VecRectilinearPointCoordinates(
|
||||
static inline VTKM_EXEC vtkm::VecAxisAlignedPointCoordinates<3> make_VecAxisAlignedPointCoordinates(
|
||||
const vtkm::Vec<vtkm::FloatDefault, 3>& origin,
|
||||
const vtkm::Vec<vtkm::FloatDefault, 3>& spacing,
|
||||
const vtkm::Vec<vtkm::Id, 3>& logicalId)
|
||||
@ -126,7 +126,7 @@ static inline VTKM_EXEC vtkm::VecRectilinearPointCoordinates<3> make_VecRectilin
|
||||
origin[0] + spacing[0] * static_cast<vtkm::FloatDefault>(logicalId[0]),
|
||||
origin[1] + spacing[1] * static_cast<vtkm::FloatDefault>(logicalId[1]),
|
||||
origin[2] + spacing[2] * static_cast<vtkm::FloatDefault>(logicalId[2]));
|
||||
return vtkm::VecRectilinearPointCoordinates<3>(offsetOrigin, spacing);
|
||||
return vtkm::VecAxisAlignedPointCoordinates<3>(offsetOrigin, spacing);
|
||||
}
|
||||
|
||||
template <vtkm::IdComponent NumDimensions>
|
||||
@ -143,7 +143,7 @@ struct FetchArrayTopologyMapInImplementation<
|
||||
ConnectivityType;
|
||||
typedef vtkm::exec::arg::ThreadIndicesTopologyMap<ConnectivityType> ThreadIndicesType;
|
||||
|
||||
typedef vtkm::VecRectilinearPointCoordinates<NumDimensions> ValueType;
|
||||
typedef vtkm::VecAxisAlignedPointCoordinates<NumDimensions> ValueType;
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC
|
||||
@ -152,7 +152,7 @@ struct FetchArrayTopologyMapInImplementation<
|
||||
{
|
||||
// This works because the logical cell index is the same as the logical
|
||||
// point index of the first point on the cell.
|
||||
return vtkm::exec::arg::detail::make_VecRectilinearPointCoordinates(
|
||||
return vtkm::exec::arg::detail::make_VecAxisAlignedPointCoordinates(
|
||||
field.GetOrigin(), field.GetSpacing(), indices.GetIndexLogical());
|
||||
}
|
||||
};
|
||||
@ -174,7 +174,7 @@ struct FetchArrayTopologyMapInImplementation<
|
||||
ConnectivityType;
|
||||
typedef vtkm::exec::arg::ThreadIndicesTopologyMap<ConnectivityType> ThreadIndicesType;
|
||||
|
||||
typedef vtkm::VecRectilinearPointCoordinates<NumDimensions> ValueType;
|
||||
typedef vtkm::VecAxisAlignedPointCoordinates<NumDimensions> ValueType;
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC
|
||||
@ -184,9 +184,9 @@ struct FetchArrayTopologyMapInImplementation<
|
||||
// This works because the logical cell index is the same as the logical
|
||||
// point index of the first point on the cell.
|
||||
|
||||
// we have a flat index but we need 3d rectilinear coordiantes, so we
|
||||
// we have a flat index but we need 3d uniform coordinates, so we
|
||||
// need to take an flat index and convert to logical index
|
||||
return vtkm::exec::arg::detail::make_VecRectilinearPointCoordinates(
|
||||
return vtkm::exec::arg::detail::make_VecAxisAlignedPointCoordinates(
|
||||
field.GetOrigin(), field.GetSpacing(), indices.GetIndexLogical());
|
||||
}
|
||||
};
|
||||
|
@ -159,7 +159,7 @@ void TryStructuredPointCoordinatesInvocation(const Invocation& invocation)
|
||||
vtkm::Vec<vtkm::FloatDefault, 3> origin = TestValue(0, vtkm::Vec<vtkm::FloatDefault, 3>());
|
||||
vtkm::Vec<vtkm::FloatDefault, 3> spacing = TestValue(1, vtkm::Vec<vtkm::FloatDefault, 3>());
|
||||
|
||||
vtkm::VecRectilinearPointCoordinates<NumDimensions> value = fetch.Load(
|
||||
vtkm::VecAxisAlignedPointCoordinates<NumDimensions> value = fetch.Load(
|
||||
ThreadIndicesType(
|
||||
0, invocation.OutputToInputMap, invocation.VisitArray, invocation.GetInputDomain()),
|
||||
invocation.Parameters.template GetParameter<ParamIndex>());
|
||||
|
@ -308,19 +308,19 @@ void TestDerivative()
|
||||
TestDerivativeFunctor<vtkm::Float64> testFunctorScalar;
|
||||
std::cout << "======== Uniform Point Coordinates 3D =====" << std::endl;
|
||||
testFunctorScalar.DoTestWithWCoords(vtkm::CellShapeTagHexahedron(),
|
||||
vtkm::VecRectilinearPointCoordinates<3>(origin, spacing),
|
||||
vtkm::VecAxisAlignedPointCoordinates<3>(origin, spacing),
|
||||
scalarField,
|
||||
expectedScalarGradient);
|
||||
std::cout << "======== Uniform Point Coordinates 2D =====" << std::endl;
|
||||
expectedScalarGradient[2] = 0.0;
|
||||
testFunctorScalar.DoTestWithWCoords(vtkm::CellShapeTagQuad(),
|
||||
vtkm::VecRectilinearPointCoordinates<2>(origin, spacing),
|
||||
vtkm::VecAxisAlignedPointCoordinates<2>(origin, spacing),
|
||||
scalarField,
|
||||
expectedScalarGradient);
|
||||
std::cout << "======== Uniform Point Coordinates 1D =====" << std::endl;
|
||||
expectedScalarGradient[1] = 0.0;
|
||||
testFunctorScalar.DoTestWithWCoords(vtkm::CellShapeTagLine(),
|
||||
vtkm::VecRectilinearPointCoordinates<1>(origin, spacing),
|
||||
vtkm::VecAxisAlignedPointCoordinates<1>(origin, spacing),
|
||||
scalarField,
|
||||
expectedScalarGradient);
|
||||
|
||||
@ -339,19 +339,19 @@ void TestDerivative()
|
||||
TestDerivativeFunctor<vtkm::Vec<vtkm::Float64, 3>> testFunctorVector;
|
||||
std::cout << "======== Uniform Point Coordinates 3D =====" << std::endl;
|
||||
testFunctorVector.DoTestWithWCoords(vtkm::CellShapeTagHexahedron(),
|
||||
vtkm::VecRectilinearPointCoordinates<3>(origin, spacing),
|
||||
vtkm::VecAxisAlignedPointCoordinates<3>(origin, spacing),
|
||||
vectorField,
|
||||
expectedVectorGradient);
|
||||
std::cout << "======== Uniform Point Coordinates 2D =====" << std::endl;
|
||||
expectedVectorGradient[2] = vtkm::Vec<vtkm::Float64, 3>(0.0);
|
||||
testFunctorVector.DoTestWithWCoords(vtkm::CellShapeTagQuad(),
|
||||
vtkm::VecRectilinearPointCoordinates<2>(origin, spacing),
|
||||
vtkm::VecAxisAlignedPointCoordinates<2>(origin, spacing),
|
||||
vectorField,
|
||||
expectedVectorGradient);
|
||||
std::cout << "======== Uniform Point Coordinates 1D =====" << std::endl;
|
||||
expectedVectorGradient[1] = vtkm::Vec<vtkm::Float64, 3>(0.0);
|
||||
testFunctorVector.DoTestWithWCoords(vtkm::CellShapeTagLine(),
|
||||
vtkm::VecRectilinearPointCoordinates<1>(origin, spacing),
|
||||
vtkm::VecAxisAlignedPointCoordinates<1>(origin, spacing),
|
||||
vectorField,
|
||||
expectedVectorGradient);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
#include <vtkm/CellTraits.h>
|
||||
#include <vtkm/StaticAssert.h>
|
||||
#include <vtkm/VecRectilinearPointCoordinates.h>
|
||||
#include <vtkm/VecAxisAlignedPointCoordinates.h>
|
||||
#include <vtkm/VecVariable.h>
|
||||
|
||||
#include <vtkm/testing/Testing.h>
|
||||
@ -163,13 +163,13 @@ void TestInterpolate()
|
||||
vtkm::Vec<vtkm::FloatDefault, 3> spacing = TestValue(1, vtkm::Vec<vtkm::FloatDefault, 3>());
|
||||
std::cout << "======== Uniform Point Coordinates 1D =====" << std::endl;
|
||||
testFunctor.DoTestWithField(vtkm::CellShapeTagLine(),
|
||||
vtkm::VecRectilinearPointCoordinates<1>(origin, spacing));
|
||||
vtkm::VecAxisAlignedPointCoordinates<1>(origin, spacing));
|
||||
std::cout << "======== Uniform Point Coordinates 2D =====" << std::endl;
|
||||
testFunctor.DoTestWithField(vtkm::CellShapeTagQuad(),
|
||||
vtkm::VecRectilinearPointCoordinates<2>(origin, spacing));
|
||||
vtkm::VecAxisAlignedPointCoordinates<2>(origin, spacing));
|
||||
std::cout << "======== Uniform Point Coordinates 3D =====" << std::endl;
|
||||
testFunctor.DoTestWithField(vtkm::CellShapeTagHexahedron(),
|
||||
vtkm::VecRectilinearPointCoordinates<3>(origin, spacing));
|
||||
vtkm::VecAxisAlignedPointCoordinates<3>(origin, spacing));
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
@ -263,10 +263,10 @@ void TestAllPCoords()
|
||||
vtkm::Vec<vtkm::FloatDefault, 3> spacing(
|
||||
randomDist(g_RandomGenerator), randomDist(g_RandomGenerator), randomDist(g_RandomGenerator));
|
||||
|
||||
TestPCoords(vtkm::VecRectilinearPointCoordinates<3>(origin, spacing),
|
||||
TestPCoords(vtkm::VecAxisAlignedPointCoordinates<3>(origin, spacing),
|
||||
vtkm::CellShapeTagHexahedron());
|
||||
TestPCoords(vtkm::VecRectilinearPointCoordinates<2>(origin, spacing), vtkm::CellShapeTagQuad());
|
||||
TestPCoords(vtkm::VecRectilinearPointCoordinates<1>(origin, spacing), vtkm::CellShapeTagLine());
|
||||
TestPCoords(vtkm::VecAxisAlignedPointCoordinates<2>(origin, spacing), vtkm::CellShapeTagQuad());
|
||||
TestPCoords(vtkm::VecAxisAlignedPointCoordinates<1>(origin, spacing), vtkm::CellShapeTagLine());
|
||||
}
|
||||
|
||||
} // Anonymous namespace
|
||||
|
@ -103,7 +103,7 @@ VTKM_EXEC_CONT inline bool Sample(const vtkm::Vec<vtkm::Vec<P, 3>, 8>& points,
|
||||
}
|
||||
|
||||
template <typename S, typename P, typename WorkletType, typename CellShapeTagType>
|
||||
VTKM_EXEC_CONT inline bool Sample(const vtkm::VecRectilinearPointCoordinates<3>& points,
|
||||
VTKM_EXEC_CONT inline bool Sample(const vtkm::VecAxisAlignedPointCoordinates<3>& points,
|
||||
const vtkm::Vec<S, 8>& scalars,
|
||||
const vtkm::Vec<P, 3>& sampleLocation,
|
||||
S& lerpedScalar,
|
||||
@ -238,7 +238,7 @@ public:
|
||||
const WorkletType& callingWorklet,
|
||||
const vtkm::Int32& vtkmNotUsed(cellShape = CELL_SHAPE_HEXAHEDRON)) const
|
||||
{
|
||||
vtkm::VecRectilinearPointCoordinates<3> rPoints(points[0], points[6] - points[0]);
|
||||
vtkm::VecAxisAlignedPointCoordinates<3> rPoints(points[0], points[6] - points[0]);
|
||||
return detail::Sample(rPoints,
|
||||
scalars,
|
||||
sampleLocation,
|
||||
|
@ -45,9 +45,9 @@ set(unit_tests
|
||||
UnitTestTypes.cxx
|
||||
UnitTestTypeTraits.cxx
|
||||
UnitTestUnaryPredicates.cxx
|
||||
UnitTestVecAxisAlignedPointCoordinates.cxx
|
||||
UnitTestVecFromPortal.cxx
|
||||
UnitTestVecFromPortalPermute.cxx
|
||||
UnitTestVecRectilinearPointCoordinates.cxx
|
||||
UnitTestVectorAnalysis.cxx
|
||||
UnitTestVecTraits.cxx
|
||||
UnitTestVecVariable.cxx
|
||||
|
@ -18,7 +18,7 @@
|
||||
// this software.
|
||||
//============================================================================
|
||||
|
||||
#include <vtkm/VecRectilinearPointCoordinates.h>
|
||||
#include <vtkm/VecAxisAlignedPointCoordinates.h>
|
||||
|
||||
#include <vtkm/testing/Testing.h>
|
||||
|
||||
@ -76,10 +76,10 @@ void CheckCoordsValues(const VecCoordsType& coords)
|
||||
}
|
||||
|
||||
template <vtkm::IdComponent NumDimensions>
|
||||
void TryVecRectilinearPointCoordinates(
|
||||
const vtkm::VecRectilinearPointCoordinates<NumDimensions>& coords)
|
||||
void TryVecAxisAlignedPointCoordinates(
|
||||
const vtkm::VecAxisAlignedPointCoordinates<NumDimensions>& coords)
|
||||
{
|
||||
typedef vtkm::VecRectilinearPointCoordinates<NumDimensions> VecCoordsType;
|
||||
typedef vtkm::VecAxisAlignedPointCoordinates<NumDimensions> VecCoordsType;
|
||||
typedef vtkm::TypeTraits<VecCoordsType> TTraits;
|
||||
typedef vtkm::VecTraits<VecCoordsType> VTraits;
|
||||
|
||||
@ -113,39 +113,39 @@ void TryVecRectilinearPointCoordinates(
|
||||
VTKM_TEST_ASSERT(test_equal(coords.GetSpacing(), g_Spacing), "Wrong spacing");
|
||||
}
|
||||
|
||||
void TestVecRectilinearPointCoordinates()
|
||||
void TestVecAxisAlignedPointCoordinates()
|
||||
{
|
||||
std::cout << "***** 1D Coordinates *****************" << std::endl;
|
||||
vtkm::VecRectilinearPointCoordinates<1> coords1d(g_Origin, g_Spacing);
|
||||
vtkm::VecAxisAlignedPointCoordinates<1> coords1d(g_Origin, g_Spacing);
|
||||
VTKM_TEST_ASSERT(coords1d.NUM_COMPONENTS == 2, "Wrong number of components");
|
||||
VTKM_TEST_ASSERT(vtkm::VecRectilinearPointCoordinates<1>::NUM_COMPONENTS == 2,
|
||||
VTKM_TEST_ASSERT(vtkm::VecAxisAlignedPointCoordinates<1>::NUM_COMPONENTS == 2,
|
||||
"Wrong number of components");
|
||||
VTKM_TEST_ASSERT(vtkm::VecTraits<vtkm::VecRectilinearPointCoordinates<1>>::NUM_COMPONENTS == 2,
|
||||
VTKM_TEST_ASSERT(vtkm::VecTraits<vtkm::VecAxisAlignedPointCoordinates<1>>::NUM_COMPONENTS == 2,
|
||||
"Wrong number of components");
|
||||
TryVecRectilinearPointCoordinates(coords1d);
|
||||
TryVecAxisAlignedPointCoordinates(coords1d);
|
||||
|
||||
std::cout << "***** 2D Coordinates *****************" << std::endl;
|
||||
vtkm::VecRectilinearPointCoordinates<2> coords2d(g_Origin, g_Spacing);
|
||||
vtkm::VecAxisAlignedPointCoordinates<2> coords2d(g_Origin, g_Spacing);
|
||||
VTKM_TEST_ASSERT(coords2d.NUM_COMPONENTS == 4, "Wrong number of components");
|
||||
VTKM_TEST_ASSERT(vtkm::VecRectilinearPointCoordinates<2>::NUM_COMPONENTS == 4,
|
||||
VTKM_TEST_ASSERT(vtkm::VecAxisAlignedPointCoordinates<2>::NUM_COMPONENTS == 4,
|
||||
"Wrong number of components");
|
||||
VTKM_TEST_ASSERT(vtkm::VecTraits<vtkm::VecRectilinearPointCoordinates<2>>::NUM_COMPONENTS == 4,
|
||||
VTKM_TEST_ASSERT(vtkm::VecTraits<vtkm::VecAxisAlignedPointCoordinates<2>>::NUM_COMPONENTS == 4,
|
||||
"Wrong number of components");
|
||||
TryVecRectilinearPointCoordinates(coords2d);
|
||||
TryVecAxisAlignedPointCoordinates(coords2d);
|
||||
|
||||
std::cout << "***** 3D Coordinates *****************" << std::endl;
|
||||
vtkm::VecRectilinearPointCoordinates<3> coords3d(g_Origin, g_Spacing);
|
||||
vtkm::VecAxisAlignedPointCoordinates<3> coords3d(g_Origin, g_Spacing);
|
||||
VTKM_TEST_ASSERT(coords3d.NUM_COMPONENTS == 8, "Wrong number of components");
|
||||
VTKM_TEST_ASSERT(vtkm::VecRectilinearPointCoordinates<3>::NUM_COMPONENTS == 8,
|
||||
VTKM_TEST_ASSERT(vtkm::VecAxisAlignedPointCoordinates<3>::NUM_COMPONENTS == 8,
|
||||
"Wrong number of components");
|
||||
VTKM_TEST_ASSERT(vtkm::VecTraits<vtkm::VecRectilinearPointCoordinates<3>>::NUM_COMPONENTS == 8,
|
||||
VTKM_TEST_ASSERT(vtkm::VecTraits<vtkm::VecAxisAlignedPointCoordinates<3>>::NUM_COMPONENTS == 8,
|
||||
"Wrong number of components");
|
||||
TryVecRectilinearPointCoordinates(coords3d);
|
||||
TryVecAxisAlignedPointCoordinates(coords3d);
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
int UnitTestVecRectilinearPointCoordinates(int, char* [])
|
||||
int UnitTestVecAxisAlignedPointCoordinates(int, char* [])
|
||||
{
|
||||
return vtkm::testing::Testing::Run(TestVecRectilinearPointCoordinates);
|
||||
return vtkm::testing::Testing::Run(TestVecAxisAlignedPointCoordinates);
|
||||
}
|
@ -78,7 +78,7 @@ struct CheckStructuredUniformPointCoords : public vtkm::worklet::WorkletMapPoint
|
||||
|
||||
template <vtkm::IdComponent NumDimensions>
|
||||
VTKM_EXEC void operator()(
|
||||
const vtkm::VecRectilinearPointCoordinates<NumDimensions>& vtkmNotUsed(coords)) const
|
||||
const vtkm::VecAxisAlignedPointCoordinates<NumDimensions>& vtkmNotUsed(coords)) const
|
||||
{
|
||||
// Success if here.
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user